refactor: rename central data structures

This commit is contained in:
Dobin
2024-04-07 11:34:13 +01:00
parent de73d5452e
commit a03c267070
12 changed files with 66 additions and 126 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ def compile(
asm_out: FilePath,
payload_len: int,
carrier: Carrier,
source_style: SourceStyle,
source_style: FunctionInvokeStyle,
exe_host: ExeHost,
short_call_patching: bool = False,
):
@@ -111,7 +111,7 @@ def compile(
asm_clean_file
))
if source_style == SourceStyle.iat_reuse:
if source_style == FunctionInvokeStyle.iat_reuse:
fixup_iat_reuse(asm_clean_file, carrier)
observer.add_text_file("carrier_asm_updated", file_readall_text(asm_clean_file))
+4 -4
View File
@@ -23,8 +23,8 @@ def inject_exe(
shellcode_in = project.payload.payload_path
exe_in = settings.inject_exe_in
exe_out = settings.inject_exe_out
inject_mode: InjectStyle = settings.inject_mode
source_style: SourceStyle = settings.source_style
carrier_invoke_style: CarrierInvokeStyle = settings.carrier_invoke_style
source_style: FunctionInvokeStyle = settings.source_style
logger.info("--[ Injecting: {} + {} -> {}".format(
shellcode_in, exe_in, exe_out
@@ -42,7 +42,7 @@ def inject_exe(
# superpe is a representation of the exe file. We gonna modify it, and save it at the end.
superpe = SuperPe(exe_in)
peinj = PeBackdoor(superpe, main_shc, inject_mode)
peinj = PeBackdoor(superpe, main_shc, carrier_invoke_style)
if not peinj.injectShellcode():
logger.error('Could not inject shellcode into PE file!')
@@ -53,7 +53,7 @@ def inject_exe(
return False
logger.info("--[ Rewrite placeholders with their data")
if source_style == SourceStyle.iat_reuse:
if source_style == FunctionInvokeStyle.iat_reuse:
injected_fix_iat(superpe, project.carrier, project.exe_host)
if True:
+2 -2
View File
@@ -24,7 +24,7 @@ def create_c_from_template(settings: Settings, payload_len: int):
})
# C Template: peb_walk
if settings.source_style == SourceStyle.peb_walk:
if settings.source_style == FunctionInvokeStyle.peb_walk:
with open(settings.template_path, 'r', encoding='utf-8') as file:
template_content = file.read()
observer.add_text_file("main_c_template", template_content)
@@ -39,7 +39,7 @@ def create_c_from_template(settings: Settings, payload_len: int):
observer.add_text_file("main_c_rendered", rendered_template)
# C Template: iat_reuse
elif settings.source_style == SourceStyle.iat_reuse:
elif settings.source_style == FunctionInvokeStyle.iat_reuse:
with open(PATH_IAT_REUSE + "template.c", 'r', encoding='utf-8') as file:
template_content = file.read()
observer.add_text_file("main_c_template", template_content)