python-3.x torrc文件中的Gaurd节点

dkqlctbz  于 2022-12-05  发布在  Python
关注(0)|答案(1)|浏览(189)

你好,我有一些关于tor的问题。
1.如何在torrc文件中或使用stem禁用保护节点
1.在stem中有没有什么方法可以指定我的退出节点。我知道torrc文件中的一个方法,但我不知道如何在stem中或使用控制器。例如。
我之所以这样做,是因为我希望为每个电路更改入口节点,并使出口节点相同

controller.set_options({'__DisablePredictedCircuits': '1',
'MaxOnionsPending': '0',
'newcircuitperiod': '999999999',
'maxcircuitdirtiness': '999999999'})

如果可能的话,在这部分也会很好。我的意思是,如果我在这里传递我的节点作为一个参数

controller.new_circuit()
1bqhqjot

1bqhqjot1#

要在torrc文件中禁用保护节点,可以添加以下行:

UseEntryGuards 0
NumEntryGuards 0

要在torrc文件中指定Exit节点,可以添加以下行:

ExitNodes $fingerprint

其中$fingerprint是要使用的Exit节点的指纹。
您可以使用Controller类别的set_options方法来设定UseEntryGuards, NumEntryGuards, and ExitNodes选项,如下所示:

from stem import Controller

with Controller.from_port() as controller:
    controller.authenticate()
    
    controller.set_options({
        'UseEntryGuards': '0',
        'NumEntryGuards': '0',
        'ExitNodes': '$fingerprint',
    })

若要在建立新韦濬时指定“结束”节点,您可以使用Controller类别的extend_circuit方法,如下所示:

from stem import Controller

with Controller.from_port() as controller:
    controller.authenticate()
    
    controller.new_circuit()
    controller.extend_circuit('$fingerprint')

其中$fingerprint是要使用的Exit节点的指纹。

相关问题