Created
October 22, 2017 19:23
-
-
Save seamustuohy/61f01ff199a465f2a5036c2ac6d24685 to your computer and use it in GitHub Desktop.
WPA-PSK Bash Golf
This file contains 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
# Bash Golf example that gets the WPA-PSK key from the WiFi network you are currently connected to. | |
# Beyond the basics (cut & grep) it uses network manager's CLI and python3 | |
c='cut -d: -f2';g=grep;a=$(nmcli -t -f ACTIVE,SSID d w l|$g -E "^yes:"|$c);p=$(nmcli -s -t c show $a|$g psk:|$c);python3 -c "from hashlib import pbkdf2_hmac as p; from binascii import hexlify as h;print('PSK',h(p('sha1', b'$p', b'$a', 4096, dklen=32)).decode('ascii'))" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment