Skip to content

Commit

Permalink
Solved issue iiitl#1
Browse files Browse the repository at this point in the history
I have written a simple Bash script that can be used on a macOS system to extract the SSID (Wi-Fi username) of the currently connected Wi-Fi network. This script utilises the airport utility that is included with macOS but is located within a framework, so its path is a bit lengthy.
  • Loading branch information
satyajit1206 authored Mar 15, 2024
1 parent 96850b2 commit b6c840e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/wifi-ssid
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# Extract the wifi username (SSID)
# Refer: "iw dev wlan0 link" command output for this
SSID=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID:/ {print substr($0, index($0, $2))}')

echo "Currently connected Wi-Fi SSID: $SSID"

0 comments on commit b6c840e

Please sign in to comment.