Here are the examples of the python api webvulnscan.request.Request taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
Example 1
Project: webvulnscan Source File: test_page.py
def FakePage(html, headers={}, status_code=200, url="http://test/"):
log = tutil.TestLog()
req = webvulnscan.request.Request(url)
return webvulnscan.page.Page(log, req, html=html,
headers=headers, status_code=status_code)
0
Example 2
def _serve_request(self):
parsed_path = urlparse(self.path)
current_path = parsed_path.path.split('/')[1]
if parsed_path.path == "/":
self._default_page()
elif current_path in sitemap:
extended_path = "".join(parsed_path.path.split('/')[2:])
site = sitemap[current_path]
client = site.client
if parsed_path.query == "":
url = "http://test.webvulnscan/" + extended_path
else:
url = "http://test.webvulnscan/" + extended_path +\
"?" + parsed_path.query
request = webvulnscan.request.Request(url)
if 'content-length' in self.headers:
content_len = int(self.headers['content-length'])
body = self.rfile.read(content_len)
request.parameters = parse_qs(body)
for value in request.parameters:
new_value = request.parameters[value][0].decode('utf-8')
request.parameters[value] = new_value
_, status_code, response_data, headers = client._download(request)
self.send_response(status_code)
self.send_header('Content-Type', 'text/html')
for header in headers:
self.send_header(header[0], header[1])
self.end_headers()
self.wfile.write(response_data)
else:
self.send_error(404, "File not Found!")