krackattacks-scripts
krackattacks-scripts copied to clipboard
ctrl_iface not found
Hi,
Firstly, thanks for all your hard work.
I cannot make it run.
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:fd:30:4d brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
valid_lft 82371sec preferred_lft 82371sec
inet6 fe80::a00:27ff:fefd:304d/64 scope link
valid_lft forever preferred_lft forever
6: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 04:f0:21:0e:35:cf brd ff:ff:ff:ff:ff:ff
nano hostapd.conf
# AP netdevice name (without 'ap' postfix, i.e., wlan0 uses wlan0ap for
# management frames with the Host AP driver); wlan0 with many nl80211 drivers
# Note: This attribute can be overridden by the values supplied with the '-i'
# command line parameter.
interface=wlan0
uname -r
4.12.0-kali2-amd64
And this is what the script returns:
[15:24:49] Note: disable Wi-Fi in network manager & disable hardware encryption. Both may interfere with this script.
[15:24:50] Starting hostapd ...
Configuration file: ./hostapd.conf
Could not unlink existing ctrl_iface socket 'hostapd_ctrl/wlan0': No such file or directory
Failed to setup control interface for wlan0
wlan0: Unable to setup interface.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
connect exception hostapd_ctrl/wlan0 9877
[15:24:51] It seems hostapd did not start properly, please inspect its output.
[15:24:51] Did you disable Wi-Fi in the network manager? Otherwise hostapd won't work.
It looks like it is trying to open a UDP connection as the line 25 (wpaspy/wpaspy.py) raises an exception. Then the UDP connection with the ctrl_interface cannot be established. Could you help me?
Did you disable Wi-Fi in the network manager? Otherwise hostapd won't work.
Thanks for the prompt response.
I did run:
nmcli radio wifi off
It looks down when I run:
ip a
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 2e:8a:6c:83:9d:8f brd ff:ff:ff:ff:ff:ff
Seems like another copy of wpa_supplicant
is still running. You're starting the script as root? Try a killall wpa_supplicant
to test things. Otherwise search for the error messages that wpa_supplicant
is outputting, since this is an issue specific to wpa_supplicant
.
Thanks.
Yes, I am running as a root. Killall outputs that no other wpa_supplicant is running.
I searched for the specific wpa_supplicant error. I ended up in line 618 of wpa_supplicant/ctrl_iface_unix.c. If I am not mistaking, it is trying to unlink the path given by by krack-test-client.py is hostapd_ctrl/
Also try running airmon-ng check kill
just to be sure. Are you executing the script from a writable directory? Hostapd must be able to create a new subdirectory. Does the directory hostapd_ctrl
already exist somewhere?
root@kali:~# airmon-ng check kill
ls: cannot access '/sys/class/ieee80211/': No such file or directory
Killing these processes:
PID Name
482 dhclient
I am running the script as root with 777 permissions in the current directory.
The only hostapd_ctrl directory I can find in the whole system is the one created after running the script. However, it is empty. What is the purpose of it?
Hi! I had a similar issue and reported this #17. In my case I think the root cause is this: WLAN card is not supporting AP mode. This is documented in Debian wiki.
To verify if your WLAN adapter supports AP mode just execute:
iw list | grep AP$```
Hi,
Sorry for the delay in the answer. I managed to solve the issue. There were several things:
-
Depending on the distribution you use you might not be allowed to run the script (even being root) anywhere. The script opens a unix socket to communicate with host apd. Not all locations are allowed depending on your OS (more info). I ended up moving it to /var/run and it was working
-
Another issue I faced earlier was to do with my bad practice ... I am using vagrant on Windows and sharing some folder with the virtual machine. I download the repository on a zip file and unzip it in Windows (big mistake). 3 links should be created during this operation, naturally they are not created if you use a Windows zip application. You should do this in Linux!
So it is now working for me.
I appreciate your effort.
Jesus
I'm also trying to get around this problem. Whenever I'm running the script, it gets the "connect exception hostapd_ctrl/wlan0 9877" but when I run hostapd on it's own with the same hostapd.conf, the "rogue ap" works with no problem at all.
Has anyone fixed this error yet?
Can you provide the exact commands you used to run the script? And the Linux distribution/version you are using?
Did you try the steps by JesGonTej?
My version Linux is 6.5.0-kali2-amd64.
┌──(venv)─(root㉿kali)-[/home/kali/Downloads/krackattacks-scripts/krackattack]
└─# python3 krack-test-client.py
[13:28:04] Note: disable Wi-Fi in network manager & disable hardware encryption. Both may interfere with this script.
[13:28:05] Starting hostapd ...
Configuration file: /home/kali/Downloads/krackattacks-scripts/krackattack/hostapd.conf
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
nl80211 driver initialization failed.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
connect exception hostapd_ctrl/wlan0 9877
[13:28:06] It seems hostapd did not start properly, please inspect its output.
[13:28:06] Did you disable Wi-Fi in the network manager? Otherwise hostapd won't work.
Traceback (most recent call last):
File "/home/kali/Downloads/krackattacks-scripts/krackattack/krack-test-client.py", line 663, in
Try to start hostapd directly. It might be that your Wi-Fi card doesn't support AP mode. Disable Wi-Fi in your network manager as well.