Пример #1
0
	def start_controller(self):
		try:
			control = stem.control.Controller.from_port(address='127.0.0.1', port=9051)
			control.authenticate()
			return True
		except stem.SocketError:
			return False
Пример #2
0
 def start_controller(self):
     try:
         control = stem.control.Controller.from_port(address='127.0.0.1',
                                                     port=9051)
         control.authenticate()
         return True
     except stem.SocketError:
         return False
Пример #3
0
def controller():
    """
  Provides a Controller for our tor instance. This starts tor if it isn't
  already running.
  """

    if not is_running():
        start()
    control = stem.control.Controller.from_port(control_port=CONTROL_PORT)
    control.authenticate()
    return control
Пример #4
0
def renew_ip(port=9051, passwd=None):
    passwd = passwd or 'password'
    with stem.control.Controller.from_port(port=port) as control:
        control.authenticate(password=passwd)
        control.signal(stem.Signal.NEWNYM)
    time.sleep(5)