mankee mankee - 1 year ago 94
Python Question

Hexadecimal Memory Address to Assembly

I am following a buffer overflow tutorial. I have set up my NOP block, I also set up my shell code, now I need to append the return address to the end of my string. I know my return address is :


however I need to write it in the form:

(that's just an example address to show what format I need)

I'm not sure how to carry out the conversion between the two.

Answer Source

You can use struct.pack like this:

import struct
struct.pack('<L', 0xbfffef40)

Check the documentation of struct.pack if you want to change the endianness.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download