EONRaider / blackhat-python3

Source code for the book "Black Hat Python" by Justin Seitz. The code has been fully converted to Python 3, reformatted to comply with PEP8 standards and refactored to eliminate dependency issues involving the implementation of deprecated libraries.
2.02k stars 414 forks source link

Chapter04 pic_carver byte vs string #13

Closed headbug closed 2 years ago

headbug commented 2 years ago

When I run pic_carver.py the packet[TCP].payload returns a byte object, like b'\r\n' and so on. str(packet[TCP].payload) becomes '\\r\\n' and thus the following if-conditions evaluate to False.

Also, if the pictures and faces directories do not exists the output fails.

I have made some changes so it runs for me, but I'm a junior python coder so there might be some un-pythonic things going on. Please have a look.

And Thank you for the nice upload. pic_carver.py.gz

EONRaider commented 2 years ago

Ok. Could you make a pull request instead? If the code is right I can simply merge it.

There's a dev branch so you can do a pull request right there.