def _kill_process(process): if stem.prereq.is_python_26(): process.kill() elif not stem.util.system.is_windows(): os.kill(process.pid, signal.SIGTERM) process.communicate() # block until its definitely gone
def close_connection(process): process.kill()
def stopTor(process): # Stop Tor if it is an option in the process descriptor if "kill" in dir(process): process.kill()
if not match(r'\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b',argv[1]): print (term.format("\n'%s' does not seem to be a valid IP\n"%argv[1], term.Color.RED)) exit(255) path = ["%s:%d"%(argv[1],port)] try: process = process.launch_tor_with_config(config={ 'ControlPort':str(CONTROL_PORT), 'HashedControlPassword':'******', 'UseBridges':'1', 'bridge':"%s:%d"%(argv[1],port) }, #init_msg_handler=lambda x: print(x), timeout=10, take_ownership=True) controller = Controller.from_port(port=CONTROL_PORT) controller.authenticate("test") except OSError: print (term.format("\nThis %s:%d does not seem to be a functional bridge!\n"% (argv[1],port), term.Color.RED)) exit(1) else: print (term.format("\n%s:%d is a valid bridge.\n"% (argv[1],port), term.Color.GREEN)) process.kill() exit(0)
def _kill_process(process): process.kill() process.communicate() # block until its definitely gone