Compare commits

...

2 Commits

Author SHA1 Message Date
JoYo 38706feff6 max op length assumed 2019-02-24 06:38:33 +00:00
JoYo ad6277c0ee capstone isn't disassembling the whole block, dumb heuristics for growth 2019-02-24 06:34:26 +00:00
1 changed files with 11 additions and 4 deletions

View File

@ -55,11 +55,18 @@ def generation(queue: Queue, shellcode: bytes):
def growth(*, shellcode: bytes, length: int) -> bytes:
for mnemonic, op_str in disasm(shellcode):
if mnemonic == 'nop':
if length <= len(shellcode):
return bytes(shellcode)
if length <= len(shellcode):
opcodes = disasm(shellcode)
max_op_len = 15
if len(shellcode) > len(opcodes) * max_op_len:
return bytes(shellcode)
for mnemonic, op_str in opcodes:
if mnemonic == 'nop':
return bytes(shellcode)
shellcode = bytearray(shellcode)