hacklib.py 文件源码

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

项目:python-hacklib 作者: lazorfuzz 项目源码 文件源码
def _login_BA(self):
        try:
            # Creates a PasswordMgr instance
            passmanager = urllib2.HTTPPasswordMgrWithDefaultRealm()
            passmanager.add_password(None, self.url, self.username, self.password)
            # Creates an auth handling object and builds it with opener
            auth = urllib2.HTTPBasicAuthHandler(passmanager)
            opener = urllib2.build_opener(auth)
            response = opener.open(self.url, timeout=8)
            data = response.read()
            response.close()
            return data
        except Exception, e:
            if 'Error 401' in str(e):
                raise Exception('Login credentials incorrect.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号