Commit 7e4bf94e authored by Cecylia Bocovich's avatar Cecylia Bocovich
Browse files

Updated to python3 and cleaned up code

parent ae0c1fb5
#!/usr/bin/env python2
#!/usr/bin/env python3
#
# This script is designed to test the reachability and throughput of
# obfs4 bridges.
#
# Prerequisites:
# - pip3 install stem
import errno
import logging
......@@ -12,13 +18,14 @@ import sys
import stem.process
BRIDGE_LINES = (
)
START_TOR_TIMEOUT = 3 * 60
START_TOR_TIMEOUT = 60
CIRCUIT_BUILD_TIMEOUT = 60
OBFS4PROXY_PATH = "/usr/bin/obfs4proxy"
#This file is ~38MB
LARGE_FILE_URL = "https://mirror.csclub.uwaterloo.ca/ubuntu/dists/bionic/Contents-amd64.gz"
def makedirs(path):
try:
return os.makedirs(path)
......@@ -48,7 +55,7 @@ def download_file(socks_port):
try:
start = time.time()
subprocess.check_call(["/usr/bin/torsocks", "-P", str(socks_port), "wget", "-O", "/dev/null", "https://mirror.csclub.uwaterloo.ca/ubuntu/dists/bionic/Contents-amd64.gz"])
subprocess.run(["/usr/bin/torsocks", "-P", str(socks_port), "wget", "-O", "/dev/null", LARGE_FILE_URL], check=True)
stop = time.time()
download_time = stop - start
except subprocess.CalledProcessError as e:
......
Supports Markdown
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