-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvpndetector.py
36 lines (28 loc) · 1.11 KB
/
vpndetector.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import requests
import json
def get_ip_address():
data = str(requests.get('http://checkip.dyndns.com/').text)
return data.split(': ')[-1].split('<')[0]
def is_vpn(ip_address):
API_key = "2c1294b9924b42fe9eba83fcf032374d" # API key (you can change it with yours )
response = requests.get(f"https://vpnapi.io/api/{ip_address}?key={API_key}")
data = json.loads(response.text)
return data["security"]["vpn"]
def print_header(title):
print(f"\n{'=' * len(title)}\n{title}\n{'=' * len(title)}\n")
while True:
print_header("VPN IP Address CHECKER")
ip_address = get_ip_address()
print(f"IP Address: {ip_address}")
vpn_status = is_vpn(ip_address)
if vpn_status:
print("This IP address is using a VPN. \U00002705")
else:
print("This IP address is not using a VPN. \U0000274C")
choice = input("\nChoose an option:\n1 - Check again \U0001F504\n2 - Close \U0001F44B\noption = ")
if choice == '1':
continue
elif choice == '2':
break
else:
print("\nInvalid choice. Please try again. \U000026A0")