예제 #1
0
def test_format_flow():
    flows = [
        tflow.tflow(resp=True),
        tflow.tflow(err=True),
        tflow.ttcpflow(),
        tflow.ttcpflow(err=True),
    ]
    for f in flows:
        for render_mode in common.RenderMode:
            assert common.format_flow(f, render_mode=render_mode)
            assert common.format_flow(f, render_mode=render_mode, hostheader=True, focused=False)
예제 #2
0
 def sig_flow_change(self, sender, flow):
     if flow == self.flow:
         self._w = common.format_flow(
             flow,
             False,
             extended=True,
             hostheader=self.master.options.showhost)
예제 #3
0
 def sig_flow_change(self, sender, flow):
     if flow == self.flow:
         self._w = common.format_flow(
             flow,
             False,
             extended=True,
             hostheader=self.master.options.showhost
         )
예제 #4
0
 def get_text(self):
     cols, _ = self.master.ui.get_cols_rows()
     return common.format_flow(
         self.flow,
         self.flow is self.master.view.focus.flow,
         hostheader=self.master.options.showhost,
         max_url_len=cols,
     )
예제 #5
0
 def get_text(self):
     cols, _ = self.master.ui.get_cols_rows()
     return common.format_flow(
         self.flow,
         self.flow is self.master.view.focus.flow,
         hostheader=self.master.options.showhost,
         max_url_len=cols,
     )
예제 #6
0
 def get_text(self):
     cols, _ = self.master.ui.get_cols_rows()
     return common.format_flow(
         self.flow,
         self.flow is self.master.view.focus.flow,
         hostheader=self.master.options.showhost,
         cols=cols,
         layout=self.master.options.console_flowlist_layout
     )
예제 #7
0
 def __init__(self, master: "mitmproxy.console.master.ConsoleMaster",
              f: http.HTTPFlow):
     self.master = master
     self.flow = f
     self._w = common.format_flow(f,
                                  False,
                                  extended=True,
                                  hostheader=self.master.options.showhost)
     signals.flow_change.connect(self.sig_flow_change)
예제 #8
0
 def focus_changed(self):
     if self.master.view.focus.flow:
         self._w = common.format_flow(
             self.master.view.focus.flow,
             False,
             extended=True,
             hostheader=self.master.options.showhost)
     else:
         self._w = urwid.Pile([])
예제 #9
0
 def focus_changed(self):
     cols, _ = self.master.ui.get_cols_rows()
     if self.master.view.focus.flow:
         self._w = common.format_flow(
             self.master.view.focus.flow,
             render_mode=common.RenderMode.DETAILVIEW,
             hostheader=self.master.options.showhost,
         )
     else:
         self._w = urwid.Pile([])
예제 #10
0
 def __init__(self, master: "mitmproxy.console.master.ConsoleMaster", f: http.HTTPFlow):
     self.master = master
     self.flow = f
     self._w = common.format_flow(
         f,
         False,
         extended=True,
         hostheader=self.master.options.showhost
     )
     signals.flow_change.connect(self.sig_flow_change)
예제 #11
0
 def focus_changed(self):
     if self.master.view.focus.flow:
         self._w = common.format_flow(
             self.master.view.focus.flow,
             False,
             extended=True,
             hostheader=self.master.options.showhost
         )
     else:
         self._w = urwid.Pile([])
예제 #12
0
 def focus_changed(self):
     cols, _ = self.master.ui.get_cols_rows()
     if self.master.view.focus.flow:
         self._w = common.format_flow(
             self.master.view.focus.flow,
             False,
             extended=True,
             hostheader=self.master.options.showhost,
             max_url_len=cols,
         )
     else:
         self._w = urwid.Pile([])
예제 #13
0
 def focus_changed(self):
     cols, _ = self.master.ui.get_cols_rows()
     if self.master.view.focus.flow:
         self._w = common.format_flow(
             self.master.view.focus.flow,
             False,
             extended=True,
             hostheader=self.master.options.showhost,
             cols=cols,
             layout=self.master.options.console_flowlist_layout)
     else:
         self._w = urwid.Pile([])
예제 #14
0
 def focus_changed(self):
     cols, _ = self.master.ui.get_cols_rows()
     if self.master.view.focus.flow:
         self._w = common.format_flow(
             self.master.view.focus.flow,
             False,
             extended=True,
             hostheader=self.master.options.showhost,
             max_url_len=cols,
         )
     else:
         self._w = urwid.Pile([])
예제 #15
0
    def get_text(self):
        cols, _ = self.master.ui.get_cols_rows()
        layout = self.master.options.console_flowlist_layout
        if layout == "list" or (layout == 'default' and cols < 100):
            render_mode = common.RenderMode.LIST
        else:
            render_mode = common.RenderMode.TABLE

        return common.format_flow(
            self.flow,
            render_mode=render_mode,
            focused=self.flow is self.master.view.focus.flow,
            hostheader=self.master.options.showhost,
        )
예제 #16
0
def test_format_flow():
    f = tflow.tflow(resp=True)
    assert common.format_flow(f, True)
    assert common.format_flow(f, True, hostheader=True)
    assert common.format_flow(f, True, extended=True)
예제 #17
0
def test_format_flow():
    f = tflow.tflow(resp=True)
    assert common.format_flow(f, True)
    assert common.format_flow(f, True, hostheader=True)
    assert common.format_flow(f, True, extended=True)