Ejemplo n.º 1
0
    def __init__(self, master):
        self.master = master
        self.lb = select.Select([
            select.Heading("Traffic Manipulation"),
            select.Option("Header Set Patterns", "H",
                          lambda: len(master.options.setheaders),
                          self.setheaders),
            select.Option("Ignore Patterns", "I",
                          lambda: master.options.ignore_hosts,
                          self.ignore_hosts),
            select.Option("Replacement Patterns", "R",
                          lambda: len(master.options.replacements),
                          self.replacepatterns),
            select.Option("Scripts", "S", lambda: master.options.scripts,
                          self.scripts),
            select.Heading("Interface"),
            select.Option("Default Display Mode", "M",
                          self.has_default_displaymode,
                          self.default_displaymode),
            select.Option("Palette", "P",
                          lambda: self.master.palette != palettes.DEFAULT,
                          self.palette),
            select.Option("Show Host", "w", lambda: master.options.showhost,
                          master.options.toggler("showhost")),
            select.Heading("Network"),
            select.Option("No Upstream Certs", "U",
                          lambda: master.options.no_upstream_cert,
                          master.options.toggler("no_upstream_cert")),
            select.Option("TCP Proxying", "T",
                          lambda: master.options.tcp_hosts, self.tcp_hosts),
            select.Option("Don't Verify SSL/TLS Certificates", "V",
                          lambda: master.options.ssl_insecure,
                          master.options.toggler("ssl_insecure")),
            select.Heading("Utility"),
            select.Option("Anti-Cache", "a", lambda: master.options.anticache,
                          master.options.toggler("anticache")),
            select.Option("Anti-Compression", "o",
                          lambda: master.options.anticomp,
                          master.options.toggler("anticomp")),
            select.Option("Kill Extra", "x",
                          lambda: master.options.replay_kill_extra,
                          master.options.toggler("replay_kill_extra")),
            select.Option("No Refresh", "f",
                          lambda: not master.options.refresh_server_playback,
                          master.options.toggler("refresh_server_playback")),
            select.Option("Sticky Auth", "A",
                          lambda: master.options.stickyauth, self.sticky_auth),
            select.Option("Sticky Cookies", "t",
                          lambda: master.options.stickycookie,
                          self.sticky_cookie),
        ])
        title = urwid.Text("Options")
        title = urwid.Padding(title, align="left", width=("relative", 100))
        title = urwid.AttrWrap(title, "heading")
        w = urwid.Frame(self.lb, header=title)
        super().__init__(w)

        self.master.loop.widget.footer.update("")
        signals.update_settings.connect(self.sig_update_settings)
        master.options.changed.connect(self.sig_update_settings)
Ejemplo n.º 2
0
 def __init__(self, master):
     self.master = master
     self.lb = select.Select([
         select.Heading("Traffic Manipulation"),
         select.Option("Header Set Patterns", "H",
                       lambda: master.setheaders.count(), self.setheaders),
         select.Option("Ignore Patterns", "I",
                       lambda: master.server.config.check_ignore,
                       self.ignorepatterns),
         select.Option("Replacement Patterns", "R",
                       lambda: master.replacehooks.count(),
                       self.replacepatterns),
         select.Option("Scripts", "S", lambda: master.scripts,
                       self.scripts),
         select.Heading("Interface"),
         select.Option("Default Display Mode", "M",
                       self.has_default_displaymode,
                       self.default_displaymode),
         select.Option("Palette", "P",
                       lambda: self.master.palette != palettes.DEFAULT,
                       self.palette),
         select.Option("Show Host", "w", lambda: master.showhost,
                       self.toggle_showhost),
         select.Heading("Network"),
         select.Option("No Upstream Certs", "U",
                       lambda: master.server.config.no_upstream_cert,
                       self.toggle_upstream_cert),
         select.Option("TCP Proxying", "T",
                       lambda: master.server.config.check_tcp,
                       self.tcp_proxy),
         select.Heading("Utility"),
         select.Option("Anti-Cache", "a", lambda: master.anticache,
                       self.toggle_anticache),
         select.Option("Anti-Compression", "o", lambda: master.anticomp,
                       self.toggle_anticomp),
         select.Option("Kill Extra", "x", lambda: master.killextra,
                       self.toggle_killextra),
         select.Option("No Refresh", "f",
                       lambda: not master.refresh_server_playback,
                       self.toggle_refresh_server_playback),
         select.Option("Sticky Auth", "A", lambda: master.stickyauth_txt,
                       self.sticky_auth),
         select.Option("Sticky Cookies", "t",
                       lambda: master.stickycookie_txt, self.sticky_cookie),
     ])
     title = urwid.Text("Options")
     title = urwid.Padding(title, align="left", width=("relative", 100))
     title = urwid.AttrWrap(title, "heading")
     self._w = urwid.Frame(self.lb, header=title)
     self.master.loop.widget.footer.update("")
     signals.update_settings.connect(self.sig_update_settings)
Ejemplo n.º 3
0
    def __init__(self, master):
        self.master = master
        low, high = [], []
        for k, v in palettes.palettes.items():
            if v.high:
                high.append(k)
            else:
                low.append(k)
        high.sort()
        low.sort()

        options = [
            select.Heading("High Colour")
        ]

        def mkopt(name):
            return select.Option(
                i,
                None,
                lambda: self.master.palette == name,
                lambda: self.select(name)
            )

        for i in high:
            options.append(mkopt(i))
        options.append(select.Heading("Low Colour"))
        for i in low:
            options.append(mkopt(i))

        options.extend(
            [
                select.Heading("Options"),
                select.Option(
                    "Transparent",
                    "T",
                    lambda: master.palette_transparent,
                    self.toggle_palette_transparent
                )
            ]
        )

        self.lb = select.Select(options)
        title = urwid.Text("Palettes")
        title = urwid.Padding(title, align="left", width=("relative", 100))
        title = urwid.AttrWrap(title, "heading")
        self._w = urwid.Frame(
            self.lb,
            header = title
        )
        signals.update_settings.connect(self.sig_update_settings)