@@ -27,7 +27,7 @@ def options(self, context, module_options):
2727 self .command_to_run = self .binary_to_upload = self .run_task_as = self .task_name = self .output_filename = self .output_file_location = self .time = None
2828 self .share = "C$"
2929 self .tmp_dir = "C:\\ Windows\\ Temp\\ "
30- self .tmp_share = self .tmp_dir .split (":" )[1 ]
30+ self .tmp_path = self .tmp_dir .split (":" )[1 ]
3131
3232 if "CMD" in module_options :
3333 self .command_to_run = module_options ["CMD" ]
@@ -68,7 +68,7 @@ def on_admin_login(self, context, connection):
6868 return 1
6969 else :
7070 self .logger .display (f"Uploading { self .binary_to_upload } " )
71- binary_file_location = self .tmp_share if self .output_file_location is None else self .output_file_location
71+ binary_file_location = self .tmp_path if self .output_file_location is None else self .output_file_location
7272 with open (self .binary_to_upload , "rb" ) as binary_to_upload :
7373 try :
7474 self .binary_to_upload_name = os .path .basename (self .binary_to_upload )
@@ -102,7 +102,11 @@ def on_admin_login(self, context, connection):
102102 )
103103
104104 self .logger .display (f"Executing { self .command_to_run } as { self .run_task_as } " )
105- output = exec_method .execute (self .command_to_run , True )
105+ #output = exec_method.execute(self.command_to_run, True)
106+ if "cmd" in self .command_to_run .lower () or "powershell" in self .command_to_run .lower ():
107+ output = exec_method .execute (self .command_to_run , True )
108+ else :
109+ output = exec_method .execute (self .command_to_run , False )
106110
107111 try :
108112 if not isinstance (output , str ):
0 commit comments