示例#1
0
文件: sed.py 项目: 1d3df9903ad/w3af
 def mangleResponse(self, response):
     '''
     This method mangles the response.
     
     @param response: This is the response to mangle.
     @return: A mangled version of the response.
     '''
     body = response.getBody()
     
     for regex, string in self._res_body_manglers:
         body = regex.sub(string, body)
     
     response.setBody(body)
     
     header_string = headersToString(response.getHeaders())
     
     for regex, string in self._res_head_manglers:
         header_string = regex.sub(string, header_string)
     
     response.setHeaders(stringToHeaders(header_string))
     
     if self._res_body_manglers and self._user_option_fix_content_len:
         response = self._fixContentLen(response)
     
     return response
示例#2
0
文件: sed.py 项目: adambaldwin2/test
 def mangleRequest(self, request ):
     '''
     This method mangles the request.
     
     @param request: This is the request to mangle.
     @return: A mangled version of the request.
     '''
     data = request.getData()
     for regex, string in self._req_body_manglers:
         data = regex.sub( string, data )
     
     header_string = headersToString( request.getHeaders() )
     for regex, string in self._req_head_manglers:
         header_string = regex.sub( string, header_string )
     header_dict = stringToHeaders( header_string )
     
     request = createFuzzableRequestRaw( request.getMethod() , request.getURL(), 
                                         data, header_dict )
     
     return request