I tried this example :
import getpass import sys import stem import stem.connection from stem.control import Controller if __name__ == '__main__': try: controller = Controller.from_port() except stem.SocketError as exc: print("Unable to connect to tor on port 9051: %s" % exc) sys.exit(1) try: controller.authenticate() except stem.connection.MissingPassword: pw = getpass.getpass("Controller password: ") try: controller.authenticate(password = pw) except stem.connection.PasswordAuthFailed: print("Unable to authenticate, password is incorrect") sys.exit(1) except stem.connection.AuthenticationFailure as exc: print("Unable to authenticate: %s" % exc) sys.exit(1) print("Tor is running version %s" % controller.get_version()) controller.close()
on Stem to check how the Tor controller works. But this gives me an error:
Failed to connect to port 9051 ([Errno 111] Connection refused)
I set ControlPort to 9051 in the torrc file inside / etc / tor /, but still getting the same error. Can anyone help? (I am using Ubuntu 14.04 on VirtualBox)
EDIT: The torus / control 9051 also works on the terminal, it produces an error:
Feb 29 17:50:17.842 [notice] Tor v0.2.4.27 (git-412e3f7dc9c6c01a) running on Linux with Libevent 2.0.21-stable and OpenSSL 1.0.1f. Feb 29 17:50:17.842 [notice] Tor can't help you if you use it wrong! Learn how to be safe at https:
but when i started
ps
no launch instance. EDIT 2: I tried the sudo killall tor
command and then checked it with sudo /etc/init.d/tor status
and now gave it an authentication error:
File "circuitPage.py", line 82, in printCircuitInfo controller.authenticate() File "/usr/local/lib/python2.7/dist-packages/stem/control.py", line 991, in authenticate stem.connection.authenticate(self, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/stem/connection.py", line 520, in authenticate raise AuthenticationFailure('socket connection failed (%s)' % exc) stem.connection.AuthenticationFailure: socket connection failed ([Errno 111] Connection refused)
source share