【发布时间】:2014-03-30 17:04:43
【问题描述】:
我正在尝试按照 tor 的website 上的说明使用 python 的 stem 库来控制 ubuntu linux 上的 tor。但是,当我运行建议的 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(最近一次调用最后一次):
模块中的文件“littleRelay.py”,第 5 行
bytes_read = controller.get_info("traffic/read")
文件“/usr/local/lib/python2.7/dist-packages/stem/control.py”,第 852 行,在 get_info 中
提高exc
stem.InvalidArguments:GETINFO 请求包含无法识别的关键字:traffic/read
那么如何在 Linux 上通过 python+stem 获取 Tor 中继信息? 我认为 Tor 运行良好,因为我从终端启动了 Tor,它说
[notice] Tor 已成功打开电路。看起来客户端功能正在运行。
[notice] 自举 100%:完成。
此外,当我运行上面的 python 代码时,终端会说
[notice] 新的控制连接打开。
附:我还在 Windows pc 上尝试过代码,它工作正常。我现在真的很困惑。
【问题讨论】:
-
那没用,但谢谢安德烈。