Last active
April 27, 2024 20:41
-
-
Save Dreyer/161b920f0d8300ed3bc750ae2f80c339 to your computer and use it in GitHub Desktop.
Check the status of a NordVPN connection from your shell.
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
#!/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" |
Updated for python 3
#!/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 -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"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the URL='https://api.nordvpn.com/vpn/check/full' is less accurate than the last url https://nordvpn.com/wp-admin/admin-ajax.php?action=get_user_info_data
thanks for sharing