2020-11-14 21:43:49 +00:00
|
|
|
--- a/onionshare_cli/common.py
|
|
|
|
+++ b/onionshare_cli/common.py
|
2022-10-10 08:50:49 +00:00
|
|
|
@@ -318,73 +318,12 @@ class Common:
|
2020-11-14 21:43:49 +00:00
|
|
|
return path
|
2022-01-18 09:04:53 +00:00
|
|
|
|
2020-04-21 20:57:48 +00:00
|
|
|
def get_tor_paths(self):
|
|
|
|
- if self.platform == "Linux":
|
2020-11-14 21:43:49 +00:00
|
|
|
- tor_path = shutil.which("tor")
|
|
|
|
- if not tor_path:
|
|
|
|
- raise CannotFindTor()
|
|
|
|
- obfs4proxy_file_path = shutil.which("obfs4proxy")
|
2022-01-18 09:04:53 +00:00
|
|
|
- snowflake_file_path = shutil.which("snowflake-client")
|
|
|
|
- meek_client_file_path = shutil.which("meek-client")
|
2020-11-14 21:43:49 +00:00
|
|
|
- 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")
|
2020-04-21 20:57:48 +00:00
|
|
|
- elif self.platform == "Windows":
|
2022-01-18 09:04:53 +00:00
|
|
|
- # In Windows, the Tor binaries are in the onionshare package, not the onionshare_cli package
|
2020-11-14 21:43:49 +00:00
|
|
|
- base_path = self.get_resource_path("tor")
|
2022-01-18 09:04:53 +00:00
|
|
|
- base_path = base_path.replace("onionshare_cli", "onionshare")
|
2022-10-10 08:50:49 +00:00
|
|
|
- tor_path = os.path.join(base_path, "tor.exe")
|
2022-01-18 09:04:53 +00:00
|
|
|
-
|
|
|
|
- # If tor.exe isn't there, mayber we're running from the source tree
|
|
|
|
- if not os.path.exists(tor_path):
|
2022-10-10 08:50:49 +00:00
|
|
|
- self.log(
|
|
|
|
- "Common", "get_tor_paths", f"Cannot find tor.exe at {tor_path}"
|
|
|
|
- )
|
2022-01-18 09:04:53 +00:00
|
|
|
- base_path = os.path.join(os.getcwd(), "onionshare", "resources", "tor")
|
|
|
|
-
|
2022-10-10 08:50:49 +00:00
|
|
|
- tor_path = os.path.join(base_path, "tor.exe")
|
2022-01-18 09:04:53 +00:00
|
|
|
- if not os.path.exists(tor_path):
|
2022-10-10 08:50:49 +00:00
|
|
|
- self.log(
|
|
|
|
- "Common", "get_tor_paths", f"Cannot find tor.exe at {tor_path}"
|
|
|
|
- )
|
2022-01-18 09:04:53 +00:00
|
|
|
- raise CannotFindTor()
|
|
|
|
-
|
2022-10-10 08:50:49 +00:00
|
|
|
- obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy.exe")
|
|
|
|
- snowflake_file_path = os.path.join(base_path, "snowflake-client.exe")
|
|
|
|
- meek_client_file_path = os.path.join(base_path, "meek-client.exe")
|
|
|
|
- tor_geo_ip_file_path = os.path.join(base_path, "geoip")
|
|
|
|
- tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6")
|
2022-01-18 09:04:53 +00:00
|
|
|
-
|
2020-04-21 20:57:48 +00:00
|
|
|
- elif self.platform == "Darwin":
|
2022-01-18 09:04:53 +00:00
|
|
|
- # Let's see if we have tor binaries in the onionshare GUI package
|
|
|
|
- base_path = self.get_resource_path("tor")
|
|
|
|
- base_path = base_path.replace("onionshare_cli", "onionshare")
|
|
|
|
- tor_path = os.path.join(base_path, "tor")
|
|
|
|
- if os.path.exists(tor_path):
|
|
|
|
- obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy")
|
|
|
|
- snowflake_file_path = os.path.join(base_path, "snowflake-client")
|
|
|
|
- meek_client_file_path = os.path.join(base_path, "meek-client")
|
|
|
|
- tor_geo_ip_file_path = os.path.join(base_path, "geoip")
|
|
|
|
- tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6")
|
|
|
|
- else:
|
|
|
|
- # Fallback to looking in the path
|
|
|
|
- tor_path = shutil.which("tor")
|
|
|
|
- if not os.path.exists(tor_path):
|
|
|
|
- raise CannotFindTor()
|
|
|
|
-
|
|
|
|
- obfs4proxy_file_path = shutil.which("obfs4proxy")
|
|
|
|
- snowflake_file_path = shutil.which("snowflake-client")
|
|
|
|
- meek_client_file_path = shutil.which("meek-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")
|
|
|
|
-
|
2020-04-21 20:57:48 +00:00
|
|
|
- elif self.platform == "BSD":
|
|
|
|
- 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"
|
2022-01-18 09:04:53 +00:00
|
|
|
- snowflake_file_path = "/usr/local/bin/snowflake-client"
|
|
|
|
- meek_client_file_path = "/usr/local/bin/meek-client"
|
2020-04-21 20:57:48 +00:00
|
|
|
+ tor_path = "@tor@/bin/tor"
|
|
|
|
+ tor_geo_ip_file_path = "@geoip@/share/tor/geoip"
|
|
|
|
+ tor_geo_ipv6_file_path = "@geoip@/share/tor/geoip6"
|
|
|
|
+ obfs4proxy_file_path = "@obfs4@/bin/obfs4proxy"
|
2022-01-18 09:04:53 +00:00
|
|
|
+ snowflake_file_path = "@snowflake@/bin/snowflake-client"
|
|
|
|
+ meek_client_file_path = "@meek@/bin/meek-client"
|
|
|
|
|
2020-04-21 20:57:48 +00:00
|
|
|
return (
|
|
|
|
tor_path,
|