0

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).

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). Other answers suggest using external services through curl or otherwise which is not what I am looking for.

I am using GNU/Linux.

1 Answers1

1

cid - is circuit id with currently in use or any other circuit id you want.
1 - by cid we retrieve circuit event whith circuit state , we taking finger print of exit node(last element in path property).
2 - checking network status and take address property.

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

kaa
  • 91
  • 2
  • 3