WiEvil.sh is a comprehensive Bash script for setting up a malicious Wi-Fi hotspot on Raspberry Pi OS (Debian Bookworm). It generates a Root CA to facilitate certificate-based HTTPS interception, serves that certificate via a captive portal, and optionally installs mitmproxy for full HTTPS MITM.
Disclaimer: This project is for educational / authorized security testing only. Creating a rogue AP and intercepting traffic is illegal without explicit permission.
- NetworkManager + systemd-networkd: Leaves
eth0to NetworkManager,wlan0to systemd-networkd. - Root CA Generation: Creates a self-signed CA (
/etc/evilca/) and places the.crtfile in/var/www/html/ca.crt. - Captive Portal: Uses Apache to serve a minimal
index.htmlthat instructs users to install the CA. - Rogue AP: Sets up hostapd + dnsmasq to broadcast an SSID (e.g.,
MaliciousAP) on192.168.50.1/24. - iptables Redirection:
- Defaults to sending all HTTP/HTTPS to the captive portal.
- (Optional) NAT from
wlan0→eth0, so devices can reach the internet once captive rules are removed or bypassed. - (Optional) Install & configure mitmproxy to silently decrypt all HTTPS.
- Raspberry Pi OS (Debian Bookworm)
- NetworkManager controlling
eth0 - systemd-networkd for
wlan0 sudoprivileges- Minimal environment to avoid conflicts
-
Clone the repository:
git clone https://github.com/exfil0/WiEvil.git cd WiEvil -
Make the script executable:
chmod +x WiEvil.sh
-
Run with sudo:
sudo ./WiEvil.sh
-
Answer the prompts:
- SSID, channel, country code, passphrase.
- CA name.
- Whether to enable NAT.
- Whether to install mitmproxy.
-
Reboot recommended:
sudo reboot
- Rogue AP: A device sees your chosen SSID. Connect with the provided WPA2 pass.
- Captive Portal: By default, all traffic on ports 80/443 is redirected to
192.168.50.1:80, showing a page instructing them to install your CA. - Root CA: In
/etc/evilca/, also served athttp://192.168.50.1/ca.crt. - If NAT is enabled, devices can get real internet once they remove or modify the captive portal rules.
If you choose to install mitmproxy, the script automatically removes the 443->80 captive rule and adds 443->8081 so you can run:
sudo mitmproxy --mode transparent -p 8081Navigation in mitmproxy:
- Up/Down: select flows
- Enter: inspect the selected flow
- Left/Right or Tab: switch between request & response
- q or Esc: go back
- Shift+Q: quit mitmproxy
- ?: help screen
Once the client trusts your CA, HTTPS traffic is decrypted & re-encrypted.
-
Flush or delete iptables rules:
sudo iptables -t nat -D PREROUTING -i wlan0 -p tcp --dport 80 -j DNAT --to-destination 192.168.50.1:80 sudo iptables -t nat -D PREROUTING -i wlan0 -p tcp --dport 443 -j DNAT --to-destination 192.168.50.1:80
-
Re-save if needed:
iptables-save > /etc/iptables/iptables-rules.v4
- No IP: Check
dnsmasqstatus, ensurewlan0is192.168.50.1. - No captive page: Verify iptables rules with
iptables -t nat -L --line-numbers. - No internet: If NAT is disabled, that’s expected. If NAT is on, confirm Pi can ping external sites.
- User won’t install CA: They must do so manually—no forced method.
- Flush iptables or remove custom rules from
/etc/rc.local. - Enable or rename
/etc/NetworkManager/conf.d/10-unmanage-wlan0.confif you want NM to re-managewlan0. - Stop & disable hostapd/dnsmasq:
sudo systemctl stop hostapd dnsmasq sudo systemctl disable hostapd dnsmasq
- Remove your CA from
/etc/evilcaand/var/www/html/ca.crt.
This code is offered as is, for educational or authorized lab usage. No formal license. Use responsibly.
You can integrate mitmproxy seamlessly by redirecting port 443 to its listening port. Once the user installs ca.crt, all HTTPS traffic can be transparently intercepted.
Below is the WiEvil folder structure, plus progress indicators:
WiEvil/
├── README.md [100%]
├── WiEvil.sh [100%]
├── Integrations/ [70%]
│ ├── WiEvilWithAlfa.sh [80%]
│ ├── EvilTwinMode/
│ │ ├── run-evil-twin.sh [In Progress - 50%]
│ │ ├── deauth-helper.sh [Planned - 0%]
│ │ └── README.md [Planned - 0%]
│ ├── MonitorMode/
│ │ ├── set-monitor.sh [Complete - 100%]
│ │ └── README.md [Planned - 0%]
│ └── Bettercap/
│ ├── run-bettercap.sh [Planned - 0%]
│ ├── bettercap-config.yml [Planned - 0%]
│ └── README.md [Planned - 0%]
├── Themes/ [60%]
│ ├── coffee-shop/
│ │ ├── index.html [Complete]
│ │ ├── style.css [Complete]
│ │ └── README.md [Planned]
│ ├── airport/
│ │ ├── index.html [In Progress]
│ │ └── style.css [In Progress]
│ └── branding-template.md [Planned]
├── Tools/ [50%]
│ ├── InstallAlfaAC1900.sh [Complete]
│ ├── captive-bypass-scripts/
│ │ ├── ... [Planned]
│ └── README.md [Planned]
└── docs/ [40%]
├── advanced-scenarios.md [In Progress]
├── captive-portal-bypass.md [Planned]
└── images/
├── demo-WiEvil-Interception.png [Complete]
└── ...