Here I'm gonna say the solution to one of the python3 encoding problem (C2)
Here I've created an exploit with python3, but the exploit not working :/ Let's analyse this...
Our exploit not working coz we have C2 before every bytes, Python3 has some encoding issues we need to change something in this to encode it correctly.
See here python2 has no issues in this, however we can use python2 but I'm a user of python3 so it takes some extra time for me to code in python2. Also I have issues in some python2 modules too :/
Now here we're fixing the issue by specifying encode('latin-1')
and using sys.stdout.buffer.write()
instead of print()
Coz print has some issues in this, It'll print the encoded payload within b' '
so our payload will be messed up :/
See now here no more c2 :)
I hope this will be helpful to you while doing binary exploitation :)