Created
May 25, 2024 22:10
-
-
Save roman01la/7a0d606779675d66386367b9929a715f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install -y iptables hostapd dnsmasq dhcpcd5 isc-dhcp-server python3-pip python3-venv | |
sudo nano /etc/dhcpcd.conf | |
interface wlan0 | |
static ip_address=192.168.42.1/24 | |
nohook wpa_supplicant | |
sudo nano /etc/dhcp/dhcpd.conf | |
authoritative; | |
subnet 192.168.42.0 netmask 255.255.255.0 { | |
range 192.168.42.10 192.168.42.250; | |
option broadcast-address 192.168.42.255; | |
option routers 192.168.42.1; | |
option domain-name "local"; | |
option domain-name-servers 8.8.8.8, 8.8.4.4; | |
} | |
sudo nano /etc/default/isc-dhcp-server | |
INTERFACESv4="wlan0" | |
cd /etc/hostapd/ | |
sudo cp /usr/share/doc/hostapd/examples/hostapd.conf . | |
sudo nano /etc/hostapd/hostapd.conf | |
interface=wlan0 | |
driver=nl80211 | |
ssid=mitmdemo | |
country_code=GB #change to your appropriate country code | |
hw_mode=g | |
channel=6 | |
macaddr_acl=0 | |
auth_algs=1 | |
wmm_enabled=0 | |
wpa=2 | |
wpa_passphrase=mitmdemo2600 | |
wpa_key_mgmt=WPA-PSK | |
wpa_pairwise=TKIP | |
rsn_pairwise=CCMP | |
sudo nano /etc/default/hostapd | |
DAEMON_CONF="/etc/hostapd/hostapd.conf" | |
python3 -m venv ./venv | |
source venv/bin/activate | |
python3 -m pip install pipx | |
python3 -m pipx ensurepath | |
sudo iptables -A FORWARD -i wlan1 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT | |
sudo iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT | |
sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE | |
sudo sh -c "iptables-save > /etc/iptables.up.rules" | |
sudo nano /etc/rc.local | |
iptables-restore < /etc/iptables.up.rules | |
exit 0 | |
sudo sysctl -w net.ipv4.ip_forward=1 | |
sudo nano /etc/sysctl.conf | |
net.ipv4.ip_forward=1 | |
sudo cp /run/systemd/generator.late/isc-dhcp-server.service /etc/systemd/system | |
sudo nano /etc/systemd/system/isc-dhcp-server.service | |
[Service] | |
Restart=on-failure | |
RestartSec=5 | |
[Install] | |
WantedBy=multi-user.target | |
sudo systemctl daemon-reload | |
sudo systemctl disable isc-dhcp-server | |
sudo systemctl enable isc-dhcp-server | |
sudo nano /etc/dnsmasq.conf | |
interface=wlan0 | |
dhcp-range=192.168.42.2,192.168.42.20,255.255.255.0,24h | |
sudo systemctl start dnsmasq | |
sudo systemctl enable dnsmasq | |
sudo reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment