@@ -75,20 +75,12 @@ def on_admin_login(self, context, connection):
7575 self .binary_to_upload_name = os .path .basename (self .binary_to_upload )
7676 connection .conn .putFile (self .share , f"{ binary_file_location } { self .binary_to_upload_name } " , binary_to_upload .read )
7777 self .logger .success (f"Binary { self .binary_to_upload_name } successfully uploaded in { binary_file_location } { self .binary_to_upload_name } " )
78-
79- with open (self .binary_to_upload , "rb" ) as binary_to_upload :
80- try :
81- self .binary_to_upload_name = os .path .basename (self .binary_to_upload )
82- connection .conn .putFile (self .share , f"{ self .tmp_share } { self .binary_to_upload_name } " , binary_to_upload .read )
83- self .logger .success (f"Binary { self .binary_to_upload_name } successfully uploaded in { self .tmp_share } { self .binary_to_upload_name } " )
84-
8578 except Exception as e :
8679 self .logger .fail (f"Error writing file to share { binary_file_location } : { e } " )
8780 return 1
8881
8982 # Returnes self.command_to_run or \Windows\temp\BinToExecute.exe depending if BINARY=BinToExecute.exe
9083 #self.command_to_run = self.command_to_run if not self.binary_to_upload else f"{self.tmp_share}{self.command_to_run}"
91- self .command_to_run = self .command_to_run if not self .binary_to_upload else f"{ self .tmp_share } { self .command_to_run } "
9284 self .logger .display ("Connecting to the remote Service control endpoint" )
9385 try :
9486 exec_method = TSCH_EXEC (
@@ -106,7 +98,6 @@ def on_admin_login(self, context, connection):
10698 connection .args .get_output_tries ,
10799 connection .args .share ,
108100 self .run_task_as ,
109- self .run_task_as ,
110101 self .command_to_run ,
111102 self .output_filename ,
112103 self .task_name ,
@@ -137,7 +128,5 @@ def on_admin_login(self, context, connection):
137128 sleep (10 )
138129 connection .conn .deleteFile (self .share , f"{ binary_file_location } { self .binary_to_upload_name } " )
139130 context .log .success (f"Binary { binary_file_location } { self .binary_to_upload_name } successfully deleted" )
140- connection .conn .deleteFile (self .share , f"{ self .tmp_share } { self .binary_to_upload_name } " )
141- context .log .success (f"Binary { self .binary_to_upload_name } successfully deleted" )
142131 except Exception as e :
143132 context .log .fail (f"Error deleting { self .binary_to_upload_name } on { self .share } : { e } " )
0 commit comments