在原生linux系统下(虚拟机不支持),可以将内置网卡直接设置为Monitor模式,嗅探空中所有802.11帧。无需购买专门的抓包网卡。
安装wireshark
sudo apt-get update
sudo apt-get install wireshark
出现Configuring wireshark-common时选择yes。
添加用户组:
sudo vim /etc/group
wireshark:x:134:wangym(你的账号名)
设置Monitor模式
1.ifconfig
查看无线网卡号,这里我的无线网卡名为“wlp3s0”,下面指令中需将“wlp3s0”替换为你的无线网卡号。
2.设置为混杂模式:
sudo service network-manager stop
sudo ifconfig wlp3s0 down
sudo iwconfig wlp3s0 mode Monitor
sudo ifconfig wlp3s0 up
3.查看当前信道
iwlist wlp3s0 channel
4.设置信道
sudo iwconfig wlp3s0 channel aabb
打开wireshark
需要以超级用户权限打开wireshark,否则可能出现失败。
结束抓包,切回正常模式
在Monitor(sniffer)模式下,无法正常使用网络。
sudo ifconfig wlp3s0 down
sudo iwconfig wlp3s0 mode Managed
sudo ifconfig wlp3s0 up
sudo service network-manager restart
无线网卡恢复正常使用。
Tips:
如果经常使用空中抓包,你可以将以上命令保存为脚本,则可以迅速设置Monitor模式,迅速切回正常模式。