def do_tor(self, inp): try: if varis.initip is "": initcheck() if "on" in inp.lower(): p = torpipe(True) if p: print(" [+] Tor > ON") else: varis.tor = False start = input(" [?] Do you want to start the Tor service? (enter if not) :> ") if start is not "": try: os.system("systemctl start tor") print(" [+] Tor service successfully started. Give it some time and run 'tor on' again.") except Exception as e: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Starting Tor service failed:"+"\033[0m"+ color.CURSIVE +"\n{}".format(e) + C) elif "off" in inp.lower(): torpipe(False) stop = input(" [?] Do you want to stop the Tor service? (enter if not) :> ") if stop is not "": try: os.system("systemctl stop tor") print(" [+] Tor service successfully stopped.") except Exception as e: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Stopping Tor service failed:"+"\033[0m"+ color.CURSIVE +"\n{}".format(e) + C) print(" [+] Tor > OFF") else: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Syntax: tor on|off") except: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Tor connection failed: IPcheck service not available.")
def do_tor(self, inp): try: initv = varis.initip == "" acc = False if initv: try: initcheck() acc = True except: acc = False if "on" in inp.lower(): if acc or not initv: p = torpipe(True) if p: print(" [+] Tor > ON") else: varis.tor = False start = input( " [?] Do you want to start the Tor service? (enter if not) :> " ) if start is not "": try: os.system("systemctl start tor") print(" [+] Tor service successfully started.") self.do_tor("on") except Exception as e: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Starting Tor service failed:" + "\033[0m" + color.CURSIVE + "\n{}".format(e) + C) else: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Starting Tor service failed: Initial IP not set." + "\033[0m" + C) elif "off" in inp.lower(): torpipe(False) stop = input( " [?] Do you want to stop the Tor service? (enter if not) :> " ) if stop is not "": try: os.system("systemctl stop tor") print(" [+] Tor service successfully stopped.") except Exception as e: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Stopping Tor service failed:" + "\033[0m" + color.CURSIVE + "\n{}".format(e) + C) print(" [+] Tor > OFF") else: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Syntax: tor on|off") except: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Tor connection failed: IPcheck service not available.")
def do_tor(self, inp, shell=True): try: initv = varis.initip == "" acc = False if initv: try: """ check the initial IP - will be used later to verify that Tor works """ initcheck() acc = True except: acc = False if "on" in inp.lower(): #check if Tor service is running; if not, prompt user to start it if acc or not initv: p = torpipe(True) if p: print(O + " [+] Tor" + C + color.TR3 + C + G + "ON" + C + color.TR2 + C) else: varis.tor = False if shell: start = input( color.END + " [?] Do you want to start the Tor service? (enter if not) :> " ) else: start = "yes" if start != "": try: os.system("systemctl start tor") print( G + " [+] Tor service successfully started." + C + color.TR2 + C) self.do_tor("on") except Exception as e: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Starting Tor service failed:" + "\033[0m" + color.CURSIVE + "\n{}".format(e) + C) else: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Starting Tor service failed: Initial IP not set." + "\033[0m" + C) elif "off" in inp.lower(): torpipe(False) if shell: stop = input( color.END + " [?] Do you want to stop the Tor service? (enter if not) :> " ) else: stop = "yes" if stop != "": try: os.system("systemctl stop tor") print(G + " [+] Tor service successfully stopped." + C + color.TR2 + C) except Exception as e: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Stopping Tor service failed:" + "\033[0m" + color.CURSIVE + "\n{}".format(e) + C) print(O + " [+] Tor" + C + color.TR3 + C + G + "OFF" + C + color.TR2 + C) else: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Syntax: tor on|off") except: print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" + "Tor connection failed: IPcheck service not available.")