Created
May 4, 2018 04:31
-
-
Save epcnt19/3b45e946eb938c0065b23c2765dd2a32 to your computer and use it in GitHub Desktop.
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
#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