Skip to content

Instantly share code, notes, and snippets.

@epcnt19
Created May 4, 2018 04:31
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 epcnt19/3b45e946eb938c0065b23c2765dd2a32 to your computer and use it in GitHub Desktop.
Save epcnt19/3b45e946eb938c0065b23c2765dd2a32 to your computer and use it in GitHub Desktop.
#coding:utf-8
import time
import socket
from stem import Signal
from stem.control import Controller
password= 'password'
domain = 'torproject.org'
domain_dic = {domain:['138.201.14.197','154.35.132.71']}
correct = 0
blocking = 0
with Controller.from_port(port=9051) as controller:
for i in range(10):
controller.authenticate(password=password)
foward = socket.gethostbyname(domain)
if foward in domain_dic[domain]:
correct += 1
else:
blocking += 1
print("reset circuit...")
controller.signal(Signal.NEWNYM)
time.sleep(10)
print("num of correct : {0}".format(correct))
print("num of blocking : {0}".format(blocking))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment