(state, flow: mitmproxy.flow.Flow)
| 21 | |
| 22 | |
| 23 | def flowdetails(state, flow: mitmproxy.flow.Flow): |
| 24 | text = [] |
| 25 | |
| 26 | sc = flow.server_conn |
| 27 | cc = flow.client_conn |
| 28 | req: http.Request | None |
| 29 | resp: http.Response | None |
| 30 | if isinstance(flow, http.HTTPFlow): |
| 31 | req = flow.request |
| 32 | resp = flow.response |
| 33 | else: |
| 34 | req = None |
| 35 | resp = None |
| 36 | metadata = flow.metadata |
| 37 | comment = flow.comment |
| 38 | |
| 39 | if comment: |
| 40 | text.append(urwid.Text([("head", "Comment: "), ("text", comment)])) |
| 41 | |
| 42 | if metadata is not None and len(metadata) > 0: |
| 43 | parts = [(str(k), repr(v)) for k, v in metadata.items()] |
| 44 | text.append(urwid.Text([("head", "Metadata:")])) |
| 45 | text.extend(common.format_keyvals(parts, indent=4)) |
| 46 | |
| 47 | if sc is not None and sc.peername: |
| 48 | text.append(urwid.Text([("head", "Server Connection:")])) |
| 49 | parts = [ |
| 50 | ("Address", human.format_address(sc.address)), |
| 51 | ] |
| 52 | if sc.peername: |
| 53 | parts.append(("Resolved Address", human.format_address(sc.peername))) |
| 54 | if resp: |
| 55 | parts.append(("HTTP Version", resp.http_version)) |
| 56 | if sc.alpn: |
| 57 | parts.append(("ALPN", strutils.bytes_to_escaped_str(sc.alpn))) |
| 58 | |
| 59 | text.extend(common.format_keyvals(parts, indent=4)) |
| 60 | |
| 61 | if sc.certificate_list: |
| 62 | c = sc.certificate_list[0] |
| 63 | text.append(urwid.Text([("head", "Server Certificate:")])) |
| 64 | parts = [ |
| 65 | ("Type", "%s, %s bits" % c.keyinfo), |
| 66 | ("SHA256 digest", c.fingerprint().hex(" ")), |
| 67 | ("Valid from", str(c.notbefore)), |
| 68 | ("Valid to", str(c.notafter)), |
| 69 | ("Serial", str(c.serial)), |
| 70 | ( |
| 71 | "Subject", |
| 72 | urwid.Pile( |
| 73 | common.format_keyvals(c.subject, key_format="highlight") |
| 74 | ), |
| 75 | ), |
| 76 | ( |
| 77 | "Issuer", |
| 78 | urwid.Pile(common.format_keyvals(c.issuer, key_format="highlight")), |
| 79 | ), |
| 80 | ] |
nothing calls this directly
no test coverage detected
searching dependent graphs…