Esempio n. 1
0
    def __init__(self, out_of_scope):
        ColumnPanel.__init__(self)

        out_of_scope_list = JList(tuple(out_of_scope))
        self.add(JScrollPane(out_of_scope_list))
        self.setBorder(make_title_border("Out of scope"))
        self.setMaximumSize(Dimension(9999999, self.getPreferredSize().height))
Esempio n. 2
0
    def __init__(self, program):
        self.setLayout(GridBagLayout())
        self.setBorder(make_title_border("User-Agent", padding=5))
        btn = JButton("Add to settings")
        ua_text = JTextField(program.user_agent)
        self.add(
            ua_text, make_constraints(weightx=4, fill=GridBagConstraints.HORIZONTAL)
        )
        self.add(btn, make_constraints(weightx=1))
        self.setMaximumSize(Dimension(9999999, self.getPreferredSize().height + 10))

        def add_to_options(event):
            prefix = "Generated by YWH-addon"
            config = json.loads(
                context.callbacks.saveConfigAsJson("proxy.match_replace_rules")
            )

            # remove other YWH addon rules
            match_replace_rules = filter(
                lambda rule: not rule["comment"].startswith(prefix),
                config["proxy"]["match_replace_rules"],
            )
            new_rule = {
                "is_simple_match": False,
                "enabled": True,
                "rule_type": "request_header",
                "string_match": "^User-Agent: (.*)$",
                "string_replace": "User-Agent: $1 {}".format(program.user_agent),
                "comment": "{} for {}".format(prefix, program.slug),
            }
            match_replace_rules.append(new_rule)
            config["proxy"]["match_replace_rules"] = match_replace_rules
            context.callbacks.loadConfigFromJson(json.dumps(config))

        btn.addActionListener(CallbackActionListener(add_to_options))
Esempio n. 3
0
 def __init__(self, program):
     self.setLayout(GridLayout())
     self.setBorder(make_title_border("Stats"))
     stats = [
         ["Average response time", program.stats.average_first_time_response],
         ["Reports - total", program.stats.total_reports],
         ["Reports - last month", program.stats.total_reports_current_month],
         ["Reports - last week", program.stats.total_reports_last7_days],
         ["Reports - last 24h", program.stats.total_reports_last24_hours],
         ["Hunter thanked", program.stats.total_hunter_thanked],
     ]
     table = JTable(stats, ["", ""])
     self.add(table)
Esempio n. 4
0
 def __init__(self, program):
     self.setLayout(GridLayout())
     self.setBorder(make_title_border("Rewards"))
     rewards = [
         ["minimum", program.bounty_reward_min],
         ["low", program.bounty_reward_low],
         ["medium", program.bounty_reward_medium],
         ["high", program.bounty_reward_high],
         ["critical", program.bounty_reward_critical],
     ]
     table = JTable(rewards, ["level", "reward"])
     table.setMaximumSize(table.getPreferredSize())
     self.add(table)
Esempio n. 5
0
    def __init__(self, scopes):
        ColumnPanel.__init__(self)

        scope_list = JList(tuple(entry.scope for entry in scopes))
        scope_list.setVisibleRowCount(10)
        btn_list = RowPanel()
        select_all = JButton("Select all")
        select_all.setMaximumSize(select_all.getPreferredSize())
        select_all.addActionListener(
            CallbackActionListener(
                partial(self.do_selection, scope_list, scopes)))
        btn_list.add(select_all)

        add_scope = JButton("Add to scope")
        add_scope.setMaximumSize(add_scope.getPreferredSize())
        add_scope.addActionListener(
            CallbackActionListener(partial(self.add_to_scope, scope_list)))
        btn_list.add(add_scope)

        self.add(JScrollPane(scope_list))
        self.add(btn_list)
        self.setBorder(make_title_border("Scopes"))
        self.setMaximumSize(Dimension(9999999, self.getPreferredSize().height))
Esempio n. 6
0
 def __init__(self, html_rules):
     html = u"<html><body>{}</body></html>".format(html_rules)
     html_renderer = HTMLRenderer(html)
     html_renderer.add_css_file("style.css")
     JScrollPane.__init__(self, html_renderer)
     self.setBorder(make_title_border("Rules"))
Esempio n. 7
0
    def __init__(self):
        self.setLayout(GridBagLayout())
        self.setBorder(make_title_border("API"))
        self.setAlignmentX(JPanel.LEFT_ALIGNMENT)

        self.status = StatusText(25)
        self.add(JLabel("Status :"), gridx=0)
        self.add(self.status, gridx=1)

        self.version = StatusText(25)
        self.version.set(context.version, bg=Color.GRAY)
        self.add(JLabel("Version :"), gridx=0)
        self.add(self.version, gridx=1)

        settings = context.settings

        txt_url = JTextField(25)
        txt_url.setText(settings.load("apiurl", "https://api.yeswehack.com/"))
        self.add(JLabel("API URL :"), gridx=0)
        self.add(txt_url, gridx=1)

        combo_auth = JComboBox((AuthMethod.anonymous, AuthMethod.email_pass))
        combo_auth.setSelectedItem(
            settings.load("auth_method", AuthMethod.anonymous))
        combo_auth.addActionListener(
            CallbackActionListener(self.auth_method_changed))

        self.add(JLabel("Authentication :"), gridx=0)
        self.add(combo_auth, gridx=1)

        txt_mail = JTextField(25)
        txt_mail.setText(settings.load("email"))
        self.add(JLabel("Email :"), gridx=0)
        self.add(txt_mail, gridx=1)

        txt_pass = JPasswordField(25)
        txt_pass.setText(settings.load("password"))
        self.add(JLabel("Password :"******"remember", True))
        self.add(JLabel("Remember password :"******"Connect")
        btn_connect.addActionListener(CallbackActionListener(self.submit))
        self.add(btn_connect, gridx=1, anchor=EAST)

        self.inputs = {
            "apiurl": txt_url,
            "auth_method": combo_auth,
            "email": txt_mail,
            "password": txt_pass,
            "remember": check_remember,
            "connect": btn_connect,
        }

        self.setMaximumSize(self.getPreferredSize())

        self.auth_method_changed()
        async_call(self.update_status)