Created
May 20, 2023 10:59
-
-
Save GTRekter/5857aded1c4f7f5b0114600ff8b1867a to your computer and use it in GitHub Desktop.
This script automates NordVPN connection to different countries and performs nslookup for a specified endpoint. It checks if NordVPN is installed and logged in, prompts for installation if needed, and asks for the endpoint for nslookup.
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 | |
# Check if NordVPN is installed | |
if ! command -v nordvpn &> /dev/null; then | |
echo "NordVPN is not installed. Installing..." | |
# Determine the installation command based on the system | |
if command -v apt-get &> /dev/null; then | |
sudo apt-get install nordvpn | |
elif command -v yum &> /dev/null; then | |
sudo yum install nordvpn | |
else | |
echo "Unsupported package manager. Please install NordVPN manually." | |
exit 1 | |
fi | |
fi | |
if ! nordvpn account &> /dev/null; then | |
echo "NordVPN is not logged in. Logging in..." | |
read -p "Enter your NordVPN username: " username | |
read -sp "Enter your NordVPN password: " password | |
nordvpn login --username "$username" --password "$password" | |
fi | |
# Prompt for the endpoint for nslookup | |
read -p "Enter the endpoint for nslookup: " endpoint | |
countries=$(nordvpn countries) | |
read -ra countryArray <<< "$countries" | |
for country in "${countryArray[@]}"; do | |
echo "$country" | |
nordvpn connect "$country" | |
nslookup "$endpoint" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment