NickJongens/PiEvilTwin

Pi Zero W Fresh Install

Closed this issue · 10 comments

I have installed this on my Pi Zero W several times over the last week and it's not working right out the box. Here are my configs:

Dnsmasq

interface=br0
listen-address=10.1.1.1
no-hosts
dhcp-range=10.1.1.2,10.1.1.254,10m
dhcp-option=option:router,10.1.1.1
dhcp-authoritative

address=/apple.com/10.1.1.1
address=/appleiphonecell.com/10.1.1.1
address=/airport.us/10.1.1.1
address=/akamaiedge.net/10.1.1.1
address=/akamaitechnologies.com/10.1.1.1
address=/microsoft.com/10.1.1.1
address=/msftncsi.com/10.1.1.1
address=/msftconnecttest.com/10.1.1.1
address=/google.com/10.1.1.1
address=/gstatic.com/10.1.1.1
address=/googleapis.com/10.1.1.1
address=/android.com/10.1.1.1

Hostapd
interface=wlan0
channel=6
hw_mode=g

ssid=Google Free WiFi

bridge=br0
auth_algs=1
wmm_enabled=0

Here is the output from PiEvilTwin.sh

root@raspberrypi:/home/pi/PiEvilTwin# ./PiEvilTwinStart.sh
Current MAC: 00:03:cf:4a:3b:8d (Muxcom, Inc.)
Permanent MAC: b8:27:eb:22:a7:97 (Raspberry Pi Foundation)
New MAC: 00:21:eb:a9:2b:b6 (ESP SYSTEMS, LLC)
Configuration file: /etc/hostapd/hostapd.conf
Could not set channel for kernel driver
Interface initialization failed
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: Unable to setup interface.
wlan0: interface state DISABLED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
net.ipv4.ip_forward = 1

Any help would be great! Thanks!

Hi! I'm not in active development of this, so sorry if I can't resolve this right away 😀

Is your wifi interface called wlan0? Execute

ip link
or
ifconfig -a

to find the name of the wireless interface name, and replace wlan0 in hostapd.conf with the wireless interface name.

If you see a wlan0mon interface, it's been put in monitor mode and will conflict.

airmon-ng check

Will allow you to see if there's a process running and you can use

pkill $process

To kill these processes.
It's definitely Hostapd at fault here and is probably the interface name (wlan0, wlan1 etc)

Also, try to disable WPA Supplicant and reboot

systemctl disable wpa_supplicant

Okay thanks, I'll try to disable the wpa_supplicant. I'm using it on wlan0, but I have another wifi adapter connected. I was hoping to maintain ssh access from wlan1 while running the captive portal. This might be messing it up so I'll disable wpa_supplicant and try it. Thank you for your help!

It is likely swapping the wlan adapter names intermittently on boot, I think I encountered this while testing on another project.

My external WiFi adapter would become wlan0 (AlphaAWUS036NEH)

If this is the case, I think timing the adapter plug in could help.

Delaying the plug in by 3-4 seconds after boot seemed to help.

Or try 'wlan1' in the config.

I will also update the hostapd configuration with a default country code of US to the top of the config to avoid

country_code=US

I am in New Zealand and we have 1 more channel available.

Running 'sudo rfkill unblock wlan' may also help - I'll add it to the script too.

On mobile, so will remind myself to do this when I'm back from holiday tomorrow!

That's awesome! Thanks so much for the responses. Since wlan0 was the onboard interface, I didn't think it would be an issue to run ssh over wlan1. I look forward to your update!

I loaded a fresh install of Buster lite and ran the script. It seems that everything is working properly. I'm not sure why I was running into problems before. I was using the desktop version of Rasbian, but I don't think that should have made a difference.

Actually after a reboot its failing to put wlan0 into ap mode.

I think Kali Linux doesn't handle the boot phase the same as raspbian. Is there an image for kali for the Raspberry Pi Zero Wireless?

There is an image but network manager on Kali keeps messing with the AP. I switched to raspian because it was easier to deal with.