mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
refactor: small cleanup
This commit is contained in:
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
<h1> SuperMega </h1>
|
<h1> SuperMega </h1>
|
||||||
|
|
||||||
|
Description of funtionality and settings.
|
||||||
|
|
||||||
<h3>Shellcode</h3>
|
<h3>Shellcode</h3>
|
||||||
<code>--shellcode <filename.exe> </code><br>
|
<code>--shellcode <filename.exe> </code><br>
|
||||||
|
|
||||||
|
|||||||
@@ -263,6 +263,8 @@ def build_project(project_name):
|
|||||||
# return redirect("/project/{}".format(project_name), code=302)
|
# return redirect("/project/{}".format(project_name), code=302)
|
||||||
|
|
||||||
project_settings.try_start_final_infected_exe = False
|
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)
|
project = Project(project_settings)
|
||||||
prepare_project(project_name)
|
prepare_project(project_name)
|
||||||
thread = Thread(target=supermega_thread, args=(project.settings, ))
|
thread = Thread(target=supermega_thread, args=(project.settings, ))
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ def clean_files(settings):
|
|||||||
settings.project_asm_path,
|
settings.project_asm_path,
|
||||||
settings.project_shc_path,
|
settings.project_shc_path,
|
||||||
settings.project_exe_path,
|
settings.project_exe_path,
|
||||||
|
settings.get_inject_exe_out(),
|
||||||
]
|
]
|
||||||
for file in files_to_clean:
|
for file in files_to_clean:
|
||||||
pathlib.Path(file).unlink(missing_ok=True)
|
pathlib.Path(file).unlink(missing_ok=True)
|
||||||
|
|||||||
+1
-1
@@ -107,6 +107,7 @@ class Injector():
|
|||||||
self.payload_rva = rdata_section.virt_addr + offset
|
self.payload_rva = rdata_section.virt_addr + offset
|
||||||
self.rdata_manager.add_range(offset, offset+len(self.payload.payload_data))
|
self.rdata_manager.add_range(offset, offset+len(self.payload.payload_data))
|
||||||
|
|
||||||
|
|
||||||
## Inject
|
## Inject
|
||||||
|
|
||||||
def inject_exe(self):
|
def inject_exe(self):
|
||||||
@@ -118,7 +119,6 @@ class Injector():
|
|||||||
logger.info(" Injectable: {} -> {}".format(exe_in, exe_out))
|
logger.info(" Injectable: {} -> {}".format(exe_in, exe_out))
|
||||||
logger.info(" Implant IAT fixup if necessary: {}".format(self.settings.fix_missing_iat))
|
logger.info(" Implant IAT fixup if necessary: {}".format(self.settings.fix_missing_iat))
|
||||||
|
|
||||||
|
|
||||||
# Patch IAT (if necessary and wanted)
|
# Patch IAT (if necessary and wanted)
|
||||||
self.injectable_patch_iat()
|
self.injectable_patch_iat()
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,8 @@ def sanity_checks(settings):
|
|||||||
def start_real(settings: Settings) -> bool:
|
def start_real(settings: Settings) -> bool:
|
||||||
"""Main entry point for the application. This is where the magic happens (based on settings)"""
|
"""Main entry point for the application. This is where the magic happens (based on settings)"""
|
||||||
|
|
||||||
|
#settings.print()
|
||||||
|
|
||||||
# Load our input
|
# Load our input
|
||||||
project = Project(settings)
|
project = Project(settings)
|
||||||
if not project.init():
|
if not project.init():
|
||||||
@@ -244,6 +246,8 @@ def start_real(settings: Settings) -> bool:
|
|||||||
dllfunc=settings.dllfunc)
|
dllfunc=settings.dllfunc)
|
||||||
if payload_exit_code != 0:
|
if payload_exit_code != 0:
|
||||||
logger.warning("Payload exit code: {}".format(payload_exit_code))
|
logger.warning("Payload exit code: {}".format(payload_exit_code))
|
||||||
|
return False
|
||||||
|
|
||||||
elif settings.try_start_final_infected_exe:
|
elif settings.try_start_final_infected_exe:
|
||||||
run_exe(settings.get_inject_exe_out(), dllfunc=settings.dllfunc, check=False)
|
run_exe(settings.get_inject_exe_out(), dllfunc=settings.dllfunc, check=False)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user