@WillireamAngel
2017-10-28T16:16:29.000000Z
字数 2880
阅读 1277
网络
BPF只会对输入capture filter文本框的字符串语法进行检查,不会对内容及进行检查。
限定符:type(指代事务,host、net、port限定符)、dir(数据包流动方向,src、dst)、Proto(数据包所匹配的协议类型,ether、ip、arp)
抓包过滤器配置文件储存位置:Wireshark\cfilters
程序源于:tcpdump
1. 配置Ethernet:
ether host <Ethernet host=MAC地址>ether dst <Ethernet host>ether src <Ethernet host>ether broadcast(ether dst ff:ff:ff:ff:ff:ff)(第二层以太网帧目的MAC地址就是以太网广播地址)ether multicastether ptoto <protocol>vlan <vlan_id> and vlan <vlan_id>...
not or !:字符串反义
以太网多播帧典型MAC地址:
IPv4:01:00:5e......
IPv6:33:33......
2. 配置主机和网络过滤器
ip or ipv6host <host> #ip or URLdst host <host>gateway <host>net <net> #net 192.168.1.0/24=net 192.168.1=net 192.168.1.0 mask 255.255.255.0dst net <net>scr net <net>net <net> mask <netmask>dst net <net> mask <netmask>scr net <net> mask <netmask>net <net>/<len>dst net <net>/<len>scr net <net>/<len>broadcastmulticastip proto <protocol code>ip6 proto <protocol>icmp[icmptype]==<identifier> #ICMP头部字段ip multicast #IP多播数据包ip broadcast #IP广播数据包ip [2:2] == <number> #特定长度的IP数据包ip [8] == <number> #特定TTL的IP数据包ip [9] == <number> #特定协议类型的数据包ip [12:4] ==1 ip[16:4] #数据包源和目的IP相同,其中16指的是从TCP头部的16个字节开始检查,4指的是检查范围为4个字节
port <port>tcp/udp portrange <p1>-<p2>
TCP头部标记位:SYN(打开连接) FIN(关闭连接) ACK(确认数据包) RST(立刻拆除连接) PSH(数据提交给末端进程处理)
4. 配置复合型过滤器
操作符:
! or not&& 或 and|| 或 or
proto [Offset: bytes]ip [Offset: bytes]tcp [Offset: bytes] or udp [Offset: bytes]
| 地址格式 | 语法 |
|---|---|
| MAC地址 | eth.addr == xx:xx:xx:xx:xx:xx/xx-xx-xx-xx-xx-xx/xxxx.xxxx.xxxx.xxxx |
| 以太网广播地址 | Etn.addr == ffff.ffff.ffff |
| IPv4主机地址 | ip.addr == x.x.x.x |
| IPv4网络地址 | ip.addr == x.x.x.x/y(0~32) |
| IPv6主机地址 | ipv6.addr == x:x:x:x:x:x:x:x/x::x:x:x:x |
| IPv6网络地址 | ipv6.addr == x::/y(0~128) |
3. ARP过滤器:
arp.opcode == 1 #ARP请求帧arp.opcode == 2 #ARP应答帧
tcp.analysis:分析与TCP重传、重复确认、窗口大小有关的网络性能问题的参照物; tcp.flags:检查TCP头部中各标记位的置位情况; tcp.window_size_value < <value>:显示TCP头部中窗口大小字段值低于指定值的数据包。
http.host == <"hostname">http.request.method == "GET"http.request.uri == <"Full request URI">http.request.uri contains "mail.google.com"http.cookiehttp.set_cookie(http.set_cookie && http contains "google")http matches "\.zip" && http.request.method == "GET"
dns.flags.response == 0 #DNS查询dns.flags.response == 1 #DNS响应
ftp.request.command == <"requestedcommand">
http.host contains <host_name>
or
http.host==<host_name>
e.g.
http.host==ce.sysu.edu.cn
load distribution:HTTP数据包在各web站点件的分布情况。
注:在访问web站点时,浏览器会发送多次HTTP请求,借助若干URL,从多个位置下载资源。
5. Flow Graph
数据流图,可采用Cascade Pilot软件实现。
6. IP属性统计信息
IP Address、IP Destination、IP Protocols Types