Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Added backup and restore for old hostapd.conf #118

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions mitmAP.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: ")
Expand Down Expand Up @@ -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...")
Expand Down Expand Up @@ -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")
Expand Down
8 changes: 8 additions & 0 deletions mitmAP_rpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: ")
Expand Down Expand Up @@ -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...")
Expand Down Expand Up @@ -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")
Expand Down