Exemple #1
0
 def gen_traffic(self, url):
     domain = get_domain_from_url(url)
     # add cookie to DEFAULT_HEADER
     cookie = get_cookie(domain)
     self.DEFAULT_HEADER['Cookie'] = cookie
     # add referer
     self.DEFAULT_HEADER['Referer'] = 'https"//' + domain + '/'
     request = HttpRequest(method='GET', url=url, headers=self.DEFAULT_HEADER, body='')
     req = urllib2.Request(url=url, headers=self.DEFAULT_HEADER)
     with gevent.Timeout(10, False)as t:
         try:
             resp = urllib2.urlopen(req)
         except urllib2.URLError, e:
             REQUEST_ERROR.append(('gen_traffic()', url, e.reason))
         except CertificateError:
             REQUEST_ERROR.append(('gen_traffic()', url, 'ssl.CertificateError'))
Exemple #2
0
     # default 2 if use browser
     num = 2
     if args.url:
         num = 1
 if args.process:
     num = args.process
 if args.coroutine:
     coroutine = args.coroutine
 if args.cookie:
     from cookie import save_cookie_ip, is_ip
     if file:
         with open(file) as f:
             scope_url = f.readline().strip()
     elif url:
         scope_url = url
     domain = get_domain_from_url(scope_url)
     if is_ip(scope_url):
         save_cookie_ip(args.cookie, domain)
     else:
         from cookie import save_cookie
         save_cookie(args.cookie, domain)
 if url or file or burp or args.id or args.filter:
     if args.id:
         id = args.id
         if not Engine.is_scanned(id):
             print 'Task %s not found,exit.'
             exit(0)
     else:
         id = gen_id()
     engine = Engine(id=id,
                     url=url,