Skip to content

Instantly share code, notes, and snippets.

@snj

snj/tor exit

Created Jan 6, 2014
Embed
What would you like to do?
#!/usr/bin/env python2
import requests
from iso3166 import countries
url="http://example.com/path/to/it"
cookies = dict(session='dcd83eacd7b3518b0d5064ce957d606218cc15616ec72c18cd866a9972aca6fb')
data= requests.get(url,cookies=cookies,verify=False).content
lines = data.split('\n')
flags = []
for i in lines:
if "inactive" in i:
flag = i[75:77]
flags.append(flag)
print flags
for todo in flags:
print countries.get(todo)[0]
fd = open("torrc", "w")
fd.write("ExitNodes {" + "},{".join(flags) + "}")
fd.close()
#started via: while true; do ./tor.py; tor -f torrc & ; PID=${!}; sleep 1; torify curl "https://149.13.33.74:443/ref/LoH9uD2k6GWj7li"; kill $PID; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment