Created
June 17, 2016 15:37
-
-
Save dustyfresh/e90ff480bca20c97211c3de57999452f to your computer and use it in GitHub Desktop.
Check if an IP address is a Tor exit node or not. Requires the requests module.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import requests | |
import re | |
def checkTor(ip): | |
headers = {'user-agent': 'checkTor'} | |
exit_nodes = requests.get('https://check.torproject.org/exit-addresses', headers=headers) | |
exit_nodes = exit_nodes.text | |
if re.search(ip, exit_nodes): | |
return True | |
else: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
BLESS