Skip to content

Instantly share code, notes, and snippets.

@SamsungGalaxyPlayer
Created July 25, 2023 19:45
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamsungGalaxyPlayer/9fe423c693ab534e9e458ca108e5938d to your computer and use it in GitHub Desktop.
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
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")
@rozhasi
Copy link

rozhasi commented Mar 25, 2024

The list of IPs that is compiled by this script doesn't seem to include server IPs used for a free ProtonVPN servers. I've had this script import a list of over 4,000 IPs (with some duplicates). Then, I removed the duplicates via the Excel data tool, saved it as CSV and imported it into my firewall to block traffic to every IP in this list. However, the free version of ProtonVPN was able to connect without any difficulty.

Is there a way to get a list of free ProtonVPN servers? I need this to block my child from bypassing content-filtering that I configured using DNS filtering. By using a free ProtonVPN account he easily defeats any parental controls that I try to implement. All he needs is a free version of ProtonVPN with a free account that any child can open.

@rozhasi
Copy link

rozhasi commented Mar 25, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment