Skip to content

Commit

Permalink
fix/feat(samruser): add back in bad password count to --users; closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
Marshall-Hallenbeck committed Mar 21, 2024
1 parent 54e6ebb commit 9a915f0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nxc/protocols/smb/samruser.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,21 @@ def get_user_info(self, domain_handle, user_ids):

user_info = info_user_resp["All"]
user_name = user_info["UserName"]
bad_pwd_count = user_info["BadPasswordCount"]
user_description = user_info["AdminComment"]
last_pw_set = old_large_int_to_datetime(user_info["PasswordLastSet"])
if last_pw_set == "1601-01-01 00:00:00":
last_pw_set = "<never>"
users.append({"name": user_name, "description": user_description, "last_pw_set": last_pw_set})
users.append({"name": user_name, "description": user_description, "bad_pwd_count": bad_pwd_count, "last_pw_set": last_pw_set})

samr.hSamrCloseHandle(self.dce, open_user_resp["UserHandle"])
return users

def print_user_info(self, users):
self.logger.highlight(f"{'Username':<30} {'Last PW Set':<20}\t{'Description'}") # header
self.logger.highlight(f"{'Username':<30} {'Last PW Set':<20} {'Bad PW #'} {'Description'}") # header
for user in users:
self.logger.debug(f"Full user info: {user}")
self.logger.highlight(f"{user['name']:<30} {user['last_pw_set']:<20}\t{user['description']} ")
self.logger.highlight(f"{user['name']:<30} {user['last_pw_set']:<20} {user['bad_pwd_count']:<8} {user['description']} ")


def old_large_int_to_datetime(large_int):
Expand Down

0 comments on commit 9a915f0

Please sign in to comment.