Created
July 25, 2023 19:45
-
-
Save SamsungGalaxyPlayer/9fe423c693ab534e9e458ca108e5938d to your computer and use it in GitHub Desktop.
Get all Proton VPN IP addresses and export them into a CSV file
This file contains 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
import requests | |
import csv | |
response_data = requests.get('https://api.protonmail.ch/vpn/logicals') | |
response_json = response_data.json() | |
ip_list = [] | |
for server in response_json['LogicalServers']: | |
for server_info in server['Servers']: | |
exit_ip = server_info['ExitIP'] | |
ip_list.append(exit_ip) | |
with open('protonvpn_exit_ips.csv', mode='w', newline='') as file: | |
writer = csv.writer(file) | |
writer.writerows(zip(ip_list)) | |
num_ips = len(ip_list) | |
print(f"{num_ips} exit IPs exported to protonvpn_exit_ips.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Response to my own comment:
This script exports a list of extit server IPs for Proton VPN. So, this list could be used to block incoming connections to an internet resource from the users coming through the Proton VPN service. However, this list can't be used to block users on the LAN from connecting to Proton VPN because such a list needs to have entrance (or ingress) VPN servers, not exit (or egress) VPN servers.
I would love a hint on how to obtain a list of entrance (or ingress) VPN server IPs for Proton VPN.