曲径通幽论坛

 找回密码
 立即注册
搜索
查看: 3715|回复: 1
打印 上一主题 下一主题

wireshark 在无线抓包中过滤器的设置

[复制链接]

4918

主题

5880

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34387
跳转到指定楼层
楼主
发表于 2014-10-9 22:08:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
使用 wireshark 捕捉无线网络数据包,可以先将无线网卡设置到监听模式,使用 airmon-ng 工具很容易做到这一点:
  1. airmon wlan0 start
复制代码

即可生成一个 mon0 的监听接口,后面只要使 wireshark 监听在该接口即可。在不设置任何过滤器的情况下,会捕捉到成千上万的数据包,这样不利于我们对数据的分析。所以,本帖主要介绍如何设置 wireshark 的无线过滤器。


1. 如果要查看所有的管理帧(Management frame),那么使用过滤器:
  1. wlan.fc.type==0
复制代码



2. 如果只想看到控制帧,那么使用过滤器:
  1. wlan.fc.type==1
复制代码




3. 如果我们只希望看到数据帧,那么可以设置过滤器为:
  1. wlan.fc.type==2
复制代码



4. 由于管理帧是有子类型的(数据帧没有子类型),比如要查看 Beacon 帧,那么可以如下使用过滤器:
  1. (wlan.fc.type==0)&&(wlan.fc.subtype==8)
复制代码


5. 创建除了 beacon 帧之外的所有帧:
  1. !wlan.fc.subtype==8
复制代码


6. 查看非空的数据帧:
  1. wlan.fc.type==2 and !(wlan.fc.type_subtype==36)
复制代码


7. 此外,可以在 wireshark 的中间窗口处右击任何一个头部,在弹出菜单中选择 “Apply as Filter” ---> “Selected” ,那么只要和该处相同的帧都会被过滤出来,如下图所示:

这样做的一个好处是,系统会为你生成正确的过滤器表达式,如你选择之后,在过滤器里可以看到生成相应的表达式。



过滤器
802.11 头部



控制帧子域





管理帧,控制帧,数据帧过滤器列表

Type value
Type description
Subtype value
Subtype description
Wireshark display filter
00
Management
0000
Association Request
wlan.fc.type_subtype == 0x00
00
Management
0001
Association Response
wlan.fc.type_subtype == 0x01
00
Management
0010
Reassociation Request
wlan.fc.type_subtype == 0x02
00
Management
0011
Reassociation Response
wlan.fc.type_subtype == 0x03
00
Management
0100
Probe Request
wlan.fc.type_subtype == 0x04
00
Management
0101
Probe Response
wlan.fc.type_subtype == 0x05
00
Management
0110-0111
Reserved

00
Management
1000
Beacon
wlan.fc.type_subtype == 0x08
00
Management
1001
ATIM
wlan.fc.type_subtype == 0x09
00
Management
1010
Disassociation
wlan.fc.type_subtype == 0x0A
00
Management
1011
Authentication
wlan.fc.type_subtype == 0x0B
00
Management
1100
Deauthentication
wlan.fc.type_subtype == 0x0C
00
Management
1101
Action
wlan.fc.type_subtype == 0x0D
00
Management
1110-1111
Reserved


Type value
Type description
Subtype value
Subtype description
Wireshark display filter
01
Control
0000-0111
Reserved

01
Control
1000
Block Ack Request
wlan.fc.type_subtype == 0x18
01
Control
1001
Block Ack
wlan.fc.type_subtype == 0x19
01
Control
1010
PS-Poll
wlan.fc.type_subtype == 0x1A
01
Control
1011
RTS
wlan.fc.type_subtype == 0x1B
01
Control
1100
CTS
wlan.fc.type_subtype == 0x1C
01
Control
1101
ACK
wlan.fc.type_subtype == 0x1D
01
Control
1110
CF-end
wlan.fc.type_subtype == 0x1E
01
Control
1111
CF-end + CF-ack
wlan.fc.type_subtype == 0x1F







Type value
Type description
Subtype value
Subtype description
Wireshark display filter
10
Data
0000
Data
wlan.fc.type_subtype == 0x20
10
Data
0001
Data + CF-ack
wlan.fc.type_subtype == 0x21
10
Data
0010
Data + CF-poll
wlan.fc.type_subtype == 0x22
10
Data
0011
Data +CF-ack +CF-poll
wlan.fc.type_subtype == 0x23
10
Data
0100
Null
wlan.fc.type_subtype == 0x24
10
Data
0101
CF-ack
wlan.fc.type_subtype == 0x25
10
Data
0110
CF-poll
wlan.fc.type_subtype == 0x26
10
Data
0111
CF-ack +CF-poll
wlan.fc.type_subtype == 0x27
10
Data
1000
QoS data
wlan.fc.type_subtype == 0x28
10
Data
1001
QoS data + CF-ack
wlan.fc.type_subtype == 0x29
10
Data
1010
QoS data + CF-poll
wlan.fc.type_subtype == 0x2A
10
Data
1011
QoS data + CF-ack + CF-poll
wlan.fc.type_subtype == 0x2B
10
Data
1100
QoS Null
wlan.fc.type_subtype == 0x2C
10
Data
1101
Reserved
wlan.fc.type_subtype == 0x2D
10
Data
1110
QoS + CF-poll (no data)
wlan.fc.type_subtype == 0x2E
10
Data
1111
Qos + CF-ack (no data)
wlan.fc.type_subtype == 0x2F
11
Reserved
0000-1111
Reserved



一张美图,过滤器和数据帧各部位的对应关系:




显示过滤器语法:



快捷键列表:



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

4918

主题

5880

帖子

3万

积分

GROAD

曲径通幽,安觅芳踪。

Rank: 6Rank: 6

积分
34387
沙发
 楼主| 发表于 2014-10-11 10:38:44 | 只看该作者
术语解释

Association request (关联请求)是由客户端发,请求 AP 进行关联。

Association response (关联响应)是对关联请求的响应。

Reassociation request (重关联请求)是客户端在相同的 ESS 里请求关联到另一个 AP 上(也就是客户端在 AP 之间漫游)。ESS 就是利用骨干网络将几个 BSS 串联在一起,所有位于同一个 ESS 的基站将会使用相同的服务组合识别码(SSID)。

Reassociation response  (重关联响应)是对重关联请求的响应。

Probe request (探测请求)是由客户端发出,目的是扫描 SSID。比如你的无线网卡,会发现许多WI-FI信号,这就是经过探测请求(扫描)得来的。

Probe response (探测响应)由 BSS 回应给客户端。

Beacon (信标)是一种由 AP 发出的一种周期帧,它向外传达了 BSS 的相关信息。

ATIM 是针对 IBSS 的通信指示地图(在 BSS 里,TIM 包含在 Beacon 帧中)。

Disassociation (取消关联)由 AP 发出,用以结束与客户端间的关联。

Authentication (认证)是用来执行 802.11 认证的一种帧 。

Deauthentication (取消认证)是用以结束客户端认证的一种帧。

Action (活动)是一种帧,它表示客户端间的信息发送。

RTS (Request to send)是请求发送帧。

CTS (Clear to send) 是取消发送帧。

ACK 表示应答。

Data 是一种基本数据帧,包含了通信的实际数据。

Null 是一个没有数据的空帧(但可以有其它的标记信息)。

Qos data 是数据帧的 Qos 版本。

Qos null 是空帧的 Qos 版本。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|曲径通幽 ( 琼ICP备11001422号-1|公安备案:46900502000207 )

GMT+8, 2024-6-2 13:42 , Processed in 0.101154 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表