Wireshark 資料包過濾規則
其實它與任何libpcap/WinPcap庫的使用格式相同
//你應當從Caption->Options 輸入表示式.
0x1僅捕獲指定IP地址的流量
host 172.18.5.4
0x2從一個IP地址範圍捕獲流量
net 192.168.0.0/24
或者
net 192.168.0.0 mask 255.255.255.0
0x3捕獲來自某地址範圍的流量
src net 192.168.0.0/24
或者
src net 192.168.0.0 mask 255.255.255.0
0x4捕獲前往某地址範圍的流量
dst net 192.168.0.0/24
或者
src net 192.168.0.0 mask 255.255.255.0
0x5僅捕獲某埠的流量
port 53 //DNS協議
port 80 //TCP UDP協議
0x6捕獲目標host流量包中除去某些埠的內容
host www.example.com and not (port 80 or port 25) //不要HTTP和SMTP包
host www.example.com and not port 80 and not port 25
0x7捕獲除了ARP和DNS外的流量
port not 53 and not arp
0x8捕獲埠範圍的流量
(tcp[0:2] > 1500 and tcp[0:2] < 1550) or (tcp[2:2] > 1500 and tcp[2:2] < 1550)
或者用新版libpcap(0.9.1)規則
tcp portrange 1501-1549
0x9僅捕獲EAPOL型別的乙太網協議
ether ptoto 0x888e
0xA拒絕向鏈路層發現協議組播組的乙太網幀(Reject ethernet frames towards the Link Layer Discovery Protocol Multicast group: )
not ether dst 01:80:c2:00:00:0e
0xB僅捕獲IP流量,兩個字母,但非常有效地擺脫了底層協議,諸如ARP和STP等
IP
0xC僅捕獲單播流量-在遮蔽網路噪聲上非常有用,如果你只希望看到從你機器上發出的流量,而不是廣播和多播公告.
not broadcast and not multicast
0xD捕獲IPV6的所有結點(路由器和鄰接計算機)的通知.便於查詢”bogue RAs”.Capture IPv6 “all nodes” (router and neighbor advertisement) traffic. Can be used to find rogue RAs: )
dst host ff02::1
0xE捕獲HTTP GET請求.對應於位元組’G”E”T’和”(Hex值 47,45,54,20)只有在TCP報頭之後.”TCP[12:1]0XF0)>>2”計算出TCP header長度.
port 80 and tcp[((tcp[12:1]&0xf0)>>2):4]=0x47455420
有用的示例:
衝擊波和衝擊波殺手 RPC蠕蟲.
0x1衝擊波(Blaster worm)
dst port 135 and tcp port 135 and ip[2:2]==48
賽門鐵克認為如下的過濾器也可以用於Blaster的檢測,哪個檢測更好?
(tcp dst port 135 or tcp dst port 4444 or udp dst port 69) and ip[2:2]==48
0x2衝擊波殺手(Welchia worm)
icmp[icmptype]==icmp-echo and ip[2:2]==92 and icmp[8:4]==0xAAAAAAAA
該過濾器尋找一個ICMP echo請求是92位元組長,有一個ICMP有效載荷開頭4位元組的(十六進位制)。 這是衝擊波殺手蠕蟲之前它試圖破壞系統的簽名。
0x3許多蠕蟲嘗試通過埠135,445,1433,或接觸其他主機傳播該過濾器是獨立於特定的蠕蟲病毒,而不是它看起來SYN資料包從這些特定埠的本地網路發起。 請更改網路過濾器來適配你自己的網路。
dst port 135 or dst port 445 or dst port 1433 and tcp[tcpflags] & (tcp-syn) != 0 and tcp[tcpflags] & (tcp-ack) = 0 and src net 192.168.0.0/24