Exemplo n.º 1
0
    def GoNextPage(self, next_page_url):
        headers = {'User-Agent': getRandomAgent()}
        response = requests.get(url=next_page_url, headers=headers)
        body = PacketStromResponse(response.content,
                                   response.apparent_encoding)

        return body, body.next_page_url
Exemplo n.º 2
0
 def __init__(self):
     self.hostname = None
     self.port = None
     #HTTPConnection的四个参数
     self.method = None
     self.request_header = {'User-Agent': getRandomAgent()}
     self.request_body = None
     self.path = '/'
Exemplo n.º 3
0
    def GoNextPage(self, next_page_url):
        headers ={
            'User-Agent':getRandomAgent()
        }
        response = requests.get(url=next_page_url, headers = headers)
        body = PacketStromResponse(response.content, response.apparent_encoding)

        return body, body.next_page_url
Exemplo n.º 4
0
 def buildRequest(self, url):
     request = Method.buildRequest(self, url)
     request.get_method = lambda: 'PUT'
     data = 'test'
     request.add_data(data)
     request.add_header('Content-Length', len(data))
     request.add_header('User-Agent', getRandomAgent())
     return request
Exemplo n.º 5
0
 def buildRequest(self, url):
     request = Method.buildRequest(self,url)
     request.get_method = lambda: 'PUT'
     data = 'test'
     request.add_data(data)
     request.add_header('Content-Length', len(data))
     request.add_header('User-Agent', getRandomAgent())
     return request
Exemplo n.º 6
0
 def __init__(self):
     self.hostname=None
     self.port=None
     #HTTPConnection的四个参数
     self.method=None
     self.request_header={
         'User-Agent':getRandomAgent()
     }
     self.request_body=None
     self.path = '/'
Exemplo n.º 7
0
    def GoNextPage(self, next_page_url):
        headers ={
            'Cookie':'SRCHD=D=4157510&AF=NOFORM; SRCHUSR=AUTOREDIR=0&GEOVAR=&DOB=20151127; _EDGE_V=1; MUID=2F2195A82AB36CD323ED9DC42B126D4B\
; SRCHHPGUSR=CW=1280&CH=243&DPR=2; SRCHUID=V=2&GUID=A3398A472384489FB0BCECAA822C8EDE; MUIDB=2F2195A82AB36CD323ED9DC42B126D4B\
; HPSHRLAN=CLOSE=1; _SS=SID=0B472366C4E76A200A642BCAC5466BAB&HV=1454139963; _EDGE_S=mkt=zh-cn&SID=0B472366C4E76A200A642BCAC5466BAB\
; WLS=C=&N=; SNRHOP=TS=635897356787832176&I=1; SCRHDN=ASD=0&DURL=#',
            'User-Agent':getRandomAgent(),
            'X-Forwarded-For':'203.69.42.169'
        }
        response = requests.get(url=next_page_url, headers = headers)
        body = BingResponseLinks(response.content, response.apparent_encoding)

        return body, body.next_page_url
Exemplo n.º 8
0
    def do(self):
        try:
            uri_http = urlparse.urlunsplit(
                ('http', self.description, exploit_path, '', ''))
            uri_https = urlparse.urlunsplit(
                ('https', self.description, exploit_path, '', ''))
            uri_http_mgr = urlparse.urlunsplit(
                ('http', ('%s:%d' % (self.description, 7071)), '/zimbraAdmin/',
                 '', ''))
            uri_https_mgr = urlparse.urlunsplit(
                ('https', ('%s:%d' % (self.description, 7071)),
                 '/zimbraAdmin/', '', ''))
            headers = {'User-Agent': getRandomAgent()}
            self.result = {
                'http':
                requests.Request('GET', uri_http, headers=headers),
                'https':
                requests.Request('GET', uri_https, headers=headers),
                'http_mgr':
                requests.Request('GET', uri_http_mgr, headers=headers),
                'https_mgr':
                requests.Request('GET', uri_https_mgr, headers=headers)
            }

            http_session = requests.Session()

            for k, v in self.result.items():
                request = http_session.prepare_request(v)
                try:
                    self.result[k] = http_session.send(request,
                                                       timeout=self.timeout,
                                                       verify=False)
                except Exception as e:
                    self.result[k] = e
            '''
            #超时,连接重置判定
            cnt_exception = 0
            for k, v in self.result.items():
                if not isinstance(v, requests.Response):
                    cnt_exception = cnt_exception + 1

            if cnt_exception == len(self.result):
                self.is_timeout = True
                self.retry = 3
                raise Exception('time out or connection reset')
            '''
        except Exception as e:
            self.exception = e

        return Job.do(self)
Exemplo n.º 9
0
    def GoNextPage(self, next_page_url):
        headers = {
            'Cookie':
            'SRCHD=D=4157510&AF=NOFORM; SRCHUSR=AUTOREDIR=0&GEOVAR=&DOB=20151127; _EDGE_V=1; MUID=2F2195A82AB36CD323ED9DC42B126D4B\
; SRCHHPGUSR=CW=1280&CH=243&DPR=2; SRCHUID=V=2&GUID=A3398A472384489FB0BCECAA822C8EDE; MUIDB=2F2195A82AB36CD323ED9DC42B126D4B\
; HPSHRLAN=CLOSE=1; _SS=SID=0B472366C4E76A200A642BCAC5466BAB&HV=1454139963; _EDGE_S=mkt=zh-cn&SID=0B472366C4E76A200A642BCAC5466BAB\
; WLS=C=&N=; SNRHOP=TS=635897356787832176&I=1; SCRHDN=ASD=0&DURL=#',
            'User-Agent': getRandomAgent(),
            'X-Forwarded-For': '203.69.42.169'
        }
        response = requests.get(url=next_page_url, headers=headers)
        body = BingResponseLinks(response.content, response.apparent_encoding)

        return body, body.next_page_url
Exemplo n.º 10
0
    def do(self):
        try:
            uri_http = urlparse.urlunsplit(('http',self.description, exploit_path,'',''))
            uri_https = urlparse.urlunsplit(('https',self.description, exploit_path,'',''))
            uri_http_mgr = urlparse.urlunsplit(('http',('%s:%d' % (self.description, 7071)), '/zimbraAdmin/','',''))
            uri_https_mgr = urlparse.urlunsplit(('https',('%s:%d' % (self.description, 7071)), '/zimbraAdmin/','',''))
            headers = {'User-Agent':getRandomAgent()}
            self.result = {
                'http' : requests.Request('GET', uri_http ,headers=headers),
                'https' : requests.Request('GET', uri_https ,headers=headers),
                'http_mgr' : requests.Request('GET', uri_http_mgr ,headers=headers),
                'https_mgr' : requests.Request('GET', uri_https_mgr ,headers=headers)
            }

            http_session = requests.Session()

            for k, v in self.result.items():
                request = http_session.prepare_request(v)
                try:
                    self.result[k] = http_session.send(request,
                                                       timeout = self.timeout,
                                                       verify = False)
                except Exception as e:
                    self.result[k] = e

            '''
            #超时,连接重置判定
            cnt_exception = 0
            for k, v in self.result.items():
                if not isinstance(v, requests.Response):
                    cnt_exception = cnt_exception + 1

            if cnt_exception == len(self.result):
                self.is_timeout = True
                self.retry = 3
                raise Exception('time out or connection reset')
            '''
        except Exception as e:
            self.exception = e

        return Job.do(self)
Exemplo n.º 11
0
    def GoNextPage(self, next_page_url):
        headers ={
            'Cookie':'SRCHD=D=4157510&AF=NOFORM; SRCHUSR=AUTOREDIR=0&GEOVAR=&DOB=20151127; _EDGE_V=1; MUID=2F2195A82AB36CD323ED9DC42B126D4B\
; SRCHHPGUSR=CW=1280&CH=243&DPR=2; SRCHUID=V=2&GUID=A3398A472384489FB0BCECAA822C8EDE; MUIDB=2F2195A82AB36CD323ED9DC42B126D4B\
; HPSHRLAN=CLOSE=1; _SS=SID=0B472366C4E76A200A642BCAC5466BAB&HV=1454139963; _EDGE_S=mkt=zh-cn&SID=0B472366C4E76A200A642BCAC5466BAB\
; WLS=C=&N=; SNRHOP=TS=635897356787832176&I=1; SCRHDN=ASD=0&DURL=#',
            'User-Agent':getRandomAgent(),
            'X-Forwarded-For':'203.69.42.169'
        }
        response = requests.get(url=next_page_url, headers = headers)
        body = response.content
        dom_body = html.fromstring(body.decode(response.encoding))

        next_page_url=''
        hrefs = dom_body.xpath("//a[@class='sb_pagN']")
        if len(hrefs) == 0:
            return dom_body, body, None

        for next_page_link in hrefs:
            next_page_url = next_page_link.attrib['href']
            next_page_url = ('https://'+ self.hostname + next_page_url)
            return dom_body, body, next_page_url
Exemplo n.º 12
0
 def buildRequest(self, url):
     request = Method.buildRequest(self,url)
     request.get_method = lambda: 'OPTIONS'
     request.add_header('User-Agent', getRandomAgent())
     return request
Exemplo n.º 13
0
 def buildRequest(self,url):
     request = urllib2.Request(url)
     request.add_header('User-Agent', getRandomAgent())
     return request
Exemplo n.º 14
0
 def buildRequest(self, url):
     request = Method.buildRequest(self, url)
     request.get_method = lambda: 'OPTIONS'
     request.add_header('User-Agent', getRandomAgent())
     return request
Exemplo n.º 15
0
 def buildRequest(self, url):
     request = urllib2.Request(url)
     request.add_header('User-Agent', getRandomAgent())
     return request