Load flows into the view, without processing them with addons.
(self, path: mitmproxy.types.Path)
| 493 | |
| 494 | @command.command("view.flows.load") |
| 495 | def load_file(self, path: mitmproxy.types.Path) -> None: |
| 496 | """ |
| 497 | Load flows into the view, without processing them with addons. |
| 498 | """ |
| 499 | try: |
| 500 | with open(path, "rb") as f: |
| 501 | for i in io.FlowReader(f).stream(): |
| 502 | # Do this to get a new ID, so we can load the same file N times and |
| 503 | # get new flows each time. It would be more efficient to just have a |
| 504 | # .newid() method or something. |
| 505 | self.add([i.copy()]) |
| 506 | except OSError as e: |
| 507 | logging.error(e.strerror) |
| 508 | except exceptions.FlowReadException as e: |
| 509 | logging.error(str(e)) |
| 510 | |
| 511 | def add(self, flows: Sequence[mitmproxy.flow.Flow]) -> None: |
| 512 | """ |