mirror of
https://github.com/dobin/SuperMega
synced 2026-06-03 01:27:11 +00:00
fix: support large payload (payload len)
This commit is contained in:
@@ -23,6 +23,7 @@ def create_c_from_template(
|
|||||||
alloc_style: AllocStyle,
|
alloc_style: AllocStyle,
|
||||||
exec_style: ExecStyle,
|
exec_style: ExecStyle,
|
||||||
decoder_style: DecoderStyle,
|
decoder_style: DecoderStyle,
|
||||||
|
payload_len: int,
|
||||||
):
|
):
|
||||||
plugin_allocator = ""
|
plugin_allocator = ""
|
||||||
plugin_decoder = ""
|
plugin_decoder = ""
|
||||||
@@ -31,6 +32,9 @@ def create_c_from_template(
|
|||||||
filepath = "plugins/allocator/{}.c".format(alloc_style.value)
|
filepath = "plugins/allocator/{}.c".format(alloc_style.value)
|
||||||
with open(filepath, "r", encoding='utf-8') as file:
|
with open(filepath, "r", encoding='utf-8') as file:
|
||||||
plugin_allocator = file.read()
|
plugin_allocator = file.read()
|
||||||
|
plugin_allocator = Template(plugin_allocator).render({
|
||||||
|
'PAYLOAD_LEN': payload_len,
|
||||||
|
})
|
||||||
|
|
||||||
filepath = "plugins/decoder/{}.c".format(decoder_style.value)
|
filepath = "plugins/decoder/{}.c".format(decoder_style.value)
|
||||||
with open(filepath, "r", encoding='utf-8') as file:
|
with open(filepath, "r", encoding='utf-8') as file:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
char *dest = VirtualAlloc(NULL, 4096, 0x3000, 0x40);
|
char *dest = VirtualAlloc(NULL, {{PAYLOAD_LEN}}, 0x3000, 0x40);
|
||||||
@@ -19,6 +19,11 @@ def r2_disas(data: bytes):
|
|||||||
f.write(data)
|
f.write(data)
|
||||||
code_len = len(data)
|
code_len = len(data)
|
||||||
|
|
||||||
|
if code_len > 0x2000:
|
||||||
|
ret['text'] = "Code too long for r2: {}".format(code_len)
|
||||||
|
ret['color'] = "Code too long for r2: {}".format(code_len)
|
||||||
|
return ret
|
||||||
|
|
||||||
r2 = r2pipe.open(filename, flags=['-2'])
|
r2 = r2pipe.open(filename, flags=['-2'])
|
||||||
r2.cmd('aaa')
|
r2.cmd('aaa')
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ def start():
|
|||||||
alloc_style = project.alloc_style,
|
alloc_style = project.alloc_style,
|
||||||
exec_style = project.exec_style,
|
exec_style = project.exec_style,
|
||||||
decoder_style= project.decoder_style,
|
decoder_style= project.decoder_style,
|
||||||
|
payload_len = len(project.payload_data),
|
||||||
)
|
)
|
||||||
# Compile: IAT_REUSE loader C -> ASM
|
# Compile: IAT_REUSE loader C -> ASM
|
||||||
if project.generate_asm_from_c:
|
if project.generate_asm_from_c:
|
||||||
@@ -153,6 +154,7 @@ def start():
|
|||||||
alloc_style = project.alloc_style,
|
alloc_style = project.alloc_style,
|
||||||
exec_style = project.exec_style,
|
exec_style = project.exec_style,
|
||||||
decoder_style= project.decoder_style,
|
decoder_style= project.decoder_style,
|
||||||
|
payload_len = len(project.payload_data),
|
||||||
)
|
)
|
||||||
# Compile: PEB_WALK C -> ASM
|
# Compile: PEB_WALK C -> ASM
|
||||||
if project.generate_asm_from_c:
|
if project.generate_asm_from_c:
|
||||||
|
|||||||
Reference in New Issue
Block a user