mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
refactor: from project.verify_filename to def.py:VerifyFilename
This commit is contained in:
@@ -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/
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -66,7 +66,6 @@ class ExeInfo():
|
||||
self.code_virtaddr,
|
||||
self.code_size))
|
||||
|
||||
|
||||
# iat
|
||||
self.iat = pehelper.extract_iat(pe)
|
||||
|
||||
|
||||
+3
-3
@@ -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)")
|
||||
|
||||
@@ -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))
|
||||
|
||||
+5
-5
@@ -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)")
|
||||
|
||||
Reference in New Issue
Block a user