mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
Chore: shrink tor binaries (#2255)
* added linux and macOS binary. Created linux test * add tor binaries for osx * packaging of tor and now also win-binaries * fix windows script * fix windows reflection * some chore * remove torbrowser directory entirely * mentioning limited usability * improved writing --------- Co-authored-by: moneymanolis <moneymanolis@protonmail.com>
This commit is contained in:
parent
c530c5fd03
commit
09e6a4255e
22 changed files with 118 additions and 118 deletions
|
|
@ -17,5 +17,5 @@ include requirements.txt
|
||||||
# ... which might make the above not necessary but the below very needed:
|
# ... which might make the above not necessary but the below very needed:
|
||||||
exclude .gitattributes .gitignore pyinstaller .pre-commit.config.yaml
|
exclude .gitattributes .gitignore pyinstaller .pre-commit.config.yaml
|
||||||
prune pyinstaller/bitcoind
|
prune pyinstaller/bitcoind
|
||||||
prune pyinstaller/torbrowser
|
prune pyinstaller/tor
|
||||||
prune .github
|
prune .github
|
||||||
|
|
@ -19,7 +19,8 @@ python .\utils\release-helper.py set_setup_py_version %1%
|
||||||
|
|
||||||
|
|
||||||
echo " --> Building pypi package"
|
echo " --> Building pypi package"
|
||||||
python setup.py sdist bdist_wheel
|
pip3 install build==0.10.0
|
||||||
|
python -m build
|
||||||
|
|
||||||
echo " --> Installing pypi package"
|
echo " --> Installing pypi package"
|
||||||
python .\utils\release-helper.py install_wheel %1%
|
python .\utils\release-helper.py install_wheel %1%
|
||||||
|
|
@ -36,8 +37,11 @@ rmdir /s /q .\dist\
|
||||||
rmdir /s /q .\build\
|
rmdir /s /q .\build\
|
||||||
rmdir /s /q .\release\
|
rmdir /s /q .\release\
|
||||||
rmdir /s /q .\electron\dist\
|
rmdir /s /q .\electron\dist\
|
||||||
|
|
||||||
|
echo " --> Creating the pyinstaller binary"
|
||||||
pyinstaller.exe specterd.spec
|
pyinstaller.exe specterd.spec
|
||||||
|
|
||||||
mkdir release
|
mkdir release
|
||||||
|
|
||||||
|
echo " --> Creating the release-package"
|
||||||
powershell Compress-Archive -Path dist\specterd.exe release\specterd-%1%-win64.zip
|
powershell Compress-Archive -Path dist\specterd.exe release\specterd-%1%-win64.zip
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,7 @@ binaries = []
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
binaries = [("./windll/libusb-1.0.dll", ".")]
|
binaries = [("./windll/libusb-1.0.dll", ".")]
|
||||||
packaged_software_datas = [
|
packaged_software_datas = [
|
||||||
('./torbrowser/tor-win64-0.4.5.7.zip', 'torbrowser'),
|
('./tor/tor-win64-0.4.8.0.tar.xz', 'tor'),
|
||||||
('./bitcoind/bitcoin-0.21.1-win64.zip', 'bitcoind'),
|
|
||||||
]
|
]
|
||||||
elif platform.system() == 'Linux':
|
elif platform.system() == 'Linux':
|
||||||
if platform.processor() == 'aarch64': #ARM 64 bit
|
if platform.processor() == 'aarch64': #ARM 64 bit
|
||||||
|
|
@ -32,16 +31,14 @@ elif platform.system() == 'Linux':
|
||||||
binaries = [(p, ".")]
|
binaries = [(p, ".")]
|
||||||
break
|
break
|
||||||
packaged_software_datas = [
|
packaged_software_datas = [
|
||||||
('./torbrowser/tor-browser-linux64-10.0.15_en-US.tar.xz', 'torbrowser'),
|
('./tor/tor-linux64-0.4.8.0.tar.xz', 'tor'),
|
||||||
('./bitcoind/bitcoin-0.21.1' + ('-arm-linux-gnueabihf.tar.gz' if "armv" in platform.machine() else '-x86_64-linux-gnu.tar.gz'), 'bitcoind')
|
|
||||||
]
|
]
|
||||||
elif platform.system() == 'Darwin':
|
elif platform.system() == 'Darwin':
|
||||||
find_brew_libusb_proc = subprocess.Popen(['brew', '--prefix', 'libusb'], stdout=subprocess.PIPE)
|
find_brew_libusb_proc = subprocess.Popen(['brew', '--prefix', 'libusb'], stdout=subprocess.PIPE)
|
||||||
libusb_path = find_brew_libusb_proc.communicate()[0]
|
libusb_path = find_brew_libusb_proc.communicate()[0]
|
||||||
binaries = [(libusb_path.rstrip().decode() + "/lib/libusb-1.0.dylib", ".")]
|
binaries = [(libusb_path.rstrip().decode() + "/lib/libusb-1.0.dylib", ".")]
|
||||||
packaged_software_datas = [
|
packaged_software_datas = [
|
||||||
('./torbrowser/TorBrowser-10.0.15-osx64_en-US.dmg', 'torbrowser'),
|
('./tor/tor-osx64-0.4.8.0.tar.xz', 'tor'),
|
||||||
('./bitcoind/bitcoin-0.21.1-osx64.tar.gz', 'bitcoind'),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
a = Analysis(['specterd.py'],
|
a = Analysis(['specterd.py'],
|
||||||
|
|
|
||||||
4
pyinstaller/tor/README.md
Normal file
4
pyinstaller/tor/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
The tor binaries in this directory has been built with the help of https://github.com/cretz/tor-static
|
||||||
|
commit: 89f64ecb518204458ada53dffecc876527a3d8ff
|
||||||
|
|
||||||
|
All tor binary packaged files has been signed by https://keybase.io/k9ert
|
||||||
BIN
pyinstaller/tor/tor-linux64-0.4.8.0.tar.xz
Normal file
BIN
pyinstaller/tor/tor-linux64-0.4.8.0.tar.xz
Normal file
Binary file not shown.
16
pyinstaller/tor/tor-linux64-0.4.8.0.tar.xz.asc
Normal file
16
pyinstaller/tor/tor-linux64-0.4.8.0.tar.xz.asc
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
|
iQIzBAABCgAdFiEE7MC0q9dOcW9a3glSKLNYqIQ7AQkFAmP4cpAACgkQKLNYqIQ7
|
||||||
|
AQlYJRAAjumOlHEyDW0uZxdkX2QSeFN5hHLVNvN+xOOHSvimVRbxKQk7lYVLCA+/
|
||||||
|
9KvkMDZE1Yran11SaIf0eKZ6Z1b1nEGfrJOJiWev8jMI/qT9tNQulFifNpIZF83O
|
||||||
|
fHt95oz4seXKyFsGU59H4CNxKewoEOE9RumkGiwGixwPHF5xSp5TJdXUJC341UF7
|
||||||
|
MrVyO0djKPtoFxq/8VPzCyF4ghnTa0BaFYwdWVdnwrDDgeNWeKTe4IcDU2VkKTbo
|
||||||
|
fy7jmmYT91ypLzj7p0YfZVX3WH8uoBqQvu7majvjnBUdh6oXUuK4WtQuy6Kr+ldL
|
||||||
|
WuWfnnTliZe07zieRvjTRdyT+ycTFWCROmmpxPoHljQTNFC9hH9H4xlmQZGeQBCb
|
||||||
|
UQzFfB7S7DPCxiTbsCQwV1EC+94SgvH5EsElO0pb8s27qt4Lii8Ifx1QDwA/7e8s
|
||||||
|
WZkJ7MVsWALCnUJXNMOTslCjkMJY8ZRHkTq0yZF2/wliLwLsFdv4uykyvivN6iNP
|
||||||
|
WXi2eszwrxXkFtWxTy5Gnp12fkWMzJlnaEMKk9Ybw5dHS3wIYr1yDHxn0ujFTLb8
|
||||||
|
QI/6IhF1kc+vLsGz4l2FpAe6ide/b1L4NpPZT+rsHqCZ0Uoa3JSqPCLMEiHQx7vR
|
||||||
|
9mUJZMKLMAXNIgcV8CO9vBNzZx1rOrdzmWjpQT7h/5eWKDB0MeU=
|
||||||
|
=fqvO
|
||||||
|
-----END PGP SIGNATURE-----
|
||||||
BIN
pyinstaller/tor/tor-osx64-0.4.8.0.tar.xz
Normal file
BIN
pyinstaller/tor/tor-osx64-0.4.8.0.tar.xz
Normal file
Binary file not shown.
16
pyinstaller/tor/tor-osx64-0.4.8.0.tar.xz.asc
Normal file
16
pyinstaller/tor/tor-osx64-0.4.8.0.tar.xz.asc
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
|
iQIzBAABCgAdFiEE7MC0q9dOcW9a3glSKLNYqIQ7AQkFAmP4dd0ACgkQKLNYqIQ7
|
||||||
|
AQmfvw//fBahwhKeitlFYz/p8FBuqxP4ufUg9RB/T+8WKaORDZm8smlourdJIMH0
|
||||||
|
UWYVmKV0Vjbho9jzI4YYbQRI9jaJXIbN977kpPdDmM1CLxGUDfOfpIEHb8FgThgL
|
||||||
|
6BKJfxfBzbrSqBRpeq/mfXxz5Db3b6Kg7nhK7BBnx37bPlx+M3CGq5yAM8AYINN6
|
||||||
|
JWfgbHF6Ao48JG+LnyJCCRJbgFgRKUmW0Oe2sWACoYu/sRda0j/Ja9WRBw4I1oZS
|
||||||
|
k5f2IlodIoWCwrLHQLJuc/lNv/I4BNS6YUJSnREUchMCZqpXTOUgoMhu77N60yYy
|
||||||
|
zBk/g10SJagtDue5GOdQL22WLGONqFCLk7R04OiADeozu3vREC5LoTGWnIzJI//J
|
||||||
|
F9GHC3X7005yIPh5XCH7UJKHswkaumkxk3XbCHub+uF5xZgbF1ukiZYvut2q0qnU
|
||||||
|
J8D900G5fAK5WnCFW7wzLVR6xZZaJyGWbdWm9eyah9l6h9WZbTY7hNEyRP32b/NA
|
||||||
|
whpEs1BAJwAZO/rENDk4hQYpJdWT0BDgVZKewAHa3G24j7rgtHnER8WZxhHFOx2x
|
||||||
|
krWhqa5bOh4tRCn3BlzjLVSS59eMZV0A78ajRNaAAa37HV/yESf5+ES4p+zAn6m8
|
||||||
|
wB+cExwhXg/i6TOlGumYtrJanrmJOValygKW4H4UziY67kAbaOA=
|
||||||
|
=xn1P
|
||||||
|
-----END PGP SIGNATURE-----
|
||||||
BIN
pyinstaller/tor/tor-win64-0.4.8.0.tar.xz
Normal file
BIN
pyinstaller/tor/tor-win64-0.4.8.0.tar.xz
Normal file
Binary file not shown.
16
pyinstaller/tor/tor-win64-0.4.8.0.tar.xz.asc
Normal file
16
pyinstaller/tor/tor-win64-0.4.8.0.tar.xz.asc
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
-----BEGIN PGP SIGNATURE-----
|
||||||
|
|
||||||
|
iQIzBAABCgAdFiEE7MC0q9dOcW9a3glSKLNYqIQ7AQkFAmP4hk4ACgkQKLNYqIQ7
|
||||||
|
AQl4dRAAsPsipzwYbR7jlk9BxmRq/iI+sZVQzeTS3mhEgFspCNWblQUe1hSHTwhA
|
||||||
|
u3S3Ynp0xxMLpI/ZAGxUUTtq4G6YH/GYqaXGbc77o0tYX2m+ZePeHIQr92XR1r1D
|
||||||
|
7ZSYdDSwCgq7mKDCrv0z7nKdyoJnsrCKLOLpBHQi6Mumt9IH97W6tXjBK8njo2pe
|
||||||
|
1+P3WkaE5Aui3s1y1ZGW+FSjFgU0CCmkTMLN+qWahbcL7YfGN3zYWAnINu+M3N11
|
||||||
|
xmpI9728R55VtmDKhU7FNM/uFBWr9ucr/dnBqlCMQaX9+CrliWThdKrQLMY6oBVi
|
||||||
|
nSMGTJKtN6/PuPWGvTflidEgiCpTIdY8eXFGqwv7EdPVmr6sLPCgugI2u9BMji+W
|
||||||
|
4qaQKAVvlyOe2pHyJRBs5/FFzx6P4XRiSOVzbp7Q2mVYVtyUIRWc95REx++hNWG6
|
||||||
|
Uz8KbRnhbhkFA88svH/dt/20Z/ZSwk30MI+2LRrzFQHd1pNtwG6MK4ORMH+a9NJT
|
||||||
|
A++vJyXd0IwN2escE/TXrrKEJJXLVkaCgITKxrSxB4yOXZg7Ngp63UUr6vIas7Ag
|
||||||
|
GSibOQE/91G618zho4c6wfpFaZE6fTQR/GujhrZbKbjmRc8VF8AvMG1NNrwYWMZf
|
||||||
|
ZpH3YsaaQ8N5cz4XyuKId/IFUyBPPi8M7kki+LY1WpJ1E7sDBwk=
|
||||||
|
=74Xl
|
||||||
|
-----END PGP SIGNATURE-----
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
|
|
||||||
iQIcBAABCgAGBQJgX1qwAAoJEOt3RJHZ/wbi4KIP/3/2RyZt19cdlNHLiO8LPLwa
|
|
||||||
nJIrbpyP50i8T6nmmsBpE0AZCt4bdktNIaMxJbnKf7kX9EJtF10CdF4wXiQnY9Vi
|
|
||||||
HYCy63kOqS6yASGlctK0pbrHCug3uoJvac1rjCsh9G1pcAkZHTzC+ZNQxd3AbSYR
|
|
||||||
ZIJkao7dFPQXXvscWmherCTWp8/LIVs7xBjhMfhRbSy86YJM6+vbubijanr+VrWz
|
|
||||||
Thfw54qLQQlyuZiv0ULnzdtanKb8BPRlPrp4iJEc6OBe8q4gTIG/4E4lg+XTqKKq
|
|
||||||
x3RUqLziue3GxIbKJdOVa19hgzo/ZsJVIWRK0k++N/BDUx1L/kXyBC8X0YQniCdo
|
|
||||||
nVVLlmBau9owh9YWZ5WJPckpvcR4lbcI+Q7l5ygTb1oaz6zDNjP7HgnhunWoA5qH
|
|
||||||
AKLpFoG1lokd/+HJfpzlDxuexd6DshH28b5cAPxjqgBPnJNbLlIbCTKCE8wxF5su
|
|
||||||
mR7AIQMrlfhqlC6uyX584fZ4LXiuZayCQDjFJcxw2fpmHRUb8awhGAoRFqv/DaSZ
|
|
||||||
qRwDuCZiWh/SgMXiL/xRI98BdQASJnW6hZDSuF0VRra1pLdWcsoWd5z2q+eDiI7f
|
|
||||||
iX+R8SjDrMg+YVlNK53bBP6ABHdg2KdPF0EQcPMeLM40i8vOYcbHzL2/697QOuYs
|
|
||||||
SqPpf7Pe+WVWLUFyTEFl
|
|
||||||
=scSU
|
|
||||||
-----END PGP SIGNATURE-----
|
|
||||||
Binary file not shown.
|
|
@ -1,16 +0,0 @@
|
||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
|
|
||||||
iQIcBAABCgAGBQJgX2g+AAoJEOt3RJHZ/wbi+BUQAKxqhLe62Lny2WQPU5gNEEeH
|
|
||||||
5mMo9OCaoYH1buWVLXoJ64EUTmDV5o5LDORhg4xC0Cddze1KQST3lhEL7LHf1VKt
|
|
||||||
FeL7AyH5NawE5EpPXqRYNBsiw0Jl76subMvC0UY9iEOrAizxmRxMlXo02aar2lSd
|
|
||||||
BeYiEUSi5FiM3VBGoetbNNoGfWC05czHb0x6OBTAfwo2CeGzUVTTIHB547YeMnHC
|
|
||||||
oKLhOH9eQGLb7T5gnIbqBRhRWM7Sqd/D6XLWu+0asUybKrSlsBPik5FA9jZv9iEl
|
|
||||||
mdRHvAyPZl2WkJAjFPun8shJ4izMpj0fdYiyIWNFWvz027gF8Qgh4MoDcL2aMlJP
|
|
||||||
nSJz16v7WWyRveOj8LrVJJaDXrBFfp5kd3br6LOCil+dBATvjufsz/2/zjenArwb
|
|
||||||
MAp26cg8+57WUoLKUBMudjTAIM2u6JO4+Mcy3w8/sxhwZGPkU9jFGw46TDd1UhQA
|
|
||||||
sg00MPN7uJFoFQFlSkvkfgcFqc2UEexQ8NxB51PaNvPxROh5FoLmeqo9apVMq0he
|
|
||||||
KD+vGL46/PdxRyy8GGrvk8qKXYvB+ZARYEDULR8gE6CPuXs4tN5kp4pWluMOX9SW
|
|
||||||
2DLsMUMECqVrj1AV+6p9Uuvx/2DnbrcJxS9VOKkV/CQa5yo3otxwzGVOs6DC6SdT
|
|
||||||
wW/E5ikD79Z5vSMap2cU
|
|
||||||
=n+4P
|
|
||||||
-----END PGP SIGNATURE-----
|
|
||||||
Binary file not shown.
|
|
@ -1,16 +0,0 @@
|
||||||
-----BEGIN PGP SIGNATURE-----
|
|
||||||
|
|
||||||
iQIcBAABCgAGBQJgX2t4AAoJEOt3RJHZ/wbi5OkP/35io0fAqEpxgnKhBzI8zHl4
|
|
||||||
49EHLQkds4Mxpf1jpPF1rcvfOtZFOAJcQENWqrR2jSqm0qemkxzy4o7cR4ckI7f6
|
|
||||||
SZXW6W6aFhqvlg+O+PYmOPNpiYfjFmH/bA8ztsuZPhUgEBj/DeDTDa1pDIRqNCci
|
|
||||||
+Pv/RSsKjx993F7Nl9jQFpa03/Lpn2R6Z3o6m+Zu7S2nKuur6ohQMIqq8E/38z6W
|
|
||||||
qCokupSbuJYS4KcqW+Os8lvkPYOs7d18IQ09MxHIInynqDJSrhSBE/po4dahZi5K
|
|
||||||
OPuaEBvkRjbHMW75kW0JG7PG6ZR8Vn+Fyz0r2MfAhJuZtmOPn9yVP2Dzuvze8xZq
|
|
||||||
y7vJNqiMD/E+opNfXd5PFIiLXTx0vuZ07rMlYWAnGIFJ9Ba36wWLLiM80vnnmK0Y
|
|
||||||
XMl7HSE7bcseOi/tO0NgyuFCFsBRcpbYMx5I2Mstb+MslN7ptGEGPaR11M+lzgY3
|
|
||||||
ddIkBCxQ+050CPQToYdN6vft4/34RH14rVq7dQ1SAu7CbC+2cDgOc4PuB6tK6v3W
|
|
||||||
fU2QrVgMjaGXMKfRxLVq2KLyYy1iI8N4STiruh5zMxSRWvyQvH7pM9tXdcrXvqEZ
|
|
||||||
AVXfmoG+kJZKJR84If1Agt0ncHvL+1+0xHO35UzpxUACoAte2Ey8ZwRzuP+lX/iW
|
|
||||||
kXUsSSSQSVc1Q0j2eQwY
|
|
||||||
=VMkJ
|
|
||||||
-----END PGP SIGNATURE-----
|
|
||||||
|
|
@ -349,9 +349,7 @@ class Specter:
|
||||||
self.setup_status[software_name]["stage_progress"] = -1
|
self.setup_status[software_name]["stage_progress"] = -1
|
||||||
|
|
||||||
def get_setup_status(self, software_name):
|
def get_setup_status(self, software_name):
|
||||||
if software_name == "bitcoind":
|
if software_name == "torbrowser":
|
||||||
installed = os.path.isfile(self.bitcoind_path)
|
|
||||||
elif software_name == "torbrowser":
|
|
||||||
installed = os.path.isfile(self.torbrowser_path)
|
installed = os.path.isfile(self.torbrowser_path)
|
||||||
else:
|
else:
|
||||||
installed = False
|
installed = False
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,14 @@
|
||||||
|
|
||||||
<h3 class="mt-8">{{ _("Tor configurations") }}</h3>
|
<h3 class="mt-8">{{ _("Tor configurations") }}</h3>
|
||||||
<!-- <img data-style="width: 25px; margin-right: 7px; vertical-align: middle;" src="{{ url_for('static', filename='img/tor.svg') }}"/><span data-style="vertical-align: bottom; margin-right: 10px;"> -->
|
<!-- <img data-style="width: 25px; margin-right: 7px; vertical-align: middle;" src="{{ url_for('static', filename='img/tor.svg') }}"/><span data-style="vertical-align: bottom; margin-right: 10px;"> -->
|
||||||
<p class="mb-5">{{ _("Enable Tor to anonymise your data connections.") }}</p>
|
<div id="hasencryptedservicedata" class="flex p-4 mt-3 mb-4 bg-dark-600 rounded-lg" role="alert">
|
||||||
|
<svg class="flex-shrink-0 inline w-6 h-6 mr-3" version="1.1" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><!--Generated by IJSVG (https://github.com/iconjar/IJSVG)--><path d="M32.0022,55.9844l-1.04907e-06,-2.84217e-14c-13.2548,-5.79387e-07 -24,-10.7452 -24,-24c5.79387e-07,-13.2548 10.7452,-24 24,-24c13.2548,5.79387e-07 24,10.7452 24,24l2.13163e-14,-1.04907e-06c0,13.2548 -10.7452,24 -24,24Zm1.5,-32l3.82016e-08,-2.71086e-09c-1.79133,0.127116 -3.35165,-1.21031 -3.5,-3l6.50646e-08,-7.8524e-07c0.148296,-1.78972 1.70866,-3.12717 3.5,-3l-5.85322e-09,4.15529e-10c1.79134,-0.127171 3.3517,1.21028 3.5,3l-5.57104e-08,6.72365e-07c-0.148295,1.78976 -1.70872,3.12723 -3.5001,3Zm1.4206,6.7635l-2.7853,10.5093l-8.37179e-08,3.15667e-07c-0.270677,1.02062 0.262417,2.08281 1.2425,2.4757l-5.91015e-08,-2.36708e-08c0.379505,0.151996 0.628277,0.519688 0.6282,0.9285v0.323l8.52651e-14,4.05e-07c0,0.551933 -0.447167,0.999503 -0.9991,1h-2.9891l-4.04477e-08,1.96948e-10c-1.65938,0.00807986 -3.01111,-1.33056 -3.01919,-2.98993c-0.00127082,-0.260991 0.0314695,-0.521035 0.0973943,-0.773566l2.7852,-10.5094l2.79671e-08,-1.05468e-07c0.270652,-1.02067 -0.262537,-2.08289 -1.2427,-2.4757l-2.20542e-08,-8.83296e-09c-0.379505,-0.151996 -0.628276,-0.519688 -0.6282,-0.9285v-0.3229l-1.77636e-14,-9.40042e-08c-8.33514e-08,-0.552011 0.447289,-0.999614 0.9993,-1h2.9887l1.06497e-07,-5.28143e-10c1.65943,-0.00822943 3.01133,1.33033 3.01956,2.98976c0.00129458,0.261047 -0.0314356,0.52115 -0.0973639,0.773738Z" fill="currentColor" fill-rule="evenodd"></path></svg>
|
||||||
|
<span class="sr-only">Info</span>
|
||||||
|
<div>
|
||||||
|
{{ _("This only anonymizes connections to block explorers and price providers.") }} <br>
|
||||||
|
{{ _("Connecting to the Electrum server via Tor is not yet supported, even with Tor options activated.") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label for="tor_type_none" class="flex bg-dark-800 p-4 mb-5 border-2 border-dark-700 rounded-xl align-start hover:bg-dark-700 cursor-pointer">
|
<label for="tor_type_none" class="flex bg-dark-800 p-4 mb-5 border-2 border-dark-700 rounded-xl align-start hover:bg-dark-700 cursor-pointer">
|
||||||
<input class="mr-4 h-8" id="tor_type_none" type="radio" name="tor_type" value="none" data-style="width: 20px; min-width: 20px; margin-top: 20px;" onchange="toggletor_type('none')" {% if tor_type == 'none' %} checked {% endif %}/>
|
<input class="mr-4 h-8" id="tor_type_none" type="radio" name="tor_type" value="none" data-style="width: 20px; min-width: 20px; margin-top: 20px;" onchange="toggletor_type('none')" {% if tor_type == 'none' %} checked {% endif %}/>
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ def get_subclasses_for_clazz(
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
try:
|
try:
|
||||||
# Another style is orgname.specterext.extensionid, for that we have to guess the orgname:
|
# Another style is orgname.specterext.extensionid, for that we have to guess the orgname:
|
||||||
orgname = str(importer).split(os.path.sep)[-2]
|
orgname = str(importer.path).split(os.path.sep)[-2]
|
||||||
logger.debug(f"guessing orgname: {orgname}")
|
logger.debug(f"guessing orgname: {orgname}")
|
||||||
module = import_module(
|
module = import_module(
|
||||||
f"{orgname}.specterext.{module_name}.service"
|
f"{orgname}.specterext.{module_name}.service"
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@ logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_tor_daemon_suffix():
|
def get_tor_daemon_suffix():
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Windows":
|
||||||
return ".real"
|
|
||||||
elif platform.system() == "Windows":
|
|
||||||
return ".exe"
|
return ".exe"
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import pgpy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from .sha256sum import sha256sum
|
from .sha256sum import sha256sum
|
||||||
from .file_download import download_file
|
from .file_download import download_file
|
||||||
|
from .tor import get_tor_daemon_suffix
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -18,69 +19,38 @@ def copytree(src, dst, symlinks=False, ignore=None):
|
||||||
|
|
||||||
|
|
||||||
def setup_tor_thread(specter=None):
|
def setup_tor_thread(specter=None):
|
||||||
|
"""This will extract the Tor binary from the tar balls packaged with specterd and copy
|
||||||
|
it over to the ~/.specter/tor-binaries folder
|
||||||
|
Also creates a torrc file and starts the Tor daemon
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
specter.update_setup_status("torbrowser", "STARTING_SETUP")
|
specter.update_setup_status("torbrowser", "STARTING_SETUP")
|
||||||
TOR_OS_SUFFIX = {
|
TOR_OS_SUFFIX = {
|
||||||
"Windows": "tor-win64-0.4.5.7.zip",
|
"Windows": "tor-win64-0.4.8.0.tar.xz",
|
||||||
"Linux": "tor-browser-linux64-10.0.15_en-US.tar.xz",
|
"Linux": "tor-linux64-0.4.8.0.tar.xz",
|
||||||
"Darwin": "TorBrowser-10.0.15-osx64_en-US.dmg",
|
"Darwin": "tor-osx64-0.4.8.0.tar.xz",
|
||||||
}
|
}
|
||||||
|
|
||||||
packed_name = (
|
packed_name = (
|
||||||
os.path.join(sys._MEIPASS, f"torbrowser/{TOR_OS_SUFFIX[platform.system()]}")
|
os.path.join(sys._MEIPASS, f"tor/{TOR_OS_SUFFIX[platform.system()]}")
|
||||||
if getattr(sys, "frozen", False)
|
if getattr(sys, "frozen", False)
|
||||||
else Path(__file__).parent
|
else Path(__file__).parent
|
||||||
/ f"../../../../pyinstaller/torbrowser/{TOR_OS_SUFFIX[platform.system()]}"
|
/ f"../../../../pyinstaller/tor/{TOR_OS_SUFFIX[platform.system()]}"
|
||||||
)
|
)
|
||||||
|
logger.info(f"packed tor binary: {packed_name}")
|
||||||
|
|
||||||
os.makedirs(os.path.join(specter.data_folder, "tor-binaries"), exist_ok=True)
|
os.makedirs(os.path.join(specter.data_folder, "tor-binaries"), exist_ok=True)
|
||||||
if TOR_OS_SUFFIX[platform.system()].endswith(".dmg"):
|
with tarfile.open(packed_name) as tar:
|
||||||
result = subprocess.run(
|
file_name = f"tor{get_tor_daemon_suffix()}"
|
||||||
[f'hdiutil attach "{packed_name}"'], shell=True, capture_output=True
|
destination_file = os.path.join(
|
||||||
|
os.path.join(specter.data_folder, "tor-binaries"), file_name
|
||||||
)
|
)
|
||||||
if result.stderr == b"hdiutil: attach failed - no mountable file systems\n":
|
extracted_file = tar.extractfile(file_name)
|
||||||
os.remove(packed_name)
|
with open(destination_file, "wb") as f:
|
||||||
return
|
shutil.copyfileobj(extracted_file, f)
|
||||||
torbrowser_source_path = os.path.join(
|
if not file_name.endswith(".exe"):
|
||||||
"/Volumes", "Tor Browser", "Tor Browser.app", "Contents", "MacOS", "Tor"
|
st = os.stat(destination_file)
|
||||||
)
|
os.chmod(destination_file, st.st_mode | stat.S_IEXEC)
|
||||||
copytree(
|
|
||||||
src=torbrowser_source_path,
|
|
||||||
dst=os.path.join(specter.data_folder, "tor-binaries"),
|
|
||||||
)
|
|
||||||
disk_image_path = "/Volumes/Tor\ Browser"
|
|
||||||
subprocess.run([f"hdiutil detach {disk_image_path}"], shell=True)
|
|
||||||
elif TOR_OS_SUFFIX[platform.system()].endswith(".zip"):
|
|
||||||
with zipfile.ZipFile(packed_name) as zip_file:
|
|
||||||
for file in zip_file.filelist:
|
|
||||||
if file.filename.endswith("dll") or file.filename.endswith("exe"):
|
|
||||||
destination_exe = os.path.join(
|
|
||||||
os.path.join(specter.data_folder, "tor-binaries"),
|
|
||||||
file.filename.split("/")[-1],
|
|
||||||
)
|
|
||||||
with zip_file.open(file.filename) as zf, open(
|
|
||||||
destination_exe, "wb"
|
|
||||||
) as f:
|
|
||||||
shutil.copyfileobj(zf, f)
|
|
||||||
elif TOR_OS_SUFFIX[platform.system()].endswith(".tar.xz"):
|
|
||||||
with tarfile.open(packed_name) as tar:
|
|
||||||
tor_files = [
|
|
||||||
"libcrypto.so.1.1",
|
|
||||||
"libevent-2.1.so.7",
|
|
||||||
"libssl.so.1.1",
|
|
||||||
"tor",
|
|
||||||
]
|
|
||||||
for tor_file in tor_files:
|
|
||||||
file_name = "tor-browser_en-US/Browser/TorBrowser/Tor/" + tor_file
|
|
||||||
destination_file = os.path.join(
|
|
||||||
os.path.join(specter.data_folder, "tor-binaries"), tor_file
|
|
||||||
)
|
|
||||||
extracted_file = tar.extractfile(file_name)
|
|
||||||
with open(destination_file, "wb") as f:
|
|
||||||
shutil.copyfileobj(extracted_file, f)
|
|
||||||
if tor_file == "tor":
|
|
||||||
st = os.stat(destination_file)
|
|
||||||
os.chmod(destination_file, st.st_mode | stat.S_IEXEC)
|
|
||||||
|
|
||||||
if "torrc_password" not in specter.config:
|
if "torrc_password" not in specter.config:
|
||||||
specter.generate_torrc_password()
|
specter.generate_torrc_password()
|
||||||
|
|
@ -94,5 +64,5 @@ def setup_tor_thread(specter=None):
|
||||||
specter.update_tor_controller()
|
specter.update_tor_controller()
|
||||||
specter.reset_setup("torbrowser")
|
specter.reset_setup("torbrowser")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(f"Failed to install Tor. Error: {e}", e)
|
logger.exception(f"Failed to install Tor.")
|
||||||
specter.update_setup_error("torbrowser", str(e))
|
specter.update_setup_error("torbrowser", str(e))
|
||||||
|
|
|
||||||
24
tests/test_tor_setup_task.py
Normal file
24
tests/test_tor_setup_task.py
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
from cryptoadvance.specter.util.tor_setup_tasks import setup_tor_thread
|
||||||
|
import mock
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
def test_tor_setup_task(caplog, empty_data_folder):
|
||||||
|
"""This test works on Linux and MacOS. But, it's only CI-tested on Linux"""
|
||||||
|
caplog.set_level(logging.DEBUG)
|
||||||
|
spectrum_mock = mock.MagicMock()
|
||||||
|
spectrum_mock.data_folder = empty_data_folder
|
||||||
|
setup_tor_thread(spectrum_mock)
|
||||||
|
print("Files in empty_data_folder")
|
||||||
|
for filename in os.listdir(empty_data_folder):
|
||||||
|
print(filename)
|
||||||
|
print("Files in empty_data_folder/tor-binaries")
|
||||||
|
for filename in os.listdir(os.path.join(empty_data_folder, "tor-binaries")):
|
||||||
|
print(filename)
|
||||||
|
tor_binary = os.path.join(empty_data_folder, "tor-binaries", "tor")
|
||||||
|
assert os.path.isfile(tor_binary)
|
||||||
|
output = subprocess.check_output([tor_binary, "--version"])
|
||||||
|
assert b"Tor version 0.4.8.0" in output
|
||||||
|
# assert False
|
||||||
|
|
@ -42,8 +42,6 @@ END_COMMENT
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
# brew install gmp # to prevent module 'embit.util' has no attribute 'ctypes_secp256k1'
|
# brew install gmp # to prevent module 'embit.util' has no attribute 'ctypes_secp256k1'
|
||||||
# npm install --global create-dmg
|
# npm install --global create-dmg
|
||||||
# Download Tor browser:
|
|
||||||
# wget -P torbrowser https://archive.torproject.org/tor-package-archive/torbrowser/10.0.15/TorBrowser-10.0.15-osx64_en-US.dmg
|
|
||||||
|
|
||||||
### Trouble shooting
|
### Trouble shooting
|
||||||
# Currently, only MacOS Catalina is supported to build the dmg-file
|
# Currently, only MacOS Catalina is supported to build the dmg-file
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue