mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-11 07:19:30 -05:00
Reverted to using Tor Browser's binaries, universal binaries (MacOS)
This commit is contained in:
parent
e3613c39fe
commit
c2fd95c29e
@ -31,9 +31,7 @@ poetry install
|
||||
|
||||
**Windows users:** Download and install 7-Zip from https://7-zip.org/download.html. [Add](https://medium.com/@kevinmarkvi/how-to-add-executables-to-your-path-in-windows-5ffa4ce61a53) `C:\Program Files (x86)\7-Zip` to your path.
|
||||
|
||||
**Apple Silicon users:** Install homebrew following the instructions at https://brew.sh.
|
||||
|
||||
Download Tor and extract the binaries for your platform. The platform must be `win32`, `win64`, `macos-x86_64`, `macos-aarch64` or `linux64`.
|
||||
Download Tor Browser and extract the binaries for your platform. The platform must be `win32`, `win64`, `macos`, or `linux64`.
|
||||
|
||||
```sh
|
||||
poetry run python ./scripts/get-tor.py [platform]
|
||||
|
1556
desktop/poetry.lock
generated
1556
desktop/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -8,9 +8,9 @@ license = "GPLv3+"
|
||||
[tool.poetry.dependencies]
|
||||
python = ">=3.7,<3.11"
|
||||
onionshare_cli = {path = "../cli", develop = true}
|
||||
PySide6 = "6.4.0"
|
||||
qrcode = "*"
|
||||
werkzeug = "~2.0.3"
|
||||
pyside6 = "^6.4.0"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
click = "*"
|
||||
|
@ -1,9 +1,19 @@
|
||||
#!/bin/bash
|
||||
MEEK_TAG=v0.37.0
|
||||
|
||||
OS=$(uname -s)
|
||||
|
||||
mkdir -p ./build/meek
|
||||
cd ./build/meek
|
||||
git clone https://git.torproject.org/pluggable-transports/meek.git
|
||||
git clone https://git.torproject.org/pluggable-transports/meek.git || echo "already cloned"
|
||||
cd meek
|
||||
git checkout $MEEK_TAG
|
||||
go build -o ../../../onionshare/resources/tor/meek-client ./meek-client
|
||||
|
||||
if [ "$OS" == "Darwin" ]; then
|
||||
go build -o ../../../onionshare/resources/tor/meek-client-arm64 ./meek-client
|
||||
GOOS=darwin GOARCH=amd64 go build -o ../../../onionshare/resources/tor/meek-client-amd64 ./meek-client
|
||||
lipo -create -output ../../../onionshare/resources/tor/meek-client ../../../onionshare/resources/tor/meek-client-arm64 ../../../onionshare/resources/tor/meek-client-amd64
|
||||
rm ../../../onionshare/resources/tor/meek-client-arm64 ../../../onionshare/resources/tor/meek-client-amd64
|
||||
else
|
||||
go build -o ../../../onionshare/resources/tor/meek-client ./meek-client
|
||||
fi
|
||||
|
@ -1,9 +1,18 @@
|
||||
#!/bin/bash
|
||||
OBFS4PROXY_TAG=obfs4proxy-0.0.14
|
||||
|
||||
OS=$(uname -s)
|
||||
|
||||
mkdir -p ./build/obfs4proxy
|
||||
cd ./build/obfs4proxy
|
||||
git clone https://gitlab.com/yawning/obfs4 || echo "already cloned"
|
||||
cd obfs4
|
||||
git checkout $OBFS4PROXY_TAG
|
||||
go build -o ../../../onionshare/resources/tor/obfs4proxy ./obfs4proxy
|
||||
if [ "$OS" == "Darwin" ]; then
|
||||
go build -o ../../../onionshare/resources/tor/obfs4proxy-arm64 ./obfs4proxy
|
||||
GOOS=darwin GOARCH=amd64 go build -o ../../../onionshare/resources/tor/obfs4proxy-amd64 ./obfs4proxy
|
||||
lipo -create -output ../../../onionshare/resources/tor/obfs4proxy ../../../onionshare/resources/tor/obfs4proxy-arm64 ../../../onionshare/resources/tor/obfs4proxy-amd64
|
||||
rm ../../../onionshare/resources/tor/obfs4proxy-arm64 ../../../onionshare/resources/tor/obfs4proxy-amd64
|
||||
else
|
||||
go build -o ../../../onionshare/resources/tor/obfs4proxy ./obfs4proxy
|
||||
fi
|
||||
|
@ -1,9 +1,18 @@
|
||||
#!/bin/bash
|
||||
SNOWFLAKE_TAG=v2.3.1
|
||||
|
||||
OS=$(uname -s)
|
||||
|
||||
mkdir -p ./build/snowflake
|
||||
cd ./build/snowflake
|
||||
git clone https://git.torproject.org/pluggable-transports/snowflake.git
|
||||
git clone https://git.torproject.org/pluggable-transports/snowflake.git || echo "already cloned"
|
||||
cd snowflake
|
||||
git checkout $SNOWFLAKE_TAG
|
||||
go build -o ../../../onionshare/resources/tor/snowflake-client ./client
|
||||
if [ "$OS" == "Darwin" ]; then
|
||||
go build -o ../../../onionshare/resources/tor/snowflake-client-arm64 ./client
|
||||
GOOS=darwin GOARCH=amd64 go build -o ../../../onionshare/resources/tor/snowflake-client-amd64 ./client
|
||||
lipo -create -output ../../../onionshare/resources/tor/snowflake-client ../../../onionshare/resources/tor/snowflake-client-arm64 ../../../onionshare/resources/tor/snowflake-client-amd64
|
||||
rm ../../../onionshare/resources/tor/snowflake-client-arm64 ../../../onionshare/resources/tor/snowflake-client-amd64
|
||||
else
|
||||
go build -o ../../../onionshare/resources/tor/snowflake-client ./client
|
||||
fi
|
@ -9,18 +9,18 @@ import subprocess
|
||||
import requests
|
||||
import click
|
||||
|
||||
torbrowser_version = "12.0"
|
||||
torbrowser_version = "12.0.1"
|
||||
expected_win32_sha256 = (
|
||||
"a9cc0f0af2ce8ca0d7a27d65c7efa37f6419cfc793fa80371e7db73d44b4cc02"
|
||||
"8fc7cf992216958b2514c251dc501df3219bb336cb1b1a67b5e4b292d7a3479e"
|
||||
)
|
||||
expected_win64_sha256 = (
|
||||
"f496cc0219c8b73f1f100124d6514bad55f503ff76202747f23620a6677e83c2"
|
||||
"b69e840f3377cfe10e2751b40d54ec9fa34d1470e8a33bd9f8df8c68451fde68"
|
||||
)
|
||||
expected_macos_sha256 = (
|
||||
"11c8360187356e6c0837612a320f1a117303fc449602c9fd73f4faf9f9bbcfc9"
|
||||
"b4b52e1e5a2a0c4e1c68cf36dc8054fd1eb826d43f2622b56ef65e0f9f5db845"
|
||||
)
|
||||
expected_linux64_sha256 = (
|
||||
"850ce601d815bac63e4f5937646d2b497173be28b27b30a7526ebb946a459874"
|
||||
"91a1df75e76d49a2067b537a8d2954af3e900c111fc6805b7b7fccf7503676cf"
|
||||
)
|
||||
|
||||
win32_filename = f"torbrowser-install-{torbrowser_version}_ALL.exe"
|
||||
@ -126,7 +126,7 @@ def get_tor_windows(platform):
|
||||
update_tor_bridges()
|
||||
|
||||
|
||||
def get_tor_macos_x86_64():
|
||||
def get_tor_macos():
|
||||
# Build paths
|
||||
dmg_tor_path = os.path.join(
|
||||
"/Volumes", "Tor Browser", "Tor Browser.app", "Contents"
|
||||
@ -186,92 +186,6 @@ def get_tor_macos_x86_64():
|
||||
update_tor_bridges()
|
||||
|
||||
|
||||
def get_tor_macos_aarch64():
|
||||
# Versions and shasums
|
||||
torbin_version = "0.4.7.10"
|
||||
libevent_version = "2.1.12"
|
||||
expected_torbin_sha256 = "01abf45e673649f6c0fee07f1fcffcce82b2bdb5f5db0c15a9cdcfda6e5eb187"
|
||||
expected_geoip_sha256 = "7e777efc194ea9788171636085b19875d19397d3249fbb88136534037a3dc38f"
|
||||
expected_geoip6_sha256 = "f11bd1d7546cad00b6db0a1594f3ac1daf9f541004fd7efb5414e068693d6add"
|
||||
expected_libevent_sha256 = "2de95fd8cf8849028f9146f04cbde8cc7399ba0191b65ab92825a9a5e691a464"
|
||||
|
||||
# Build paths
|
||||
dist_path = os.path.join(root_path, "onionshare", "resources", "tor")
|
||||
|
||||
# Make sure homebrew is installed and in path
|
||||
brew_path = shutil.which("brew")
|
||||
if brew_path is None:
|
||||
print("brew not found in path. Homebrew must be installed")
|
||||
sys.exit(-1)
|
||||
brew_prefix = os.path.dirname(os.path.dirname(brew_path))
|
||||
|
||||
# Check that tor is installed, otherwise install it
|
||||
tor_path = os.path.join(brew_prefix, "Cellar", "tor", torbin_version)
|
||||
libevent_path = os.path.join(brew_prefix, "Cellar", "libevent", libevent_version)
|
||||
torbin_path = os.path.join(tor_path, "bin", "tor")
|
||||
if not os.path.exists(torbin_path):
|
||||
print(f"Installing tor v{torbin_version}...")
|
||||
if subprocess.call([os.path.join(brew_path), "install", "tor"]) != 0:
|
||||
print(f"Could not install tor using homebrew")
|
||||
sys.exit(-1)
|
||||
|
||||
# Compute the hashes
|
||||
torbin_data = open(torbin_path, "rb").read()
|
||||
torbin_sha256 = hashlib.sha256(torbin_data).hexdigest()
|
||||
geoip_data = open(
|
||||
os.path.join(tor_path, "share", "tor", "geoip"),
|
||||
"rb").read()
|
||||
geoip_sha256 = hashlib.sha256(geoip_data).hexdigest()
|
||||
geoip6_data = open(
|
||||
os.path.join(tor_path, "share", "tor", "geoip6"),
|
||||
"rb").read()
|
||||
geoip6_sha256 = hashlib.sha256(geoip6_data).hexdigest()
|
||||
libeventlib_path = os.path.join(libevent_path, "lib", "libevent-2.1.7.dylib")
|
||||
libevent_data = open(libeventlib_path, "rb").read()
|
||||
libevent_sha256 = hashlib.sha256(libevent_data).hexdigest()
|
||||
|
||||
# Compare the hashes
|
||||
if torbin_sha256 != expected_torbin_sha256:
|
||||
print("ERROR! The sha256 doesn't match (tor):")
|
||||
print("expected: {}".format(expected_torbin_sha256))
|
||||
print(" actual: {}".format(torbin_sha256))
|
||||
sys.exit(-1)
|
||||
if geoip_sha256 != expected_geoip_sha256:
|
||||
print("ERROR! The sha256 doesn't match (geoip):")
|
||||
print("expected: {}".format(expected_geoip_sha256))
|
||||
print(" actual: {}".format(geoip_sha256))
|
||||
sys.exit(-1)
|
||||
if geoip6_sha256 != expected_geoip6_sha256:
|
||||
print("ERROR! The sha256 doesn't match (geoip6):")
|
||||
print("expected: {}".format(expected_geoip6_sha256))
|
||||
print(" actual: {}".format(geoip6_sha256))
|
||||
sys.exit(-1)
|
||||
if libevent_sha256 != expected_libevent_sha256:
|
||||
print("ERROR! The sha256 doesn't match (libevent):")
|
||||
print("expected: {}".format(expected_libevent_sha256))
|
||||
print(" actual: {}".format(libevent_sha256))
|
||||
sys.exit(-1)
|
||||
|
||||
# Copy into dist
|
||||
shutil.copyfile(
|
||||
os.path.join(tor_path, "share", "tor", "geoip"),
|
||||
os.path.join(dist_path, "geoip"),
|
||||
)
|
||||
shutil.copyfile(
|
||||
os.path.join(tor_path, "share", "tor", "geoip6"),
|
||||
os.path.join(dist_path, "geoip6"),
|
||||
)
|
||||
shutil.copyfile(
|
||||
torbin_path,
|
||||
os.path.join(dist_path, "tor"),
|
||||
)
|
||||
os.chmod(os.path.join(dist_path, "tor"), 0o755)
|
||||
shutil.copyfile(
|
||||
libeventlib_path,
|
||||
os.path.join(dist_path, "libevent-2.1.7.dylib"),
|
||||
)
|
||||
|
||||
|
||||
def get_tor_linux64():
|
||||
# Build paths
|
||||
tarball_path = os.path.join(working_path, linux64_filename)
|
||||
@ -402,7 +316,7 @@ def main(platform):
|
||||
"""
|
||||
Download Tor Browser and extract tor binaries
|
||||
"""
|
||||
valid_platforms = ["win32", "win64", "macos-x86_64", "macos-aarch64", "linux64"]
|
||||
valid_platforms = ["win32", "win64", "macos", "linux64"]
|
||||
if platform not in valid_platforms:
|
||||
click.echo(f"platform must be one of: {valid_platforms}")
|
||||
return
|
||||
@ -411,10 +325,8 @@ def main(platform):
|
||||
get_tor_windows(platform)
|
||||
elif platform == "win64":
|
||||
get_tor_windows(platform)
|
||||
elif platform == "macos-x86_64":
|
||||
get_tor_macos_x86_64()
|
||||
elif platform == "macos-aarch64":
|
||||
get_tor_macos_aarch64()
|
||||
elif platform == "macos":
|
||||
get_tor_macos()
|
||||
elif platform == "linux64":
|
||||
get_tor_linux64()
|
||||
else:
|
||||
|
43
desktop/scripts/macos-check-arch.py
Executable file
43
desktop/scripts/macos-check-arch.py
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os, subprocess, sys
|
||||
|
||||
def main(argv):
|
||||
if len(argv) != 2:
|
||||
print("Usage: check-arch.py PATH_TO_APP", file = sys.stderr)
|
||||
sys.exit(-1)
|
||||
universal = []
|
||||
silicon = []
|
||||
intel = []
|
||||
for d in os.walk(argv[1]):
|
||||
ap = os.path.join(os.path.abspath('.'),d[0])
|
||||
for f in os.listdir(ap):
|
||||
fl = os.path.join(ap,f)
|
||||
if os.path.isfile(fl):
|
||||
a = subprocess.run(['file',fl], stdout = subprocess.PIPE)
|
||||
b = a.stdout.decode('utf-8')
|
||||
if 'binary' in b or 'executable' in b or 'library' in b:
|
||||
arm64, x86 = False, False
|
||||
if 'arm64' in b:
|
||||
arm64 = True
|
||||
if 'x86_64' in b:
|
||||
x86 = True
|
||||
if arm64 and x86:
|
||||
universal += [fl]
|
||||
elif arm64:
|
||||
silicon += [fl]
|
||||
elif x86:
|
||||
intel += [fl]
|
||||
with open('macos-check-arch.log', 'w') as fout:
|
||||
fout.write('-*- Universal -*-\n')
|
||||
for p in universal:
|
||||
fout.write(p+'\n')
|
||||
fout.write('\n-*- Silicon -*-\n')
|
||||
for p in silicon:
|
||||
fout.write(p+'\n')
|
||||
fout.write('\n-*- Intel -*-\n')
|
||||
for p in intel:
|
||||
fout.write(p+'\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
Loading…
Reference in New Issue
Block a user