tcpdump使用笔记

来源:互联网 发布:js 数组 编辑:程序博客网 时间:2024/05/18 05:27

一,简单示例

1, cpdump 监视第一个网络卡上面流过的所有数据包。

2,tcpdump -i eth1 监视网卡eth1上流过的所有数据包。
3,tcpdump host 210.27.48.1 截获所有该主机流过的数据包。
4,tcpdump host 210.27.48.1 and \ (210.27.48.2 or 210.27.48.3 \) 截获210.27.48.1和210.27.48.2或210.27.48.3之间的数据包。
5,tcpdump ip host 210.27.48.1 and ! 210.27.48.2 自己理解
6,tcpdump -i eth0 src host hostname 截获所有hostname发出的数据包
7, tcpdump -i eth0 dst host hostname截获所有发给hostname的数据包
8,tcpdump –r file 查看保存的抓取文件
9,抓10000个包后退出 -c 10000
10,多个条件的话用and or等连接。
11,tcpdump  -XvvennSs 0 -i eth0 tcp[20:2]=0x4745 or tcp[20:2]=0x4854抓取http包,解释一下,http包有个get和post两种协议,故上面写法。12,tcpdump host  10.10.100.1 -c 10 -w ./xxx.cap
二,命令格式如下所示:
tcpdump [ -AdDeflLnNOpqRStuUvxX ] [ -c count ]
           [ -C file_size ] [ -F file ]
           [ -i interface ] [ -m module ] [ -M secret ]
           [ -r file ] [ -s snaplen ] [ -T type ] [ -w file ]
           [ -W filecount ]
           [ -E spi@ipaddr algo:secret,...  ]
           [ -y datalinktype ] [ -Z user ]
           [ expression ]
如:tcpdump  -XX -i eth0 -w 93.cap -s 0  host 172.31.9.2 and  172.31.9.3 and udp  port 6666
各项具体表示的含义,可用man查看。
三,一般保存为.cap格式的文件,用wiresharp查看
 
 
 
 

 

0 0
原创粉丝点击