1

Is there anyway to print out the IP address that is generated by TOR, to ensure that it is not using my IP address?

Here is my code:

from stem import Signal
from stem.control import Controller

def tor_connection():
    with Controller.from_port(port=9051) as controller:
        controller.authenticate(password='password')
        controller.signal(Signal.NEWNYM)
        time.sleep(controller.get_newnym_wait())

If there is a way to print out the IP address that is generated by TOR how would I write that in?

user3062459
  • 1,587
  • 7
  • 27
  • 39
  • To get your exit node's IP, you have to have a circuit established which might not happen if Tor is dormant (signal NEWNYM won't make it non-dormant). You can either use `GETINFO circuit-status` and parse each circuit, most likely the first general purpose circuit with 3 hops will reveal your exit node (but not it's IP). The easiest way is to issue a request using cURL's socks proxy to a site that reveals your IP. – drew010 Mar 23 '17 at 18:58
  • How would I issue a request using cURL's socks proxy to reveal my IP? Can you provide a code sample? – user3062459 Mar 23 '17 at 19:11
  • I assume you mean this: `curl --socks http://localhost:9050 -L http://ifconfig.me` If so, how would you implement this in Python 3.4? – user3062459 Mar 23 '17 at 19:23
  • Either curl or Python requests or urllib or however you plan on using Tor. – drew010 Mar 24 '17 at 00:09

0 Answers0