Quantcast
Channel: V2EX - scriptB0y
Viewing all articles
Browse latest Browse all 50

[分享创造] 教程:用 Linux 自带工具实现的一个“tcpdump” (不需要特殊权限)

$
0
0

用 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>

原文地址: https://www.kawabangga.com/posts/3723


Viewing all articles
Browse latest Browse all 50

Trending Articles