tags: convertitore buffer_overflow
from keystone import Ks, KS_ARCH_X86, KS_MODE_32
# Initialize Keystone engine for 32-bit x86
ks = Ks(KS_ARCH_X86, KS_MODE_32)
# Assembly instruction
assembly_code = input ("Enter the assembly code here : ")
# Assemble the instruction
encoding, count = ks.asm(assembly_code)
# Convert the resulting bytes to hexadecimal format
hex_encoding = ''.join(f'{byte:02x}' for byte in encoding)
print(f"Hex: {hex_encoding}")