Last active
October 17, 2017 12:41
-
-
Save harukaeru/b2e09fb8f8eb5fc05890f4f45fdce130 to your computer and use it in GitHub Desktop.
Connect to VPN on Mac OS X (10.13)
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
current_network_name=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}') | |
if [ $current_network_name == "ICHINEN-PC_Network" ]; then # You should replace this Network name with your own. | |
VPN="8EEFE99B-582D-4E3E-B08B-F40030C4BB39" # You can get this VPN name from "scutil --nc list" | |
if scutil --nc status "$VPN" | grep -q Connected; then | |
scutil --nc stop "$VPN" | |
else | |
scutil --nc start "$VPN" --secret vpn # this 'secret' is depended of your environment. | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment