mirror of
https://github.com/certbot/certbot.git
synced 2026-01-26 07:41:33 +03:00
organize exit nodes by country
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import pygeoip
|
||||
import pygeoip, random
|
||||
geoip = pygeoip.GeoIP('GeoIP.dat', pygeoip.MEMORY_CACHE)
|
||||
|
||||
allrouters = []
|
||||
exits = []
|
||||
by_country = {}
|
||||
|
||||
for L in open("/var/lib/tor/cached-consensus"):
|
||||
if L.startswith("s "):
|
||||
@@ -17,10 +18,7 @@ for L in open("/var/lib/tor/cached-consensus"):
|
||||
|
||||
duplicates = set(e[0] for e in exits if allrouters.count(e[0]) != 1)
|
||||
|
||||
print "All the good stable exits with unique names:"
|
||||
print
|
||||
|
||||
for exit in exits:
|
||||
name, ip, flags = exit
|
||||
if name not in duplicates:
|
||||
print name, ip, geoip.country_code_by_addr(ip)
|
||||
by_country.setdefault(geoip.country_code_by_addr(ip), []).append(name)
|
||||
|
||||
Reference in New Issue
Block a user