mirror of
https://github.com/dobin/SuperMega
synced 2026-06-02 17:27:10 +00:00
refactor: rework logging
This commit is contained in:
+7
-3
@@ -11,7 +11,8 @@ logger = logging.getLogger("Assembler")
|
||||
|
||||
def asm_to_shellcode(asm_in: FilePath, build_exe: FilePath) -> bytes:
|
||||
"""Takes ASM source file asm_in, compiles it into build_exe, extracts its code section and write into shellcode_out"""
|
||||
logger.info("-[ Assemble to exe: {} -> {}".format(asm_in, build_exe))
|
||||
logger.info("-[ Carrier: ASM to EXE".format())
|
||||
logger.info(" Carrier: {} -> {}".format(asm_in, build_exe))
|
||||
run_process_checkret([
|
||||
config.get("path_ml64"),
|
||||
asm_in,
|
||||
@@ -22,6 +23,9 @@ def asm_to_shellcode(asm_in: FilePath, build_exe: FilePath) -> bytes:
|
||||
if not os.path.isfile(build_exe):
|
||||
raise Exception("Compiling failed")
|
||||
code = extract_code_from_exe_file(build_exe)
|
||||
logging.info(" Carrier Size: {}".format(
|
||||
len(code)
|
||||
))
|
||||
return code
|
||||
|
||||
|
||||
@@ -30,12 +34,12 @@ def encode_payload(payload: bytes, decoder_style: str) -> bytes:
|
||||
return bytes(payload)
|
||||
elif decoder_style == "xor_1":
|
||||
xor_key = config.xor_key
|
||||
logger.info("---[ XOR payload with key 0x{:X}".format(xor_key))
|
||||
logger.debug(" XOR payload with key 0x{:X}".format(xor_key))
|
||||
xored = bytes([byte ^ xor_key for byte in payload])
|
||||
return bytes(xored)
|
||||
elif decoder_style == "xor_2":
|
||||
xor_key = config.xor_key2
|
||||
logger.info("---[ XOR2 payload with key {}".format(xor_key))
|
||||
logger.debug(" XOR2 payload with key {}".format(xor_key))
|
||||
xored = bytearray(payload)
|
||||
for i in range(len(xored)):
|
||||
xored[i] ^= xor_key[i % 2]
|
||||
|
||||
Reference in New Issue
Block a user