ryan4yin / thiscute.world

Ryan4Yin's Space
https://thiscute.world
17 stars 3 forks source link

posts/socat-netcat/ #20

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Linux 网络工具中的瑞士军刀 - socat & netcat - This Cute World

https://thiscute.world/posts/socat-netcat/

Nillouise commented 2 years ago

关于 socat - openssl-connect:192.168.31.123:4433,cafile=server.crt 这条命令,最后的cafile参数应该设置成ca.crt,即ca的证书而不是server的证书,毕竟使用ca的证书来验证server的证书嘛,在我本机的测试确实是这样的。

另外感谢作者这篇文章对我的帮助。

ryan4yin commented 2 years ago

@Nillouise 感谢反馈:heart:,文章已更新

asddongmen commented 2 years ago

很有用!

shinvdu commented 1 year ago

担当临时的 web 服务器

curl 请求会报错的, 因为没有http返回头。

silas@silas-ThinkPad-L460:~/tmp$ curl http://localhost:8484 curl: (1) Received HTTP/0.9 when not allowed

silas@silas-ThinkPad-L460:~/tmp$ curl localhost:8484 curl: (1) Received HTTP/0.9 when not allowed

silas@silas-ThinkPad-L460:~/tmp$ telnet localhost 8484 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. hello world Connection closed by foreign host. silas@silas-ThinkPad-L460:~/tmp$ nc localhost 8484 hello world

ryan4yin commented 1 year ago

@shinvdu 哦确实是,我之前测试时没到位,把 py 脚本改为如下内容即可,我更新下文章:

print("""HTTP/1.1 200 OK
Content-Type: text/plain

hello world
""")