MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / inject_javascript_handler

Function inject_javascript_handler

examples/contrib/xss_scanner.py:367–380  ·  view source on GitHub ↗

Whether you can inject a Javascript:alert(0) as a link

(html: str)

Source from the content-addressed store, hash-verified

365 return False
366
367 def inject_javascript_handler(html: str) -> bool:
368 """Whether you can inject a Javascript:alert(0) as a link"""
369
370 class injectJSHandlerHTMLParser(HTMLParser):
371 injectJSHandler = False
372
373 def handle_starttag(self, tag, attrs):
374 for name, value in attrs:
375 if name == "href" and value.startswith(FRONT_WALL.decode("utf-8")):
376 self.injectJSHandler = True
377
378 parser = injectJSHandlerHTMLParser()
379 parser.feed(html)
380 return parser.injectJSHandler
381
382 # Only convert the body to bytes if needed
383 if isinstance(body, str):

Callers 1

get_XSS_dataFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…