这本书很不错,十分推荐阅读的!

但是问题很明显,这东西有点跟不上时代了.在 Ubuntu 都默认 Python 3 的情况下用 2 真的很不爽…很不爽.

于是直接用 Python 3 尝试实现里面的工具.

首先就是那个 Netcat.py,原理还算简单,但是坑不少.

首先就是 socket.send 的编码问题,这个你可能在前面的 TCP Server 处就踩到这个坑了,加上 encode 搞定.

client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
...
client.send((balbalbalbal).encode(encoding="utf-8"))

第二个踩的是 Netcat 中端口的数据类型,前面加个判断解决.

if type(port) is int:
....
else:
    int(port)

#未完


Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.