Ethereal过滤规则语法

捕获过滤器(Filtering while capturing)

ethereal使用libpcap filter language 过滤语言,在tcpdump的man page中有解释,但是比较难理解


一个捕获过滤器 规则类似于 下面的表达式


[not] primitive [and|or [not] primitive ...


primitive 原始的, 远古的, 粗糙的, 简单的

由表示式 和 and/or/not 组成




过滤器名称 Filter name
过滤法则 Filter string



捕获到IP为10.0.0.5的主机的telnet数据

tcp port 23 and host 10.0.0.5



只捕获DNS数据

port 53



只捕获IP为 172.18.5.4 的主机的包

host 172.18.5.4


1.捕获 MAC地址为 00:d0:f8:00:00:03 网络设备通信的所有报文
Filter string就是
ether host 00:d0:f8:00:00:03


2.捕获 IP地址为 192.168.10.1 网络设备通信的所有报文
Filter string就是
host 192.168.10.1


3.捕获网络web浏览的所有报文
Filter string就是
tcp port 80


4. 捕获192.168.10.1除了http外的所有通信数据报文
Filter string就是
host 192.168.10.1 and not tcp port 80


5.

捕获非http和非smtp 报文,在你的服务器上的(下面两个过滤法则是等价的)

host http://www.example.com and not (port 80 or port 25)
host http://www.example.com and not port 80 and not port 25




6.捕获所有除了dns和arp的报文

port not 53 and not arp


7.堪称最短的过滤器,只捕获IP包,对于除去底层通信协议ARP和STP很有用

ip




一些其他的过滤器

Blaster worm是RPC wordm,下面的规则可以捕捉它的包

dst port 135 and tcp port 135 and ip[2:2]==48


Welchia worm
icmp[icmptype]==icmp-echo and ip[2:2]==92 and icmp[8:4]==0xAAAAAAAA


[src|dst] host


这个表达式,允许你过滤一个用IP地址或者主机名来过滤一个主机。
可以在 前面加上 src|dst 关键字来指定你感兴趣的 源主机 或者 目的主机
如果没有 src|dst 关键字,则所有进出的包都会捕获


ether [src|dst] host


过滤 以太网 主机地址(就是mac地址),可在前面加上src|dst 关键字


gateway host


This primitive allows you to filter on packets that used host as a gateway. That is, where the Ethernet source or destination was host but neither the source nor destination IP address was host.
过滤使用这个这个主机作为 网关的 所有包


less|greater


过滤 报文长度


[tcp|udp] [src|dst] port
过滤端口,可在前面 加 tcp|udp 或者 src|dst关键字

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值