diff options
author | Maximilian Hils <git@maximilianhils.com> | 2019-11-15 17:24:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-15 17:24:59 +0100 |
commit | 50443df3404e660984c5bbfd999dc96d0bc9b1b2 (patch) | |
tree | 58a1636284b7a933b7c483531723f780f77e6efc /examples/complex | |
parent | 3eebfed79f4d54840a054c2dc5061e155c416d3e (diff) | |
parent | f6f9eb2c4e022cd44ccc39b3f61fdf31cbfea793 (diff) | |
download | mitmproxy-50443df3404e660984c5bbfd999dc96d0bc9b1b2.tar.gz mitmproxy-50443df3404e660984c5bbfd999dc96d0bc9b1b2.tar.bz2 mitmproxy-50443df3404e660984c5bbfd999dc96d0bc9b1b2.zip |
Merge branch 'master' into master
Diffstat (limited to 'examples/complex')
-rw-r--r-- | examples/complex/__init__.py | 0 | ||||
-rw-r--r-- | examples/complex/har_dump.py | 5 | ||||
-rwxr-xr-x | examples/complex/xss_scanner.py | 4 |
3 files changed, 6 insertions, 3 deletions
diff --git a/examples/complex/__init__.py b/examples/complex/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/examples/complex/__init__.py diff --git a/examples/complex/har_dump.py b/examples/complex/har_dump.py index 33a2f79f..e3cea9fd 100644 --- a/examples/complex/har_dump.py +++ b/examples/complex/har_dump.py @@ -87,7 +87,10 @@ def response(flow): } # HAR timings are integers in ms, so we re-encode the raw timings to that format. - timings = dict([(k, int(1000 * v)) for k, v in timings_raw.items()]) + timings = { + k: int(1000 * v) if v != -1 else -1 + for k, v in timings_raw.items() + } # full_time is the sum of all timings. # Timings set to -1 will be ignored as per spec. diff --git a/examples/complex/xss_scanner.py b/examples/complex/xss_scanner.py index 97e94ed4..d5f4aaab 100755 --- a/examples/complex/xss_scanner.py +++ b/examples/complex/xss_scanner.py @@ -86,7 +86,7 @@ def get_cookies(flow: http.HTTPFlow) -> Cookies: return {name: value for name, value in flow.request.cookies.fields} -def find_unclaimed_URLs(body: str, requestUrl: bytes) -> None: +def find_unclaimed_URLs(body, requestUrl): """ Look for unclaimed URLs in script tags and log them if found""" def getValue(attrs: List[Tuple[str, str]], attrName: str) -> Optional[str]: for name, value in attrs: @@ -111,7 +111,7 @@ def find_unclaimed_URLs(body: str, requestUrl: bytes) -> None: try: socket.gethostbyname(domain) except socket.gaierror: - ctx.log.error("XSS found in %s due to unclaimed URL \"%s\"." % (requestUrl, url)) + ctx.log.error(f"XSS found in {requestUrl} due to unclaimed URL \"{url}\".") def test_end_of_URL_injection(original_body: str, request_URL: str, cookies: Cookies) -> VulnData: |