Skip to content

Latest commit

 

History

History
40 lines (19 loc) · 1.39 KB

GetRidofC2.md

File metadata and controls

40 lines (19 loc) · 1.39 KB

Python 3 encoding problems

Here I'm gonna say the solution to one of the python3 encoding problem (C2)

Ok what's C2?

img1

Here I've created an exploit with python3, but the exploit not working :/ Let's analyse this...

img2

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.

Same exploit on python2

img3

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 :/

FIX

img4

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 :/

img5

See now here no more c2 :)

I hope this will be helpful to you while doing binary exploitation :)