如何获取正在使用的TOR入口节点的IP地址 [英] How do I get the IP address of the TOR entry node in use

查看:31
本文介绍了如何获取正在使用的TOR入口节点的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找映射 tor 的方法,并查看地址是如何分配的,但我需要能够知道我在任何给定时间使用的入口节点的 IP 地址.

I've been poking around at ways to map tor, and to look at how addresses get allocated but I need to be able to know the IP address of the entry node that I'm using at any given time.

不确定从哪里开始,因为我只是一个熟练的程序员 (python),并且倾向于根据需要学习零碎的知识.任何指向要使用的命令的指针将不胜感激.

Not really sure where to start as I'm not more than a journeyman programmer (python) and tend to learn bits and pieces as necessary. Any pointers to commands to use would b emuch appreciated.

我确实认为在中间节点上运行 wireshark 可能是最简单的方法,但需要一台我现在没有的额外机器.

I did think that running wireshark on an intermediate node might be the easiest way but needs an extra machine that I don't have knocking around at the minute.

推荐答案

其实这个和 我们的常见问题解答之一.要获取当前电路的 IP 地址,您可以使用 stem...

Actually, this is very similar to one of our FAQ entries. To get the IP address of your present circuits you can do the following using stem...

from stem import CircStatus
from stem.control import Controller

with Controller.from_port() as controller:
  controller.authenticate()

  for circ in controller.get_circuits():
    if circ.status != CircStatus.BUILT:
      continue  # skip circuits that aren't yet usable

    entry_fingerprint = circ.path[0][0]
    entry_descriptor = controller.get_network_status(entry_fingerprint, None)

    if entry_descriptor:
      print "Circuit %s starts with %s" % (circ.id, entry_descriptor.address)
    else:
      print "Unable to determine the address belonging to circuit %s" % circ.id

这提供了类似...的输出

This provides output like...

atagar@morrigan:~/Desktop/stem$ python example.py 
Circiut 15 starts with 209.222.8.196
Circiut 7 starts with 209.222.8.196

希望这有帮助!-达米安

Hope this helps! -Damian

这篇关于如何获取正在使用的TOR入口节点的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆