コード例 #1
0
ファイル: graphql.py プロジェクト: u2ubf989u2/mitmproxy
 def __call__(self, data, **metadata):
     data = parse_json(data)
     if data is not PARSE_ERROR:
         if is_graphql_query(data):
             return "GraphQL", base.format_text(format_graphql(data))
         elif is_graphql_batch_query(data):
             return "GraphQL", base.format_text(format_query_list(data))
コード例 #2
0
ファイル: html_outline.py プロジェクト: whocare2014/banruo
 def __call__(self, data, **metadata):
     data = data.decode("utf-8", "replace")
     h = html2text.HTML2Text(baseurl="")
     h.ignore_images = True
     h.body_width = 0
     outline = h.handle(data)
     return "HTML Outline", base.format_text(outline)
コード例 #3
0
ファイル: xml_html.py プロジェクト: dwfreed/mitmproxy
 def __call__(self, data, **metadata):
     # TODO:
     # We should really have the message text as str here,
     # not the message content as bytes.
     # https://github.com/mitmproxy/mitmproxy/issues/1662#issuecomment-266192578
     data = data.decode("utf8", "xmlcharrefreplace")
     tokens = tokenize(data)
     # TODO:
     # Performance: Don't render the whole document right away.
     # Let's wait with this until we have a sequence-like interface,
     # this thing is reasonably fast right now anyway.
     pretty = base.format_text(format_xml(tokens))
     if "html" in data.lower():
         t = "HTML"
     else:
         t = "XML"
     return t, pretty
コード例 #4
0
ファイル: xml_html.py プロジェクト: zhzDeveloper/mitmproxy
 def __call__(self, data, **metadata):
     # TODO:
     # We should really have the message text as str here,
     # not the message content as bytes.
     # https://github.com/mitmproxy/mitmproxy/issues/1662#issuecomment-266192578
     data = data.decode("utf8", "xmlcharrefreplace")
     tokens = tokenize(data)
     # TODO:
     # Performance: Don't render the whole document right away.
     # Let's wait with this until we have a sequence-like interface,
     # this thing is reasonably fast right now anyway.
     pretty = base.format_text(format_xml(tokens))
     if "html" in data.lower():
         t = "HTML"
     else:
         t = "XML"
     return t, pretty
コード例 #5
0
ファイル: css.py プロジェクト: EndUser509/mitmproxy
 def __call__(self, data, **metadata):
     data = data.decode("utf8", "surrogateescape")
     beautified = beautify(data)
     return "CSS", base.format_text(beautified)
コード例 #6
0
 def __call__(self, data, **metadata):
     data = data.decode("utf-8", "replace")
     res = beautify(data)
     return "JavaScript", base.format_text(res)
コード例 #7
0
 def __call__(self, data, **metadata):
     data = data.decode("utf-8", "replace")
     res = beautify(data)
     return "JavaScript", base.format_text(res)
コード例 #8
0
ファイル: css.py プロジェクト: cortesi/mitmproxy
 def __call__(self, data, **metadata):
     data = data.decode("utf8", "surrogateescape")
     beautified = beautify(data)
     return "CSS", base.format_text(beautified)
コード例 #9
0
 def __call__(self, data, **metadata):
     pj = pretty_json(data)
     if pj:
         return "JSON", base.format_text(pj)
コード例 #10
0
ファイル: json.py プロジェクト: StevenVanAcker/mitmproxy
 def __call__(self, data, **metadata):
     pj = pretty_json(data)
     if pj:
         return "JSON", base.format_text(pj)
コード例 #11
0
ファイル: msgpack.py プロジェクト: tasn/mitmproxy
def format_msgpack(data):
    return base.format_text(pretty(data))