设置无线网卡工作模式
转自Linux使用tcpdump抓获取WIFI包
注意,在无线网卡已经启用的情况下,可能无法设置模式,如下:
# iwconfig wlan0 mode monitor
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Device or resource busy
上述提示无法设置,设备正忙,所以要先禁止wlan0:
# ifconfig wlan0 down
再设置模式:
# iwconfig wlan0 mode monitor或managed
使用iwconfig查看模式:
# iwconfig wlan0
wlan0 IEEE 802.11abgn Mode:Monitor Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
看到Mode:Monitor表明已修改成功。然后再启用:
# ifconfig wlan0 up
有时候我们一边想用wireshark抓包,一边想用python进行包注入,所以会利用monitor模式新建一个别名,因为这样不会冲突。
# iw wlan0 interface add mon0 type monitor // 添加一个别名mon0,monitor模式
# ifconfig mon0 up // 启用mon0,默认不启用
注意默认情况下,系统启动后,wlan0是managed模式。
Those who seek some sort of a higher purpose or 'universal goal', who don't know what to live for, who moan that they must 'find themselves'. You hear it all around us. That seems to be theofficial bromide of our century. Every book you open. Every drooling self-confession. It seems to be the noble thing to confess. I'd think it would be the most shameful one.