在 Debian 上,“sniffer”通常指网络抓包/嗅探工具,最常用的是 tcpdump、Wireshark(含命令行 tshark)。下面按常见场景说明如何“分析数据”。
sudo apt update
sudo apt install tcpdump tshark wireshark
使用 Wireshark 图形界面需要桌面环境;服务器一般用
tcpdump或tshark。
sudo tcpdump -i eth0 -nn
sudo tcpdump -i eth0 -w capture.pcap
tcpdump -r capture.pcap
# 只看某 IP
tcpdump -r capture.pcap host 192.168.1.10
# 只看端口
tcpdump -r capture.pcap port 80
# TCP 握手/异常
tcpdump -r capture.pcap 'tcp[tcpflags] & (tcp-syn|tcp-ack) != 0'
sudo tshark -i eth0
tshark -r capture.pcap
tshark -r capture.pcap -Y http.request -T fields \
-e ip.src -e http.host -e http.request.uri
tshark -r capture.pcap -T fields -e ip.src | sort | uniq -c | sort -nr
wireshark capture.pcap
常用分析功能:
ip.addr == 192.168.1.10
tcp.port == 443
http
ip addr
tcpdump -i eth0 -w suspicious.pcap
如果你能说清楚:
我可以直接给你针对性的分析命令。