capstone isn't disassembling the whole block, dumb heuristics for growth
							parent
							
								
									0b709669b0
								
							
						
					
					
						commit
						ad6277c0ee
					
				| 
						 | 
					@ -55,11 +55,16 @@ def generation(queue: Queue, shellcode: bytes):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def growth(*, shellcode: bytes, length: int) -> bytes:
 | 
					def growth(*, shellcode: bytes, length: int) -> bytes:
 | 
				
			||||||
    for mnemonic, op_str in disasm(shellcode):
 | 
					    if length <= len(shellcode):
 | 
				
			||||||
        if mnemonic == 'nop':
 | 
					 | 
				
			||||||
        return bytes(shellcode)
 | 
					        return bytes(shellcode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if length <= len(shellcode):
 | 
					    opcodes = disasm(shellcode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if len(shellcode) > len(opcodes) * 8:
 | 
				
			||||||
 | 
					        return bytes(shellcode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for mnemonic, op_str in opcodes:
 | 
				
			||||||
 | 
					        if mnemonic == 'nop':
 | 
				
			||||||
            return bytes(shellcode)
 | 
					            return bytes(shellcode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    shellcode = bytearray(shellcode)
 | 
					    shellcode = bytearray(shellcode)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue