connection.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:SlowLoris 作者: maxkrivich 项目源码 文件源码
def __init__(self, target, socket_count=300, headers={
        'User-Agent': None,  # UserAgent()
        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
        'Accept-Encoding': 'gzip, deflate',
        'Accept-Language': 'ru,en-us;q=0.7,en;q=0.3',
        'Accept-Charset': 'windows-1251,utf-8;q=0.7,*;q=0.7',
        'Connection': 'keep-alive'
    }):
        """

        :param target: link to web server [TargetInfo]
        :param socket_count: maximum count of created socket default value 300
        :param headers: HTTP headers what puts in request
        """
        super(Connection, self).__init__()
        # self.lock = lock
        self.target = target
        self.headers = headers

        try:
            self.fake_ua = UserAgent()
        except FakeUserAgentError as fe:
            logger.error(fe)
        # Counters
        self.socket_count = socket_count
        self.__cnt_sent_requests = 0
        self.__cnt_died_sockets = 0
        self.__cnt_alive_socket = 0
        self.__sockets = []
        self.is_stop = False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号