抓取指定端口的数据包 并保存文件,用wireshark分析
tcpdump -Ans 4096 -i any port 8080 -w mpass.cap
抓取指定端口和指定ip的数据包 并保存文件,用wireshark分析
tcpdump -Ans 4096 -i any port 8080 and host 192.168.10.12 -w mpass.cap
-i 表示指定的网卡, any是任意的意思
---------------------------------------------------------------------------------------
假设服务器的ip是 192.168.10.11
截获主机192.168.10.12发送的所有数据 [192.168.10.12 --> 192.168.10.11] src 表示源(source)
tcpdump -i eth0 src host 192.168.10.12
监视所有送到主机192.168.10.12的数据包 [192.168.10.11 --> 192.168.10.12] dst表示目的地 (destination)
tcpdump -i eth0 dst host 192.168.10.12
eth0 代表第一块网卡 , 可以用ifconfig -a查看所有网卡
原文:http://www.cnblogs.com/web21/p/6372866.html