Skip to content

Instantly share code, notes, and snippets.

@bjesus
Created February 24, 2023 16:19
Show Gist options
  • Save bjesus/1ab65c17233b3d63def86bcc83a2a873 to your computer and use it in GitHub Desktop.
Save bjesus/1ab65c17233b3d63def86bcc83a2a873 to your computer and use it in GitHub Desktop.
Linux wifi iwd qr code generator for sharing ssid and passphrase
#!/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"
@bjesus
Copy link
Author

bjesus commented Feb 24, 2023

requires qrencode, and well, using iwd.

@J-MR-T
Copy link

J-MR-T commented Dec 23, 2023

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