Created
February 24, 2023 16:19
-
-
Save bjesus/1ab65c17233b3d63def86bcc83a2a873 to your computer and use it in GitHub Desktop.
Linux wifi iwd qr code generator for sharing ssid and passphrase
This file contains hidden or 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
#!/bin/bash | |
FILE=$(sudo find /var/lib/iwd -iname '*.psk' -type f -printf "%T+ %p\n" | sort | tail -1 | cut -d ' ' -f2-) | |
SSID=${FILE:13:-4} | |
PASS=$(sudo cat "$FILE" | grep Passphrase | cut -c 12-) | |
STRING="WIFI:S:$SSID;T:WPA;P:$PASS;;" | |
qrencode -t UTF8 "$STRING" | |
echo -e "SSID: \033[1m${SSID}\033[0m" | |
echo -e "Passphrase: \033[1m${PASS}\033[0m" |
Thanks for sharing this, helped me out quite a lot :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
requires
qrencode
, and well, usingiwd
.