for software in ${TCPDUMP} ${LIBPCAP} do echo "Download $software ..." echo "wget http://www.tcpdump.org/release/${software}.tar.gz" wget http://www.tcpdump.org/release/${software}.tar.gz echo "tar xvf ${software}.tar.gz" tar xvf ${software}.tar.gz done
cd ${LIBPCAP} ./configure --host=arm-linux --with-pcap=linux --prefix=${PWD}/out make; make install cd -
cd ${TCPDUMP} ./configure --host=arm-linux --with-system-libpcap=${PWD}/../${LIBPCAP}/out/lib --prefix=${PWD}/out make; make install cd -
cp ${PWD}/${TCPDUMP}/out/sbin/tcpdump .
示例
-n:直接打印,-w:保存文件
抓取wlan0中的所有数据包
1
# tcpdump -i wlan0 -v -n
抓取wlan0中的udp包
1
# tcpdump -i wlan0 -v -n udp
抓取wlan中的5个udp包
1
# tcpdump -i wlan0 -v -n udp -c 5
指定端口号
1
tcpdump -i wlan0 tcp port 7236 -w rrrr.pcap
分析–wireshark
netstat
1 2 3 4 5 6
# netstat -n Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 192.168.100.3:40964 192.168.100.2:7236 ESTABLISHED udp 0 0 239.0.0.11:15550 192.168.100.2:* ESTABLISHED udp 0 0 239.0.0.11:15551 192.168.100.2:1 ESTABLISHED