#!/bin/bash
echo "$(tput setaf 1) _ ___ _______ ____ _ __ "
echo " | | / (_) ____(_) / __ \\(_)___ ___ ____ _____ ____ / /__ "
echo " | | /| / / / /_ / / / /_/ / / __ \/ _ \/ __ '/ __ \/ __ \/ / _ \\"
echo " | |/ |/ / / __/ / / / ____/ / / / / __/ /_/ / /_/ / /_/ / / __/"
echo " |__/|__/_/_/ /_/ /_/ /_/_/ /_/\___/\__,_/ .___/ .___/_/\___/ "
echo " $(tput sgr0) OWN the Network $(tput setaf 1)/_/ /_/$(tput sgr0) v2.1"
echo ""
echo ""
echo "Reset the setting of WiFi Pineapple - PC Tethering ...."
echo ""
echo "Only for reset the previous setting,"
echo "if you did not run the wp4.sh before, do NOT run this script."
echo "Otherwise, you cannot connect to the internet."
echo ""
echo "Your current iptables rules ....."
echo ""
iptables -L
echo ""
echo "It will DELETE all iptables rules (if any) ...."
echo ""
echo -n "Are you sure to run this script (Y/N) - [default - Y]? "
read doit
if [[ $doit == '' ]] || [[ $doit == 'Y' ]] || [[ $doit == 'y' ]]; then
route del -net 172.16.42.0 netmask 255.255.255.0
iptables -X
iptables -F
echo '0' > /proc/sys/net/ipv4/ip_forward
route -n
echo "Reset completed!"
echo ""
echo "If you do see any default gateway, you need to reboot your PC."
echo "Otherwise, you cannot access to the internet."
echo "It is because you did not run wp4.sh before."
else
echo ""
echo "Nothing to do, quit!"
fi