From 98f540c3f81a94923b198c6734091bba4c2e8dd9 Mon Sep 17 00:00:00 2001 From: Jan Rude Date: Sun, 24 Aug 2014 13:24:24 +0200 Subject: [PATCH] Added support for Windows --- lib/tor_with_privoxy.py | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/lib/tor_with_privoxy.py b/lib/tor_with_privoxy.py index 2ae363b..f28c92f 100644 --- a/lib/tor_with_privoxy.py +++ b/lib/tor_with_privoxy.py @@ -6,13 +6,23 @@ from colorama import Fore try: import socks except: - print "The module 'SocksiPy' is not installed.\nPlease install it with: sudo apt-get install python-socksipy" + print "The module 'SocksiPy' is not installed." + if sys.platform.startswith('linux'): + "Please install it with: sudo apt-get install python-socksipy" + else: + "You can download it from http://socksipy.sourceforge.net/" sys.exit(-2) def start_daemon(): - os.system('service tor start') - os.system('service privoxy start') - print '[' + Fore.GREEN + ' ok ' + Fore.RESET + '] Starting privoxy daemon...done.' + if sys.platform.startswith('linux'): + os.system('service tor start') + os.system('service privoxy start') + print '[' + Fore.GREEN + ' ok ' + Fore.RESET + '] Starting privoxy daemon...done.' + elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): + print "Please make sure TOR and Privoxy are running..." + else: + print "You are using", sys.platform, ", which is not supported (yet)." + sys.exit(-2) # Using Privoxy and TOR for all connections def connect(port): @@ -44,6 +54,9 @@ def connect(port): def stop(): print "\n" - os.system('service tor stop') - os.system('service privoxy stop') - print '[' + Fore.GREEN + ' ok ' + Fore.RESET + '] Stopping privoxy daemon...done.' \ No newline at end of file + if sys.platform.startswith('linux'): + os.system('service tor stop') + os.system('service privoxy stop') + print '[' + Fore.GREEN + ' ok ' + Fore.RESET + '] Stopping privoxy daemon...done.' + elif sys.platform.startswith('win32') or sys.platform.startswith('cygwin'): + print "You can close TOR and Privoxy now..."