Skip to content

Instantly share code, notes, and snippets.

@GrenderG
Last active October 24, 2017 22:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GrenderG/c680b8f4a723ef81b2fdadc83b641848 to your computer and use it in GitHub Desktop.
Save GrenderG/c680b8f4a723ef81b2fdadc83b641848 to your computer and use it in GitHub Desktop.
Check if you are using Tor
import requests
TOR_CHECK_URL = 'https://check.torproject.org/cgi-bin/TorBulkExitList.py?ip=1.1.1.1'
IPIFY_API_URL = 'https://api.ipify.org'
def check_tor():
ip = requests.get(IPIFY_API_URL).text
tor_exit_node_list = requests.get(TOR_CHECK_URL).text
return ip in tor_exit_node_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment