JonathanSalwan/ROPgadget

Generated ROPchain code not compatible with Python3 `str`

chinggg opened this issue · 1 comments

Thanks for making this great tool and keep maintaining it to support Python3! However, I find some part of code that ROPMaker generate is still "Python2-style". To be specific, quoted string has type of str in Python3, but bytes in Python2. So users have to use Python2 or modify the code to run it.

eg.

## - Step 5 -- Build the ROP chain
#!/usr/bin/env python
# execve generated by ROPgadget

from struct import pack

# Padding goes here
p = ''

p += pack('<I', 0x0806f34a) # pop edx ; ret
p += pack('<I', 0x080ea060) # @ .data
p += pack('<I', 0x080bb496) # pop eax ; ret
p += '/bin'

should be changed to

# Padding goes here
p = b''

p += pack('<I', 0x0806f34a) # pop edx ; ret
p += pack('<I', 0x080ea060) # @ .data
p += pack('<I', 0x080bb496) # pop eax ; ret
p += b'/bin'

I upgraded ROPMaker to Python3.