I want to print external ip when the system is connected to tor proxy. ie. tor exit node IP. I have found plenty of ways, by using online services. But i have found that most of the servers are sending empty response or not reachable since its blocking tor (i think so). Is there any dedicated servers for that? is there any way by using tor control port?

NOTE: sites like ifconfig.me, ipfy , ..etc Fails most of the time.

1 Answer 1


Create an alias like this:

alias tconfig='curl --socks5 https://check.torproject.org |& grep -Po "(?<=strong>)[\d\.]+(?=</strong)"'

then whenever you want run tconfig to get your exit node ip.

You can also use other tools but they can't say what circuit you are connecting to.

  • Thank you it worked. can i do the same thing in python too? using beautifulsoup library?
    – knobiDev
    Aug 2, 2017 at 5:59
  • @Susmith you can do it using any language or library that's up to you ;)
    – Ravexina
    Aug 2, 2017 at 7:54
  • @Susmith Be aware that your Tor client changes its exit node every ten minutes or so, so any new TCP connections after ten minutes probably use a new IP. Mar 18, 2018 at 0:02
  • On macOS and likely a different version of grep, 2.5.1, the grep command didn't seem to work. Here's my alternative solution alias tconfig='curl --socks5 https://check.torproject.org |& grep "<strong>" | grep -Eo "(\d|\.)+"'
    – James T.
    Mar 25, 2020 at 21:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .