Airmon-ng
描述
介紹
該腳本可用于在無線接口上啟用監視模式。它也可以用于從監視模式返回到托管模式。輸入不帶參數的airmon-ng命令將顯示接口狀態。
屏幕截圖

用法
用法:airmon-ng <start|stop> [channel] or airmon-ng <check|check kill>
在哪里:
<start | stop>指示您是否要啟動或停止界面。(必填)
指定接口。(必填)
[channel](可選)將卡設置為特定頻道。
<check | check kill>“檢查”將顯示可能干擾aircrack-ng套件的所有進程。強烈建議在使用aircrack-ng套件之前消除這些過程。“ check kill”將檢查并殺死可能干擾aircrack-ng套件的進程。
使用范例
典型用途
檢查狀態和/或列出無線接口
~# airmon-ng
PHY Interface Driver Chipset
phy0 wlan0 ath9k_htc Atheros Communications, Inc. AR9271 802.11n
檢查干擾過程
將卡置于監視模式時,它將自動檢查干擾過程。也可以通過運行以下命令來手動完成此操作:
~# airmon-ng check
Found 5 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!
PID Name
718 NetworkManager
870 dhclient
1104 avahi-daemon
1105 avahi-daemon
1115 wpa_supplicant
消除干擾過程
此命令停止網絡管理器,然后殺死剩余的干擾進程:
~# airmon-ng check kill
Killing these processes:
PID Name
870 dhclient
1115 wpa_supplicant
啟用監控模式
注意:將卡置于監視模式之前,殺死網絡管理員非常重要!
~# airmon-ng start wlan0
Found 5 processes that could cause trouble.
If airodump-ng, aireplay-ng or airtun-ng stops working after
a short period of time, you may want to kill (some of) them!
PID Name
718 NetworkManager
870 dhclient
1104 avahi-daemon
1105 avahi-daemon
1115 wpa_supplicant
PHY Interface Driver Chipset
phy0 wlan0 ath9k_htc Atheros Communications, Inc. AR9271 802.11n
(mac80211 monitor mode vif enabled for [phy0]wlan0 on [phy0]wlan0mon)
(mac80211 station mode vif disabled for [phy0]wlan0)
如您所見,它創建了一個名為wlan0mon的監視模式接口,并通知有一些進程會干擾這些工具。
禁用監控模式
~# airmon-ng stop wlan0mon
PHY Interface Driver Chipset
phy0 wlan0mon ath9k_htc Atheros Communications, Inc. AR9271 802.11n
(mac80211 station mode vif enabled on [phy0]wlan0)
(mac80211 monitor mode vif disabled for [phy0]wlan0mon)
不要忘記重啟網絡管理器。通常使用以下命令完成此操作:
service network-manager start
Madwifi-ng驅動程序監控模式
這說明了如何將界面置于監視模式。啟動計算機后,輸入“ iwconfig”以顯示無線接口的當前狀態。看起來與以下輸出類似。
輸入“ iwconfig”:
lo no wireless extensions.
eth0 no wireless extensions.
wifi0 no wireless extensions.
ath0 IEEE 802.11b ESSID:"" Nickname:""
Mode:Managed Channel:0 Access Point: Not-Associated
Bit Rate:0 kb/s Tx-Power:0 dBm Sensitivity=0/3
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
如果要使用ath0(已使用):
airmon-ng stop ath0
系統將響應:
Interface Chipset Driver
wifi0 Atheros madwifi-ng
ath0 Atheros madwifi-ng VAP (parent: wifi0) (VAP destroyed)
現在,如果你使用iwconfig:
系統響應:
lo no wireless extensions.
eth0 no wireless extensions.
wifi0 no wireless extensions.
您可以看到ath0消失了。
要將wifi0置于監視模式:
airmon-ng start wifi0
系統響應:
Interface Chipset Driver
wifi0 Atheros madwifi-ng
ath0 Atheros madwifi-ng VAP (parent: wifi0) (monitor mode enabled)
現在輸入“ iwconfig”
系統響應:
lo no wireless extensions.
eth0 no wireless extensions.
wifi0 no wireless extensions.
ath0 IEEE 802.11g ESSID:""
Mode:Monitor Frequency:2.452 GHz Access Point: 00:0F:B5:88:AC:82
Bit Rate=2 Mb/s Tx-Power:18 dBm Sensitivity=0/3
Retry:off RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=0/94 Signal level=-96 dBm Noise level=-96 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
您可以看到ath0處于監視模式。還要確保未設置essid,昵稱和加密。接入點顯示卡的MAC地址。僅在使用madwifi-ng驅動程序時顯示卡的MAC地址。其他驅動程序不顯示卡的MAC地址。
如果ath1 / ath2等正在運行,則在執行上述所有命令之前先將其停止:
airmon-ng stop ath1
您可以通過將其添加到末尾來設置頻道號:airmon-ng start wifi0 9
使用技巧
確認卡處于監控模式
要確認卡處于監視模式,請運行命令“ iwconfig”。然后,您可以確認模式為“顯示器”和接口名稱。
對于madwifi-ng驅動程序,iwconfig中的訪問點字段顯示您的無線卡的MAC地址。
確定當前通道
要確定當前通道,請輸入“ iwlist <接口名稱>通道”。如果要使用特定的接入點,則卡的當前通道應與AP的通道匹配。在這種情況下,最好在運行初始airmon-ng命令時包括通道號。
如何將我的卡放回托管模式?
這取決于您使用的驅動程序。對于除madwifi-ng以外的所有驅動程序:
airmon-ng stop <interface name>
對于madwifi-ng,首先停止所有接口:
airmon-ng stop athX
其中X是0、1、2等。對iwconfig列出的每個接口進行停止。
然后:
wlanconfig ath create wlandev wifi0 wlanmode sta
請參閱madwifi-ng站點文檔。
對于mac80211驅動程序,無需執行任何操作,因為airmon-ng會將受管接口與監視模式保持在一起(mac80211使用接口類型而不是操作模式)。如果您不再需要監視器界面并想刪除它,請使用以下命令:
airmon-ng stop monX
X是監視器接口號-0,除非同時運行多個監視接口。
調試問題
airmon-ng有兩個顯示更多信息的選項,在報告或調試問題時很有用。
–verbose標志
它提供有關系統的信息以及有關無線網卡的詳細信息。
root@kali:~# airmon-ng --verbose
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2019.1
Codename: n/a
Linux kali 4.19.0-kali4-amd64 #1 SMP Debian 4.19.28-2kali1 (2019-03-18) x86_64 GNU/Linux
Detected VM using lspci
This appears to be a VMware Virtual Machine
If your system supports VT-d, it may be possible to use PCI devices
If your system does not support VT-d, you can only use USB wifi cards
K indicates driver is from 4.19.0-kali4-amd64
V indicates driver comes directly from the vendor, almost certainly a bad thing
S indicates driver comes from the staging tree, these drivers are meant for reference not actual use, BEWARE
? indicates we do not know where the driver comes from... report this
X[PHY]Interface Driver[Stack]-FirmwareRev Chipset Extended Info
K[phy1]wlan0 ath9k_htc[mac80211]-1.4 Qualcomm Atheros Communications AR9271 802.11n mode managed
在這種情況下,可以看到以下附加信息:
有關Linux發行版和內核版本的詳細信息
系統是虛擬機(以及有關受支持功能的詳細信息)
詳細的驅動程序信息(內核,供應商驅動程序,暫存或未知來源),無線堆棧,當前操作模式和固件版本
–debug標志
它將提供與詳細信息相同的信息,并添加更多詳細信息:
root@kali:~# airmon-ng --debug
/bin/sh -> /usr/bin/dash
SHELL is GNU bash, version 5.0.3(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2019.1
Codename: n/a
Linux kali 4.19.0-kali4-amd64 #1 SMP Debian 4.19.28-2kali1 (2019-03-18) x86_64 GNU/Linux
Detected VM using lspci
This appears to be a VMware Virtual Machine
If your system supports VT-d, it may be possible to use PCI devices
If your system does not support VT-d, you can only use USB wifi cards
K indicates driver is from 4.19.0-kali4-amd64
V indicates driver comes directly from the vendor, almost certainly a bad thing
S indicates driver comes from the staging tree, these drivers are meant for reference not actual use, BEWARE
? indicates we do not know where the driver comes from... report this
X[PHY]Interface Driver[Stack]-FirmwareRev Chipset Extended Info
getStack mac80211
getBus usb
getdriver() ath9k_htc
getchipset() Qualcomm Atheros Communications AR9271 802.11n
BUS = usb
BUSINFO = 0CF3:9271
DEVICEID =
getFrom() K
getFirmware 1.4
K[phy1]wlan0 ath9k_htc[mac80211]-1.4 Qualcomm Atheros Communications AR9271 802.11n mode managed
補充資料:
外殼名稱和版本
有關無線適配器和加載的驅動程序的調試信息
使用故障排除
Madwifi-ng
通常,Linux發行版上的標準腳本會設置ath0和/或其他athX接口。必須首先按照上述說明將其全部刪除。另一個問題是腳本設置了字段,例如essid,昵稱和加密。確保所有這些都已清除。
Airmon-ng表示界面未處于監控模式
~# airmon-ng stop wlan0mon
PHY Interface Driver Chipset
phy0 wlan0mon ath9k_htc Atheros Communications, Inc. AR9271 802.11n
You are trying to stop a device that isn't in monitor mode.
Doing so is a terrible idea, if you really want to do it then you
need to type 'iw wlan2mon del' yourself since it is a terrible idea.
Most likely you want to remove an interface called wlan[0-9]mon
If you feel you have reached this warning in error,
please report it.
這很可能意味著網絡管理器將接口模式從監視器模式更改為托管模式。在這種情況下,當停止監視模式時,這不是問題。
我的界面進入了監視模式,但工具顯示不是
通常,這意味著在殺死網絡管理員之前,將接口置于監視模式。然后網絡管理員將卡放回托管模式。
請參考上面的文檔,以殺死網絡管理員并將其放回監視模式。
接口athX編號遞增(ath0,ath1,ath2 …. ath45 ..)
問題:每次運行“ airmon-ng start wifi0 x”命令時,都會按原樣創建一個新接口,但是存在兩個問題。第一個是每次在wifi0上運行airmon-ng時,接口號ath都會增加:第一次是ath1,第二個ath2,第三個ath3,依此類推。而且這種情況還在持續,因此在很短的時間內達到ath56并持續攀升。卸載madwifi-ng驅動程序或重新啟動系統均無效,并且airmon-ng創建的接口數量繼續增加。
第二個問題是,如果您在wifi0上運行airmon-ng,即使創建了athXX,它也不會顯示為在Monitor模式下顯示。可以通過iwconfig確認。
所有這些問題都與udev如何分配接口名稱有關。問題的根源來自UDEV持久網絡規則生成器。
每個發行版都是不同的……因此這里是專門針對Gentoo的解決方案。您應該能夠使此解決方案適合您的特定發行版。
Gentoo 2.6.20-r4 Udev 104-r12 Madwifi 0.9.3-r2 Aircrack-ng 0.7-r2
解決方案:
更改文件/etc/udev/rules.d/75-persistent-net-generator.rules
從:KERNEL ==“ eth * | ath * | wlan * | ra * | sta *……..到:KERNEL ==“ eth * | Ath * | wlan * | ra * | sta *……。
換句話說,您只需將a大寫。ath *成為Ath *。保存文件。
現在刪除文件/etc/udev/rules.d/70-persistent-net.rules。
卸下驅動器,然后重新插入。
刪除路徑也可以:KERNEL ==” eth * | wlan * | ra * | sta *…。
2.6.19-gentoo-r5和2.6.20-gentoo-r6都在Gentoo上
對于Ubuntu,/etc/udev/rules.d/75-persistent-net-generator.rules的修改版本為:
# these rules generate rules for persistent network device naming
ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|Ath*|wlan*|ra*|sta*" \
NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do"
GOTO="persistent_net_generator_end"
LABEL="persistent_net_generator_do"
# build device description string to add a comment the generated rule
SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device attr{vendor}:$attr{device}($attr{driver})"
SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct}($attr{driver})"
SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})"
SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device"
ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($attr{driver})"
IMPORT{program}="write_net_rules $attr{address}"
ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}"
LABEL="persistent_net_generator_end"
創建接口ath1代替ath0
此故障排除提示適用于madwifi-ng驅動程序。首先,嘗試停止正在運行的每個VAP接口(“ airmon-ng stop IFACE”,其中IFACE是VAP名稱)。您可以從iwconfig獲取列表。然后執行“ airmon-ng start wifi0”。
如果這樣做不能解決問題,請遵循此線程中的建議。
為什么我的ioctl(SIOCGIFINDEX)失敗?
如果您收到類似于以下內容的錯誤消息:
錯誤消息:“ SIOCSIFFLAGS:沒有這樣的文件或目錄”
錯誤消息:“ ioctl(SIOCGIFINDEX)失敗:沒有這樣的設備”
然后,請參閱此FAQ條目。
錯誤消息:“ wlanconfig:找不到命令”
如果收到“ wlanconfig:未找到命令”或類似信息,則說明系統中缺少wlanconfig命令或該路徑不在路徑中。使用定位或查找來確定它是否在您的系統上以及它在哪個目錄中。
如果您的系統缺少該文件,請確保在編譯madwifi-ng驅動程序之后已完成“安裝”。在Ubuntu上,執行“ apt-get install madwifi-tools”。
如果它不在您路徑的目錄中,則將其移至該目錄或將目錄添加到您的路徑。
airmon-ng顯示RT2500而不是RT73
請參閱安裝RT73驅動程序下的此項。
錯誤“ add_iface:權限被拒絕”
您收到類似于以下錯誤:
Interface Chipset Driver
wlan0 iwl4965 - [phy0]/usr/sbin/airmon-ng: line 338: /sys/class/ieee80211/phy0/add_iface: Permission denied
mon0: unknown interface: No matching device found
(monitor mode enabled on mon0)
或與此類似:
wlan0 iwlagn - [phy0]/usr/local/sbin/airmon-ng: 856: cannot create /sys/class/ieee80211/phy0/add_iface: Directory nonexistent
Error for wireless request "Set Mode" (8B06) :
SET failed on device mon0 ; No such device.
mon0: ERROR while getting interface flags: No such device
這意味著您安裝了舊版本的airmon-ng。至少升級到v1.0-rc1。最好您應該升級到當前版本。有關更多詳細信息,請參見安裝頁面。另外,不要忘記您需要root才能使用airmon-ng(或使用sudo)。
檢查取消失敗
從現在開始,發行版將采用“ upstart”,它將取代/ sbin / init守護程序,該守護程序在引導過程中管理服務和任務。
基本上做:
service network-manager stop
service avahi-daemon stop
service upstart-udev-bridge stop
然后繼續檢查取消dhclient和wpa_supplicant的pid。
這是永久取消aireplay-ng的所有可能有問題的pid的唯一方法。訣竅是先取消守護程序,然后終止“任務”。
SIOCSIFFLAGS:未知錯誤132
如果您的輸出類似于:
# airmon-ng start wlan0
Interface Chipset Driver
wlan0 Broadcom b43 - [phy0]SIOCSIFFLAGS: Unknown error 132
(monitor mode enabled on mon0)
它指示RF被阻止。需要使用筆記本電腦上的開關和/或使用以下命令來啟用它:
rfkill unblock all
添加監視器模式界面時出錯:命令失敗:不支持操作(-95)
已知在使用airmon-ng時會在Raspberry Pi上發生。發生這種情況時,可以在dmesg中看到以下內容:
brcmfmac: brcmf_vif_add_validate: Attempt to add a MONITOR interface...
brcmfmac: brcmf_vif_add_validate: ... there is already a monitor interface, returning EOPNOTSUPP
brcmfmac: brcmf_cfg80211_add_iface: iface validation failed: err=-95
在上述輸出之前,dmesg中可能還存在以下實例:
brcmfmac: brcmf_vif_add_validate: Attempt to add a MONITOR interface...
brcmfmac: brcmf_mon_add_vif: brcmf_mon_add_vif called
brcmfmac: brcmf_mon_add_vif: Adding vif "wlan0mon"
brcmfmac: brcmf_cfg80211_get_channel: chanspec failed (-52)
即使dmesg表示該接口已經處于監視模式,并且“ iw dev wlan0 info”確認該接口已存在,airodump-ng仍將失敗并報告接口數據鏈接類型為以太網。這是驅動程序和/或固件中的錯誤,解決方法是重新引導系統或重新加載驅動程序:
rmmod brcmfmac
modprobe brcmfmac
Aircrack-ng中文使用教程
推薦文章: