MCPcopy
hub / github.com/mitmproxy/mitmproxy / resolve

Method resolve

mitmproxy/addons/view.py:449–473  ·  view source on GitHub ↗

Resolve a flow list specification to an actual list of flows.

(self, flow_spec: str)

Source from the content-addressed store, hash-verified

447
448 @command.command("view.flows.resolve")
449 def resolve(self, flow_spec: str) -> Sequence[mitmproxy.flow.Flow]:
450 """
451 Resolve a flow list specification to an actual list of flows.
452 """
453 if flow_spec == "@all":
454 return [i for i in self._store.values()]
455 if flow_spec == "@focus":
456 return [self.focus.flow] if self.focus.flow else []
457 elif flow_spec == "@shown":
458 return [i for i in self]
459 elif flow_spec == "@hidden":
460 return [i for i in self._store.values() if i not in self._view]
461 elif flow_spec == "@marked":
462 return [i for i in self._store.values() if i.marked]
463 elif flow_spec == "@unmarked":
464 return [i for i in self._store.values() if not i.marked]
465 elif re.match(r"@[0-9a-f\-,]{36,}", flow_spec):
466 ids = flow_spec[1:].split(",")
467 return [i for i in self._store.values() if i.id in ids]
468 else:
469 try:
470 filt = flowfilter.parse(flow_spec)
471 except ValueError as e:
472 raise exceptions.CommandError(str(e)) from e
473 return [i for i in self._store.values() if filt(i)]
474
475 @command.command("view.flows.create")
476 def create(self, method: str, url: str) -> None:

Callers 2

parse_map_local_specFunction · 0.45

Calls 4

valuesMethod · 0.80
matchMethod · 0.45
splitMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected