wireshark是一个抓包小能手,排查网络问题的时候常常离不开,网上的使用教程也有很多,但多数是抓的有线数据包,本文主要介绍使用wireshark抓空口包的方法和常用命令。
-----再牛逼的梦想,也抵不住傻逼般的坚持! --2024-06-24 16:10
前言:
什么是空口包? 这里大家可以思考下:笔记本电脑通过网线连接路由器和通过wifi连接路由器访问百度,淘宝等有什么区别?
个人理解:是传播介质不同,一个通过网线,另外一种是通过空气。
那么,网线传输,我们可以通过网线分流去抓包,空气抓包要如何做呢?这里就是我这篇博客的目的了,通过空气作为介质传播的包通常就叫做空口包,我们需要使用wifi usb 抓包网卡,或者笔记本自身的wifi网卡,使其处于监听模式,时刻监听空气中的包,以此来完成抓空口包的目的。
一. wireshark抓空口报文
wireshark抓取有线报文的方式,这里就不再做记录了,有疑问的同学可以留言或者私信。这里主要纪律下抓空口包的两种方式。
wireshark抓取空口报文方式有两种:
- 电脑外接一个usb wifi网卡,安装这个网卡的特定驱动(用于抓包),之后打开wireshark进行抓包。
- 电脑切换到ubuntu系统,将电脑自身的wifi网卡切换到监听模式,然后打开wireshark进行抓包。
linux下切换网卡至监听(monitor)模式的命令如下:
sudo airmon-ng wlan0 start;
sudo wireshark
如上两种各有优缺点,最大的区别在于,wifi6即80211ax目前只能在linux系统下进行抓包,即使用方式2。
二. 常见过滤wifi空口包命令
空口报文与有线抓包的报文有些区别,如有线抓包我们通常只需要分析网络,传输,应用层的协议即可,如:arp, icmp, tcp, udp, http, https等等,但空口包,我们往往还需要分析很多链路层的报文。
1.协议、MAC地址、ip地址过滤
ip.src == 源IP地址
ip.dst == 目标IP地址
ip.addr == 主机IP地址 //个人使用较多
tcp.srcport == 源端口号
tcp.dstport == 目标端口号
tcp.port == 端口号 //个人使用较多
dhcp/icmp/tcp/upd/http/https
无线/有线mac地址过滤
wlan.addr == mac地址
eth.addr == mac地址
2.wifi链路层报文过滤命令如下
Management frame
wlan.fc.type == 0
Control frame
wlan.fc.type == 1
Data frame
wlan.fc.type == 2
Association request
wlan.fc.type_subtype == 0x00
Association response
wlan.fc.type_subtype == 0x01
Reassociation request
wlan.fc.type_subtype == 0x02
Reassociation response
wlan.fc.type_subtype == 0x03
Probe request
wlan.fc.type_subtype == 0x04
Probe response
wlan.fc.type_subtype == 0x05
Beacon
wlan.fc.type_subtype == 0x08
Disassociate
wlan.fc.type_subtype == 0x0A
Authentication
wlan.fc.type_subtype == 0x0B
Deauthentication
wlan.fc.type_subtype == 0x0C
Action frame
wlan.fc.type_subtype == 0x0D
Block ACK requests
wlan.fc.type_subtype == 0x18
Block ACK
wlan.fc.type_subtype == 0x19
Power save poll
wlan.fc.type_subtype == 0x1A
Request to send
wlan.fc.type_subtype == 0x1B
Clear to send
wlan.fc.type_subtype == 0x1C
ACK
wlan.fc.type_subtype == 0x1D
Contention free period end
wlan.fc.type_subtype == 0x1E
NULL data
wlan.fc.type_subtype == 0x24
QoS data
wlan.fc.type_subtype == 0x28
Null QoS data
wlan.fc.type_subtype == 0x2C
EAPOL
eapol
三. 小结
未完待续,搬砖搬砖,后续有新问题大家可以提出来,本人也会更新到这里