template features

This commit is contained in:
Roman Hergenreder 2023-10-04 12:24:41 +02:00
parent b4a96e1398
commit 8a10184379
4 changed files with 19 additions and 6 deletions

@ -79,9 +79,14 @@ class FileServerRequestHandler(BaseHTTPRequestHandler):
result = route(self)
blacklist_headers = ["transfer-encoding", "content-length", "content-encoding", "allow", "connection"]
status_code = 200 if len(result) < 1 else result[0]
data = b"" if len(result) < 2 else result[1]
headers = { } if len(result) < 3 else result[2]
if isinstance(result, tuple):
status_code = 200 if len(result) < 1 else result[0]
data = b"" if len(result) < 2 else result[1]
headers = { } if len(result) < 3 else result[2]
else:
status_code = result
data = b""
headers = {}
if path in self.server.dumpRequests:
headers["Access-Control-Allow-Origin"] = "*"
@ -123,6 +128,7 @@ class FileServerRequestHandler(BaseHTTPRequestHandler):
print("==========")
except Exception as e:
print("Exception on handling http", str(e))
raise e
def log_message(self, format, *args):
if self.server.logRequests:

@ -4,10 +4,10 @@ import sys
def generate_template(base_url, features):
if "proxy" in features or "burp" in features:
if "proxies" in features or "burp" in features:
proxy = """
if \"proxy\" not in kwargs:
kwargs[\"proxy\"] = {\"http\":\"http://127.0.0.1:8080\", \"https\":\"http://127.0.0.1:8080\"}
if \"proxies\" not in kwargs:
kwargs[\"proxies\"] = {\"http\":\"http://127.0.0.1:8080\", \"https\":\"http://127.0.0.1:8080\"}
"""
else:
proxy = ""

@ -83,6 +83,13 @@ def assert_header_present(res, header, err=None):
err = f"[-] '{res.url}' did not return header: {header}" if err is None else err
exit_with_error(res, err)
def assert_empty(res, err=None):
if not res.content or len(res.content) == 0:
return
err = f"[-] '{res.url}' did not return unexpected data" if err is None else err
exit_with_error(res, err)
def assert_not_empty(res, err=None):
if len(res.content) > 0:
return

BIN
win/FullPowers.exe Normal file

Binary file not shown.