aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2022-10-09 16:14:29 -0700
committerMicah Lee <micah@micahflee.com>2022-10-09 16:14:29 -0700
commitc51430d6f7ab179d5c64f6ab96f4390081168703 (patch)
tree7410f17e062b82d2d69d3b90cbb725468ba5e60e
parentd176d82bd38b7d9053de5ffa1fba8e3dfb278408 (diff)
downloadonionshare-c51430d6f7ab179d5c64f6ab96f4390081168703.tar.gz
onionshare-c51430d6f7ab179d5c64f6ab96f4390081168703.zip
Revert "Replace request to censorship API to get built-in bridges with a request to tor's source code"
This reverts commit db089d7816d6a6c890929a2885a679b5b58bf0fe.
-rw-r--r--cli/onionshare_cli/resources/torrc_template-meek_lite_azure2
-rw-r--r--cli/onionshare_cli/resources/torrc_template-obfs42
-rw-r--r--desktop/scripts/get-tor.py66
3 files changed, 35 insertions, 35 deletions
diff --git a/cli/onionshare_cli/resources/torrc_template-meek_lite_azure b/cli/onionshare_cli/resources/torrc_template-meek_lite_azure
index e3140fe3..73ad5042 100644
--- a/cli/onionshare_cli/resources/torrc_template-meek_lite_azure
+++ b/cli/onionshare_cli/resources/torrc_template-meek_lite_azure
@@ -1,2 +1,2 @@
-# Enable built-in meek_lite bridge
+# Enable built-in meek-azure bridge
Bridge meek_lite 192.0.2.2:2 97700DFE9F483596DDA6264C4D7DF7641E1E39CE url=https://meek.azureedge.net/ front=ajax.aspnetcdn.com
diff --git a/cli/onionshare_cli/resources/torrc_template-obfs4 b/cli/onionshare_cli/resources/torrc_template-obfs4
index cd5437b6..c6091b87 100644
--- a/cli/onionshare_cli/resources/torrc_template-obfs4
+++ b/cli/onionshare_cli/resources/torrc_template-obfs4
@@ -1,5 +1,4 @@
# Enable built-in obfs4 bridge
-Bridge obfs4 144.217.20.138:80 FB70B257C162BF1038CA669D568D76F5B7F0BABB cert=vYIV5MgrghGQvZPIi1tJwnzorMgqgmlKaB77Y3Z9Q/v94wZBOAXkW+fdx4aSxLVnKO+xNw iat-mode=0
Bridge obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0
Bridge obfs4 192.95.36.142:443 CDF2E852BF539B82BD10E27E9115A31734E378C2 cert=qUVQ0srL1JI/vO6V6m/24anYXiJD3QP2HgzUKQtQ7GRqqUvs7P+tG43RtAqdhLOALP7DJQ iat-mode=1
Bridge obfs4 193.11.166.194:27015 2D82C2E354D531A68469ADF7F878FA6060C6BACA cert=4TLQPJrTSaDffMK7Nbao6LC7G9OW/NHkUwIdjLSS3KYf0Nv4/nQiiI8dY2TcsQx01NniOg iat-mode=0
@@ -8,6 +7,7 @@ Bridge obfs4 193.11.166.194:27025 1AE2C08904527FEA90C4C4F8C1083EA59FBC6FAF cert=
Bridge obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0
Bridge obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0
Bridge obfs4 38.229.1.78:80 C8CBDB2464FC9804A69531437BCF2BE31FDD2EE4 cert=Hmyfd2ev46gGY7NoVxA9ngrPF2zCZtzskRTzoWXbxNkzeVnGFPWmrTtILRyqCTjHR+s9dg iat-mode=1
+Bridge obfs4 38.229.33.83:80 0BAC39417268B96B9F514E7F63FA6FBA1A788955 cert=VwEFpk9F/UN9JED7XpG1XOjm/O8ZCXK80oPecgWnNDZDv5pdkhq1OpbAH0wNqOT6H6BmRQ iat-mode=1
Bridge obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0
Bridge obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0
Bridge obfs4 85.31.186.26:443 91A6354697E6B02A386312F68D82CF86824D3606 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=0
diff --git a/desktop/scripts/get-tor.py b/desktop/scripts/get-tor.py
index 3e6dc053..0f67fde8 100644
--- a/desktop/scripts/get-tor.py
+++ b/desktop/scripts/get-tor.py
@@ -286,46 +286,46 @@ def update_tor_bridges():
torrc_template_dir = os.path.join(
root_path, os.pardir, "cli/onionshare_cli/resources"
)
-
- r = requests.get("https://gitweb.torproject.org/builders/tor-browser-build.git/plain/projects/tor-browser/Bundle-Data/PTConfigs/bridge_prefs.js")
+ endpoint = "https://bridges.torproject.org/moat/circumvention/builtin"
+ r = requests.post(
+ endpoint,
+ headers={"Content-Type": "application/vnd.api+json"},
+ )
if r.status_code != 200:
print(
f"There was a problem fetching the latest built-in bridges: status_code={r.status_code}"
)
return False
-
- # Parse the bridges from this javascript file
- bridges = {}
- for line in r.content.decode().split("\n"):
- if line.startswith('pref("extensions.torlauncher.default_bridge.'):
- i = line.index('", "') + 4
- bridge = line[i:].rstrip('");')
-
- bridge_type = bridge.split()[0]
- if bridge_type not in bridges:
- bridges[bridge_type] = []
-
- bridges[bridge_type].append(bridge)
-
- for bridge_type in bridges:
- if bridge_type == "meek_lite":
- torrc_template_extension = "meek_lite_azure"
- else:
- torrc_template_extension = bridge_type
-
- torrc_template = os.path.join(
- root_path,
- torrc_template_dir,
- f"torrc_template-{torrc_template_extension}",
+
+ result = r.json()
+ print(f"Built-in bridges: {result}")
+
+ if "errors" in result:
+ print(
+ f"There was a problem fetching the latest built-in bridges: errors={result['errors']}"
)
+ return False
- with open(torrc_template, "w") as f:
- f.write(f"# Enable built-in {bridge_type} bridge\n")
- # Sorts the bridges numerically by IP, since they come back in
- # random order from the API each time, and create noisy git diff.
- bridges[bridge_type].sort(key=lambda s: s.split()[1])
- for item in bridges[bridge_type]:
- f.write(f"Bridge {item}\n")
+ for bridge_type in ["meek-azure", "obfs4", "snowflake"]:
+ if bridge_type in result and result[bridge_type]:
+ if bridge_type == "meek-azure":
+ torrc_template_extension = "meek_lite_azure"
+ else:
+ torrc_template_extension = bridge_type
+ torrc_template = os.path.join(
+ root_path,
+ torrc_template_dir,
+ f"torrc_template-{torrc_template_extension}",
+ )
+
+ with open(torrc_template, "w") as f:
+ f.write(f"# Enable built-in {bridge_type} bridge\n")
+ bridges = result[bridge_type]
+ # Sorts the bridges numerically by IP, since they come back in
+ # random order from the API each time, and create noisy git diff.
+ bridges.sort(key=lambda s: s.split()[1])
+ for item in bridges:
+ f.write(f"Bridge {item}\n")
@click.command()