WireShack过滤规则书写:

一、IP过滤:

  (1)源IP:(以192.168.1.122为源IP举例)

     表达式:ip.src==192.168.1.122或ip.src eq 192.168.1.122    //筛选出源IP是192.168.1.122的数据包

  (2)目标IP:(以192.168.1.137为目的IP举例)

     表达式:ip.dst==192.168.1.137或ip.src eq 192.168.1.137    //筛选出目的IP是192.168.1.137的数据包

  (3)直接按IP过滤:(以192.168.1.137为举例IP)

     表达式:ip.addr==192.168.1.137或ip.src eq 192.168.1.137    //筛选出与192.168.1.137相关的数据包

二、端口过滤:

  比如:tcp.port eq 80 // 不管端口是来源的还是目标的都显示

     tcp.port == 80

     tcp.port eq 2722

     tcp.port eq 80 or udp.port eq 80

     tcp.dstport == 80 // 只显tcp协议的目标端口80

     tcp.srcport == 80 // 只显tcp协议的来源端口80

  过滤端口范围

     tcp.port >= 1 and tcp.port <= 80

三、协议过滤:

  tcp 、udp、 arp、 icmp、 http、 smtp、 ftp、 dns、 msnms、 ip、 ssl 等等 ,排除ssl包,如!ssl 或者 not ssl

四、包长度过滤:

  比如: udp.length == 26 这个长度是指udp本身固定长度8加上udp下面那块数据包之和

     tcp.len >= 7 指的是ip数据包(tcp下面那块数据),不包括tcp本身

     ip.len == 94 除了以太网头固定长度14,其它都算是ip.len,即从ip本身到最后

     frame.len == 119 整个数据包长度,从eth开始到最后

五、http模式过滤:

  例子: http.request.method == “GET”

      http.request.method == “POST”

      http.request.uri == “/img/logo-edu.gif”

      http contains “GET”

      http contains “HTTP/1.”

  // GET包

      http.request.method == “GET” && http contains “Host: ”

      http.request.method == “GET” && http contains “User-Agent: ”

  // POST包

     http.request.method == “POST” && http contains “Host: ”

     http.request.method == “POST” && http contains “User-Agent: ”

  // 响应包

     http contains “HTTP/1.1 200 OK” && http contains “Content-Type: ”

     http contains “HTTP/1.0 200 OK” && http contains “Content-Type: ”

  一定包含如下: Content-Type:

六、连接符 and / or

七、表达式:!(arp.src==192.168.1.1) and !(arp.dst.proto_ipv4==192.168.1.243)

http://www.cnblogs.com/zhusd/archive/2010/11/16/1878375.html

posted on 2012-03-06 11:26  猥琐丶欲为  阅读(494)  评论(0编辑  收藏  举报