我正在尝试使用python的stem库在ubuntulinux上控制tor,正如tor的website上所指示的那样。但是,当我运行建议的python代码时from stem.control import Controller
with Controller.from_port(port = 9051) as controller:
controller.authenticate() # provide the password here if you set one
bytes_read = controller.get_info("traffic/read")
bytes_written = controller.get_info("traffic/written")
print "My Tor relay has read %s bytes and written %s." % (bytes_read, bytes_written)
我得到了一个错误:Traceback (most recent call last):
File "littleRelay.py", line 5, in module
bytes_read = controller.get_info("traffic/read")
File "/usr/local/lib/python2.7/dist-packages/stem/control.py", line 852, in get_info
raise exc
stem.InvalidArguments: GETINFO request contained unrecognized keywords: traffic/read
那么如何在linux上通过python+stem获取torrelay信息呢?
我认为Tor运行良好,因为我从终端启动了Tor,它显示[notice] Tor has successfully opened a circuit. Looks like client functionality is working.
[notice] Bootstrapped 100%: Done.
此外,当我运行上面的python代码时,终端显示[notice] New control connection opened.
另外,我也在windows个人电脑上试用过这个代码,而且很管用。我现在真的很困惑。在