Last active
May 18, 2017 19:00
-
-
Save jordan-wright/6531867 to your computer and use it in GitHub Desktop.
Tor Consensus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<snip> | |
r IviazAsdNL AASW0qAJEUE0tk2UHR7BHiLUzno tILb+kHI/szC4u467eg/Z4G8UEo 2013-09-11 23:00:49 213.127.162.10 3074 0 | |
s Exit Named Running Valid | |
v Tor 0.2.4.17-rc | |
w Bandwidth=5 | |
p accept 80,443 | |
r metroholografix ACEhJSRnU4ydobwjeJl+ZGKYFPY 9fsNMx/fO+VW3tn43n9f+KWy5Hc 2013-09-11 17:10:09 46.4.253.194 9001 9030 | |
s Fast Guard Named Running Stable V2Dir Valid | |
v Tor 0.2.3.25 | |
w Bandwidth=515 | |
p reject 1-65535 | |
r Firescout3 ACdmNMWH4Sks7h80SO4VIQVgHlU rWasoCBGxYrRTvDpp5jl6TG8vFw 2013-09-11 10:12:39 83.246.143.86 443 9030 | |
s Fast Running V2Dir Valid | |
v Tor 0.2.3.25 | |
w Bandwidth=100 | |
p reject 1-65535 | |
<snip> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.getJSON('https://onionoo.torproject.org/details', function(data){ | |
$.each(data.relays, function(idx, relay) | |
{ | |
// Add marker on a map for the relay | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>TorMap - Jordan</title> | |
<script src="js/jquery.min.js"></script> | |
<script src="js/jquery-jvectormap-1.2.2.min.js"></script> | |
<script src="js/jquery-jvectormap-world-mill-en.js"></script> | |
<link rel="stylesheet" media="all" href="css/jquery-jvectormap-1.2.2.css"/> | |
</head> | |
<body style="margin:0px;"> | |
<div style="height:100%;width:100%" id="tor_map"></div> | |
<script> | |
$(function(){ | |
$('#tor_map').vectorMap({ | |
map: 'world_mill_en', | |
scaleColors: ['#C8EEFF', '#0071A4'], | |
normalizeFunction: 'polynomial', | |
hoverOpacity: 0.7, | |
hoverColor: false, | |
markerStyle: { | |
initial: { | |
fill: '#cc6600', | |
stroke: '#222222', | |
r: 2 | |
} | |
}, | |
backgroundColor: '#222222', | |
markers: [ | |
] | |
}); | |
map = $('#tor_map').vectorMap('get', 'mapObject'); | |
$.getJSON('https://onionoo.torproject.org/details', function(data){ | |
$.each(data.relays, function(idx, relay) | |
{ | |
map.addMarker(relay.or_addresses[0], {'latLng' : [relay.latitude, relay.longitude], "name" : relay.or_addresses[0]}); | |
}); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygeoip | |
geo = pygeoip.GeoIP('GeoLiteCity.dat') | |
... <snip> ... | |
relay = { ... } | |
relay = dict(relay.items() + geo.record_by_addr(relay['ip']).items()) | |
relays['relays'].append(relay) | |
<snip> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"relays_published":"2013-09-13 03:00:00", | |
"relays":[ | |
{"nickname":"Unnamed", | |
"fingerprint":"A71D02ADB6576B631B09B030BC8A4D37A7B2A246", | |
"or_addresses":["93.31.114.107:443"], | |
"dir_address":"93.31.114.107:9030", | |
"last_seen":"2013-09-12 18:00:00", | |
"first_seen":"2013-09-12 18:00:00", | |
"last_changed_address_or_port":"2013-09-12 18:00:00", | |
"running":false, | |
"flags":["Running","V2Dir","Valid"], | |
"country":"fr", | |
"latitude":45.7751, | |
"longitude":4.8271, | |
"country_name":"France", | |
"region_name":"Rhone-Alpes", | |
"city_name":"Lyon", | |
"as_number":"AS15557", | |
"as_name":"Societe Francaise du Radiotelephone S.A", | |
"consensus_weight":20, | |
"host_name":"107.114.31.93.rev.sfr.net", | |
"exit_policy_summary":{"reject":["1-65535"]}, | |
"last_restarted":"2013-09-12 17:39:41", | |
"bandwidth_rate":5242880, | |
"bandwidth_burst":10485760, | |
"observed_bandwidth":36864, | |
"advertised_bandwidth":36864, | |
"exit_policy":[ | |
"reject *:*" | |
], | |
"platform":"Tor 0.2.3.25 on Windows 7" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import re | |
import json | |
relays = {'relays' : []} | |
# We pick a random directory authority, and pull down the consensus | |
consensus = requests.get('http://82.94.251.203/tor/status-vote/current/consensus').text | |
# Then, we parse out the IP address, nickname, and flags using a regular expression | |
regex = re.compile('''^r\s(.*?)\s(?:.*?\s){4}(.*?)\s.*?\ns\s(.*?)\n''', re.MULTILINE) | |
# Find all the matches in the consenses | |
# matches = regex.finditer(consensus) | |
for record in regex.finditer(consensus): | |
# For each record, create a dictionary object for the relay | |
relay = { | |
'nickname' : record.group(1), | |
'ip' : record.group(2), | |
'type' : 'exit' if 'Exit' in record.group(3) else 'normal' | |
} | |
# And append it to the master list | |
relays['relays'].append(relay) | |
open('tor_relays.txt','w').write(json.dumps(relays, indent=4)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"relays": [ | |
{ | |
"city": "", | |
"region_name": "", | |
"ip": "213.127.162.10", | |
"area_code": 0, | |
"time_zone": "Europe/Amsterdam", | |
"dma_code": 0, | |
"metro_code": null, | |
"country_code3": "NLD", | |
"country_name": "Netherlands", | |
"postal_code": "", | |
"longitude": 5.75, | |
"country_code": "NL", | |
"type": "exit", | |
"latitude": 52.5, | |
"nickname": "IviazAsdNL", | |
"continent": "EU" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"relays": [ | |
{ | |
"ip": "213.127.162.10", | |
"nickname": "IviazAsdNL", | |
"type": "exit" | |
}, | |
{ | |
"ip": "46.4.253.194", | |
"nickname": "metroholografix", | |
"type": "normal" | |
}, | |
{ | |
"ip": "83.246.143.86", | |
"nickname": "Firescout3", | |
"type": "normal" | |
}, | |
{ | |
"ip": "98.199.21.156", | |
"nickname": "TheMatrix", | |
"type": "normal" | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment