{"id":31299232,"url":"https://github.com/fjh658/get-ssid","last_synced_at":"2026-06-23T03:31:20.881Z","repository":{"id":314976257,"uuid":"1057601544","full_name":"fjh658/get-ssid","owner":"fjh658","description":"get-ssid — Read Wi‑Fi SSID on macOS *without* Location (TCC)","archived":false,"fork":false,"pushed_at":"2026-02-24T22:30:34.000Z","size":155,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-02-25T03:33:51.547Z","etag":null,"topics":["getssid","mac","macos","macos26","ssid"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fjh658.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-16T00:44:52.000Z","updated_at":"2026-02-24T22:30:37.000Z","dependencies_parsed_at":"2025-09-16T02:02:13.096Z","dependency_job_id":"96387341-27f9-4dc9-8e1f-2af73617bc73","html_url":"https://github.com/fjh658/get-ssid","commit_stats":null,"previous_names":["fjh658/get-ssid"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fjh658/get-ssid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjh658%2Fget-ssid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjh658%2Fget-ssid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjh658%2Fget-ssid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjh658%2Fget-ssid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fjh658","download_url":"https://codeload.github.com/fjh658/get-ssid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjh658%2Fget-ssid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34674702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["getssid","mac","macos","macos26","ssid"],"created_at":"2025-09-25T00:10:42.796Z","updated_at":"2026-06-23T03:31:20.872Z","avatar_url":"https://github.com/fjh658.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# get-ssid — Read Wi‑Fi SSID on macOS *without* Location (TCC)\n\n**English** | [中文](./README_zh.md)\n\n\u003e 🧩 **Goal**: Print the current Wi‑Fi SSID on macOS 11+ (incl. “macOS 26”) **without** Location permission (TCC), and without Location‑gated CLIs.\n\n---\n\n## Overview ✨\n\nOn modern macOS, many SSID sources are gated by **Location** permission (TCC). With Location **off**, tools will hide or refuse the SSID. **get‑ssid** first tries non-Location CoreWLAN/IORegistry paths, then (if needed) infers the SSID by correlating the current network environment with the **system known‑networks** database.\n\n**Highlights**  \n- No CoreLocation, no external commands.  \n- Uses CoreWLAN (live/profile), IORegistry, and SystemConfiguration (DHCP/Router).  \n- known‑networks plist is a last resort and may require `sudo` if unreadable.\n\n---\n\n## Why the usual tools fail 🔎\n\n### 1) `airport` (legacy Apple80211 tool)\n```bash\n/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -i\n\nzsh: no such file or directory: /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport\n```\n- ❌ **Key issue**: The legacy path/binary is removed or relocated on modern macOS; even where an `airport` wrapper exists, SSID disclosure is typically gated by Location/TCC.\n\n### 2) `networksetup -getairportnetwork en0`\n```bash\n/usr/sbin/networksetup -getairportnetwork en0\nYou are not associated with an AirPort network.\n```\n- ❌ **Key issue**: With Location off, the underlying API refuses to disclose association/SSID and returns a generic *not associated*, even when you are connected.\n\n### 3) `wdutil info` (Wi‑Fi diagnostics)\n```bash\nsudo wdutil info\n…\nWIFI\n  Interface Name : en0\n  Power          : On\n  Op Mode        : STA\n  SSID           : \u003credacted\u003e\n  BSSID          : \u003credacted\u003e\n```\n- ❌ **Key issue**: Diagnostic tooling **redacts** SSID without Location consent.\n\n### 4) `system_profiler SPAirPortDataType -json`\n```bash\n/usr/sbin/system_profiler SPAirPortDataType -detailLevel basic -json\n{\n  \"SPAirPortDataType\" : [\n    {\n      \"spairport_airport_interfaces\" : [\n        {\n          \"_name\" : \"en0\",\n          …\n          \"spairport_current_network_information\" : {\n            \"_name\" : \"\u003credacted\u003e\"\n```\n- ❌ **Key issue**: `system_profiler` respects privacy defaults and **redacts** the SSID when Location is off.\n\n---\n\n## How it works 🧠\n\n- **Default path (current macOS):**  \n  1) CoreWLAN live association (`CWInterface.ssid()`) when available.  \n  2) CoreWLAN profile fallback (`networkProfiles`).  \n  3) Interface-scoped IORegistry SSID keys (`IO80211SSID_STR` / `IO80211SSID` / `SSID_STR`).  \n  4) Last resort: correlate SystemConfiguration (DHCP/Router) with `/Library/Preferences/com.apple.wifi.known-networks.plist`.\n- **known-networks stage only:** score candidates and break ties by **most recent association timestamp**.\n- **When CoreWLAN is unavailable:** direct fallback to interface-scoped IORegistry lookup.\n- Priority policy: keep default execution on non-privileged paths; use known-networks only as a compatibility fallback when needed.\n\n---\n\n## Build ⚙️\n\n\u003e Requires Xcode Command Line Tools; source file: `get_ssid.swift`\n\n```bash\n# Recommended: build universal binary via Makefile\nmake universal\n\n# Run tests (unit + integration)\nmake test\n```\n\n---\n\n## 🍺 Homebrew Tap Install\n\nHomebrew install uses the prebuilt package in `dist/` and does not compile on the end-user machine.\n\nTap this repository locally:\n\n```bash\nbrew tap fjh658/get-ssid /path/to/get-ssid\nbrew install get-ssid\n```\n\nInstall from GitHub tap:\n\n```bash\nbrew tap fjh658/get-ssid https://github.com/fjh658/get-ssid.git\nbrew install get-ssid\n```\n\nRefresh prebuilt package before release:\n\n```bash\nmake package\n```\n\n`make package` also refreshes `Formula/get-ssid.rb` from `Formula/get-ssid.rb.tmpl`, injecting the current version (from `get_ssid.swift`) and tarball `sha256`.\n\n---\n\n## Install \u0026 Privileges 📦\n\nFor Homebrew installs, run `get-ssid` directly.\nAs long as current macOS API behavior remains unchanged, `sudo` is not required.\n\nOnly when you explicitly need known‑networks fallback and the system plist is unreadable to the current user, retry once with `sudo`:\n\n```bash\nget-ssid en0\n# If fallback is needed:\nsudo get-ssid en0\n```\n\n---\n\n## Usage 🚀\n\n```bash\n# Default: use the active Wi-Fi service\nget-ssid\n# MyWiFi-5G\n\n# Strictly bind to a specific interface (e.g., en0)\nget-ssid en0\n# MyWiFi-5G\n\n# Help / Version\nget-ssid --help\nget-ssid --version\n```\n\n**Behavior**  \n- Explicit non‑Wi‑Fi interface in strict mode exits `2` with `error: interface '\u003ciface\u003e' is not a Wi-Fi interface (strict mode)`.  \n- A Wi‑Fi interface that is not associated prints `Unknown (not associated)` and exits `0` (not an error).  \n- Non‑existent interface → exit `3`.  \n- Usage error → exit `2`.\n\n**Exit codes**\n| Code | Meaning                               |\n|-----:|----------------------------------------|\n| 0    | Success (incl. “Unknown …”)           |\n| 1    | Internal safety failure                |\n| 2    | Usage error                            |\n| 3    | Interface not found (when explicit)    |\n\n---\n\n## Security \u0026 Privacy 🔐\n\n- Open the system plist with **`O_NOFOLLOW`** and verify ownership; **drop effective privileges** immediately after reading.  \n- Never parse untrusted paths; prefer hardcoded absolute paths.  \n- Consider sandboxing when distributing.\n\n---\n\n## Limitations ⚠️\n\n- These limits apply only when `networkProfiles`/IORegistry did not yield an SSID and the tool falls back to known‑networks correlation.  \n- In that fallback stage, if the network was **never saved** to system known‑networks, or DHCP/Router signals are ambiguous, inference may fail.  \n- Apple may change plist formats/fields in future releases, which would affect this fallback path.\n\n---\n\n## License 📝\n\nMIT — keep copyright and license.\n\n---\n\n## Acknowledgements 🙏\n\n- Apple SystemConfiguration, IOKit, and the macOS Wi‑Fi stack.  \n- Community research on Wi‑Fi diagnostics \u0026 known‑networks internals.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjh658%2Fget-ssid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffjh658%2Fget-ssid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjh658%2Fget-ssid/lists"}