用 Linux 自带的工具实现了一个可以将 TCP 流量打印出来的中间人代理程序(透明的)。也不完全是 tcpdump,这只是将 TCP 内容简单的打印出来。
相当于一个反向的透明代理。
对一些开发任务很有用。
用 curl --proxy 127.0.0.1:8800 kawabangga.com -v
测试,效果如下:
➜ tmp ./tcp_proxy.sh 8800 kawabangga.com 80
=> GET http://kawabangga.com/ HTTP/1.1
=> Host: kawabangga.com
=> User-Agent: curl/7.66.0
=> Accept: */*
=> Proxy-Connection: Keep-Alive
=>
<= HTTP/1.1 301 Moved Permanently
<= Server: wts/1.6.0
<= Date: Thu, 07 Nov 2019 12:50:38 GMT
<= Content-Type: text/html; charset=iso-8859-1
<= Content-Length: 299
<= Connection: keep-alive
<= Location: https://www.kawabangga.com/
<= X-Cache: from WTS
<=
<= <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<= <html><head>
<= <title>301 Moved Permanently</title>
<= </head><body>
<= <h1>Moved Permanently</h1>
<= <p>The document has moved <a href="https://www.kawabangga.com/">here</a>.</p>
<= <hr>
<= <address>Apache Server at kawabangga.com Port 80</address>
<= </body></html>
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.