Cut data from a set of flows. Cut specifications are attribute paths from the base of the flow object, with a few conveniences - "port" and "host" retrieve parts of an address tuple, ".header[key]" retrieves a header value. Return values converted to strings or
(
self,
flows: Sequence[flow.Flow],
cuts: mitmproxy.types.CutSpec,
)
| 83 | class Cut: |
| 84 | @command.command("cut") |
| 85 | def cut( |
| 86 | self, |
| 87 | flows: Sequence[flow.Flow], |
| 88 | cuts: mitmproxy.types.CutSpec, |
| 89 | ) -> mitmproxy.types.Data: |
| 90 | """ |
| 91 | Cut data from a set of flows. Cut specifications are attribute paths |
| 92 | from the base of the flow object, with a few conveniences - "port" |
| 93 | and "host" retrieve parts of an address tuple, ".header[key]" |
| 94 | retrieves a header value. Return values converted to strings or |
| 95 | bytes: SSL certificates are converted to PEM format, bools are "true" |
| 96 | or "false", "bytes" are preserved, and all other values are |
| 97 | converted to strings. |
| 98 | """ |
| 99 | ret: list[list[str | bytes]] = [] |
| 100 | for f in flows: |
| 101 | ret.append([extract(c, f) for c in cuts]) |
| 102 | return ret # type: ignore |
| 103 | |
| 104 | @command.command("cut.save") |
| 105 | def save( |