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.
File "./bhnet.py", line 230, in main
client_sender(buffer)
File "./bhnet.py", line 127, in client_sender
client.send(buffer)
TypeError: a bytes-like object is required, not 'str'
echo -ne "GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n" | ./bhnet.py -t www.google.com -p 80 Traceback (most recent call last): File "./bhnet.py", line 239, in
main()
File "./bhnet.py", line 230, in main client_sender(buffer) File "./bhnet.py", line 127, in client_sender client.send(buffer) TypeError: a bytes-like object is required, not 'str'
encoding buffer fixed it for me :)