mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
minor fixes
This commit is contained in:
parent
123ef043dc
commit
3e37cbd061
@ -11,7 +11,7 @@ class Injector:
|
|||||||
def response(self, flow):
|
def response(self, flow):
|
||||||
if flow.request.host in self.iframe_url:
|
if flow.request.host in self.iframe_url:
|
||||||
return
|
return
|
||||||
html = BeautifulSoup(flow.response.content)
|
html = BeautifulSoup(flow.response.content, "html.parser")
|
||||||
if html.body:
|
if html.body:
|
||||||
iframe = html.new_tag(
|
iframe = html.new_tag(
|
||||||
"iframe",
|
"iframe",
|
||||||
|
@ -17,7 +17,7 @@ class ViewAuto(base.View):
|
|||||||
if ct in contentviews.content_types_map:
|
if ct in contentviews.content_types_map:
|
||||||
return contentviews.content_types_map[ct][0](data, **metadata)
|
return contentviews.content_types_map[ct][0](data, **metadata)
|
||||||
elif strutils.is_xml(data):
|
elif strutils.is_xml(data):
|
||||||
return contentviews.get("XML")(data, **metadata)
|
return contentviews.get("XML/HTML")(data, **metadata)
|
||||||
if metadata.get("query"):
|
if metadata.get("query"):
|
||||||
return contentviews.get("Query")(data, **metadata)
|
return contentviews.get("Query")(data, **metadata)
|
||||||
if data and strutils.is_mostly_bin(data):
|
if data and strutils.is_mostly_bin(data):
|
||||||
|
@ -82,4 +82,4 @@ def test_get_message_content_view():
|
|||||||
|
|
||||||
|
|
||||||
def test_get_by_shortcut():
|
def test_get_by_shortcut():
|
||||||
assert contentviews.get_by_shortcut("h")
|
assert contentviews.get_by_shortcut("s")
|
||||||
|
@ -56,7 +56,7 @@ class TestScripts(mastertest.MasterTest):
|
|||||||
tscript("simple/modify_body_inject_iframe.py")
|
tscript("simple/modify_body_inject_iframe.py")
|
||||||
|
|
||||||
m, sc = tscript("simple/modify_body_inject_iframe.py", "http://example.org/evil_iframe")
|
m, sc = tscript("simple/modify_body_inject_iframe.py", "http://example.org/evil_iframe")
|
||||||
f = tflow.tflow(resp=tutils.tresp(content=b"<html>mitmproxy</html>"))
|
f = tflow.tflow(resp=tutils.tresp(content=b"<html><body>mitmproxy</body></html>"))
|
||||||
m.response(f)
|
m.response(f)
|
||||||
content = f.response.content
|
content = f.response.content
|
||||||
assert b'iframe' in content and b'evil_iframe' in content
|
assert b'iframe' in content and b'evil_iframe' in content
|
||||||
|
Loading…
Reference in New Issue
Block a user