zl程序教程

您现在的位置是:首页 >  其它

当前栏目

Scalable_scared用法

用法
2023-06-13 09:15:15 时间

大家好,又见面了,我是你们的朋友全栈君。

qualifier:

  1. type(定义了类型)

可选值:host, net, port, portrange

例如:

host hostnameA

net 172.31 //相当于172.31.0.0/16,又例如:192.168.1相当于192.168.1.0/24

port 80

portrange 6000-6010

  1. dir(direction,定义了传输方向)

可选值:src, dst, src or dst, src and dst

例如:

src net 172.31

src or dst port 21

  1. proto(protocol定义了网络协议)

可选值:ether, fddi, tr, wlan, ip, ip6, arp, rarp, decnet, tcp, udp, icmp

(fddi, tr, wlan是ether的别名, 包结构很类似)

例如:

ether src hostnameA

arp net 172.31

udp portrange 7000-8000

连接词:and, or, not

例如:

tcp or udp

not icmp

常用的一些表达式([]表示可选项,/表示并列可选项):

[src/dst] host host

IPv4/v6的[源/目的]主机为host,既可以是IP地址又可以是hostname,前面可以追加ip,arp, rarp或ip6,例如:

ip host host

ether host/src/dstehost

以太网地址/源地址/目的地址为ehost,ehost可以是名称或number

gateway host

报文以host作为gateway

[src/dst] net net

IPv4/v6[源/目的]地址的网络号为net,net既可以是一个网络名也可以是一个网络号,IPv4的网络号可以写成点分式,例如:192.168.1.0,或者192.168.1(等价于192.168.1.0/24),或者172.16(等价于172.16.0.0/16),或者10(等价于10.0.0.0/8)。IPv6的掩码为ff:ff:ff:ff:ff:ff,所以IPv6的地址匹配模式为全匹配,需要完全匹配对应的主机IPv6地址

net net mask netmask

匹配网络号和掩码,掩码格式例如:255.255.0.0,IPv6不支持此语法

net net/len

netmask的另一种写法,len指定子网掩码的长度

[src/dst] port port

匹配[源/目的]端口号

[src/dst] portrangeport1-port2

匹配[源/目的]端口范围

less length

报文长度小于等于length,等价于len <= length

greater length

报文长度大于等于length,等价于len>= length

ip proto protocol

匹配IPv4,协议类型为protocol,protocol可取值为:icmp, icmp6, igmp, igrp, pim, ah,esp, vrrp, udp, tcp,注意icmp, tcp, udp也是关键字,所以需要使用“\”进行转义

ip6 proto protocol

匹配IPv6的协议

ip/ip6 protochain protocol

匹配IPv4/v6协议,协议中的protocolheader chain中包含protocol,例如:

ip6 protochain 6

(注:6代表TCP)

Value (in decimal)

Header

0

Hop-by-Hop Options Header

6

TCP

17

UDP

41

Encapsulated IPv6 Header

43

Routing Header

44

Fragment Header

46

Resource ReSerVation Protocol

50

Encapsulating Security Payload

51

Authentication Header

58

ICMPv6

59

No next header

60

Destination Options Header

ether broadcast

匹配以太网广播报文

ip broadcast

匹配IPv4广播报文

参考链接:

http://biot.com/capstats/bpf.html

http://alumni.cs.ucr.edu/~marios/ethereal-tcpdump.pdf

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/210431.html原文链接:https://javaforall.cn