diff --git a/defs.py b/defs.py index f40bc80..b675c5c 100644 --- a/defs.py +++ b/defs.py @@ -4,6 +4,9 @@ import os class FilePath(str): pass +# with shellcodes/createfile.bin +VerifyFilename: FilePath = r'C:\Temp\a' + # Correlated with real template files # in plugins/ diff --git a/helper.py b/helper.py index d41efe9..a3b5e56 100644 --- a/helper.py +++ b/helper.py @@ -29,7 +29,7 @@ def clean_files(): os.path.join(build_dir, "peb_lookup.h"), #os.path.join(build_dir, "main.exe"), - project.verify_filename, + VerifyFilename, ] for file in files_to_clean: pathlib.Path(file).unlink(missing_ok=True) diff --git a/model.py b/model.py index dbf213b..f8988ce 100644 --- a/model.py +++ b/model.py @@ -66,7 +66,6 @@ class ExeInfo(): self.code_virtaddr, self.code_size)) - # iat self.iat = pehelper.extract_iat(pe) diff --git a/phases/injector.py b/phases/injector.py index 3c1b842..53844ad 100644 --- a/phases/injector.py +++ b/phases/injector.py @@ -81,16 +81,16 @@ def injected_fix_iat(exe_out: FilePath, exe_info: ExeInfo): def verify_injected_exe(exefile: FilePath) -> int: logger.info("---[ Verify infected exe: {} ".format(exefile)) # remove indicator file - pathlib.Path(project.verify_filename).unlink(missing_ok=True) + pathlib.Path(VerifyFilename).unlink(missing_ok=True) run_process_checkret([ exefile, ], check=False) time.sleep(SHC_VERIFY_SLEEP) - if os.path.isfile(project.verify_filename): + if os.path.isfile(VerifyFilename): logger.info("---> Verify OK. Infected exe works (file was created)") # better to remove it immediately - os.remove(project.verify_filename) + os.remove(VerifyFilename) return 0 else: logger.warning("---> Verify FAIL. Infected exe does not work (no file created)") diff --git a/project.py b/project.py index b340e11..e9e945b 100644 --- a/project.py +++ b/project.py @@ -36,8 +36,6 @@ class Project(): self.generate_asm_from_c: bool = True self.generate_shc_from_asm: bool = True - self.verify_filename: FilePath = r'C:\Temp\a' - def load_payload(self): logging.info("Load payload: {}".format(self.payload_path)) diff --git a/supermega.py b/supermega.py index f0c6e00..ae17531 100644 --- a/supermega.py +++ b/supermega.py @@ -275,21 +275,21 @@ def verify_shellcode(shc_name): logger.info("---[ Verify shellcode: {}".format(shc_name)) # check if directory exists - if not os.path.exists(os.path.dirname(project.verify_filename)): - logger.info("Error, directory does not exist for: {}".format(project.verify_filename)) + if not os.path.exists(os.path.dirname(VerifyFilename)): + logger.info("Error, directory does not exist for: {}".format(VerifyFilename)) return # remove indicator file - pathlib.Path(project.verify_filename).unlink(missing_ok=True) + pathlib.Path(VerifyFilename).unlink(missing_ok=True) run_process_checkret([ config.get("path_runshc"), "{}".format(shc_name), ], check=False) time.sleep(SHC_VERIFY_SLEEP) - if os.path.isfile(project.verify_filename): + if os.path.isfile(VerifyFilename): logger.info("---> Verify OK. Shellcode works (file was created)") - os.remove(project.verify_filename) + os.remove(VerifyFilename) return True else: logger.warning("---> Verify FAIL. Shellcode doesnt work (file was not created)")