-
-
Save bauruine/6f333720b50ba6747970a5e6e4b97cb4 to your computer and use it in GitHub Desktop.
Import Family to tor weather python tor_weather_importer.py --family 02EC629306C61EE1D3BDD4DD978514B99E226EA0 --wait-for 1
This file contains 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 python3 | |
import argparse | |
import logging | |
import requests | |
def main(): | |
""" Add all fingerprints of your family to Tor weather """ | |
email='' | |
password="" | |
weather_session = requests.sessions.Session() | |
weather_session.post("https://weather.torproject.org/api/login", data={"email": email, "password": password}) | |
resp = requests.get(url=f"https://onionoo.torproject.org/details?search=family:{args.family}", | |
timeout=10) | |
onionoo_data = resp.json() | |
for relay in onionoo_data["relays"]: | |
fingerprint = relay["fingerprint"] | |
weather_session.post("https://weather.torproject.org/api/dashboard/node-status/node-down/create", data={"fingerprint": fingerprint, "wait_for": args.wait_for}) | |
#weather_session.post("https://weather.torproject.org/api/dashboard/node-status/node-bandwidth/create", data={"fingerprint": fingerprint, "wait_for": args.wait_for, "threshold": "15000"}) | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(description='Add whole Family to Tor weather') | |
# Global arguments | |
parser.add_argument('--family', dest='family', type=str, required=True, help='The fingerprint of one relay of your family') | |
parser.add_argument('--wait-for', dest='wait_for', type=str, required=True, help='Tor-Weather service will wait for this time after first noticing the anomaly with the relay.') | |
logging.basicConfig(filename='tor_weather.log', level=logging.DEBUG, filemode='a', format='%(name)s - %(levelname)s - %(message)s') | |
logging.getLogger("urllib3").setLevel(logging.ERROR) | |
args = parser.parse_args() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment