diff options
author | Micah Lee <micah@micahflee.com> | 2021-10-24 17:35:24 -0700 |
---|---|---|
committer | Micah Lee <micah@micahflee.com> | 2021-10-24 17:35:24 -0700 |
commit | c3eeaefb9f1f67afc81c75068e6e7216d9fe8bfb (patch) | |
tree | de71bab5ce7e72be4dab2f6ce9afcd400d3191d2 /cli/onionshare_cli/common.py | |
parent | 7cd1a53d0034ec73418c905069dc1d4b68fc66a5 (diff) | |
download | onionshare-c3eeaefb9f1f67afc81c75068e6e7216d9fe8bfb.tar.gz onionshare-c3eeaefb9f1f67afc81c75068e6e7216d9fe8bfb.zip |
In CLI get_tor_path, stop trying to look in resources first
Diffstat (limited to 'cli/onionshare_cli/common.py')
-rw-r--r-- | cli/onionshare_cli/common.py | 58 |
1 files changed, 16 insertions, 42 deletions
diff --git a/cli/onionshare_cli/common.py b/cli/onionshare_cli/common.py index 945a75bb..07e0aa0a 100644 --- a/cli/onionshare_cli/common.py +++ b/cli/onionshare_cli/common.py @@ -309,30 +309,14 @@ class Common: def get_tor_paths(self): if self.platform == "Linux": - # Look in resources first - base_path = self.get_resource_path("tor") - if os.path.exists(base_path): - self.log( - "Common", "get_tor_paths", f"using tor binaries in {base_path}" - ) - tor_path = os.path.join(base_path, "tor") - tor_geo_ip_file_path = os.path.join(base_path, "geoip") - tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6") - obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy") - snowflake_file_path = os.path.join(base_path, "snowflake-client") - else: - # Fallback to looking in the path - self.log( - "Common", "get_tor_paths", f"using tor binaries in system path" - ) - tor_path = shutil.which("tor") - if not tor_path: - raise CannotFindTor() - obfs4proxy_file_path = shutil.which("obfs4proxy") - snowflake_file_path = shutil.which("snowflake-client") - prefix = os.path.dirname(os.path.dirname(tor_path)) - tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip") - tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6") + tor_path = shutil.which("tor") + if not tor_path: + raise CannotFindTor() + obfs4proxy_file_path = shutil.which("obfs4proxy") + snowflake_file_path = shutil.which("snowflake-client") + prefix = os.path.dirname(os.path.dirname(tor_path)) + tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip") + tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6") elif self.platform == "Windows": base_path = self.get_resource_path("tor") tor_path = os.path.join(base_path, "Tor", "tor.exe") @@ -341,24 +325,14 @@ class Common: tor_geo_ip_file_path = os.path.join(base_path, "Data", "Tor", "geoip") tor_geo_ipv6_file_path = os.path.join(base_path, "Data", "Tor", "geoip6") elif self.platform == "Darwin": - # Look in resources first - base_path = self.get_resource_path("tor") - if os.path.exists(base_path): - tor_path = os.path.join(base_path, "tor") - tor_geo_ip_file_path = os.path.join(base_path, "geoip") - tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6") - obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy") - snowflake_file_path = os.path.join(base_path, "snowflake-client") - else: - # Fallback to looking in the path - tor_path = shutil.which("tor") - if not tor_path: - raise CannotFindTor() - obfs4proxy_file_path = shutil.which("obfs4proxy") - snowflake_file_path = shutil.which("snowflake-client") - prefix = os.path.dirname(os.path.dirname(tor_path)) - tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip") - tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6") + tor_path = shutil.which("tor") + if not tor_path: + raise CannotFindTor() + obfs4proxy_file_path = shutil.which("obfs4proxy") + snowflake_file_path = shutil.which("snowflake-client") + prefix = os.path.dirname(os.path.dirname(tor_path)) + tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip") + tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6") elif self.platform == "BSD": tor_path = "/usr/local/bin/tor" tor_geo_ip_file_path = "/usr/local/share/tor/geoip" |