Building a DIY WiFi Pineapple Out of a Raspberry Pi

2026-08-27

The WiFi Pineapple is Hak5's commercial rogue-AP platform -- a small box with two radios and a web dashboard for running evil-twin APs, Karma/MANA attacks, deauth, and captive portals. Almost all of that is just Linux plumbing: hostapd, dnsmasq, iptables, and the aircrack-ng suite, wired together. A Raspberry Pi with the right USB WiFi adapter reproduces the core functionality for the cost of the hardware, and building it by hand instead of flashing someone else's firmware means you actually understand what each piece is doing.

Everything below is for testing your own network, an isolated lab, or an engagement with signed, scoped authorization. A rogue AP that intercepts or manipulates traffic from devices that aren't yours -- or people who haven't agreed to it -- crosses into wiretapping and CFAA territory immediately. This is the same category as lockpicks: legal to own and practice with, illegal to point at a lock that isn't yours.

What you need

Flashing and base setup

Raspberry Pi OS Lite (64-bit) or Kali ARM both work; Kali ships most of the wireless tooling preinstalled. Enable SSH before first boot so you can work headless, then:

sudo apt update && sudo apt full-upgrade -y
sudo apt install -y hostapd dnsmasq aircrack-ng iptables-persistent \
                     dhcpcd5 bridge-utils tcpdump macchanger

Confirm the USB adapter actually supports monitor mode:

sudo airmon-ng
iw list | grep -A 10 "Supported interface modes"

Standing up the rogue AP

Identify interfaces with iwconfig -- typically wlan0 (onboard) and wlan1 (USB adapter) -- then stop the services so you can hand-configure them:

sudo systemctl stop hostapd dnsmasq
sudo rfkill unblock wifi

/etc/hostapd/hostapd.conf:

interface=wlan1
driver=nl80211
ssid=Free_Public_WiFi
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
sudo sed -i 's/#DAEMON_CONF=.*/DAEMON_CONF="\/etc\/hostapd\/hostapd.conf"/' /etc/default/hostapd

/etc/dnsmasq.conf:

interface=wlan1
dhcp-range=10.0.0.10,10.0.0.250,255.255.255.0,12h
dhcp-option=3,10.0.0.1
dhcp-option=6,10.0.0.1
server=8.8.8.8
log-queries
log-dhcp
sudo ip addr add 10.0.0.1/24 dev wlan1

Routing it to the internet

If you want connected clients to get real internet (useful for credential-harvesting or MITM audits where a dead-end AP would tip off the target), NAT wlan1 out through wlan0:

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o wlan1 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan1 -o wlan0 -j ACCEPT
sudo netfilter-persistent save

Then bring the AP up:

sudo systemctl unmask hostapd
sudo systemctl start hostapd dnsmasq

At this point wlan1 is an open AP handing out DHCP leases and routing clients through wlan0 -- the evil-twin core of what a Pineapple does out of the box.

Layering on the actual Pineapple-style attacks

Where this goes wrong in practice