| 268 | return view |
| 269 | |
| 270 | def view_message_stream(self) -> urwid.Widget: |
| 271 | flow = self.flow |
| 272 | assert isinstance(flow, (tcp.TCPFlow, udp.UDPFlow)) |
| 273 | |
| 274 | if not flow.messages: |
| 275 | return searchable.Searchable([urwid.Text(("highlight", "No messages."))]) |
| 276 | |
| 277 | viewmode = self.master.commands.call("console.flowview.mode") |
| 278 | |
| 279 | widget_lines = [] |
| 280 | for m in flow.messages: |
| 281 | if m.from_client: |
| 282 | marker = self.FROM_CLIENT_MARKER |
| 283 | else: |
| 284 | marker = self.TO_CLIENT_MARKER |
| 285 | pretty = contentviews.prettify_message(m, flow, viewmode) |
| 286 | chunks = mitmproxy_rs.syntax_highlight.highlight( |
| 287 | pretty.text, |
| 288 | language=pretty.syntax_highlight, |
| 289 | ) |
| 290 | |
| 291 | widget_lines.append(urwid.Text([marker, *chunks])) |
| 292 | |
| 293 | if flow.intercepted: |
| 294 | markup = widget_lines[-1].get_text()[0] |
| 295 | widget_lines[-1].set_text(("intercept", markup)) |
| 296 | |
| 297 | widget_lines.insert( |
| 298 | 0, self._contentview_status_bar(viewmode.capitalize(), viewmode) |
| 299 | ) |
| 300 | |
| 301 | return searchable.Searchable(widget_lines) |
| 302 | |
| 303 | def view_details(self): |
| 304 | return flowdetailview.flowdetails(self.view, self.flow) |