Hello! I am fairly new to both python and Linux so forgive me if my code is bad or this is in the wrong Forum.
My Problem:
I am on a Kali Linux Virtual Machine. I have a list of NordVPN accounts with password in the form email:password. Since NordVPN connections only work when under six people are using the account at once and the accounts are public and are being shared, I would like to write a script that:
I am not 100% sure how to do this. I have written a script that looks like this:
Thanks for your help!
My Problem:
I am on a Kali Linux Virtual Machine. I have a list of NordVPN accounts with password in the form email:password. Since NordVPN connections only work when under six people are using the account at once and the accounts are public and are being shared, I would like to write a script that:
- Tries to login with the Email and Password (Goes to the next one if the password is wrong)
- Tries to connect to a server in a specific country. If the connection fails or takes too long, it goes to the next account.
- If the connection was a success, stop the program and print the used Email with password.
I am not 100% sure how to do this. I have written a script that looks like this:
import subprocess
import time
def checkConnection():
cmd = ['nordvpn', 'c']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
o, e = proc.communicate()
if "Connected" in o.decode('ascii'):
return True
else:
return False
def tryConnection():
cmd = ['nordvpn', 'c']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
time.sleep(2)
if checkConnection() == True:
print("Sucessfull Connection with:\n" + email +" " +password)
else:
print("Failed")
cmd = ['nordvpn', 'logout']
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print("Logged out")
def loginWithPassword(email, password):
cmd = ['nordvpn', 'login', '-u', email, '-p', password]
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
print(proc)
o, e = proc.communicate()
if "is not correct" in o.decode('ascii'):
print("Wrong password")
else:
tryConnection()
f = open("list.txt", "r")
for line in f:
username = line.split(":")[0]
password = line.split(":")[1]
print("--------------------------\nUsername "+username+", Password "+password)
loginWithPassword(username, password)But the connection just fails for every login. It could be a possibility that I have just set up NordVPN wrong, but I can manually login via the terminal.Thanks for your help!
