抓包过滤器用来抓取感兴趣的包,用在抓包过程中。抓包过滤器使用的是libcap过滤器语言,在tcpdump的手册中有详细的解释,基本结构是:[not] primitive [and|or [not] primitive ...]
个人观点:如果你想抓取某些特定的数据包时,可以有以下两种方法,你可以任选一种,个人比较偏好第二种方式:
(1)在抓包的时候,就先定义好抓包过滤器,这样结果就是只抓到你设定好的那些类型的数据包;
(2)先不管三七二十一,把本机收到或者发出的包一股脑的抓下来,然后使用下节介绍的显示过滤器,只让Ethereal 显示那些你想要的那些类型的数据包;
3、etheral的显示过滤器(重点内容)
在抓包完成以后,显示过滤器可以用来找到你感兴趣的包,可以根据协议、是否存在某个域、域值、域值之间的比较来查找你感兴趣的包。
举个例子,如果你只想查看使用tcp协议的包,在ethereal窗口的左下角的Filter中输入tcp, 然后回车,ethereal就会只显示tcp 协议的包。
值比较表达式可以使用下面的操作符来构造显示过滤器自然语言类c 表示举例
eq ==
ip.addr==10.1.10.20
ne !=
ip.addr!=10.1.10.20
gt >
frame.pkt_len>10
lt <
lt < frame.pkt_len<10
ge >=
frame.pkt_len>=10
le <=
frame.pkt_len<=10
表达式组合可以使用下面的逻辑操作符将表达式组合起来自然语言类c 表示举例
and &&:逻辑与
ip.addr=10.1.10.20&&tcp.flag.fin
or ||:逻辑或
ip.addr=10.1.10.20||ip.addr=10.1.10.21
xor ^^:异或
tr.dst[0:3] == 0.6.29 xor tr.src[0:3] == not
!:逻辑非
!llc
ethereal的抓包过滤器
最新推荐文章于 2022-12-06 10:16:49 发布