mirror of
https://github.com/certbot/certbot.git
synced 2026-06-06 07:12:54 -04:00
and my cached-consensus exit geography parser
This commit is contained in:
parent
2731f85032
commit
d6d55e159b
3 changed files with 30 additions and 0 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -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
|
||||
|
|
|
|||
1
pygeoip
Submodule
1
pygeoip
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 2bd928e6b3af32bfd40091cfcdbba2903eadb418
|
||||
26
server-ca/sni_challenge/exit-geography.py
Normal file
26
server-ca/sni_challenge/exit-geography.py
Normal file
|
|
@ -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)
|
||||
Loading…
Reference in a new issue