1)抓取百度80端口数据包
localhost:~ # tcpdump -i eth0 host hostname and src port 80
tcpdump: unknown host 'hostname'
localhost:~ # tcpdump -i eth0 host www.baidu.cm and src port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
^C
0 packets captured
8 packets received by filter
0 packets dropped by kernel
2)将抓取的数据包保存到指定的文件中
localhost:~ # tcpdump -l >/mnt/hgfs/tools/baidutcp.txt
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
^C54 packets captured
54 packets received by filter
0 packets dropped by kernel
3)查看文件大小
localhost:~ # du -sh /mnt/hgfs/tools/baidutcp.txt
2.5K /mnt/hgfs/tools/baidutcp.txt
localhost:~ #
本文介绍了如何使用tcpdump工具捕获针对百度网站80端口的HTTP流量数据包,并将其保存为文本文件。文中还展示了如何查看所保存文件的大小。
1510

被折叠的 条评论
为什么被折叠?



