1. 程式人生 > 其它 >tcpdump抓包

tcpdump抓包

1. 抓取某一網段的包
  tcpdump -i eth0 -nn net 10.191.234.0
2. 抓取當前主機與指定主機之間的通訊資料包
  tcpdump -i eth0 -nn host A and B
3. 抓取某一網絡卡的所有資料包
  tcpdump -i eth0
4.抓取包含10.10.10.122的資料包
  tcpdump -i eth0 -vnn host 10.10.10.122

5、抓取包含10.10.10.0/24網段的資料包
  tcpdump -i eth0 -vnn net 10.10.10.0/24

6、抓取包含埠22的資料包
  tcpdump -i eth0 -vnn port 22
7、抓取udp協議的資料包
  tcpdump -i eth0 -vnn udp
8、抓取icmp協議的資料包
  tcpdump -i eth0 -vnn icmp
9、抓取arp協議的資料包
  tcpdump -i eth0 -vnn arp
10、抓取ip協議的資料包
  tcpdump -i eth0 -vnn ip
11、抓取源ip是10.10.10.122資料包。
  tcpdump -i eth0 -vnn src host 10.10.10.122
12、抓取目的ip是10.10.10.122資料包
  tcpdump -i eth0 -vnn dst host 10.10.10.122
13、抓取源埠是22的資料包
  tcpdump -i eth0 -vnn src port 22
14、抓取源ip是10.10.10.253且目的ip是22的資料包
  tcpdump -i eth0 -vnn src host 10.10.10.253 and dst port 22
15、抓取源ip是10.10.10.122且埠不是22的資料包
  tcpdump -i eth0 -vnn src host 10.10.10.122 and not port 22

17、抓取源ip是10.10.10.2且目的埠是22,或源ip是10.10.10.65且目的埠是80的資料包。
  tcpdump -i eth0 -vnn \( src host 10.10.10.2 and dst port 22 \) or \( src host 10.10.10.65 and dst port 80 \)
18、抓取源ip是10.10.10.59且目的埠是22,或源ip是10.10.10.68且目的埠是80的資料包。
  tcpdump -i eth0 -vnn 'src host 10.10.10.59 and dst port 22' or ' src host 10.10.10.68 and dst port 80 '
19、把抓取的資料包記錄存到/tmp/fill檔案中,當抓取100個數據包後就退出程式。
  tcpdump –i eth0 -vnn -w /tmp/fil1 -c 100
20、從/tmp/fill記錄中讀取tcp協議的資料包
  tcpdump –i eth0 -vnn -r /tmp/fil1 tcp
21、從/tmp/fill記錄中讀取包含10.10.10.58的資料包
  tcpdump –i eth0 -vnn -r /tmp/fil1 host 10.10.10.58
  tcpdump -i eth0 -vnn src host 10.10.10.122 or port 22

**************************************************************************************
當你的才華還撐不起你的野心的時候,你就應該靜下心來學習;當你的能力還駕馭不了你的目標時,就應該沉下心來,歷練;夢想,不是浮躁,而是沉澱和積累,只有拼出來的美麗,沒有等出來的輝煌,機會永遠是留給最渴望的那個人,學會與內心深處的你對話,問問自己,想 要怎樣的人生,靜心學習,耐心沉澱,送給自己,共勉。
**************************************************************************************