diff --git a/mitmAP.py b/mitmAP.py index 8d42fbb..5fc5d46 100644 --- a/mitmAP.py +++ b/mitmAP.py @@ -101,6 +101,8 @@ def append_file(path, s): #/DNSMASQ CONFIG #HOSTAPD CONFIG + print("[I] Backing up hostapd.conf...") + os.system("sudo cp /etc/hostapd/hostapd.conf /etc/hostapd/hostapd.conf.backup") ssid = input("[?] Please enter the SSID for the AP: ") while True: channel = input("[?] Please enter the channel for the AP: ") @@ -349,6 +351,9 @@ def append_file(path, s): os.system("sudo mv /etc/dnsmasq.conf.backup /etc/dnsmasq.conf > /dev/null 2>&1") print("[I] Deleting old '/etc/dnsmasq.hosts' file...") os.system("sudo rm /etc/dnsmasq.hosts > /dev/null 2>&1") + if os.path.isfile("/etc/hostapd/hostapd.conf.backup"): + print("[I] Restoring old hostapd...") + os.system("sudo mv /etc/hostapd/hostapd.conf.backup /etc/hostapd/hostapd.conf") print("[I] Removeing speed limit from " + ap_iface + "...") os.system("sudo wondershaper clear " + ap_iface + " > /dev/null 2>&1") print("[I] Flushing iptables rules...") @@ -400,6 +405,9 @@ def append_file(path, s): os.system("sudo mv /etc/dnsmasq.conf.backup /etc/dnsmasq.conf > /dev/null 2>&1") print("[I] Deleting old '/etc/dnsmasq.hosts' file...") os.system("sudo rm /etc/dnsmasq.hosts > /dev/null 2>&1") + if os.path.isfile("/etc/hostapd/hostapd.conf.backup"): + print("[I] Restoring old hostapd...") + os.system("sudo mv /etc/hostapd/hostapd.conf.backup /etc/hostapd/hostapd.conf") try: print("[I] Removeing speed limit from " + ap_iface + "...") os.system("sudo wondershaper clear " + ap_iface + " > /dev/null 2>&1") diff --git a/mitmAP_rpi.py b/mitmAP_rpi.py index bebb269..3c38e83 100644 --- a/mitmAP_rpi.py +++ b/mitmAP_rpi.py @@ -85,6 +85,8 @@ #/DNSMASQ CONFIG #HOSTAPD CONFIG + print("[I] Backing up hostapd.conf...") + os.system("sudo cp /etc/hostapd/hostapd.conf /etc/hostapd/hostapd.conf.backup") ssid = input("[?] Please enter the SSID for the AP: ") while True: channel = input("[?] Please enter the channel for the AP: ") @@ -324,6 +326,9 @@ os.system("sudo screen -S mitmap-driftnet -X stuff '^C\n'") if tshark_if == "y" or tshark_if == "": os.system("sudo screen -S mitmap-tshark -X stuff '^C\n'") + if os.path.isfile("/etc/hostapd/hostapd.conf.backup"): + print("[I] Restoring old hostapd...") + os.system("sudo mv /etc/hostapd/hostapd.conf.backup /etc/hostapd/hostapd.conf") # print("[I] Restoring old NetworkManager.cfg") # os.system("sudo mv /etc/NetworkManager/NetworkManager.conf.backup /etc/NetworkManager/NetworkManager.conf") # print("[I] Restarting NetworkManager...") @@ -390,6 +395,9 @@ os.system("sudo wondershaper clear " + ap_iface + " > /dev/null 2>&1") except: pass + if os.path.isfile("/etc/hostapd/hostapd.conf.backup"): + print("[I] Restoring old hostapd...") + os.system("sudo mv /etc/hostapd/hostapd.conf.backup /etc/hostapd/hostapd.conf") print("[I] Flushing iptables rules...") os.system("sudo iptables --flush") os.system("sudo iptables --flush -t nat")