安裝
yum -y install tcpdump
基本用法
#抓取網口eth0流量包# tcpdump -i eth0 -nnv
#指定抓取100個包
# tcpdump -i eth0 -nnv -c 100
#把抓包輸出寫入檔案
# tcpdump -i eth0 -nnv -w /file1.tcpdump
#讀取# tcpdump -nnv -r /file1.tcpdump
條件 port,host,net
# tcpdump -i eth0 -nnv not port 80# tcpdump -i eth0 -nnv port 22
# tcpdump -i eth0 -nnv port 80
# tcpdump -i eth0 -nnv net 192.168.0.0/24
# tcpdump -i eth0 -nnv host 192.168.0.15
# tcpdump -i eth0 -nnv dst port 22
# tcpdump -i eth0 -nnv src port 22
協議作為條件
# tcpdump -i eth0 -nnv arp# tcpdump -i eth0 -nnv icmp
# tcpdump -i eth0 -nnv udp #udp協議
# tcpdump -i eth0 -nnv tcp #tcp協議,三次握手及四次斷開
# tcpdump -i eth0 -nnv ip #ip協議
# tcpdump -i eth0 -nnv vrrp #keepalived使用協議
多條件:與或非 and or not
# tcpdump -i eth0 -nnv not net 192.168.0.0/24# tcpdump -i eth0 -nnv not port 80
# tcpdump -i eth0 -nnv host 192.168.0.15 and port 22
# tcpdump -i eth0 -nnv host 192.168.0.15 and host 192.168.0.33
# tcpdump -i eth0 -nnv host 192.168.0.15 or host 192.168.0.33
# tcpdump -i eth0 -nnv \( host 192.168.0.15 and port 22 \) or \( host
192.168.0.33 and port 80 \)
# tcpdump -i eth0 -nnv host 192.168.0.110 and port 22 or port 80
# tcpdump -i eth0 -nnv host 192.168.0.110 and \( port 22 or port 80\)
# tcpdump -i eth0 -nnv host 192.168.0.110 and port 80
# tcpdump -i eth0 -nnv host 192.168.0.110 and ! port 80
tcp資料報頭,有8位標識位部分
cwr | ece | urg | ack | psh | rst | syn | fin
# man tcpdump#條件為tcp僅有syn標記的
# tcpdump -i eth0 -nnv tcp[13]==2
|c|e|u|a|p|r|s|f|
|--------------- |
|0 0 0 0 0 0 1 0 |
|--------------- |
|7 6 5 4 3 2 1 0|
# tcpdump -i eth0 -nnv tcp[13]==2 and port 22 -w ssh-conn.tcpdump
條件是:tcp僅有syn/ack標記的
# tcpdump -i eth0 -nnv tcp[13]==18
|c|e|u|a|p|r|s|f|
|--------------- |
|0 0 0 1 0 0 1 0 |
|--------------- |
|7 6 5 4 3 2 1 0|
# tcpdump -i eth0 -nnv tcp[13]==17
tcpdump 抓包工具使用
tcpdump抓包引數 a以ascii列印 n不現實名稱位址,顯示主機ip埠 s抓取得每個資料報的長度 i指定網絡卡 特殊的網絡卡特殊的網絡卡 w指定檔案儲存的路徑 nn 不把網路ip和埠號轉成名字 檢視tcpdump可以抓包的網路網絡卡 tcpdump d 抓取指定埠的資料報,並且儲存檔案,用wi...
tcpdump抓包工具
1 tcpdump是乙個用於擷取網路分組,並輸出分組內容的工具,tcpdump具有強大的功能和靈活的擷取策略,使其成為unix系統下用於網路分析和問題排查的首選工具。2 tcpdump必須在root許可權下執行,用來獲取網路上的資訊。3 tcpdump可以將網路中傳送的資料報的 頭 完全截獲下來提供...
Linux 抓包工具 tcpdump 使用
tcpdump d獲取網路介面卡列表,以下是在windows上獲取到的結果 device pssdkloopback pssdk loopback ethernet emulation adapter device intel r pro 100 ve network co nnection tcp...