-
-
Save j3lte/97b4e6784d2463e2b073e3a61b74baf4 to your computer and use it in GitHub Desktop.
Check the status of a NordVPN connection from your shell.
This file contains hidden or 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
| #!/bin/bash | |
| URL='https://nordvpn.com/wp-admin/admin-ajax.php?action=get_user_info_data' | |
| JSON=$(curl -s $URL) | |
| printf "\n" | |
| #echo $JSON | python -m json.tool | |
| echo $JSON | python -c 'import sys, json; data = json.load(sys.stdin); print "IP: %s (%s)\nStatus: %s" % (data["ip"], data["isp"], "\033[32mProtected" if data["status"] is True else "\033[31mUnprotected");' | |
| printf "\n" |
This file contains hidden or 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
| # | |
| # Automatically reconnect when disconnected from the VPN. | |
| # | |
| # You don't need this if you're using the NordVPN application. | |
| # This is a utility for using native VPN connection settings on MacOS. | |
| # | |
| on idle | |
| tell application "System Events" | |
| tell current location of network preferences | |
| set myConnection to the service "WorkVPN" | |
| if myConnection is not null then | |
| if current configuration of myConnection is not connected then | |
| connect myConnection | |
| end if | |
| end if | |
| end tell | |
| return 120 | |
| end tell | |
| end idle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment