mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
refactor: make inject mode configurable
This commit is contained in:
@@ -32,6 +32,7 @@ def clean_files():
|
||||
os.path.join(build_dir, "main.asm"),
|
||||
os.path.join(build_dir, "main.bin"),
|
||||
os.path.join(build_dir, "main.c"),
|
||||
os.path.join(build_dir, "peb_lookup.h"),
|
||||
#os.path.join(build_dir, "main.exe"),
|
||||
|
||||
verify_filename,
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@ from helper import *
|
||||
import shutil
|
||||
|
||||
|
||||
def inject_exe(shc_file, exe_in, exe_out):
|
||||
def inject_exe(shc_file, exe_in, exe_out, mode):
|
||||
print("--[ Injecting: {} into: {} -> {} ]".format(
|
||||
shc_file, exe_in, exe_out
|
||||
))
|
||||
@@ -12,7 +12,7 @@ def inject_exe(shc_file, exe_in, exe_out):
|
||||
subprocess.run([
|
||||
"python3.exe",
|
||||
"redbackdoorer.py",
|
||||
"1,1",
|
||||
mode,
|
||||
shc_file,
|
||||
exe_out
|
||||
], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
|
||||
+11
-2
@@ -35,6 +35,12 @@ options_default = {
|
||||
"copy_style": CopyStyle.SIMPLE,
|
||||
"dataref_style": DataRefStyle.APPEND,
|
||||
|
||||
# injecting into exe
|
||||
"inject_exe": True,
|
||||
"inject_mode": "1,1",
|
||||
"inject_exe_in": "exes/procexp64.exe",
|
||||
"inject_exe_out": "out/procexp64-a.exe",
|
||||
|
||||
"try_start_loader_shellcode": False, # without payload (Debugging)
|
||||
"try_start_final_shellcode": False, # with payload (should work)
|
||||
"try_start_final_infected_exe": True, # with payload (should work)
|
||||
@@ -75,6 +81,7 @@ options_verify = {
|
||||
|
||||
# injecting into exe
|
||||
"inject_exe": True,
|
||||
"inject_mode": "1,1",
|
||||
"inject_exe_in": "exes/procexp64.exe",
|
||||
"inject_exe_out": "out/procexp64-a.exe",
|
||||
|
||||
@@ -84,13 +91,15 @@ options_verify = {
|
||||
|
||||
# cleanup
|
||||
"cleanup_files_on_start": True,
|
||||
"cleanup_files_on_exit": False, # all is just in out/
|
||||
"cleanup_files_on_exit": True, # all is just in out/
|
||||
|
||||
# doesnt work
|
||||
"obfuscate_shc_loader": False,
|
||||
"test_obfuscated_shc": False,
|
||||
}
|
||||
|
||||
|
||||
|
||||
options = None
|
||||
|
||||
main_c_file = os.path.join(build_dir, "main.c")
|
||||
@@ -201,7 +210,7 @@ def main():
|
||||
if options["inject_exe"]:
|
||||
debug_data["original_exe"] = file_readall_binary(options["inject_exe_in"])
|
||||
|
||||
inject_exe(main_shc_file, options["inject_exe_in"], options["inject_exe_out"])
|
||||
inject_exe(main_shc_file, options["inject_exe_in"], options["inject_exe_out"], options["inject_mode"])
|
||||
if options["verify"]:
|
||||
print("--[ Verify final exe ]")
|
||||
if verify_injected_exe(options["inject_exe_out"]):
|
||||
|
||||
Reference in New Issue
Block a user