Last active
March 18, 2024 16:48
-
-
Save kvbik/2f90a73d3acd9fb1ef4d2a45c5f9cfe8 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# git clone https://gist.github.com/kvbik/2f90a73d3acd9fb1ef4d2a45c5f9cfe8 | |
# current macos wifi connection, thx to | |
# https://apple.stackexchange.com/questions/81221/how-do-i-get-wi-fi-info-from-within-terminal | |
W=$( | |
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | \ | |
sed -n '/^[ ]*SSID: / s/^[ ]*SSID: //p' | |
) | |
# current macos wifi password, thx to | |
# https://www.labnol.org/software/find-wi-fi-network-password/28949/ | |
P=$( | |
security find-generic-password -wa "$W" | |
) | |
echo "$W" >/dev/stderr | |
echo "$P" >/dev/stderr | |
# you really want to avoid the \n in the QR code | |
echo -n "$P" | qr # pip install qrcode |
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
security find-generic-password -wa "$( | |
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | \ | |
sed -n '/^[ ]*SSID: / s/^[ ]*SSID: //p' | |
)" | tee /dev/stderr | head -n1 | while read pwd; do echo -n $pwd | qr; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment