mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-27 00:09:50 -05:00
support obfs4 via obfs4proxy on macOS
This commit is contained in:
parent
82b1860dac
commit
284213aa2d
@ -84,6 +84,9 @@ def main():
|
||||
shutil.copyfile(os.path.join(dmg_tor_path, 'MacOS', 'Tor', 'tor.real'), os.path.join(dist_path, 'MacOS', 'Tor', 'tor.real'))
|
||||
shutil.copyfile(os.path.join(dmg_tor_path, 'MacOS', 'Tor', 'libevent-2.0.5.dylib'), os.path.join(dist_path, 'MacOS', 'Tor', 'libevent-2.0.5.dylib'))
|
||||
os.chmod(os.path.join(dist_path, 'MacOS', 'Tor', 'tor.real'), 0o755)
|
||||
# obfs4proxy binary
|
||||
shutil.copyfile(os.path.join(dmg_tor_path, 'MacOS', 'Tor', 'PluggableTransports', 'obfs4proxy'), os.path.join(dist_path, 'Resources', 'Tor', 'obfs4proxy'))
|
||||
os.chmod(os.path.join(dist_path, 'Resources', 'Tor', 'obfs4proxy'), 0o755)
|
||||
|
||||
# Unmount dmg
|
||||
subprocess.call(['diskutil', 'unmount', '/Volumes/Tor Browser'])
|
||||
|
@ -94,22 +94,26 @@ def get_tor_paths():
|
||||
tor_path = '/usr/bin/tor'
|
||||
tor_geo_ip_file_path = '/usr/share/tor/geoip'
|
||||
tor_geo_ipv6_file_path = '/usr/share/tor/geoip6'
|
||||
obfs4proxy_file_path = '/usr/bin/obfs4proxy'
|
||||
elif p == 'Windows':
|
||||
base_path = os.path.join(os.path.dirname(os.path.dirname(get_resource_path(''))), 'tor')
|
||||
tor_path = os.path.join(os.path.join(base_path, 'Tor'), "tor.exe")
|
||||
tor_geo_ip_file_path = os.path.join(os.path.join(os.path.join(base_path, 'Data'), 'Tor'), 'geoip')
|
||||
tor_geo_ipv6_file_path = os.path.join(os.path.join(os.path.join(base_path, 'Data'), 'Tor'), 'geoip6')
|
||||
obfs4proxy_file_path = os.path.join(os.path.join(os.path.join(base_path, 'Data'), 'Tor'), 'obfs4proxy')
|
||||
elif p == 'Darwin':
|
||||
base_path = os.path.dirname(os.path.dirname(os.path.dirname(get_resource_path(''))))
|
||||
tor_path = os.path.join(base_path, 'Resources', 'Tor', 'tor')
|
||||
tor_geo_ip_file_path = os.path.join(base_path, 'Resources', 'Tor', 'geoip')
|
||||
tor_geo_ipv6_file_path = os.path.join(base_path, 'Resources', 'Tor', 'geoip6')
|
||||
obfs4proxy_file_path = os.path.join(base_path, 'Resources', 'Tor', 'obfs4proxy')
|
||||
elif p == 'OpenBSD' or p == 'FreeBSD':
|
||||
tor_path = '/usr/local/bin/tor'
|
||||
tor_geo_ip_file_path = '/usr/local/share/tor/geoip'
|
||||
tor_geo_ipv6_file_path = '/usr/local/share/tor/geoip6'
|
||||
obfs4proxy_file_path = '/usr/local/bin/obfs4proxy'
|
||||
|
||||
return (tor_path, tor_geo_ip_file_path, tor_geo_ipv6_file_path)
|
||||
return (tor_path, tor_geo_ip_file_path, tor_geo_ipv6_file_path, obfs4proxy_file_path)
|
||||
|
||||
|
||||
def get_version():
|
||||
|
@ -140,7 +140,7 @@ class Onion(object):
|
||||
self.bundle_tor_supported = True
|
||||
|
||||
# Set the path of the tor binary, for bundled tor
|
||||
(self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path) = common.get_tor_paths()
|
||||
(self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path, self.obfs4proxy_file_path) = common.get_tor_paths()
|
||||
|
||||
# The tor process
|
||||
self.tor_proc = None
|
||||
@ -207,7 +207,7 @@ class Onion(object):
|
||||
|
||||
# Bridge support
|
||||
if self.settings.get('tor_bridges_use_obfs4'):
|
||||
f.write('\n')
|
||||
f.write('ClientTransportPlugin obfs4 exec {}\n'.format(self.obfs4proxy_file_path))
|
||||
with open(common.get_resource_path('torrc_template-obfs4')) as o:
|
||||
for line in o:
|
||||
f.write(line)
|
||||
|
@ -130,6 +130,11 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
# OBFS4 option radio
|
||||
self.tor_bridges_use_obfs4_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_obfs4_radio_option', True))
|
||||
self.tor_bridges_use_obfs4_radio.toggled.connect(self.tor_bridges_use_obfs4_radio_toggled)
|
||||
# if the obfs4proxy binary is missing, we can't use obfs4 transports
|
||||
if system != 'Windows' and system != 'Darwin':
|
||||
(self.tor_path, self.tor_geo_ip_file_path, self.tor_geo_ipv6_file_path, self.obfs4proxy_file_path) = common.get_tor_paths()
|
||||
if not os.path.isfile(self.obfs4proxy_file_path):
|
||||
self.tor_bridges_use_obfs4_radio.setEnabled(False)
|
||||
|
||||
# Custom bridges radio and textbox
|
||||
self.tor_bridges_use_custom_radio = QtWidgets.QRadioButton(strings._('gui_settings_tor_bridges_custom_radio_option', True))
|
||||
|
Loading…
Reference in New Issue
Block a user