From 0f4d0e460beed2efc16e97aceabb64b7e623ad2c Mon Sep 17 00:00:00 2001 From: antonioCoco Date: Sun, 19 Sep 2021 13:18:02 +0200 Subject: [PATCH] added compatibility for Windows paths --- core/Generate.py | 5 +++-- core/config.py | 6 +++--- modules/download.py | 2 +- modules/mimikatz.py | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/Generate.py b/core/Generate.py index ea58d63..f79975e 100644 --- a/core/Generate.py +++ b/core/Generate.py @@ -4,6 +4,7 @@ from itertools import cycle import hashlib import random import io +import os.sep class Generate(): @@ -12,8 +13,8 @@ class Generate(): __obfuscator = '' __endian_type = '' - __templates_path = config.sharpyshell_path+'agent/' - __runtime_compiler_path = __templates_path + 'runtime_compiler/' + __templates_path = config.sharpyshell_path+'agent'+os.sep + __runtime_compiler_path = __templates_path + 'runtime_compiler'+os.sep __output_path = config.output_path + 'sharpyshell.aspx' def __init__(self, password, encryption, obfuscator, endian_type, output): diff --git a/core/config.py b/core/config.py index d34aaf2..a29f8fa 100644 --- a/core/config.py +++ b/core/config.py @@ -19,7 +19,7 @@ banner = """ """ % header -sharpyshell_path=os.path.dirname(os.path.realpath(sys.argv[0])) + '/' +sharpyshell_path=os.path.dirname(os.path.realpath(sys.argv[0])) + os.sep sys.path.insert(0, sharpyshell_path) -modules_paths=sharpyshell_path + 'modules/' -output_path=sharpyshell_path + 'output/' +modules_paths=sharpyshell_path + 'modules' + os.sep +output_path=sharpyshell_path + 'output' + os.sep diff --git a/modules/download.py b/modules/download.py index 28e859c..bce7138 100644 --- a/modules/download.py +++ b/modules/download.py @@ -23,7 +23,7 @@ class Download(Module): Positional arguments: remote_input_path The file path you want to download from the remote server local_output_path The path where the file will be saved on your local machine - Default: 'output/' directory of Sharpyshell directory + Default: 'output' directory of Sharpyshell directory chunk_size The maximum limit of a chunk to be transferred over the network Default: 102400 diff --git a/modules/mimikatz.py b/modules/mimikatz.py index 576d70a..84832d4 100644 --- a/modules/mimikatz.py +++ b/modules/mimikatz.py @@ -8,6 +8,7 @@ from modules.invoke_ps_module_as import Invoke_ps_module_as from modules.inject_dll_srdi import Inject_dll_srdi from utils.random_string import random_generator import traceback +import os.sep class MimikatzModuleException(ModuleException): @@ -104,7 +105,7 @@ class Mimikatz(Module): if 'mimikatz.exe' in self._module_settings.keys(): bin_path = self._module_settings['mimikatz.exe'] else: - exe_path = config.modules_paths + 'exe_modules/mimikatz.exe' + exe_path = config.modules_paths + 'exe_modules' + os.sep + 'mimikatz.exe' remote_upload_path = self._module_settings['env_directory'] + '\\' + random_generator() + '.exe' print ('\n\n\nUploading mimikatz binary....\n') upload_response = self._parse_response(self.upload_module_object.run([exe_path, remote_upload_path]))