1- from impacket .ldap import ldap as ldap_impacket
2- from nxc .logger import nxc_logger
31from nxc .parsers .ldap_results import parse_result_attributes
42
53
@@ -8,9 +6,8 @@ class NXCModule:
86 Get the info field of users
97 Module by @sepauli
108 """
11-
129 name = "get-info-users"
13- description = "Get the info field of the users. May contained password"
10+ description = "Get the info field of all users. May contain password"
1411 supported_protocols = ["ldap" ]
1512 opsec_safe = True
1613 multiple_hosts = True
@@ -25,15 +22,14 @@ def on_login(self, context, connection):
2522 # Building the search filter
2623 searchFilter = "(info=*)"
2724
28- context .log .debug (f"Search Filter={ searchFilter } " )
2925 resp = connection .search (
3026 searchFilter = searchFilter ,
3127 attributes = ["sAMAccountName" , "info" ]
3228 )
3329
3430 context .log .debug (f"Total of records returned { len (resp )} " )
3531 resp_parsed = parse_result_attributes (resp )
36- answers = [[x ["sAMAccountName" ], x . get ( "info" )] for x in resp_parsed if x . get ( "info" ) ]
32+ answers = [[x ["sAMAccountName" ], x [ "info" ]] for x in resp_parsed ]
3733
3834 answers = self .filter_answer (context , answers )
3935 if len (answers ) > 0 :
@@ -43,12 +39,12 @@ def on_login(self, context, connection):
4339
4440 def filter_answer (self , context , answers ):
4541 answersFiltered = []
46- # No option to filter
42+ # No option to filter
4743 if self .FILTER == "" :
4844 context .log .debug ("No filter option enabled" )
4945 return answers
5046 # Filter
51- context .log .debug ("Prepare to filter " )
47+ context .log .debug (f"Filter info field with: { self . FILTER } " )
5248 for answer in answers :
5349 if self .FILTER and self .FILTER in str (answer [1 ]):
5450 answersFiltered .append (answer )
0 commit comments