@@ -16,17 +16,17 @@ class NXCModule:
1616
1717 def options (self , context , module_options ):
1818 """
19- FILTER Apply the FILTER (grep-like) (default: '')
19+ FILTER Apply the FILTER (grep-like) (default: '')
2020 OUTPUTFILE Path to a file to save the results (default: None)
2121 """
22- self .FILTER = ""
23- self .OUTPUTFILE = None
22+ self .filter = ""
23+ self .outputfile = None
2424
2525 if "FILTER" in module_options :
26- self .FILTER = module_options ["FILTER" ]
26+ self .filter = module_options ["FILTER" ]
2727
2828 if "OUTPUTFILE" in module_options :
29- self .OUTPUTFILE = module_options ["OUTPUTFILE" ]
29+ self .outputfile = module_options ["OUTPUTFILE" ]
3030
3131 def on_login (self , context , connection ):
3232 # Building the search filter
@@ -47,19 +47,19 @@ def on_login(self, context, connection):
4747 context .log .highlight (f"User: { answer [0 ]:<20} ScriptPath: { answer [1 ]} " )
4848
4949 # Save the results to a file
50- if self .OUTPUTFILE :
50+ if self .outputfile :
5151 self .save_to_file (context , answers )
5252 else :
5353 context .log .warning ("No results found after filtering." )
5454
5555 def filter_answer (self , context , answers ):
5656 # No filter
57- if not self .FILTER :
57+ if not self .filter :
5858 context .log .debug ("No filter option enabled" )
5959 return answers
6060 # Filter
61- context .log .debug (f"Filter info field with: { self .FILTER } " )
62- return [answer for answer in answers if self .FILTER in answer [0 ]]
61+ context .log .debug (f"Filter info field with: { self .filter } " )
62+ return [answer for answer in answers if self .filter in answer [0 ]]
6363
6464 def save_to_file (self , context , answers ):
6565 """Save the results to a JSON file."""
@@ -68,9 +68,9 @@ def save_to_file(self, context, answers):
6868 json_data = [{"sAMAccountName" : answer [0 ], "scriptPath" : answer [1 ]} for answer in answers ]
6969
7070 # Save the JSON data to the specified file
71- with open (self .OUTPUTFILE , "w" ) as f :
71+ with open (self .outputfile , "w" ) as f :
7272 json .dump (json_data , f , indent = 4 )
73- context .log .success (f"Results successfully saved to { self .OUTPUTFILE } " )
73+ context .log .success (f"Results successfully saved to { self .outputfile } " )
7474
7575 except Exception as e :
7676 context .log .error (f"Failed to save results to file: { e } " )
0 commit comments