Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added domain name for --users with samr #345

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions nxc/protocols/smb/samruser.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@ def fetch_users(self, requested_users):
if resp2["ErrorCode"] != 0:
raise Exception("Connect error")

domain_name = resp2["Buffer"]["Buffer"][0]["Name"]
resp3 = samr.hSamrLookupDomainInSamServer(
self.dce,
serverHandle=resp["ServerHandle"],
name=resp2["Buffer"]["Buffer"][0]["Name"],
name=domain_name,
)
if resp3["ErrorCode"] != 0:
raise Exception("Connect error")
Expand Down Expand Up @@ -132,7 +133,7 @@ def fetch_users(self, requested_users):
# set these for the while loop
enumerationContext = enumerate_users_resp["EnumerationContext"]
status = enumerate_users_resp["ErrorCode"]
self.print_user_info(users)
self.print_user_info(users, domain_name)
self.dce.disconnect()

def get_user_info(self, domain_handle, user_ids):
Expand Down Expand Up @@ -165,8 +166,8 @@ def get_user_info(self, domain_handle, user_ids):
samr.hSamrCloseHandle(self.dce, open_user_resp["UserHandle"])
return users

def print_user_info(self, users):
self.logger.display(f"Enumerated {len(users):d} local users")
def print_user_info(self, users, domain_name):
self.logger.display(f"Enumerated {len(users):d} local users: {domain_name}")
self.logger.highlight(f"{'-Username-':<30}{'-Last PW Set-':<20}{'-BadPW-':<8}{'-Description-':<60}")
for user in users:
self.logger.debug(f"Full user info: {user}")
Expand Down
Loading