@@ -256,6 +256,16 @@ def enum_host_info(self):
256256
257257 self .output_filename = os .path .expanduser (f"~/.nxc/logs/{ self .hostname } _{ self .host } " .replace (":" , "-" ))
258258
259+ try :
260+ self .db .add_host (
261+ self .host ,
262+ self .hostname ,
263+ self .domain ,
264+ self .server_os
265+ )
266+ except Exception as e :
267+ self .logger .debug (f"Error adding host { self .host } into db: { e !s} " )
268+
259269 def print_host_info (self ):
260270 self .logger .debug ("Printing host info for LDAP" )
261271 self .logger .extra ["protocol" ] = "LDAP" if str (self .port ) == "389" else "LDAPS"
@@ -309,6 +319,13 @@ def kerberos_login(self, domain, username, password="", ntlm_hash="", aesKey="",
309319
310320 self .check_if_admin ()
311321
322+ if password :
323+ self .logger .debug (f"Adding credential: { domain } /{ self .username } :{ self .password } " )
324+ self .db .add_credential ("plaintext" , domain , self .username , self .password )
325+ elif ntlm_hash :
326+ self .logger .debug (f"Adding credential: { domain } /{ self .username } :{ self .hash } " )
327+ self .db .add_credential ("hash" , domain , self .username , self .hash )
328+
312329 used_ccache = " from ccache" if useCache else f":{ process_secret (kerb_pass )} "
313330 self .logger .success (f"{ domain } \\ { self .username } { used_ccache } { self .mark_pwned ()} " )
314331
@@ -407,6 +424,8 @@ def plaintext_login(self, domain, username, password):
407424 self .ldap_connection = ldap_impacket .LDAPConnection (url = ldap_url , baseDN = self .baseDN , dstIp = self .host )
408425 self .ldap_connection .login (self .username , self .password , self .domain , self .lmhash , self .nthash )
409426 self .check_if_admin ()
427+ self .logger .debug (f"Adding credential: { domain } /{ self .username } :{ self .password } " )
428+ self .db .add_credential ("plaintext" , domain , self .username , self .password )
410429
411430 # Prepare success credential text
412431 self .logger .success (f"{ domain } \\ { self .username } :{ process_secret (self .password )} { self .mark_pwned ()} " )
@@ -428,6 +447,8 @@ def plaintext_login(self, domain, username, password):
428447 self .ldap_connection = ldap_impacket .LDAPConnection (url = ldaps_url , baseDN = self .baseDN , dstIp = self .host )
429448 self .ldap_connection .login (self .username , self .password , self .domain , self .lmhash , self .nthash )
430449 self .check_if_admin ()
450+ self .logger .debug (f"Adding credential: { domain } /{ self .username } :{ self .password } " )
451+ self .db .add_credential ("plaintext" , domain , self .username , self .password )
431452
432453 # Prepare success credential text
433454 self .logger .success (f"{ domain } \\ { self .username } :{ process_secret (self .password )} { self .mark_pwned ()} " )
@@ -493,6 +514,8 @@ def hash_login(self, domain, username, ntlm_hash):
493514 self .ldap_connection = ldap_impacket .LDAPConnection (url = ldaps_url , baseDN = self .baseDN , dstIp = self .host )
494515 self .ldap_connection .login (self .username , self .password , self .domain , self .lmhash , self .nthash )
495516 self .check_if_admin ()
517+ self .logger .debug (f"Adding credential: { domain } /{ self .username } :{ self .hash } " )
518+ self .db .add_credential ("hash" , domain , self .username , self .hash )
496519
497520 # Prepare success credential text
498521 out = f"{ domain } \\ { self .username } :{ process_secret (self .nthash )} { self .mark_pwned ()} "
@@ -514,6 +537,8 @@ def hash_login(self, domain, username, ntlm_hash):
514537 self .ldap_connection = ldap_impacket .LDAPConnection (url = ldaps_url , baseDN = self .baseDN , dstIp = self .host )
515538 self .ldap_connection .login (self .username , self .password , self .domain , self .lmhash , self .nthash )
516539 self .check_if_admin ()
540+ self .logger .debug (f"Adding credential: { domain } /{ self .username } :{ self .hash } " )
541+ self .db .add_credential ("hash" , domain , self .username , self .hash )
517542
518543 # Prepare success credential text
519544 out = f"{ domain } \\ { self .username } :{ process_secret (self .nthash )} { self .mark_pwned ()} "
0 commit comments