Nord VPN – Python automatic location switcher

The following will automatically switch Nord VPN locations after a set period of time. The prerequisite of this script is Nord VPN must be installed on your machine; the script will check your machine automatically for the Nord program files.

In the script we create a list which contains all Nord VPN server locations. Then making use of the ‘random’ library in Python we can have the script select a random location each time and connect to the relevant server.

Full source code for this project can be found below:

from nordvpn_connect import initialize_vpn, rotate_VPN, close_vpn_connection
import time
import random

Locations =['New Zealand', 'Brisbane', 'Sydney', 'Melbourne', 'Adelaide', 'Perth', 'Japan', 'South Korea', 'Indonesia',
'Vietnam', 'Thailand', 'India', 'Singapore', 'Malaysia', 'Hong Kong', 'Taiwan', 'South Africa', 'Georgia',
'Turkey', 'Cyprus', 'Israel', 'Ukraine', 'Moldova', 'Romania', 'Bulgaria', 'Greece', 'North Macedonia',
'Albania', 'Serbia', 'Hungary', 'Slovakia', 'Poland', 'Lithuania', 'Latvia', 'Estonia', 'Finland', 'Sweden',
'Norway', 'Denmark', 'Croatia', 'Sloveniea', 'Austria', 'Czech Republic', 'Berlin', 'Frankfurt', 'Itlay', 'Switzerland',
'Luxembourg', 'Belgium', 'Netherlands', 'Marseille', 'Paris', 'Spain', 'Portugal', 'London', 'Manchester', 'Edinburgh',
'Glasgow', 'Ireland', 'Iceland', 'Chile', 'Argentina', 'Brazil', 'Mexico', 'Miami', 'Los Angeles', 'San Francisco',
'Seattle', 'Salt Lake City', 'Phoenix', 'Denver', 'Dallas', 'Kansas City', 'Atlanta', 'Saint Louis', 'Chicago',
'Charlotte', 'Manassas', 'New York', 'Buffalo', 'Toronto', 'Montreal', 'Vancouver']

while 1 == 1:
    Location = random.choice(Locations)
    settings = initialize_vpn(Location)

Leave a Reply