<commit_before>import utils.http as http
import utils.dnslib as dns

SEARCH_STRING = "home network testbed will appear at"

class TurkeyExperiment:
    name = "turkey"

    def __init__(self, input_file):
        self.input_file = input_file
        self.results = []
        self.host = "twitter.com"
        self.path = "/feamster/status/452889624541921280"

    def run(self):
        ips = dns.get_ips(self.host)
        blocked_ips = filter(self.is_blocked, ips)

        print ips, blocked_ips

        # let's try using Google's nameserver
        ips = dns.get_ips(self.host, nameserver="8.8.8.8")
        blocked_ips = filter(self.is_blocked, ips)

        print ips, blocked_ips

    def is_blocked(self, ip):
        headers = {
            "Host" : self.host
        }

        result = http.get_request(ip, self.path, headers, ssl=True)
<commit_msg>add logic to turkey test<commit_after>import utils.http as http
import utils.dnslib as dns

SEARCH_STRING = "home network testbed will appear at"

class TurkeyExperiment:
    name = "turkey"

    def __init__(self, input_file):
        self.input_file = input_file
        self.results = []
        self.host = "twitter.com"
        self.path = "/feamster/status/452889624541921280"

    def run(self):
        ips = dns.get_ips(self.host)
        blocked_ips = filter(self.is_blocked, ips)

        if not blocked_ips:
            print "No censorship"
            return

        # let's try using Google's nameserver
        ips = dns.get_ips(self.host, nameserver="8.8.8.8")
        blocked_ips = filter(self.is_blocked, ips)

        if not blocked_ips:
            print "DNS blocking, use Google DNS"
            return
        
        print blocked_ips

    def is_blocked(self, ip):
        headers = {
            "Host" : self.host
        }

        result = http.get_request(ip, self.path, headers, ssl=True)

{'fraction_non_alphanumeric': 0.09708222811671087, 'fraction_numerical': 0.023342175066312996, 'mean_word_length': 2.212947189097104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7019030', 'n_tokens_mistral': 651, 'n_tokens_neox': 605, 'n_words': 145}