debug: config.debug feature for more logs/

This commit is contained in:
Dobin
2024-02-19 20:39:00 +00:00
parent fb23835d51
commit b7ac5938a4
3 changed files with 12 additions and 5 deletions
+1
View File
@@ -8,6 +8,7 @@ class Config(object):
def __init__(self):
self.data = {}
self.ShowCommandOutput: bool = False
self.debug: bool = False
def getConfigPath(self):
return CONFIG_FILE
+8 -3
View File
@@ -37,7 +37,9 @@ def compile(
logger.info("---[ ASM Fixup : {} ".format(asm_out))
if not fixup_asm_file(asm_out, payload_len, short_call_patching=short_call_patching):
raise Exception("Error: Fixup failed")
#observer.add_text("carrier_asm_fixup", file_readall_text(asm_out))
if config.debug:
observer.add_text("carrier_asm_fixup", file_readall_text(asm_out))
# Assembly cleanup (masm_shc)
asm_clean_file = asm_out + ".clean"
@@ -52,7 +54,8 @@ def compile(
# Move to destination we expect
shutil.move(asm_clean_file, asm_out)
#observer.add_text("carrier_asm_cleanup", file_readall_text(asm_out))
if config.debug:
observer.add_text("carrier_asm_cleanup", file_readall_text(asm_out))
def bytes_to_asm_db(byte_data: bytes) -> bytes:
@@ -151,4 +154,6 @@ def fixup_iat_reuse(filename: FilePath, exe_info):
with open(filename, 'w') as asmfile:
asmfile.writelines(lines)
#observer.add_text("carrier_asm_iat_patch", file_readall_text(filename))
if config.debug:
observer.add_text("carrier_asm_iat_patch", file_readall_text(filename))
+3 -2
View File
@@ -47,8 +47,9 @@ def inject_exe(
code = extract_code_from_exe(exe_out)
in_code = code[peinj.shellcodeOffsetRel:peinj.shellcodeOffsetRel+shellcode_len]
jmp_code = code[peinj.backdoorOffsetRel:peinj.backdoorOffsetRel+12]
observer.add_code("exe_extracted_loader", in_code)
observer.add_code("exe_extracted_jmp", jmp_code)
if config.debug:
observer.add_code("exe_extracted_loader", in_code)
observer.add_code("exe_extracted_jmp", jmp_code)
if in_code != shellcode:
raise Exception("Shellcode injection error")