예제 #1
0
 def modifyRequest(self, request ):
     '''
     Mangles the request
     
     @parameter request: urllib2.Request instance that is going to be modified by the evasion plugin
     '''
     # First we mangle the URL        
     path = urlParser.getPathQs( request.get_full_url() )
     path = self._mutate( path )
     
     # Now we mangle the postdata
     data = request.get_data()
     if data:
         # Only mangle the postdata if it is a url encoded string
         try:
             urlParser.getQueryString('http://w3af/?' + data )
         except:
             pass
         else:
             data = self._mutate( data )            
     
     # Finally, we set all the mutants to the request in order to return it
     url = urlParser.getProtocol( request.get_full_url() )
     url += '://' + urlParser.getNetLocation( request.get_full_url() ) + path
     
     new_req = urllib2.Request( url , data, request.headers, request.get_origin_req_host() )
     
     return new_req
예제 #2
0
 def modifyRequest(self, request ):
     '''
     Mangles the request
     
     @parameter request: urllib2.Request instance that is going to be modified by the evasion plugin
     '''
     # This is a test URL
     # http://172.16.1.132/index.asp?q=%uFF1Cscript%3Ealert(%22Hello%22)%3C/script%3E
     # This is the content of index.asp :
     # <%=Request.QueryString("q")%>
     
     # First we mangle the URL        
     path = urlParser.getPathQs( request.get_full_url() )
     path = self._mutate( path )
     
     # Now we mangle the postdata
     data = request.get_data()
     if data:
         # Only mangle the postdata if it is a url encoded string
         try:
             urlParser.getQueryString('http://w3af/?' + data )
         except:
             pass
         else:
             data = self._mutate( data )            
     
     # Finally, we set all the mutants to the request in order to return it
     url = urlParser.getProtocol( request.get_full_url() )
     url += '://' + urlParser.getNetLocation( request.get_full_url() ) + path
     
     new_req = urllib2.Request( url , data, request.headers, request.get_origin_req_host() )
     
     return new_req
예제 #3
0
 def createBurpRequest(self,request,method):
     """Create a Burp formated request from 
     a urllib2 request object
     """
     new_req=[]
     path = getPathQs(request.get_full_url())
     new_req.append(method + ' ' + path + ' ' + 'HTTP/1.1')
     # Unfortunatly a dict is not sorted so random order. We need to work with urllib2 though
     # with w3af, so I may need to find a way to fix this
     for key in request.headers.keys():
         new_req.append("%s: %s" % (key, request.headers[key]))
     if method == 'POST':
         new_req.append('')
         new_req.append(request.get_data())
     new_req = '\r\n'.join(new_req) + '\r\n\r\n'
     return new_req
예제 #4
0
 def createBurpRequest(self, request, method):
     """Create a Burp formated request from 
     a urllib2 request object
     """
     new_req = []
     path = getPathQs(request.get_full_url())
     new_req.append(method + ' ' + path + ' ' + 'HTTP/1.1')
     # Unfortunatly a dict is not sorted so random order. We need to work with urllib2 though
     # with w3af, so I may need to find a way to fix this
     for key in request.headers.keys():
         new_req.append("%s: %s" % (key, request.headers[key]))
     if method == 'POST':
         new_req.append('')
         new_req.append(request.get_data())
     new_req = '\r\n'.join(new_req) + '\r\n\r\n'
     return new_req
예제 #5
0
 def modifyRequest(self, request ):
     '''
     Mangles the request
     
     @parameter request: urllib2.Request instance that is going to be modified by the evasion plugin
     '''
     # We mangle the URL
     path = urlParser.getPathQs( request.get_full_url() )
     path = path.replace('/','/./' )
     
     # Finally, we set all the mutants to the request in order to return it
     url = urlParser.getProtocol( request.get_full_url() )
     url += '://' + urlParser.getNetLocation( request.get_full_url() ) + path        
     new_req = urllib2.Request( url , request.get_data(), request.headers, 
                                             request.get_origin_req_host() )
     
     return new_req
예제 #6
0
 def modifyRequest(self, request ):
     '''
     Mangles the request
     
     @parameter request: urllib2.Request instance that is going to be modified by the evasion plugin
     '''
     # We mangle the URL
     path = urlParser.getPathQs( request.get_full_url() )
     if re.match('^/', path):
         random_alnum = createRandAlNum()
         path = '/' + random_alnum + '/..' + path
     
     # Finally, we set all the mutants to the request in order to return it
     url = urlParser.getProtocol( request.get_full_url() )
     url += '://' + urlParser.getNetLocation( request.get_full_url() ) + path        
     new_req = urllib2.Request( url , request.get_data(), request.headers,
                                             request.get_origin_req_host() )
     
     return new_req