I have been working on some of the 'easy' pwn challenges and I keep running into issues with python3 and properly encoding my payload (specifically with using pwn-tools). What worked in Python2 isn't working in Python3 and I have read up on how Python3 handles String and Bytes differently from Python2. I find that most write-ups/guides using pwn-tools or doing binary exploitation in general seem to use python2.
Whats got me caught up is that Kali (2021.1) appears to no longer have python-pip (python2) and only supports pip3 which means I cannot install pwn-tools for python2. So I figured I'd try working with Python3.. but I can't figure out the proper way to encode the payload and this seems to be affecting my ability to successfully exploit multiple challenges.
I have tried converting to bytes object, encoding, but cant find the solution to get the desired output I was getting with Python2.
python -c "print 'A'*5 + '\xde\xad\xc0\xde'" | hexdump -C 41 41 41 41 41 de ad c0 de 0a
python3 -c "print('A'*5 + '\xde\xad\xc0\xde')" | hexdump -C 41 41 41 41 41 c3 9e c2 ad c3 80 c3 9e 0a
If anyone has any tips on how to properly encode a payload so get the desired output I'd greatly appreciate it!