Skip to content

Commit 50d551d

Browse files
committed
Comment updates
1 parent 70a5e05 commit 50d551d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

nxc/modules/change-password.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,14 @@ def _smb_samr_change(self, context, connection, target_username, target_domain,
108108
dce.bind(samr.MSRPC_UUID_SAMR)
109109

110110
try:
111+
# Retrieve the user handle by connecting to SAMR and looking up the username.
111112
server_handle = samr.hSamrConnect(dce, connection.host + "\x00")["ServerHandle"]
112113
domain_sid = samr.hSamrLookupDomainInSamServer(dce, server_handle, target_domain)["DomainId"]
113114
domain_handle = samr.hSamrOpenDomain(dce, server_handle, domainId=domain_sid)["DomainHandle"]
114115
user_rid = samr.hSamrLookupNamesInDomain(dce, domain_handle, (target_username,))["RelativeIds"]["Element"][0]
115116
user_handle = samr.hSamrOpenUser(dce, domain_handle, userId=user_rid)["UserHandle"]
116117
if self.reset:
118+
# Reset the password
117119
samr.hSamrSetNTInternal1(dce, user_handle, new_password, new_nthash)
118120
context.log.success(f"Successfully reset password for {target_username}")
119121
else:

0 commit comments

Comments
 (0)