Skip to content

Commit b8ce694

Browse files
authored
Update schtask_as.py
Signed-off-by: Kahvi-0xFF <46513413+Kahvi-0@users.noreply.github.com>
1 parent e663fb8 commit b8ce694

1 file changed

Lines changed: 0 additions & 11 deletions

File tree

nxc/modules/schtask_as.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)