当前位置: 首页>>代码示例>>Python>>正文


Python common.format_keyvals函数代码示例

本文整理汇总了Python中mitmproxy.console.common.format_keyvals函数的典型用法代码示例。如果您正苦于以下问题:Python format_keyvals函数的具体用法?Python format_keyvals怎么用?Python format_keyvals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了format_keyvals函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: helptext

    def helptext(self):
        text = []
        text.append(urwid.Text([("head", "This view:\n")]))
        text.extend(self.help_context)

        text.append(urwid.Text([("head", "\n\nMovement:\n")]))
        keys = [
            ("j, k", "down, up"),
            ("h, l", "left, right (in some contexts)"),
            ("g, G", "go to beginning, end"),
            ("space", "page down"),
            ("pg up/down", "page up/down"),
            ("ctrl+b/ctrl+f", "page up/down"),
            ("arrows", "up, down, left, right"),
        ]
        text.extend(
            common.format_keyvals(
                keys,
                key="key",
                val="text",
                indent=4))

        text.append(urwid.Text([("head", "\n\nGlobal keys:\n")]))
        keys = [
            ("i", "set interception pattern"),
            ("o", "options"),
            ("q", "quit / return to previous page"),
            ("Q", "quit without confirm prompt"),
            ("R", "replay of requests/responses from file"),
        ]
        text.extend(
            common.format_keyvals(keys, key="key", val="text", indent=4)
        )

        text.append(urwid.Text([("head", "\n\nFilter expressions:\n")]))
        text.extend(common.format_keyvals(flowfilter.help, key="key", val="text", indent=4))

        text.append(
            urwid.Text(
                [
                    "\n",
                    ("text", "    Regexes are Python-style.\n"),
                    ("text", "    Regexes can be specified as quoted strings.\n"),
                    ("text", "    Header matching (~h, ~hq, ~hs) is against a string of the form \"name: value\".\n"),
                    ("text", "    Expressions with no operators are regex matches against URL.\n"),
                    ("text", "    Default binary operator is &.\n"),
                    ("head", "\n    Examples:\n"),
                ]
            )
        )
        examples = [
            ("google\.com", "Url containing \"google.com"),
            ("~q ~b test", "Requests where body contains \"test\""),
            ("!(~q & ~t \"text/html\")", "Anything but requests with a text/html content type."),
        ]
        text.extend(
            common.format_keyvals(examples, key="key", val="text", indent=4)
        )
        return text
开发者ID:mkagenius,项目名称:mitmproxy,代码行数:59,代码来源:help.py

示例2: _mkhelp

def _mkhelp():
    text = []
    keys = [
        ("A", "accept all intercepted flows"),
        ("a", "accept this intercepted flow"),
        ("b", "save request/response body"),
        ("C", "clear flow list or eventlog"),
        ("d", "delete flow"),
        ("D", "duplicate flow"),
        ("E", "export"),
        ("e", "toggle eventlog"),
        ("F", "toggle follow flow list"),
        ("l", "set limit filter pattern"),
        ("L", "load saved flows"),
        ("m", "toggle flow mark"),
        ("n", "create a new request"),
        ("P", "copy flow to clipboard"),
        ("r", "replay request"),
        ("U", "unmark all marked flows"),
        ("V", "revert changes to request"),
        ("w", "save flows "),
        ("W", "stream flows to file"),
        ("X", "kill and delete flow, even if it's mid-intercept"),
        ("tab", "tab between eventlog and flow list"),
        ("enter", "view flow"),
        ("|", "run script on this flow"),
    ]
    text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
    return text
开发者ID:thesprockee,项目名称:mitmproxy,代码行数:29,代码来源:flowlist.py

示例3: make_help

 def make_help(self):
     text = []
     text.append(urwid.Text([("text", "Editor control:\n")]))
     keys = [
         ("A", "insert row before cursor"),
         ("a", "add row after cursor"),
         ("d", "delete row"),
         ("e", "spawn external editor on current field"),
         ("q", "save changes and exit editor"),
         ("r", "read value from file"),
         ("R", "read unescaped value from file"),
         ("esc", "save changes and exit editor"),
         ("tab", "next field"),
         ("enter", "edit field"),
     ]
     text.extend(
         common.format_keyvals(keys, key="key", val="text", indent=4)
     )
     text.append(
         urwid.Text(
             [
                 "\n",
                 ("text", "Values are escaped Python-style strings.\n"),
             ]
         )
     )
     return text
开发者ID:Splat,项目名称:mitmproxy,代码行数:27,代码来源:grideditor.py

示例4: _mkhelp

def _mkhelp():
    text = []
    keys = [
        ("enter/space", "activate option"),
        ("C", "clear all options"),
    ]
    text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
    return text
开发者ID:PranavKrishnan,项目名称:mitmproxy,代码行数:8,代码来源:options.py

示例5: test_format_keyvals

def test_format_keyvals():
    assert common.format_keyvals(
        [
            ("aa", "bb"),
            None,
            ("cc", "dd"),
            (None, "dd"),
            (None, "dd"),
        ]
    )
开发者ID:Angelcold,项目名称:mitmproxy,代码行数:10,代码来源:test_master.py

示例6: conn_text

    def conn_text(self, conn):
        if conn:
            txt = common.format_keyvals(
                [(h + ":", v) for (h, v) in conn.headers.items(multi=True)],
                key = "header",
                val = "text"
            )
            viewmode = self.viewmode_get()
            msg, body = self.content_view(viewmode, conn)

            cols = [
                urwid.Text(
                    [
                        ("heading", msg),
                    ]
                ),
                urwid.Text(
                    [
                        " ",
                        ('heading', "["),
                        ('heading_key', "m"),
                        ('heading', (":%s]" % viewmode.name)),
                    ],
                    align="right"
                )
            ]
            title = urwid.AttrWrap(urwid.Columns(cols), "heading")

            txt.append(title)
            txt.extend(body)
        else:
            txt = [
                urwid.Text(""),
                urwid.Text(
                    [
                        ("highlight", "No response. Press "),
                        ("key", "e"),
                        ("highlight", " and edit any aspect to add one."),
                    ]
                )
            ]
        return searchable.Searchable(self.state, txt)
开发者ID:lordillusions,项目名称:mitmproxy,代码行数:42,代码来源:flowview.py

示例7: _mkhelp

def _mkhelp():
    text = []
    keys = [
        ("A", "accept all intercepted flows"),
        ("a", "accept this intercepted flow"),
        ("b", "save request/response body"),
        ("C", "export flow to clipboard"),
        ("d", "delete flow"),
        ("D", "duplicate flow"),
        ("e", "toggle eventlog"),
        ("E", "export flow to file"),
        ("f", "filter view"),
        ("F", "toggle follow flow list"),
        ("L", "load saved flows"),
        ("m", "toggle flow mark"),
        ("M", "toggle marked flow view"),
        ("n", "create a new request"),
        ("N", "add filter to remove Noise"),
        ("r", "replay request"),
        ("R", "repeat this 64 times with incrementing id"),
        ("S", "server replay request/s"),
        ("u", "toggle listed flows markings"),
        ("U", "unmark all marked flows"),
        ("v", "remove all filters"),
        ("V", "revert changes to request"),
        ("w", "save flows "),
        ("W", "stream flows to file"),
        ("X", "kill and delete flow, even if it's mid-intercept"),
        ("z", "clear flow list or eventlog"),
        ("tab", "tab between eventlog and flow list"),
        ("enter", "view flow"),
        ("|", "run script on this flow"),
        ("f1", "toggle authenticion to fail/pass"),
        ("f2", "toggle authorization to fail/pass"),
        ("f3", "toggle payu salt leak to fail/pass"),
        ("f4", "toggle otp leak to fail/pass")
    ]
    text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
    return text
开发者ID:mkagenius,项目名称:mitmproxy,代码行数:39,代码来源:flowlist.py

示例8: flowdetails

def flowdetails(state, flow):
    text = []

    cc = flow.client_conn
    sc = flow.server_conn
    req = flow.request
    resp = flow.response

    if sc is not None:
        text.append(urwid.Text([("head", "Server Connection:")]))
        parts = [
            ["Address", repr(sc.address)],
            ["Resolved Address", repr(sc.ip_address)],
        ]

        text.extend(
            common.format_keyvals(parts, key="key", val="text", indent=4)
        )

        c = sc.cert
        if c:
            text.append(urwid.Text([("head", "Server Certificate:")]))
            parts = [
                ["Type", "%s, %s bits" % c.keyinfo],
                ["SHA1 digest", c.digest("sha1")],
                ["Valid to", str(c.notafter)],
                ["Valid from", str(c.notbefore)],
                ["Serial", str(c.serial)],
                [
                    "Subject",
                    urwid.BoxAdapter(
                        urwid.ListBox(
                            common.format_keyvals(
                                c.subject,
                                key="highlight",
                                val="text"
                            )
                        ),
                        len(c.subject)
                    )
                ],
                [
                    "Issuer",
                    urwid.BoxAdapter(
                        urwid.ListBox(
                            common.format_keyvals(
                                c.issuer, key="highlight", val="text"
                            )
                        ),
                        len(c.issuer)
                    )
                ]
            ]

            if c.altnames:
                parts.append(
                    [
                        "Alt names",
                        ", ".join(c.altnames)
                    ]
                )
            text.extend(
                common.format_keyvals(parts, key="key", val="text", indent=4)
            )

    if cc is not None:
        text.append(urwid.Text([("head", "Client Connection:")]))

        parts = [
            ["Address", repr(cc.address)],
        ]

        text.extend(
            common.format_keyvals(parts, key="key", val="text", indent=4)
        )

    parts = []

    if cc is not None and cc.timestamp_start:
        parts.append(
            [
                "Client conn. established",
                maybe_timestamp(cc, "timestamp_start")
            ]
        )
        if cc.ssl_established:
            parts.append(
                [
                    "Client conn. TLS handshake",
                    maybe_timestamp(cc, "timestamp_ssl_setup")
                ]
            )
    if sc is not None and sc.timestamp_start:
        parts.append(
            [
                "Server conn. initiated",
                maybe_timestamp(sc, "timestamp_start")
            ]
        )
        parts.append(
#.........这里部分代码省略.........
开发者ID:AlTune,项目名称:mitmproxy,代码行数:101,代码来源:flowdetailview.py

示例9: _mkhelp

def _mkhelp():
    text = []
    keys = [
        ("A", "accept all intercepted flows"),
        ("a", "accept this intercepted flow"),
        ("b", "save request/response body"),
        ("C", "export flow to clipboard"),
        ("D", "duplicate flow"),
        ("d", "delete flow"),
        ("e", "edit request/response"),
        ("f", "load full body data"),
        ("m", "change body display mode for this entity\n(default mode can be changed in the options)"),
        (None,
         common.highlight_key("automatic", "a") +
         [("text", ": automatic detection")]
         ),
        (None,
         common.highlight_key("hex", "e") +
         [("text", ": Hex")]
         ),
        (None,
         common.highlight_key("html", "h") +
         [("text", ": HTML")]
         ),
        (None,
         common.highlight_key("image", "i") +
         [("text", ": Image")]
         ),
        (None,
         common.highlight_key("javascript", "j") +
         [("text", ": JavaScript")]
         ),
        (None,
         common.highlight_key("json", "s") +
         [("text", ": JSON")]
         ),
        (None,
         common.highlight_key("urlencoded", "u") +
         [("text", ": URL-encoded data")]
         ),
        (None,
         common.highlight_key("raw", "r") +
         [("text", ": raw data")]
         ),
        (None,
         common.highlight_key("xml", "x") +
         [("text", ": XML")]
         ),
        ("E", "export flow to file"),
        ("r", "replay request"),
        ("V", "revert changes to request"),
        ("v", "view body in external viewer"),
        ("w", "save all flows matching current view filter"),
        ("W", "save this flow"),
        ("x", "delete body"),
        ("z", "encode/decode a request/response"),
        ("tab", "next tab"),
        ("h, l", "previous tab, next tab"),
        ("space", "next flow"),
        ("|", "run script on this flow"),
        ("/", "search (case sensitive)"),
        ("n", "repeat search forward"),
        ("N", "repeat search backwards"),
    ]
    text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
    return text
开发者ID:lordillusions,项目名称:mitmproxy,代码行数:66,代码来源:flowview.py

示例10: _mkhelp

def _mkhelp():
    text = []
    keys = [("enter/space", "select")]
    text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
    return text
开发者ID:dufferzafar,项目名称:mitmproxy,代码行数:5,代码来源:palettepicker.py


注:本文中的mitmproxy.console.common.format_keyvals函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。