This script no longer works as of November 2021.
Kali now makes it much easier to accomplish this:
- Create a new WiFi connection using "Advanced Network Configuration"
- Set Mode drop-down to "Hotspot"
- Set Band to "Automatic"
- Select the correct wifi adapter from "Device" (this will usually be wlan1)
- Set Cloned MAC Address to "Random"
- Ensure MTU is "Automatic"
- On the Wi-Fi Security tab, set Security to "WPA & WPA2 Personal"
- Enter the password used to protect the SSID
- save
Now you can connect your client devices to this newly-created AP!
Automate the standup of a wifi access point in Kali Linux to monitor WiFi traffic
WiFi Adapter with good driver support, ability to utilize all WiFi modes, and preferably packet injection. I use the Alfa AWUS051NH, but if I had to buy a new one today, it would be the Alfa AWUS036NHA
apt-get install -y dnsmasq hostapd
Prevent dns on the loopback interface by commenting out line 115 (or nearby) containing:
no-dhcp-interface=lo
Enable the integrated DHCP server and provide IP address range and lease time (around line 157):
dhcp-range=10.0.0.2,10.0.0.20,12h
note: increase 20 as needed to allow more devices on the subnet and the dhcp lease as desired
This is the file hostapd will use for configuration. Specify the interface, driver (nl80211 is the one I’ve had most success with), SSID, hardware mode, channel, and security parameters:
interface=wlan0
driver=nl80211
ssid=<ssid can contain spaces>
hw_mode=g
channel=11
wpa=2
wpa_passphrase=<password>
Ensure the VM is set to Bridged networking on the interface that will be providing Internet access to the VM
Ensure the kernel picked up your wifi adapter:
ifconfig -a
Run ./wifiap.sh
. It will prompt you for three things:
- Monitor interface (this will likely be wlan0 or wlan1 in Kali)
- Path to hostapd.conf (This will be your custom location. I keep mine in /root/hostapd.conf)
- Path to dnsmasq.conf (This will be /etc/dnsmasq.conf or your custom location)
Wait for the script to provide the SSID in green text (pulled from your hostapd.conf). This AP should now be selectable from your devices. Connect all devices you wish to monitor traffic for to this AP.
Start Wireshark and capture on the Monitor interface you specified when you ran the script.
This script was developed and tested on Kali 2018.1 in a Parallels 13 VM. It has been tested in a Kali 2018.3 Parallels 14 VM. If you run into any issues, please report them.