aboutsummaryrefslogtreecommitdiff
path: root/cli/onionshare_cli/meek.py
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2021-10-25 11:45:50 +1100
committerMiguel Jacq <mig@mig5.net>2021-10-25 11:45:50 +1100
commit8543d215dcdc92fb621a55299a04d8fcef738223 (patch)
treec4f591c2020e6ebfed4b97801952bba9a6b6959d /cli/onionshare_cli/meek.py
parent6f0674afd8c6b39818dd6ddda417db69d458f68f (diff)
downloadonionshare-8543d215dcdc92fb621a55299a04d8fcef738223.tar.gz
onionshare-8543d215dcdc92fb621a55299a04d8fcef738223.zip
Fix-ups for detecting if the meek binary doesn't exist. Pass the GUI's get_tor_paths down to the CLI when instantiating Meek object
Diffstat (limited to 'cli/onionshare_cli/meek.py')
-rw-r--r--cli/onionshare_cli/meek.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/cli/onionshare_cli/meek.py b/cli/onionshare_cli/meek.py
index ff44cb13..762a454c 100644
--- a/cli/onionshare_cli/meek.py
+++ b/cli/onionshare_cli/meek.py
@@ -17,6 +17,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
+import os
import subprocess
import time
from queue import Queue, Empty
@@ -31,7 +32,7 @@ class Meek(object):
bridges, before connecting to Tor.
"""
- def __init__(self, common):
+ def __init__(self, common, get_tor_paths=None):
"""
Set up the Meek object
"""
@@ -39,7 +40,9 @@ class Meek(object):
self.common = common
self.common.log("Meek", "__init__")
- get_tor_paths = self.common.get_tor_paths
+ # Set the path of the meek binary
+ if not get_tor_paths:
+ get_tor_paths = self.common.get_tor_paths
(
self.tor_path,
self.tor_geo_ip_file_path,
@@ -72,10 +75,12 @@ class Meek(object):
queue.put(line)
out.close()
+ self.common.log("Meek", "start", self.meek_client_file_path)
+
# Abort early if we can't find the Meek client
- # common.get_tor_paths() has already checked it's a file
- # so just abort if it's a NoneType object
- if self.meek_client_file_path is None:
+ if self.meek_client_file_path is None or not os.path.exists(
+ self.meek_client_file_path
+ ):
raise MeekNotFound()
# Start the Meek Client as a subprocess.
@@ -186,6 +191,7 @@ class MeekNotRunning(Exception):
number it started on, in order to do domain fronting.
"""
+
class MeekNotFound(Exception):
"""
We were unable to find the Meek Client binary.