refactor: small cleanup

This commit is contained in:
Dobin Rutishauser
2025-06-21 10:19:01 +02:00
parent 71bc23f47a
commit 1db212de53
5 changed files with 10 additions and 1 deletions
+2
View File
@@ -10,6 +10,8 @@
<h1> SuperMega </h1>
Description of funtionality and settings.
<h3>Shellcode</h3>
<code>--shellcode &lt;filename.exe&gt; </code><br>
+2
View File
@@ -263,6 +263,8 @@ def build_project(project_name):
# return redirect("/project/{}".format(project_name), code=302)
project_settings.try_start_final_infected_exe = False
project_settings.cleanup_files_on_start = True # cleanup, or it will be confusing if failed
project = Project(project_settings)
prepare_project(project_name)
thread = Thread(target=supermega_thread, args=(project.settings, ))
+1
View File
@@ -34,6 +34,7 @@ def clean_files(settings):
settings.project_asm_path,
settings.project_shc_path,
settings.project_exe_path,
settings.get_inject_exe_out(),
]
for file in files_to_clean:
pathlib.Path(file).unlink(missing_ok=True)
+1 -1
View File
@@ -107,6 +107,7 @@ class Injector():
self.payload_rva = rdata_section.virt_addr + offset
self.rdata_manager.add_range(offset, offset+len(self.payload.payload_data))
## Inject
def inject_exe(self):
@@ -118,7 +119,6 @@ class Injector():
logger.info(" Injectable: {} -> {}".format(exe_in, exe_out))
logger.info(" Implant IAT fixup if necessary: {}".format(self.settings.fix_missing_iat))
# Patch IAT (if necessary and wanted)
self.injectable_patch_iat()
+4
View File
@@ -148,6 +148,8 @@ def sanity_checks(settings):
def start_real(settings: Settings) -> bool:
"""Main entry point for the application. This is where the magic happens (based on settings)"""
#settings.print()
# Load our input
project = Project(settings)
if not project.init():
@@ -244,6 +246,8 @@ def start_real(settings: Settings) -> bool:
dllfunc=settings.dllfunc)
if payload_exit_code != 0:
logger.warning("Payload exit code: {}".format(payload_exit_code))
return False
elif settings.try_start_final_infected_exe:
run_exe(settings.get_inject_exe_out(), dllfunc=settings.dllfunc, check=False)