Xinu

WireShark基础使用教程
设置抓取网卡抓取过滤条件设置添加自定义过滤器 捕获 => 捕获过滤器设置过滤器设置显示器过滤规则数据包详情T...
扫描右侧二维码阅读全文
09
2019/12

WireShark基础使用教程

设置抓取网卡

UTOOLS1575509175785.png

抓取过滤条件设置

  1. 添加自定义过滤器 捕获 => 捕获过滤器

UTOOLS1575509839740.png

  1. 设置过滤器

UTOOLS1575510089802.png

设置显示器过滤规则

UTOOLS1575510353717.png

数据包详情

UTOOLS1575510553271.png

TCP数据包详情

UTOOLS1575509102273.png

抓包过滤器语法及实例

语法:

<Protocol> <Direction> <Host(s)> < Value> < Logical Operations> <Other expression>

  • Protocol(协议):ether,fddi, ip,arp,rarp,decnet,lat, sca,moprc,mopdl, tcp , udp 等,如果没指明协议类型,则默认为捕捉所有支持的协议。
  • Direction(方向):src, dst,src and dst, src or dst等,如果没指明方向,则默认使用 “src or dst” 作为关键字。
  • Host(s): net, port, host, portrange等,默认使用”host”关键字,”src 10.1.1.1″与”src host 10.1.1.1″等价。
  • Logical Operations(逻辑运算):not, and, or 等,否(“not”)具有最高的优先级。或(“or”)和与(“and”)具有相同的优先级,运算时从左至右进行。

实例

# 1. 只(不)捕获某主机的HTTP流量

#只捕获主机192.168.5.231 的http流量。注意如果你的HTTP端口为8080,把80 改为8080。
host 192.168.5.231 and port 80 and http

#捕获所有经过该接口的http流量。注意如果你的HTTP端口为8080,把80 改为8080。
port 80 and http

# 捕获主机192.168.5.231除 http 之外的其他所有流量,注意如果你的HTTP端口为8080,把80 改为8080。
host 192.168.5.231 and not port 80

# 捕获除 http 之外的其他所有流量,注意如果你的HTTP端口为8080,把80 改为8080。
not port 80 

# 捕获除 http 之外的其他所有流量,注意如果你的HTTP端口为8080,把80 改为8080。
not port 80 and !http


# 2. 只捕获某主机的所有流量

#捕获源目主机均为192.168.5.231
host 192.168.5.231

#捕获目的主机均为192.168.5.231
dst 192.168.5.231

#捕获来源主机均为192.168.5.231
src 192.168.5.231

#捕获网段为d192.168.5的所有主机的所有流量
net 192.168.5.0/24


# 3. 只捕获特定端口的流量

#捕获端口8000-9000之间和80端口的流量
tcp portrange 8000-9000 an port 80

#捕获sip流量,因为sip的默认端口是5060。举一反三:port 22 #捕获ssh流量
port 5060

附录-常用服务及对应端口

协议通用端口
http80
https443
mysql3306
ssh22
dns53
ftp21
telnet23
smtp25
snmp161
pop3110

显示过滤器常用语法及实例

UTOOLS1575512160262.png

  • 比较运算符 == != > < >= <=
  • 逻辑运算 and、&& 、or、|| 、!、not

实例

# 1、过滤IP案例
ip.addr == 192.168.1.1
ip.src == 192.168.1.1
ip.dst == 192.168.1.1
ip.src == 192.168.1.1 and ip.dst == 58.520.9.9

# 2、过滤端口案例
tcp.port == 80
tcp.srcport == 80
tcp.dstport == 80
tcp.flag.syn == 1
tcp.flag.ack == 1

# 3、过滤协议案例
arp
tcp
udp
not http
not arp

# 4、综合过滤案例
ip.src == 192.168.1.100 and tcp.dstport == 80
ip.addr == 192.168.1.100 and udp.port == 3000

直接通过报文设置显示条件

UTOOLS1575512978360.png

Last modification:December 9th, 2019 at 10:38 pm

Leave a Comment