我知道我可以通过
获得Wifi SSID/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | sed -e "s/^ *SSID: //p" -e d
但有没有办法获取当前正在使用的VPN名称?
答案 0 :(得分:5)
假设您指的是使用网络偏好设置注册的VPN服务,AppleScript,特别是系统事件'网络偏好设置套件将起作用:
tell application "System Events"
tell current location of network preferences
get name of every service whose (kind is greater than 11 and kind is less than 16) and connected of current configuration is true
end tell
end tell
如果您需要从shell访问此内容,osascript -e
是您的朋友(每行AppleScript一个-e
选项,请注意引用和转义 - 请参阅man osascript
)。