我想使用一些参数运行tcpdump (仍然不知道使用什么),然后加载stackoverflow.com页面。
输出应该是HTTP通信。稍后,我想将它用作script.sh site.com脚本,所以每当我想要检查站点site.com的HTTP通信时,我只需运行shell即可。
HTTP通信应该足够简单。如下所示:
GET /questions/9241391/how-to-capture-all-the-http-communication-data-using-tcp-dump
Host: stackoverflow.com
...
...
HTTP/1.1 200 OK
Cache-Control: public, max-age=60
Content-Length: 35061
Content-Type: text/html; charset=utf-8
Expires: Sat, 11 Feb 2012 15:36:46 GMT
Last-Modified: Sat, 11 Feb 2012 15:35:46 GMT
Vary: *
Date: Sat, 11 Feb 2012 15:35:45 GMT
....
decoded deflated data
....现在,我应该在tcpdump中使用哪些选项来捕获它?
发布于 2012-03-28 17:13:30
这可以由ngrep来完成
ngrep -q -d eth1 -W byline host stackoverflow.com and port 80
^ ^ ^ ^
| | | |
| | | |
| | | v
| | | filter expression
| | |
| | +--> -W is set the dump format ("normal", "byline", "single", "none")
| |
| +----------> -d is use specified device instead of the pcap default
|
+-------------> -q is be quiet ("don't print packet reception hash marks")发布于 2016-01-21 16:00:20
tcpdump -i eth0 -w dump3.pcap -v 'tcp and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'https://stackoverflow.com/questions/9241391
复制相似问题