mirror of
https://github.com/certbot/certbot.git
synced 2026-07-27 08:09:10 +02:00
and my cached-consensus exit geography parser
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
[submodule "m3crypto"]
|
||||
path = m3crypto
|
||||
url = git@github.com:research/m3crypto.git
|
||||
[submodule "pygeoip"]
|
||||
path = pygeoip
|
||||
url = https://github.com/appliedsec/pygeoip.git
|
||||
|
||||
Submodule
+1
Submodule pygeoip added at 2bd928e6b3
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import pygeoip
|
||||
geoip = pygeoip.GeoIP('GeoIP.dat', pygeoip.MEMORY_CACHE)
|
||||
|
||||
allrouters = []
|
||||
exits = []
|
||||
|
||||
for L in open("/var/lib/tor/cached-consensus"):
|
||||
if L.startswith("s "):
|
||||
flags = L.strip().split()
|
||||
if "Exit" in flags and "BadExit" not in flags and "Running" in flags and "Valid" in flags and "Stable" in flags:
|
||||
exits.append((router[1], router[6], flags))
|
||||
if L.startswith("r "):
|
||||
router = L.strip().split()
|
||||
allrouters.append(router[1])
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user