Commit 011e7c5d authored by Torsten Grote's avatar Torsten Grote

Hash bridge fingerprints the Tor way so Onionoo will find them

parent 72cfbe69
#!/usr/bin/env python3
import requests
import sys
import hashlib
import json
import os
import re
import json
import sys
from binascii import a2b_hex
import requests
......@@ -49,7 +51,8 @@ def get_fingerprints(torrc):
def print_health_check(fingerprint):
print("Checking bridge %s..." % fingerprint)
# Search Onionoo for bridge
url = URL_DETAILS + "fingerprint=%s" % fingerprint
hashed_fingerprint = get_tor_sha1(fingerprint)
url = URL_DETAILS + "lookup=%s" % hashed_fingerprint
response = requests.get(url)
bridges = json.loads(response.content)['bridges']
if len(bridges) != 1:
......@@ -84,6 +87,12 @@ def print_health_check(fingerprint):
return True
def get_tor_sha1(to_hash):
sha1 = hashlib.sha1()
return sha1.hexdigest()
def fail(msg=""):
sys.stderr.write("Error: %s\n" % msg)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment