def replace_url(self, url, payload):
     if self.fsig in url:
         return url.replace(self.fsig, urllib.quote_plus(payload))
     template_sig = self.template_signature(url)
     if template_sig:
         tp = TemplateParser()
         tp.set_payload(payload)
         new_payload = repr(
             tp.transform(self.template_signature(url),
                          self.sig))[1:-1]  # removing extra " "
         return url.replace(template_sig, new_payload)
     return url
Ejemplo n.º 2
0
 def replace_url(self, url, payload):
     if self.fsig in url:
         return url.replace(self.fsig, urllib.quote_plus(payload))
     template_sig = self.template_signature(url)
     if template_sig:
         tp = TemplateParser()
         tp.set_payload(payload)
         new_payload = repr(
             tp.transform(self.template_signature(url),
                          self.sig))[1:-1]  # removing extra " "
         return url.replace(template_sig, new_payload)
     return url
 def replace_body(self, body, payload):
     if body is None:
         return body
     if self.fsig in body:
         return body.replace(self.fsig, urllib.quote_plus(payload))
     template_sig = self.template_signature(body)
     if template_sig:
         tp = TemplateParser()
         tp.set_payload(payload)
         new_payload = repr(
             tp.transform(self.template_signature(body),
                          self.sig))[1:-1]  # removing extra " "
         return body.replace(template_sig, new_payload)
     return body
Ejemplo n.º 4
0
 def replace_body(self, body, payload):
     if body is None:
         return body
     if self.fsig in body:
         return body.replace(self.fsig, urllib.quote_plus(payload))
     template_sig = self.template_signature(body)
     if template_sig:
         tp = TemplateParser()
         tp.set_payload(payload)
         new_payload = repr(
             tp.transform(self.template_signature(body),
                          self.sig))[1:-1]  # removing extra " "
         return body.replace(template_sig, new_payload)
     return body
Ejemplo n.º 5
0
 def replace_header(self, headers, payload):
     raw_headers = str(headers)
     if self.fsig in raw_headers:
         raw_headers = raw_headers.replace(self.fsig, payload)
         return HTTPHeaders(ast.literal_eval(raw_headers))
     template_sig = self.template_signature(raw_headers)
     if template_sig:
         tp = TemplateParser()
         tp.set_payload(payload)
         header_template = self.template_signature(raw_headers)
         new_payload = repr(tp.transform(
             header_template, self.sig))[1:-1]  # removing extra " "
         raw_headers = raw_headers.replace(header_template, new_payload)
         new_headers = HTTPHeaders(ast.literal_eval(raw_headers))
         return new_headers
     return headers
 def replace_header(self, headers, payload):
     raw_headers = str(headers)
     if self.fsig in raw_headers:
         raw_headers = raw_headers.replace(self.fsig, payload)
         return HTTPHeaders(ast.literal_eval(raw_headers))
     template_sig = self.template_signature(raw_headers)
     if template_sig:
         tp = TemplateParser()
         tp.set_payload(payload)
         header_template = self.template_signature(raw_headers)
         new_payload = repr(
             tp.transform(header_template,
                          self.sig))[1:-1]  # removing extra " "
         raw_headers = raw_headers.replace(header_template, new_payload)
         new_headers = HTTPHeaders(ast.literal_eval(raw_headers))
         return new_headers
     return headers