Merge branch 'master' of github.com:research/chocolate

This commit is contained in:
James Kasten
2012-09-04 15:03:45 -04:00
@@ -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)