Skip to content

Instantly share code, notes, and snippets.

@j3lte
Forked from Dreyer/nordvpn.sh
Created February 8, 2023 12:16
Show Gist options
  • Save j3lte/97b4e6784d2463e2b073e3a61b74baf4 to your computer and use it in GitHub Desktop.
Save j3lte/97b4e6784d2463e2b073e3a61b74baf4 to your computer and use it in GitHub Desktop.
Check the status of a NordVPN connection from your shell.
#!/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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment