我最近购买了 ALFA-AWUS03NHA 无线卡,我正在运行 Debian,并且我想将该卡与 aircrack-ng 工具套件一起使用。然而,我很确定它正在使用我的笔记本电脑无线卡,原因有几个:ALFA 卡上的灯从不闪烁,如果我运行命令并拔掉卡,这没有什么区别。
我对该卡的驱动程序进行了一些研究,我相信它使用 AR9271 驱动程序,该驱动程序包含在一些名为“ath_9k”的下载中。但我认为这已经安装了,至少当我运行 lsmod 时,驱动程序会显示出来:
在插入卡之前,我运行以下命令:
~$ sudo iwconfig
[sudo] password for root:
eth0 no wireless extensions.
lo no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"..."
Mode:Managed Frequency:2.412 GHz Access Point: "MA:CA:DD:RE:SS"
Bit Rate=54 Mb/s Tx-Power=16 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=56/70 Signal level=-54 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:53 Missed beacon:0
~$ sudo ifconfig
eth0 Link encap:Ethernet HWaddr "mac_address"
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:"ip address" Mask:255.0.0.0
inet6 addr: "..." Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:166 errors:0 dropped:0 overruns:0 frame:0
TX packets:166 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:29969 (29.2 KiB) TX bytes:29969 (29.2 KiB)
wlan0 Link encap:Ethernet HWaddr "..."
inet addr: "..." Bcast: "..." Mask:255.255.240.0
inet6 addr: "..." Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8272 errors:0 dropped:0 overruns:0 frame:0
TX packets:5897 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10531170 (10.0 MiB) TX bytes:766102 (748.1 KiB)
~$ lsmod | grep ath
ath9k 98430 0
ath9k_common 12634 1 ath9k
ath9k_hw 391009 2 ath9k_common,ath9k
ath 26026 3 ath9k_common,ath9k,ath9k_hw
mac80211 488308 1 ath9k
cfg80211 436618 3 ath,ath9k,mac80211
我省略了一些内容,例如可识别的网络信息和地址,以及 lsmod 中的很多内容以节省空间,我只包含了包含 ath9k 的所有内容。
现在我插入卡,并运行以下命令:
~$ lsusb
Bus 002 Device 005: ID 0cf3:9271 Atheros Communications, Inc. AR9271 802.11n
Bus 002 Device 003: ID 062a:4102 Creative Labs
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 04f2:b1d6 Chicony Electronics Co., Ltd
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
记下驱动程序编号(这是驱动程序号还是芯片组号?有什么区别吗?):9271。
~$ sudo iwconfig
eth0 no wireless extensions.
lo no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"..."
Mode:Managed Frequency:2.412 GHz Access Point: "..."
Bit Rate=54 Mb/s Tx-Power=16 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality=56/70 Signal level=-54 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:1 Invalid misc:59 Missed beacon:0
~$ sudo ifconfig
eth0 Link encap:Ethernet HWaddr "..."
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:"..." Mask:255.0.0.0
inet6 addr: "..." Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:178 errors:0 dropped:0 overruns:0 frame:0
TX packets:178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:33921 (33.1 KiB) TX bytes:33921 (33.1 KiB)
wlan0 Link encap:Ethernet HWaddr "..."
inet addr:"..." Bcast:"..." Mask:255.255.240.0
inet6 addr: "..." Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10338 errors:0 dropped:0 overruns:0 frame:0
TX packets:7222 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13177945 (12.5 MiB) TX bytes:1030820 (1006.6 KiB)
运行 if/iwconfig 似乎返回几乎相同的输出,无论有没有卡。
~$ sudo airmon-ng start wlan0
Found 3 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!
-e
PID Name
2675 NetworkManager
2847 wpa_supplicant
3886 dhclient
Process with PID 3886 (dhclient) is running on interface wlan0
Interface Chipset Driver
wlan0 Atheros AR9285 ath9k - [phy0]
(monitor mode enabled on mon0)
首先要注意的是 AR9285,与无线卡列出的芯片组/驱动程序不同。插上卡后,似乎还有一个可以访问的无线接口,wlan0。应该发生什么情况,我是否会在旧接口之上获得一个新接口 wlan1,或者无线卡是否应该覆盖另一个接口并成为新的 wlan0?
如果我现在插入卡后运行与之前相同的 lsmod 命令,我会在“usbcore”部分中看到新的驱动程序:
~$ lsmod | grep ath
ath9k_htc 64602 0
ath9k 98430 0
ath9k_common 12634 2 ath9k,ath9k_htc
ath9k_hw 391009 3 ath9k_common,ath9k,ath9k_htc
ath 26026 4 ath9k_common,ath9k,ath9k_htc,ath9k_hw
mac80211 488308 2 ath9k,ath9k_htc
cfg80211 436618 4 ath,ath9k,mac80211,ath9k_htc
usbcore 166472 5 uvcvideo,ehci_hcd,ehci_pci,usbhid,ath9k_htc
我很确定这些事情都没有发生,而是无线卡根本没有被使用,我确信这一点,因为我可以拔掉它而不会产生任何影响,并且它在设置或执行期间的任何时候都不会闪烁命令。
那么,问题来了!
我是否为该卡安装了正确的驱动程序?如果是这样,为什么它不起作用?我看过的每个视频或教程都假设阿尔法是即插即用的。我在这里错过了一些步骤吗?
答案1
要在 Debian 9 中修复此问题,请将以下存储库添加到/etc/apt/sources.list
:
deb http://httpredir.debian.org/debian/ stretch main contrib non-free
然后安装相应的驱动程序:
apt update; apt-get install firmware-misc-nonfree
现在它应该可以正常工作了:
root@debian:~# wpa_supplicant -i wlx00xx -c wpa_supplicant.conf -D wext
Successfully initialized wpa_supplicant
wlx00xx: CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
wlx00xx: Trying to associate with xx:xx:xx:xx:xx:xx (SSID='TestWiFi' freq=5640 MHz)
wlx00xx: Association request to the driver failed
wlx00xx: Associated with xx:xx:xx:xx:xx:xx
wlx00xx: WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
wlx00xx: CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed [id=0 id_str=]
现在您可以使用 请求 IP dhclient wlx00xx
。
答案2
解决了。
事实证明我没有安装正确的驱动程序,我只是对 lsmod 中列出的驱动程序(仅在 usbcore 部分下)感到困惑,发现它实际上并未安装。捂脸