linux tor python,如何在linux上通过python+stem获取torrelay信息?

我正在尝试使用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个人电脑上试用过这个代码,而且很管用。我现在真的很困惑。在

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值