gpt4 book ai didi

bash - 如何使用 tcpdump 捕获所有 HTTP 数据包

转载 作者:可可西里 更新时间:2023-11-01 15:04:11 30 4
gpt4 key购买 nike

我想用一些参数运行tcpdump(仍然不知道使用什么),然后加载stackoverflow.com 页面。

输出应该是 HTTP 通信。后来,我想将它用作 shell 脚本,所以每当我想检查站点 site.com 的 HTTP 通信时,只需运行 script.sh site.com 即可。

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 一起捕获它?

最佳答案

可以通过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")

关于bash - 如何使用 tcpdump 捕获所有 HTTP 数据包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9241391/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com