简体   繁体   English

如何通过控制端口获取 *current* Tor 出口节点 IP 地址?

[英]How do I get the *current* Tor exit node IP address over the control port?

How do I get the external IP address of the current Tor exit node (the one which is in use) without using external services/websites (through curl or otherwise) but only through the Tor control port functionality (using bash or python3).如何在使用外部服务/网站(通过curl或其他方式)而仅通过 Tor 控制端口功能(使用 bash 或 python3)的情况下获取当前Tor 出口节点(正在使用的节点)的外部 IP 地址。

NOTE: I have been looking for an answer to this question and found this one (which lists all exit nodes) and this one (which does not give the IP address of the current exit node but of some other node).注意:我一直在寻找这个问题的答案,并找到了这个(列出了所有出口节点)和这个(它没有提供当前出口节点的 IP 地址,而是某个其他节点的 IP 地址)。 Other answers suggest using external services through curl or otherwise which is not what I am looking for.其他答案建议通过curl或其他方式使用外部服务,这不是我想要的。

I am using GNU/Linux.我正在使用 GNU/Linux。

cid - is circuit id with currently in use or any other circuit id you want. cid - 当前正在使用的电路 ID 或您想要的任何其他电路 ID。
1 - by cid we retrieve circuit event whith circuit state , we taking finger print of exit node(last element in path property). 1 - 通过 cid 我们检索电路事件和电路状态,我们获取出口节点的指纹(路径属性中的最后一个元素)。
2 - checking network status and take address property. 2 - 检查网络状态并获取地址属性。

er = controller.get_circuit(cid).path[-1][0]
ip = controller.get_network_status(er).address

or I not try it yet, there is或者我还没试过,有

get_network_statuses - provides all presently available router status entries

hope it helps.希望能帮助到你。 https://stem.torproject.org/api/control.html https://stem.torproject.org/api/control.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM