WinPcap过滤表达式知识

http://m.sodocs.net/doc/475ec10c763231126edb1191.html /CaptureFilters

Search:



Login

CaptureFilters
FrontPage
RecentChanges
FindPage
HelpContents
CaptureFilters

--------------------------------------------------------------------------------

Immutable Page
Comments
Info
Attachments


CaptureFilters
An overview of the capture filter syntax can be found in the User's Guide. A complete reference can be found in the expression section of the tcpdump manual page.

Wireshark uses the same syntax for capture filters as tcpdump, WinDump, Analyzer, and any other program that uses the libpcap/WinPcap library.

If you need a capture filter for a specific protocol, have a look for it at the ProtocolReference.

Contents

1. CaptureFilters

1. Examples

2. Useful Filters

3. Default Capture Filters

4. Further Information

5. See Also

6. Discussion

Examples
Capture only traffic to or from IP address 172.18.5.4

· host 172.18.5.4
Capture traffic to or from a range of IP addresses:

· net 192.168.0.0/24
or

· net 192.168.0.0 mask 255.255.255.0
Capture traffic from a range of IP addresses:

· src net 192.168.0.0/24
or

· src net 192.168.0.0 mask 255.255.255.0
Capture traffic to a range of IP addresses:

· dst net 192.168.0.0/24
or

· dst net 192.168.0.0 mask 255.255.255.0
Capture only DNS (port 53) traffic:

· port 53
Capture non-HTTP and non-SMTP traffic on your server (both are equivalent):

· host http://m.sodocs.net/doc/475ec10c763231126edb1191.html and not (port 80 or port 25)
host http://m.sodocs.net/doc/475ec10c763231126edb1191.html and not port 80 and not port 25
Capture except all ARP and DNS traffic:

· port not 53 and not arp
Capture traffic within a range of ports

· (tcp[0:2] > 1500 and tcp[0:2] < 1550) or (tcp[2:2] > 1500 and tcp[2:2] < 1550)
or, with newer versions of libpcap (0.9.1 and later):

· tcp portrange 1501-1549
Capture only Ethernet type EAPOL:

· ether proto 0x888e
Reject ethernet frames towards the Link Layer Discovery Protocol Multicast group:

· not ether dst 01:80:c2:00:00:0e
Capture only IP traffic - the shortest filter, but sometimes very useful to get rid of lower layer protocols like ARP and STP:

· ip
Capture only unicast traffic - useful to get rid of noise on the network if you only want to see traffic to and from your machine, not, for example, broadcast and multicast announcements:

· not broadcast and not multicast
Capture HTTP GET requests. This looks for the bytes 'G', 'E', 'T', and ' ' (hex values 47, 45, 54, and 20) just after the TCP header. "tcp[12:1] & 0xf0) >> 2" figures out the TCP header length. From Jefferson Ogata via the tcpdump-workers mailing list.

· port 80 and tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420
Useful Filters
Blaster and Welchia are RPC worms. (Does anyone have better links, i.e. on

相关推荐
相关主题
热门推荐