Bring RoamSwitch's diagnostics straight into your own Mac or Linux app
RoamSwitchKit (Mac) and roamswitch-linux-kit (Linux) are free, open-source clients that let Swift / Rust code read directly the security diagnosis results computed by RoamSwitch itself. Without building your own ARP monitoring or port scanning, you can build “is the current network safe?” into your own app.
🔒 Why it's safe
- No setting changes: there is no API that changes settings, defenses or ports. It writes only when auditSecurityLogs and activeVulnScan update their own records.
- Fully local: it launches the bundled binary and communicates only over standard input and output. It sends no telemetry. The only thing that talks to the outside is run_npm_audit_signatures (the npm registry), which is disabled by default; everything else is 127.0.0.1 and pings to the gateway.
- Free and open source: MIT license.
One line in your package manager
Just add it to the dependencies in Package.swift. The prerequisites are macOS 12+, Swift 5.9+ and RoamSwitch 1.3.0 or later installed.
dependencies: [
.package(url: "https://github.com/lafine1211/RoamSwitchKit.git", from: "1.0.0")
]
Just add it to the dependencies in Cargo.toml. You need stable Rust (2021 edition, tokio async runtime) and an installation of RoamSwitch for Linux that includes the roamswitch-mcp binary.
[dependencies]
roamswitch-linux-kit = { git = "https://github.com/lafine1211/roamswitch-linux-kit", tag = "v0.1.0" }
Get diagnostics with a few simple methods
import RoamSwitchKit
let client = try RoamSwitchClient()
let report = try await client.securityReport()
print(report.score, report.grade)
let ports = try await client.exposedPorts()
for port in ports.ports where port.overallRisk == "high" {
print(port.processName, port.port)
}
let status = try await client.guardStatus()
print(status.activeSecurityLevelLabel, status.isCurrentNetworkTrusted)
let urlReport = try await client.auditURLSafety(url: "https://apple.com.login-verify.xyz")
print(urlReport.score, urlReport.riskLevel) // e.g. 20, "dangerous"
use roamswitch_linux_kit::RoamSwitchClient;
let client = RoamSwitchClient::new(None, None)?;
let report = client.security_report().await?;
println!("{} ({})", report.score, report.grade);
let ports = client.exposed_ports(false).await?;
for port in ports.ports.iter().filter(|p| p.overall_risk.as_deref() == Some("high")) {
println!("{} {}", port.process_name, port.port);
}
let status = client.guard_status().await?;
println!("{} {}", status.active_security_level_label, status.is_current_network_trusted);
let url_report = client.audit_url_safety("https://apple.com.login-verify.xyz").await?;
println!("{} {}", url_report.score, url_report.risk_level); // e.g. 20, "dangerous"
Methods
securityReport()
Runs a combined diagnosis of 23 items, including FileVault, SIP, Gatekeeper and externally exposed ports, and returns a score and improvement advice.
exposedPorts(includeLocalOnly:)
Lists all listening ports and returns audit results for those exposed externally, including whether each is a known dangerous service (such as Redis/MongoDB) or a local AI inference server (such as Ollama/LM Studio). On Mac, it sends one HTTP GET to 127.0.0.1 for each exposed port and checks the headers.
guardStatus()
Gets whether each guard is enabled, such as automatic unknown-port blocking, automatic ARP spoofing response, and the USB storage guard, along with the current protection level.
auditURLSafety(url:)
Give it a suspicious email link or shortened URL and it analyzes phishing scams, Unicode homograph spoofing, subdomains impersonating well-known brands and high-risk TLDs, entirely on the device (Zero Telemetry), and assigns a score.
Other methods
| Method | Summary |
|---|---|
auditSecurityLogs(hours:) | Aggregates recent security logs (Sudo authentication failures, SSH brute force, firewall blocks, and so on; on Mac also Gatekeeper and XProtect, on Linux also AppArmor and ClamAV) and returns them with secrets such as API keys and tokens masked. It also includes detection results for new patterns and frequency anomalies (statistical spikes). On Linux, when the journal could not be read, it does not treat 0 items as “nothing happened”; it sets journalReadComplete to false and puts the reason in journalError. |
activeVulnScan() | A non-destructive vulnerability check that targets only 127.0.0.1. Because it is a tool that sends network requests, it is disabled by default. On Mac it also lists the side effects of each check (sideEffects in probesRun, such as more than 5 requests to one port). Findings distinguish what was confirmed (confirmed) from cases where only the version is in the affected range (version_range_match). |
packageCveScan() | Checks installed packages (Homebrew / dpkg, dnf, and so on) against the local CVE map. It makes no network connections. If the list cannot be obtained, it sets complete to false. For Ubuntu (20.04 to 26.04), it checks only CVSS 7.0 and above that have a fixed version, so “no match” does not mean there are no CVEs. On Mac, results are ordered by severity and then EPSS (epss). For findings a person has accepted, it returns the count (acceptance); acceptance cannot be done through MCP. |
packageCveScanLanguages(watchedFolders:) | Checks dependency lockfiles for npm, PyPI, crates.io, and others against the same local CVE map. It makes no network connections at all. |
canaryStatus() | Returns the ransomware canary's decoy-file state plus up to the 50 most recent detected incidents. |
portAnomalyIncidents() | Returns the baseline status of the port anomaly guard, the ports currently auto-blocked, and up to the latest 50 incidents. Auto-blocked ports are a current state with no timestamp, and are distinct from the timestamped incident history. This distinction is written in the annotation field of the response. |
runtimeThreatStatus() | Returns whether an Air-Gap isolation triggered by XProtect malware detection has occurred, and the incident that triggered it. When investigating the reason for an Air-Gap, use this tool first. |
notificationHistory() | Returns the history of notifications RoamSwitch has sent (security log-audit anomalies, ClickFix detections, and the like) from the past 7 days, most recent first. |
Every return type's fields are documented as plain Swift declarations in the README on GitHub and in AGENTS.md.
security_report()
Runs a combined diagnosis of 31 items, including LUKS/dm-crypt disk encryption, UEFI Secure Boot and externally exposed ports, and returns a score and improvement advice.
exposed_ports(include_local_only)
Lists all listening ports and returns audit results for those exposed externally, including whether each is a known dangerous service (such as Redis/MongoDB) or a local AI inference server (such as Ollama/LM Studio). On Mac, it sends one HTTP GET to 127.0.0.1 for each exposed port and checks the headers.
guard_status()
Gets whether each guard is enabled, such as automatic unknown-port blocking, automatic ARP spoofing response, and the USB storage guard, along with the current protection level.
audit_url_safety(url)
Give it a suspicious email link or shortened URL and it analyzes phishing scams, Unicode homograph spoofing, subdomains impersonating well-known brands and high-risk TLDs, entirely on the device (Zero Telemetry), and assigns a score.
Other methods
| Method | Summary |
|---|---|
server_security_report() | Runs the Server Edition's 42-item profile (kernel hardening, container isolation, kernel CVE exposure, eBPF LSM) instead of the desktop client's audit. |
run_active_vuln_scan() | A non-destructive vulnerability check that targets only 127.0.0.1. Because it is a tool that sends network requests, it is disabled by default. On Mac it also lists the side effects of each check (sideEffects in probesRun, such as more than 5 requests to one port). Findings distinguish what was confirmed (confirmed) from cases where only the version is in the affected range (version_range_match). |
audit_secrets(text) | Detects leaked API keys and private keys in text, a file, or a directory tree (matches are masked in the output). |
audit_security_logs(hours) | Aggregates recent security logs (Sudo authentication failures, SSH brute force, firewall blocks, and so on; on Mac also Gatekeeper and XProtect, on Linux also AppArmor and ClamAV) and returns them with secrets such as API keys and tokens masked. It also includes detection results for new patterns and frequency anomalies (statistical spikes). On Linux, when the journal could not be read, it does not treat 0 items as “nothing happened”; it sets journalReadComplete to false and puts the reason in journalError. |
get_app_help(query, topic) | Searches, on the device, the official knowledge base covering the specifications, internal behavior, all notification messages, and troubleshooting of every RoamSwitch feature, and returns explanations and advice. |
quarantine_status() | Returns the malware quarantine vault's contents: original path, detected threat name, quarantine time and size. |
canary_status() | Returns the ransomware canary's decoy-file state plus up to the 50 most recent detected incidents. |
package_cve_scan() | Checks installed packages (Homebrew / dpkg, dnf, and so on) against the local CVE map. It makes no network connections. If the list cannot be obtained, it sets complete to false. For Ubuntu (20.04 to 26.04), it checks only CVSS 7.0 and above that have a fixed version, so “no match” does not mean there are no CVEs. On Mac, results are ordered by severity and then EPSS (epss). For findings a person has accepted, it returns the count (acceptance); acceptance cannot be done through MCP. |
package_cve_scan_languages(watched_folders) | Checks dependency lockfiles for npm, PyPI, crates.io, and others against the same local CVE map. It makes no network connections at all. |
verify_fim() | Re-hashes the critical system files and compares them with the baseline to check for tampering. When run as root, the result gains recentIntrusionContext. For each recent change, it contains the process that made the change and the SSH login it belongs to (or the reason it could not be determined). |
get_port_anomaly_incidents() | Returns the baseline status of the port anomaly guard, the ports currently auto-blocked, and up to the latest 50 incidents. Auto-blocked ports are a current state with no timestamp, and are distinct from the timestamped incident history. This distinction is written in the annotation field of the response. |
get_ebpf_incidents() | Returns the current isolation state of the eBPF runtime guard and the incident history of why it was triggered. On the Server Edition, each record gains the time from detection to action (in milliseconds: detect_to_receive_ms, receive_to_action_ms, detect_to_action_ms), and the state of the Falco heartbeat (heartbeat) is also returned. |
get_ssh_guard_incidents(), which returns the state and records of the SSH brute-force guard (Server Edition, and Client Edition when sshd is running), exists in RoamSwitch's internal crate (roamswitchkit), but is not yet included in the published roamswitch-linux-kit.
Every return type's fields are documented as plain Rust declarations in the README on GitHub.
What you can build with it
The examples below use Swift (macOS). roamswitch-linux-kit (Linux) offers the same methods (in snake_case) for the same result.
Sync & backup apps
Pause background sync automatically when connected to an untrusted network.
let status = try await client.guardStatus()
if !status.isCurrentNetworkTrusted {
syncEngine.pauseBackgroundSync()
}
Password managers
Shorten the auto-lock timeout on untrusted networks, adapting behavior to the active protection level.
let status = try await client.guardStatus() let lockTimeout: TimeInterval = status.isCurrentNetworkTrusted ? 300 : 30 vault.setAutoLockTimeout(lockTimeout)
Developer tools & automation
Warns when a development server or local AI inference server (Ollama/LM Studio, etc.) starts listening on 0.0.0.0. Use Shortcuts and similar tools to build workflows that depend on how much the network is trusted.
let ports = try await client.exposedPorts(includeLocalOnly: false)
for port in ports.ports where [3000, 5173, 8000, 11434, 1234].contains(port.port) {
print("⚠️ Dev/AI server exposed on port \(port.port)")
}
Pre-checking links in email & chat apps
Automatically scan links in incoming messages before they're displayed, and warn only about the dangerous ones.
let result = try await client.auditURLSafety(url: link)
if result.riskLevel == "dangerous" || result.riskLevel == "suspicious" {
showWarningBanner(for: link, score: result.score)
}
Right-click menu & Shortcuts safety check
Wire it into Finder’s Services menu or macOS Shortcuts so a copied URL can be checked in one action.
// Called from a macOS Shortcuts (App Intent) or Services menu handler
let report = try await client.auditURLSafety(url: pasteboardURL)
return "\(report.riskLevel.uppercased()) (\(report.score)/100)"
IT asset management & MDM dashboards
Collect scores from multiple Macs in your company, list them on an admin dashboard, and raise alerts.
let report = try await client.securityReport() try await mdmAPI.reportScore(deviceID: deviceID, score: report.score, grade: report.grade)
About the SDKs
Q. Is it free to use?
A. Yes. Both RoamSwitchKit (macOS) and roamswitch-linux-kit (Linux) are published for free under the MIT License. They require RoamSwitch itself (the diagnostic engine) to be installed, but the SDKs themselves cost nothing.
Q. Can it change a user's settings?
A. No. There is no API that changes settings, defenses, ports or devices. Only two write: auditSecurityLogs and activeVulnScan, and they only update RoamSwitch's own record files. An embedded app cannot change RoamSwitch's protection settings without the user's permission.
Q. What happens if RoamSwitch isn't installed?
A. The corresponding error is returned (Mac: RoamSwitchClientError.appNotInstalled / Linux: RoamSwitchClientError::AppNotInstalled). In that case, we recommend handling it gracefully, for example by hiding the feature.
Q. What if I want to bundle and redistribute RoamSwitch itself with my product?
A. The SDK integration (the content of this page) is free to use without restriction. Bundling or redistributing RoamSwitch itself requires an OEM license. Please contact us via the OEM and partner integration page.