Ejemplo n.º 1
0
    def __init__(self, parent):
        self._parent = parent
        self.setTitle("Select Parameters/Headers for new Session")

        print "IN DIALOG!Q!!"

        self.table = JTable()

        columns = ["Use", "Type", "Name", "Value"]
        data = []

        headers = self._parent._extender.headers
        parameters = self._parent._extender.parameters

        for header in headers[1:]:
            name, val = header.split(": ")
            data.append([self.should_use(name), "Header", name, val])

        for param in parameters:
            data.append([
                self.should_use(param.getName()),
                Parameter.type_mapping[param.getType()],
                param.getName(),
                param.getValue()
            ])

        class CheckBoxTableModel(DefaultTableModel):
            def getColumnClass(self, x):
                if x == 0:
                    return Boolean
                else:
                    return String

        data_model = CheckBoxTableModel(data, columns)
        self.table.setModel(data_model)
        self.table.getColumnModel().getColumn(0).setMaxWidth(30)
        self.table.getColumnModel().getColumn(1).setMaxWidth(50)

        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [0, 0, 0]
        gridBagLayout.rowHeights = [0, 0, 0]
        gridBagLayout.columnWeights = [0.0, 0.0, 0.0]
        gridBagLayout.rowWeights = [0.0, 1.0, 0.0]
        self.setLayout(gridBagLayout)

        self.getContentPane().add(
            JLabel("Select Parameters/Headers for new session:"),
            _new_grid_bag(0, 0, 3))
        self.getContentPane().add(JScrollPane(self.table),
                                  _new_grid_bag(0, 1, 3))
        self.getContentPane().add(JButton("Save", actionPerformed=self.save),
                                  _new_grid_bag(1, 2))

        self.pack()
        self.setVisible(True)
Ejemplo n.º 2
0
    def __init__(self, extender, controller, editable):
        self._extender = extender

        self._panel = JPanel()  # main panel

        # type combobox for tables
        self._types = Parameter.type_mapping.values() + ["- Remove Row -"]
        self._actions = ["replace", "insert", "delete"]

        # define the GridBagLayout ( 4x4 )
        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [0, 0, 0, 0]
        gridBagLayout.rowHeights = [0, 0, 0, 0]
        gridBagLayout.columnWeights = [1.0, 0.0, 0.0, 0.0]
        gridBagLayout.rowWeights = [0.0, 1.0, 5.0, 0.0]
        self._panel.setLayout(gridBagLayout)

        # JComboBox for Session selection
        self._session_selector = JComboBox(extender.sm.sessions,
                                           itemStateChanged=self.changeSession)
        self._session_selector_model = self._session_selector.getModel()
        gbc_session_selector = _new_grid_bag(0, 0)
        self._panel.add(self._session_selector, gbc_session_selector)

        # "Delete Session" Button
        del_session = JButton("Delete Session",
                              actionPerformed=self.deleteSession)
        gbc_del_session = _new_grid_bag(1, 0)
        self._panel.add(del_session, gbc_del_session)

        # "New Session" Button
        new_session = JButton("New Session", actionPerformed=self.new_session)
        gbc_new_session = _new_grid_bag(2, 0)
        self._panel.add(new_session, gbc_new_session)

        # Table containing modified parameters
        self.modification_table = JTable()
        self.update_table()

        gbc_modification_table = _new_grid_bag(0, 1, 3)
        self._panel.add(JScrollPane(self.modification_table),
                        gbc_modification_table)
        self.modification_table.setPreferredScrollableViewportSize(
            self.modification_table.getPreferredSize())
        self.modification_table.setFillsViewportHeight(True)

        # HTTP message editor
        self._editor = self._extender.callbacks.createTextEditor()
        gbc_messageEditor = _new_grid_bag(0, 2, 3)
        self._panel.add(self._editor.getComponent(), gbc_messageEditor)
Ejemplo n.º 3
0
    def __init__(self, parent):
        self._parent = parent
        self.setTitle("Select Parameters/Headers for new Session")

        print "IN DIALOG!Q!!"

        self.table = JTable()

        columns = ["Use", "Type", "Name", "Value"]
        data = []

        headers = self._parent._extender.headers
        parameters = self._parent._extender.parameters

        for header in headers[1:]:
            name, val = header.split(": ")
            data.append([self.should_use(name), "Header", name, val])

        for param in parameters:
            data.append([self.should_use(param.getName()), Parameter.type_mapping[param.getType()], param.getName(), param.getValue()])

        class CheckBoxTableModel(DefaultTableModel):
            def getColumnClass(self, x):
                if x == 0:
                    return Boolean
                else:
                    return String

        data_model = CheckBoxTableModel(data, columns)
        self.table.setModel(data_model)
        self.table.getColumnModel().getColumn(0).setMaxWidth(30)
        self.table.getColumnModel().getColumn(1).setMaxWidth(50)


        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [ 0, 0, 0]
        gridBagLayout.rowHeights = [0, 0, 0]
        gridBagLayout.columnWeights = [0.0, 0.0, 0.0]
        gridBagLayout.rowWeights = [0.0, 1.0, 0.0]
        self.setLayout(gridBagLayout)

        self.getContentPane().add(JLabel("Select Parameters/Headers for new session:"), _new_grid_bag(0, 0, 3))
        self.getContentPane().add(JScrollPane(self.table), _new_grid_bag(0, 1, 3))
        self.getContentPane().add(JButton("Save", actionPerformed=self.save), _new_grid_bag(1, 2))

        self.pack()
        self.setVisible(True)
Ejemplo n.º 4
0
    def __init__(self, extender, controller, editable):
        self._extender = extender

        self._panel = JPanel()  # main panel

        # type combobox for tables
        self._types = Parameter.type_mapping.values() + ["- Remove Row -"]
        self._actions = ["replace", "insert", "delete"]

        # define the GridBagLayout ( 4x4 )
        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [ 0, 0, 0, 0]
        gridBagLayout.rowHeights = [0, 0, 0, 0]
        gridBagLayout.columnWeights = [1.0, 0.0, 0.0, 0.0]
        gridBagLayout.rowWeights = [0.0, 1.0, 5.0, 0.0]
        self._panel.setLayout(gridBagLayout)

        # JComboBox for Session selection
        self._session_selector = JComboBox(extender.sm.sessions, itemStateChanged=self.changeSession)
        self._session_selector_model = self._session_selector.getModel()
        gbc_session_selector = _new_grid_bag(0, 0)
        self._panel.add(self._session_selector, gbc_session_selector)


        # "Delete Session" Button
        del_session = JButton("Delete Session", actionPerformed=self.deleteSession)
        gbc_del_session = _new_grid_bag(1, 0)
        self._panel.add(del_session, gbc_del_session)

        # "New Session" Button
        new_session = JButton("New Session", actionPerformed=self.new_session)
        gbc_new_session = _new_grid_bag(2, 0)
        self._panel.add(new_session, gbc_new_session)

        # Table containing modified parameters
        self.modification_table = JTable()
        self.update_table()

        gbc_modification_table = _new_grid_bag(0, 1, 3)
        self._panel.add(JScrollPane(self.modification_table), gbc_modification_table)
        self.modification_table.setPreferredScrollableViewportSize(self.modification_table.getPreferredSize());
        self.modification_table.setFillsViewportHeight(True)

        # HTTP message editor
        self._editor = self._extender.callbacks.createTextEditor()
        gbc_messageEditor = _new_grid_bag(0, 2, 3)
        self._panel.add(self._editor.getComponent(), gbc_messageEditor)
Ejemplo n.º 5
0
    def registerExtenderCallbacks( self, callbacks):
        self._helpers = callbacks.getHelpers()
        callbacks.setExtensionName("JWT FuzzHelper")
        callbacks.registerIntruderPayloadProcessor(self)
        callbacks.registerExtensionStateListener(self)
        
        self._stdout = PrintWriter(callbacks.getStdout(), True)
        self._stderr = PrintWriter(callbacks.getStderr(), True)

        # Holds values passed by user from Configuration panel
        self._fuzzoptions = { 
                                "target" : "Header", 
                                "selector" : None, 
                                "signature" : False,
                                "algorithm" : "HS256",
                                "key" : "",
                                "key_cmd" : ""
                            }

        self._isNone = lambda val: isinstance(val, type(None))

        # Configuration panel Layout
        self._configurationPanel = JPanel()
        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [ 0, 0, 0]
        gridBagLayout.rowHeights = [ 10, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
        gridBagLayout.columnWeights = [ 0.0, 0.0, 0.0 ]
        gridBagLayout.rowWeights = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
        self._configurationPanel.setLayout(gridBagLayout)

        # Setup tabs
        self._tabs = JTabbedPane()
        self._tabs.addTab('Configuration',self._configurationPanel)
        #self._tabs.addTab('Help',self._helpPanel)

        # Target Options
        targetLabel = JLabel("Target Selection (Required): ")
        targetLabel.setFont(Font("Tahoma",Font.BOLD, 12))
        c = GridBagConstraints()
        c.gridx = 0
        c.gridy = 1
        c.insets = Insets(0,10,0,0)
        c.anchor = GridBagConstraints.LINE_END
        self._configurationPanel.add(targetLabel,c)

        options = [ 'Header', 'Payload' ]
        self._targetComboBox = JComboBox(options)
        c = GridBagConstraints()
        c.gridx = 1
        c.gridy = 1
        c.anchor = GridBagConstraints.LINE_START
        self._configurationPanel.add(self._targetComboBox,c)

        # Help Button
        self._helpButton = JButton("Help", actionPerformed=self.helpMenu)
        c = GridBagConstraints()
        c.gridx = 2
        c.gridy = 1
        c.anchor = GridBagConstraints.FIRST_LINE_START
        self._configurationPanel.add(self._helpButton,c)

        # Selector Options
        self._selectorLabel = JLabel("JSON Selector [Object Identifier-Index Syntax] (Required): ")
        self._selectorLabel.setFont(Font("Tahoma",Font.BOLD, 12))
        c = GridBagConstraints()
        c.gridx = 0
        c.gridy = 2
        c.insets = Insets(0,10,0,0)
        c.anchor = GridBagConstraints.LINE_END
        self._configurationPanel.add(self._selectorLabel, c)

        self._selectorTextField = JTextField('',50)
        c = GridBagConstraints()
        c.gridx = 1
        c.gridy = 2
        self._configurationPanel.add(self._selectorTextField, c)

        # Regex option

        self._regexLabel = JLabel("Use regex as JSON Selector? (Optional): ")
        self._regexLabel.setFont(Font("Tahoma",Font.BOLD, 12))
        c = GridBagConstraints()
        c.gridx = 0
        c.gridy = 3
        c.insets = Insets(0,0,0,0)
        c.anchor = GridBagConstraints.LINE_END
        self._configurationPanel.add(self._regexLabel,c)

        self._regexCheckBox = JCheckBox("", actionPerformed=self.regexSelector)
        c = GridBagConstraints()
        c.gridx = 1
        c.gridy = 3
        c.anchor = GridBagConstraints.FIRST_LINE_START
        self._configurationPanel.add(self._regexCheckBox,c)

        # Signature Options
        generateSignatureLabel = JLabel("Generate signature? (Required): ")
        generateSignatureLabel.setFont(Font("Tahoma",Font.BOLD, 12))
        c = GridBagConstraints()
        c.gridx = 0
        c.gridy = 4
        c.insets = Insets(0,10,0,0)
        c.anchor = GridBagConstraints.LINE_END
        self._configurationPanel.add(generateSignatureLabel,c)

        options = ["False", "True"]
        self._generateSignatureComboBox = JComboBox(options)
        c = GridBagConstraints()
        c.gridx = 1
        c.gridy = 4
        c.anchor = GridBagConstraints.LINE_START
        self._configurationPanel.add(self._generateSignatureComboBox,c)

        signatureAlgorithmLabel = JLabel("Signature Algorithm (Optional): ")
        signatureAlgorithmLabel.setFont(Font("Tahoma",Font.BOLD, 12))
        c = GridBagConstraints()
        c.gridx = 0
        c.gridy = 5
        c.insets = Insets(0,10,0,0)
        c.anchor = GridBagConstraints.LINE_END
        self._configurationPanel.add(signatureAlgorithmLabel,c)

        options = ["None", "HS256","HS384","HS512","ES256","ES384","ES512","RS256","RS384","RS512","PS256","PS256","PS384","PS512"]
        self._algorithmSelectionComboBox = JComboBox(options)
        c = GridBagConstraints()
        c.gridx = 1
        c.gridy = 5
        c.anchor = GridBagConstraints.LINE_START
        self._configurationPanel.add(self._algorithmSelectionComboBox,c)

        # Signing key options
        self._signingKeyLabel = JLabel("Signing Key (Optional): ")
        self._signingKeyLabel.setFont(Font("Tahoma",Font.BOLD, 12))
        c = GridBagConstraints()
        c.gridx = 0
        c.gridy = 6
        c.insets = Insets(0,10,0,0)
        c.anchor = GridBagConstraints.LINE_END
        self._configurationPanel.add(self._signingKeyLabel,c)

        self.addSigningKeyTextArea()
        self._fromFileTextField = JTextField('',50) 

        fromFileLabel = JLabel("Signing key from file? (Optional): ")
        fromFileLabel.setFont(Font("Tahoma",Font.BOLD, 12))
        c = GridBagConstraints()
        c.gridx = 0
        c.gridy = 7
        c.insets = Insets(0,0,0,0)
        c.anchor = GridBagConstraints.LINE_END
        self._configurationPanel.add(fromFileLabel,c)

        self._fromFileCheckBox = JCheckBox("", actionPerformed=self.fromFile)
        c = GridBagConstraints()
        c.gridx = 1
        c.gridy = 7
        c.anchor = GridBagConstraints.FIRST_LINE_START
        self._configurationPanel.add(self._fromFileCheckBox,c)

        self._fromCmdTextField = JTextField('',50)

        fromCmdLabel = JLabel("Signing key from command? (Optional): ")
        fromCmdLabel.setFont(Font("Tahoma",Font.BOLD, 12))
        c = GridBagConstraints()
        c.gridx = 0
        c.gridy = 8
        c.insets = Insets(0,0,0,0)
        c.anchor = GridBagConstraints.LINE_END
        self._configurationPanel.add(fromCmdLabel,c)

        self._fromCmdCheckBox = JCheckBox("", actionPerformed=self.fromCmd)
        c = GridBagConstraints()
        c.gridx = 1
        c.gridy = 8
        c.anchor = GridBagConstraints.FIRST_LINE_START
        self._configurationPanel.add(self._fromCmdCheckBox,c)

        self._saveButton = JButton("Save Configuration", actionPerformed=self.saveOptions)
        self._saveButton.setText("Save Configuration")
        c = GridBagConstraints()
        c.gridx = 1
        c.gridy = 9
        c.anchor = GridBagConstraints.FIRST_LINE_START
        self._configurationPanel.add(self._saveButton,c)

        
        callbacks.customizeUiComponent(self._configurationPanel)
        callbacks.customizeUiComponent(self._tabs)
        callbacks.addSuiteTab(self)

        self._stdout.println("[JWT FuzzHelper] Loaded successfully")
        return
Ejemplo n.º 6
0
    def __init__(self, extender=None, *rows):
        self.extender = extender

        self.table = table = JTable(ParameterProcessingRulesTableModel(*rows))
        table.setPreferredScrollableViewportSize(Dimension(500, 70))
        table.setRowSorter(TableRowSorter(table.getModel()))
        table.setFillsViewportHeight(True)

        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [0, 0, 25, 0 ]
        gridBagLayout.rowHeights = [0, 0, 0, 0]
        gridBagLayout.columnWeights = [0.0, 1.0, 1.0, Double.MIN_VALUE]
        gridBagLayout.rowWeights = [0.0, 0.0, 0.0, Double.MIN_VALUE]
        self.setLayout(gridBagLayout)

        addButton = JButton("Add")
        addButton.addActionListener(AddRemoveParameterListener(table))
        addButtonConstraints = GridBagConstraints()
        addButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        addButtonConstraints.insets = Insets(0, 0, 5, 5) 
        addButtonConstraints.gridx = 0
        addButtonConstraints.gridy = 0
        self.add(addButton, addButtonConstraints)

        removeButton = JButton("Remove")
        removeButton.addActionListener(AddRemoveParameterListener(table))
        removeButtonConstraints = GridBagConstraints()
        removeButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        removeButtonConstraints.insets = Insets(0, 0, 5, 5) 
        removeButtonConstraints.gridx = 0
        removeButtonConstraints.gridy = 1
        self.add(removeButton, removeButtonConstraints)

        upButton = JButton("Up")
        upButton.addActionListener(AddRemoveParameterListener(table))
        upButtonConstraints = GridBagConstraints()
        upButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        upButtonConstraints.insets = Insets(0, 0, 5, 5) 
        upButtonConstraints.gridx = 0
        upButtonConstraints.gridy = 2
        self.add(upButton, upButtonConstraints)

        downButton = JButton("Down")
        downButton.addActionListener(AddRemoveParameterListener(table))
        downButtonConstraints = GridBagConstraints()
        downButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        downButtonConstraints.anchor = GridBagConstraints.NORTH
        downButtonConstraints.insets = Insets(0, 0, 5, 5) 
        downButtonConstraints.gridx = 0
        downButtonConstraints.gridy = 3
        self.add(downButton, downButtonConstraints)

        scrollPane = JScrollPane(table)
        scrollPaneConstraints = GridBagConstraints()
        scrollPaneConstraints.gridwidth = 2
        scrollPaneConstraints.gridheight = 5
        scrollPaneConstraints.insets = Insets(0, 0, 5, 5)
        scrollPaneConstraints.anchor = GridBagConstraints.NORTHWEST 
        scrollPaneConstraints.gridx = 1
        scrollPaneConstraints.gridy = 0
        self.add(scrollPane, scrollPaneConstraints)

        self.initParameterColumn(table)
        self.initColumnSizes(table)
Ejemplo n.º 7
0
    def __init__(self, extender=None, *rows):
        self.extender = extender

        self.table = table = JTable(ParameterProcessingRulesTableModel(*rows))
        table.setPreferredScrollableViewportSize(Dimension(500, 70))
        table.setRowSorter(TableRowSorter(table.getModel()))
        table.setFillsViewportHeight(True)

        gridBagLayout = GridBagLayout()
        gridBagLayout.columnWidths = [0, 0, 25, 0]
        gridBagLayout.rowHeights = [0, 0, 0, 0]
        gridBagLayout.columnWeights = [0.0, 1.0, 1.0, Double.MIN_VALUE]
        gridBagLayout.rowWeights = [0.0, 0.0, 0.0, Double.MIN_VALUE]
        self.setLayout(gridBagLayout)

        addButton = JButton("Add")
        addButton.addActionListener(AddRemoveParameterListener(table))
        addButtonConstraints = GridBagConstraints()
        addButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        addButtonConstraints.insets = Insets(0, 0, 5, 5)
        addButtonConstraints.gridx = 0
        addButtonConstraints.gridy = 0
        self.add(addButton, addButtonConstraints)

        removeButton = JButton("Remove")
        removeButton.addActionListener(AddRemoveParameterListener(table))
        removeButtonConstraints = GridBagConstraints()
        removeButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        removeButtonConstraints.insets = Insets(0, 0, 5, 5)
        removeButtonConstraints.gridx = 0
        removeButtonConstraints.gridy = 1
        self.add(removeButton, removeButtonConstraints)

        upButton = JButton("Up")
        upButton.addActionListener(AddRemoveParameterListener(table))
        upButtonConstraints = GridBagConstraints()
        upButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        upButtonConstraints.insets = Insets(0, 0, 5, 5)
        upButtonConstraints.gridx = 0
        upButtonConstraints.gridy = 2
        self.add(upButton, upButtonConstraints)

        downButton = JButton("Down")
        downButton.addActionListener(AddRemoveParameterListener(table))
        downButtonConstraints = GridBagConstraints()
        downButtonConstraints.fill = GridBagConstraints.HORIZONTAL
        downButtonConstraints.anchor = GridBagConstraints.NORTH
        downButtonConstraints.insets = Insets(0, 0, 5, 5)
        downButtonConstraints.gridx = 0
        downButtonConstraints.gridy = 3
        self.add(downButton, downButtonConstraints)

        scrollPane = JScrollPane(table)
        scrollPaneConstraints = GridBagConstraints()
        scrollPaneConstraints.gridwidth = 2
        scrollPaneConstraints.gridheight = 5
        scrollPaneConstraints.insets = Insets(0, 0, 5, 5)
        scrollPaneConstraints.anchor = GridBagConstraints.NORTHWEST
        scrollPaneConstraints.gridx = 1
        scrollPaneConstraints.gridy = 0
        self.add(scrollPane, scrollPaneConstraints)

        self.initParameterColumn(table)
        self.initColumnSizes(table)