def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        #self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("Create Content View of Unique Event Id's", actionPerformed=self.checkBoxEvent)
        self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent)
        self.text1 = JLabel("*** Only run this once otherwise it adds it to the data again.")
        self.text2 = JLabel(" ")
        self.text3 = JLabel("*** Format is a comma delimited text ie:  8001, 8002")
        self.panel1.add(self.checkbox)
        self.panel1.add(self.text1)
        self.panel1.add(self.text2)
        self.panel1.add(self.checkbox4)
        self.panel1.add(self.text3)
        self.add(self.panel1)
		
        self.area = JTextArea(5,25)
        #self.area.addKeyListener(self)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        #self.pane.addKeyListener(self)
        #self.add(self.area)
        self.add(self.pane)
Exemplo n.º 2
0
 def addApplicationCheckbox(app, app_id, ap):
     checkbox = JCheckBox("{} ({})".format(app.capitalize(), app_id), actionPerformed= ap)
     checkbox.setActionCommand(app)
     checkbox.setSelected(True)
     checkbox.setVisible(False)
     checkbox.setActionCommand(app_id)
     return checkbox
Exemplo n.º 3
0
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("Искать таблицы?".decode('UTF-8'),
                                  actionPerformed=self.checkBoxEvent)
        self.label0 = JLabel(" ")
        self.label1 = JLabel(
            "Введите названия интересуемых таблиц".decode('UTF-8'))
        self.label2 = JLabel(
            "через запятую, после чего установите флажок".decode('UTF-8'))
        self.label3 = JLabel(" ")
        self.panel1.add(self.checkbox)
        self.panel1.add(self.label0)
        self.panel1.add(self.label1)
        self.panel1.add(self.label2)
        self.panel1.add(self.label3)
        self.add(self.panel1)
        self.local_settings.setSetting('Flag', 'false')

        self.area = JTextArea(5, 25)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        self.add(self.pane)
Exemplo n.º 4
0
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        #self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("All Logs",
                                  actionPerformed=self.checkBoxEvent)
        self.checkbox1 = JCheckBox("Application.Evtx",
                                   actionPerformed=self.checkBoxEvent)
        self.checkbox2 = JCheckBox("Security.EVTX",
                                   actionPerformed=self.checkBoxEvent)
        self.checkbox3 = JCheckBox("System.EVTX",
                                   actionPerformed=self.checkBoxEvent)
        self.checkbox4 = JCheckBox(
            "Other - Input in text area below then check this box",
            actionPerformed=self.checkBoxEvent)
        self.panel1.add(self.checkbox)
        self.panel1.add(self.checkbox1)
        self.panel1.add(self.checkbox2)
        self.panel1.add(self.checkbox3)
        self.panel1.add(self.checkbox4)
        self.add(self.panel1)

        self.area = JTextArea(5, 25)
        #self.area.addKeyListener(self)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        #self.pane.addKeyListener(self)
        #self.add(self.area)
        self.add(self.pane)
Exemplo n.º 5
0
    def __init__(self, tree):
        TreeCellEditor.__init__(self)
        self.editor = None
        self.tree = tree

        flowLayout = FlowLayout(FlowLayout.LEFT, 0, 0)

        self.cbPanel = JPanel(flowLayout)
        self.cb = JCheckBox(actionPerformed=self.checked)
        self.cbPanel.add(self.cb)
        self.cbLabel = JLabel()
        self.cbPanel.add(self.cbLabel)

        self.tcbPanel = JPanel(flowLayout)
        self.tcb = TristateCheckBox(self.checked)
        self.tcbPanel.add(self.tcb)
        self.tcbLabel = JLabel()
        self.tcbPanel.add(self.tcbLabel)

        self.rbPanel = JPanel(flowLayout)
        self.rb = JRadioButton(actionPerformed=self.checked)
        self.rbPanel.add(self.rb)
        self.rbLabel = JLabel()
        self.rbPanel.add(self.rbLabel)

        self.tfPanel = JPanel(flowLayout)
        self.tfLabel = JLabel()
        self.tfPanel.add(self.tfLabel)
        self.tf = JTextField()
        self.tf.setColumns(12)
        self.tf.addActionListener(self)
        self.tfPanel.add(self.tf)
Exemplo n.º 6
0
    def __init__(self, frame, chart, pingFun):
        JDialog(frame)
        self.setTitle("Chart Settings")
        self.setModal(True)
        self.pingFun = pingFun
        pane = self.getRootPane().getContentPane()
        pane.setLayout(GridLayout(7, 2))
        pane.add(JLabel("Marker color"))
        self.markerPanel = self.createColorPanel(chart.markerColor, pane)
        pane.add(JLabel("Positive selection color"))
        self.posPanel = self.createColorPanel(chart.posColor, pane)
        pane.add(JLabel("Neutral color"))
        self.neuPanel = self.createColorPanel(chart.neuColor, pane)
        pane.add(JLabel("Balancing selection color "))
        self.balPanel = self.createColorPanel(chart.balColor, pane)

        self.add(JLabel("Label candidate selected loci"))
        self.selLabel = JCheckBox()
        self.selLabel.setSelected(chart.labelSelected)
        self.add(self.selLabel)
        self.add(JLabel("Label candidate neutral loci"))
        self.neuLabel = JCheckBox()
        self.neuLabel.setSelected(chart.labelNeutral)
        self.add(self.neuLabel)

        change = JButton("Change")
        change.setActionCommand("Change")
        change.addActionListener(self)
        pane.add(change)
        exit = JButton("Exit")
        exit.setActionCommand("Exit")
        exit.addActionListener(self)
        pane.add(exit)
        self.pack()
Exemplo n.º 7
0
    def __init__(self, frame, chart, pingFun):
        JDialog(frame)
        self.setTitle('Chart Settings')
        self.setModal(True)
        self.pingFun = pingFun
        pane = self.getRootPane().getContentPane()
        pane.setLayout(GridLayout(7, 2))
        pane.add(JLabel('Marker color'))
        self.markerPanel = self.createColorPanel(chart.markerColor, pane)
        pane.add(JLabel('Positive selection color'))
        self.posPanel = self.createColorPanel(chart.posColor, pane)
        pane.add(JLabel('Neutral color'))
        self.neuPanel = self.createColorPanel(chart.neuColor, pane)
        pane.add(JLabel('Balancing selection color '))
        self.balPanel = self.createColorPanel(chart.balColor, pane)

        self.add(JLabel('Label candidate selected loci'))
        self.selLabel = JCheckBox()
        self.selLabel.setSelected(chart.labelSelected)
        self.add(self.selLabel)
        self.add(JLabel('Label candidate neutral loci'))
        self.neuLabel = JCheckBox()
        self.neuLabel.setSelected(chart.labelNeutral)
        self.add(self.neuLabel)

        change = JButton('Change')
        change.setActionCommand('Change')
        change.addActionListener(self)
        pane.add(change)
        exit = JButton('Exit')
        exit.setActionCommand('Exit')
        exit.addActionListener(self)
        pane.add(exit)
        self.pack()
Exemplo n.º 8
0
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        #self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("Create Content View of Unique Event Id's",
                                  actionPerformed=self.checkBoxEvent)
        self.checkbox4 = JCheckBox(
            "Other - Input in text area below then check this box",
            actionPerformed=self.checkBoxEvent)
        self.text1 = JLabel(
            "*** Only run this once otherwise it adds it to the data again.")
        self.text2 = JLabel(" ")
        self.text3 = JLabel(
            "*** Format is a comma delimited text ie:  8001, 8002")
        self.panel1.add(self.checkbox)
        self.panel1.add(self.text1)
        self.panel1.add(self.text2)
        self.panel1.add(self.checkbox4)
        self.panel1.add(self.text3)
        self.add(self.panel1)

        self.area = JTextArea(5, 25)
        #self.area.addKeyListener(self)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        #self.pane.addKeyListener(self)
        #self.add(self.area)
        self.add(self.pane)
Exemplo n.º 9
0
    def __init__(self):
        DefaultTreeCellRenderer.__init__(self)

        flowLayout = FlowLayout(FlowLayout.LEFT, 0, 0)

        self.cbPanel = JPanel(flowLayout)
        self.cb = JCheckBox()
        self.cb.setBackground(None)
        self.cbPanel.add(self.cb)
        self.cbLabel = JLabel()
        self.cbPanel.add(self.cbLabel)

        self.tcbPanel = JPanel(flowLayout)
        self.tcb = TristateCheckBox()
        self.tcb.setBackground(None)
        self.tcbPanel.add(self.tcb)
        self.tcbLabel = JLabel()
        self.tcbPanel.add(self.tcbLabel)

        self.rbPanel = JPanel(flowLayout)
        self.rb = JRadioButton()
        self.rb.setBackground(None)
        self.rbPanel.add(self.rb)
        self.rbLabel = JLabel()
        self.rbPanel.add(self.rbLabel)
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        #self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("Check to activate/deactivate TextArea",
                                  actionPerformed=self.checkBoxEvent)
        self.label0 = JLabel(" ")
        self.label1 = JLabel("Input in SQLite DB's in area below,")
        self.label2 = JLabel("seperate values by commas.")
        self.label3 = JLabel("then check the box above.")
        self.label4 = JLabel(" ")
        self.panel1.add(self.checkbox)
        self.panel1.add(self.label0)
        self.panel1.add(self.label1)
        self.panel1.add(self.label2)
        self.panel1.add(self.label3)
        self.panel1.add(self.label4)
        self.add(self.panel1)

        self.area = JTextArea(5, 25)
        #self.area.getDocument().addDocumentListener(self.area)
        #self.area.addKeyListener(listener)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        #self.pane.addKeyListener(self.area)
        #self.add(self.area)
        self.add(self.pane)
    def __init__(self, tree, mapContext):
        self.tree = tree
        self.mapContext = mapContext
        self.lblGroup = JLabel()
        self.lblGroup.setBackground(Color(222, 227, 233))  #.BLUE.brighter())
        self.lblGroup.setOpaque(True)
        self.lblGroup.setText(
            "plddddddddddddddddddddddddddddddddddddddddddddddddddddddd")
        self.lblGroupPreferredSize = self.lblGroup.getPreferredSize()
        #border = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)
        #border = BorderFactory.createLineBorder(Color(222,227,233).darker(),1)
        #self.lblGroup.setBorder(border)
        #self.lblGroupPreferredSize.setSize(30,200)#self.lblGroupPreferredSize.getHeight()+4, self.lblGroupPreferredSize.getWidth())
        self.pnlLayer = JPanel()
        self.pnlLayer.setOpaque(False)
        #self.pnlLayer.setBorder(EmptyBorder(2,2,2,2))

        self.pnlLayer.setLayout(FlowLayout(FlowLayout.LEFT))
        self.chkLayerVisibility = JCheckBox()
        self.chkLayerVisibility.setOpaque(False)
        self.pnlLayer.add(self.chkLayerVisibility)
        self.lblLayerIcon = JLabel()
        self.lblLayerName = JLabel()
        self.lblLayerName.setText(
            "plddddddddddddddddddddddddddddddddddddddddddddddddddddddd")

        self.tree.setRowHeight(
            int(self.pnlLayer.getPreferredSize().getHeight()) - 3)  #+2
        self.pnlLayer.add(self.lblLayerIcon)
        self.pnlLayer.add(self.lblLayerName)

        self.lblUnknown = JLabel()
Exemplo n.º 12
0
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        #self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("All Logs", actionPerformed=self.checkBoxEvent)
        self.checkbox1 = JCheckBox("Application.Evtx", actionPerformed=self.checkBoxEvent)
        self.checkbox2 = JCheckBox("Security.EVTX", actionPerformed=self.checkBoxEvent)
        self.checkbox3 = JCheckBox("System.EVTX", actionPerformed=self.checkBoxEvent)
        self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent)
        self.panel1.add(self.checkbox)
        self.panel1.add(self.checkbox1)
        self.panel1.add(self.checkbox2)
        self.panel1.add(self.checkbox3)
        self.panel1.add(self.checkbox4)
        self.add(self.panel1)
		
        self.area = JTextArea(5,25)
        #self.area.addKeyListener(self)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        #self.pane.addKeyListener(self)
        #self.add(self.area)
        self.add(self.pane)
Exemplo n.º 13
0
 def getUiComponent(self):
     self.HaEPanel = JPanel()
     self.HaEPanel.setBorder(None)
     self.HaEPanel.setLayout(BorderLayout(0, 0))
     self.panel = JPanel()
     self.HaEPanel.add(self.panel, BorderLayout.NORTH)
     self.panel.setLayout(BorderLayout(0, 0))
     self.tabbedPane = JTabbedPane(JTabbedPane.TOP)
     self.panel.add(self.tabbedPane, BorderLayout.CENTER)
     self.setPanel = JPanel()
     self.tabbedPane.addTab("Set", None, self.setPanel, None)
     self.setPanel.setLayout(BorderLayout(0, 0))
     self.setPanel_1 = JPanel()
     self.setPanel.add(self.setPanel_1, BorderLayout.NORTH)
     self.nameString = JLabel("Name")
     self.setPanel_1.add(self.nameString)
     self.nameTextField = JTextField()
     self.setPanel_1.add(self.nameTextField)
     self.nameTextField.setColumns(10)
     self.regexString = JLabel("Regex")
     self.setPanel_1.add(self.regexString)
     self.regexTextField = JTextField()
     self.setPanel_1.add(self.regexTextField)
     self.regexTextField.setColumns(10)
     self.extractCheckBox = JCheckBox("Extract")
     self.setPanel_1.add(self.extractCheckBox)
     self.highlightCheckBox = JCheckBox("Highlight")
     self.setPanel_1.add(self.highlightCheckBox)
     self.setPanel_2 = JPanel()
     self.setPanel.add(self.setPanel_2)
     self.colorString = JLabel("Color")
     self.setPanel_2.add(self.colorString)
     self.colorTextField = JTextField()
     self.setPanel_2.add(self.colorTextField)
     self.colorTextField.setColumns(5)
     self.addBottun = JButton("Add", actionPerformed=self.addConfig)
     self.setPanel_2.add(self.addBottun)
     self.tipString = JLabel("")
     self.setPanel_2.add(self.tipString)
     self.configPanel = JPanel()
     self.tabbedPane.addTab("Config", None, self.configPanel, None)
     self.configPanel.setLayout(BorderLayout(0, 0))
     self.configString = JLabel("This is config file content.")
     self.configString.setHorizontalAlignment(SwingConstants.CENTER)
     self.configPanel.add(self.configString, BorderLayout.NORTH)
     self.configTextArea = JTextArea()
     self.configTextArea.setEnabled(False)
     self.configTextArea.setTabSize(4)
     self.configTextArea.setLineWrap(True)
     self.configTextArea.setRows(20)
     self.configPanel.add(self.configTextArea, BorderLayout.SOUTH)
     self.scrollPane = JScrollPane(self.configTextArea)
     self.configPanel.add(self.scrollPane, BorderLayout.SOUTH)
     self.reloadButton = JButton("Reload",
                                 actionPerformed=self.reloadConfig)
     self.configPanel.add(self.reloadButton, BorderLayout.CENTER)
     return self.HaEPanel
Exemplo n.º 14
0
 def initComponents(self):
     self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
     self.cache_parse_checkbox = JCheckBox(
         "Parse Cached Files", actionPerformed=self.cache_checkbox_event)
     self.add(self.cache_parse_checkbox)
     self.settings_parse_checkbox = JCheckBox(
         "Parse Setting Files",
         actionPerformed=self.settings_checkbox_event)
     self.add(self.settings_parse_checkbox)
Exemplo n.º 15
0
class EditCurveAttr(JPanel):
    def __init__(self, cattr):
        self.attr = cattr
        self.cbox = JColorChooser(self.attr.color)
        self.sym_panel = EditSymbolAttr(cattr.sym_prop)
        self.thickness_field = JTextField(str(cattr.thickness), 2)
        self.draw_symbol_box = JCheckBox("Draw Symbol?", cattr.draw_symbol)
        self.dps_field = JTextField(str(self.attr.data_per_symbol), 2)
        self.dash_box = JComboBox(CurveProps.DASH_TYPES.keys())
        self.dash_box.setSelectedItem(self.attr.dash_type)
        self.dash_box.setBorder(
            BorderFactory.createTitledBorder("Dash type: (Only JDK2 & Slow!)"))
        tpanelx = JPanel()
        tpanelx.add(self.thickness_field)
        tpanelx.setBorder(
            BorderFactory.createTitledBorder("curve thickness (integer)"))
        tpanely = JPanel()
        tpanely.add(self.dps_field)
        tpanely.setBorder(
            BorderFactory.createTitledBorder("data per symbol(integer)"))
        tpanel = JPanel()
        tpanel.setLayout(GridLayout(2, 2))
        tpanel.add(self.draw_symbol_box)
        tpanel.add(tpanelx)
        tpanel.add(tpanely)
        tpanel.add(self.dash_box)
        panel1 = JPanel()
        panel1.setLayout(BorderLayout())
        panel1.add(self.cbox, BorderLayout.CENTER)
        panel1.add(tpanel, BorderLayout.SOUTH)
        panel2 = JPanel()
        panel2.setLayout(BorderLayout())
        panel2.add(self.sym_panel, BorderLayout.CENTER)
        tp1 = JTabbedPane()
        tp1.addTab("Curve Attributes", panel1)
        tp1.addTab("Symbol Attributes", panel2)
        tp1.setSelectedComponent(panel1)
        self.setLayout(BorderLayout())
        self.add(tp1, BorderLayout.CENTER)

    def setAttribute(self, cattr):
        self.attr = cattr
        self.cbox.color = self.attr.color
        self.sym_panel.setAttribute(cattr.sym_prop)
        self.thickness_field.text = str(cattr.thickness)
        self.dps_field.text = str(cattr.data_per_symbol)
        self.draw_symbol_box.setSelected(cattr.draw_symbol)
        self.dash_box.setSelectedItem(cattr.dash_type)

    def update(self):
        self.attr.color = self.cbox.getColor()
        self.attr.thickness = string.atoi(self.thickness_field.text)
        self.attr.data_per_symbol = string.atoi(self.dps_field.text)
        self.attr.draw_symbol = self.draw_symbol_box.isSelected()
        self.attr.dash_type = self.dash_box.getSelectedItem()
        #print 'Updating Self.draw_symbol',self.draw_symbol,self.attr
        self.sym_panel.update()
    def initGui(self):
        #~ if DEBUG:
            #~ import pdb;
            #~ pdb.set_trace()
        tabPane = JTabbedPane(JTabbedPane.TOP)
        CreditsText = "<html># Burp Custom Deserializer<br/># Copyright (c) 2016, Marco Tinari<br/>#<br/># This program is free software: you can redistribute it and/or modify<br/># it under the terms of the GNU General Public License as published by<br/># the Free Software Foundation, either version 3 of the License, or<br/># (at your option) any later version.<br/>#<br/># This program is distributed in the hope that it will be useful,<br/># but WITHOUT ANY WARRANTY; without even the implied warranty of<br/># MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br/># GNU General Public License for more details.<br/>#<br/># You should have received a copy of the GNU General Public License<br/># along with this program.  If not, see <http://www.gnu.org/licenses/>.)<br/></html>"
        label1 = JLabel("<html>Usage:<br>1 - Select the desired encoding functions<br>2 - Enter the name of the parameter in the input field below and press the Apply button!</html>")
        label2 = JLabel(CreditsText)
        panel1 = JPanel()
        #set layout
        panel1.setLayout(GridLayout(11,1))
        panel2 = JPanel()
        panel1.add(label1)
        panel2.add(label2)
        tabPane.addTab("Configuration", panel1)
        tabPane.addTab("Credits", panel2)

        applyButton = JButton('Apply',actionPerformed=self.reloadConf)
        panel1.add(applyButton, BorderLayout.SOUTH)
        
        #define GET/POST/COOKIE radio button
        self.GETparameterTypeRadioButton = JRadioButton('GET parameter')
        self.POSTparameterTypeRadioButton = JRadioButton('POST parameter')
        self.COOKIEparameterTypeRadioButton = JRadioButton('COOKIE parameter')
        self.POSTparameterTypeRadioButton.setSelected(True)
        group = ButtonGroup()
        group.add(self.GETparameterTypeRadioButton)
        group.add(self.POSTparameterTypeRadioButton)
        group.add(self.COOKIEparameterTypeRadioButton)
        self.base64Enabled = JCheckBox("Base64 encode")
        self.URLEnabled = JCheckBox("URL encode")
        self.ASCII2HexEnabled = JCheckBox("ASCII to Hex")
        self.ScannerEnabled = JCheckBox("<html>Enable serialization in Burp Scanner<br>Usage:<br>1.Place unencoded values inside intruder request and define the placeholder positions<br>2.rightclick->Actively scan defined insertion points)</html>")
        self.IntruderEnabled = JCheckBox("<html>Enable serialization in Burp Intruder<br>Usage:<br>1.Place unencoded values inside intruder request and define the placeholder positions<br>2.Start the attack</html>")
        self.parameterName = JTextField("Parameter name goes here...",60)
        
        #set the tooltips
        self.parameterName.setToolTipText("Fill in the parameter name and apply")
        self.base64Enabled.setToolTipText("Enable base64 encoding/decoding")
        self.ASCII2HexEnabled.setToolTipText("Enable ASCII 2 Hex encoding/decoding") 
        self.URLEnabled.setToolTipText("Enable URL encoding/decoding")
        self.IntruderEnabled.setToolTipText("Check this if You want the extension to intercept and modify every request made by the Burp Intruder containing the selected paramter")
        self.ScannerEnabled.setToolTipText("Check this if You want the extension to intercept and modify every request made by the Burp Scanner containing the selected paramter")

        #add checkboxes to the panel            
        panel1.add(self.parameterName)
        panel1.add(self.POSTparameterTypeRadioButton)
        panel1.add(self.GETparameterTypeRadioButton)
        panel1.add(self.COOKIEparameterTypeRadioButton)
        panel1.add(self.base64Enabled)
        panel1.add(self.URLEnabled)
        panel1.add(self.ASCII2HexEnabled)
        panel1.add(self.IntruderEnabled)
        panel1.add(self.ScannerEnabled)
        #assign tabPane
        self.tab = tabPane
Exemplo n.º 17
0
    def paint(self, g):
        """Called when the tree needs to paint the checkbox icon."""
        if self.triState == 2:
            self.setIcon(self.selected)
        elif self.triState == 1:
            self.setIcon(self.halfselected)
        else:
            self.setIcon(self.unselected)

        JCheckBox.paint(self, g)
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        self.file_checkbox = JCheckBox("Look for Files relating to Dropbox",
                                       actionPerformed=self.checkBoxEvent)
        self.add(self.file_checkbox)

        self.dir_checkbox = JCheckBox(
            "Look for Directories relating to Dropbox",
            actionPerformed=self.checkBoxEvent)
        self.add(self.dir_checkbox)
Exemplo n.º 19
0
 def tag_2(self, c):
     # 创建 检查框
     self.is_scan_post_start_box = JCheckBox(u'是否扫描POST类型的参数(推荐打勾)',
                                             XssConfig.IS_SCAN_POST_START)
     self.setFontBold(self.is_scan_post_start_box)
     self.is_scan_post_start_box.setForeground(Color(0, 0, 153))
     c.insets = Insets(5, 5, 5, 5)
     c.gridx = 0
     c.gridy = 2
     self.scan_type_settings.add(self.is_scan_post_start_box, c)
Exemplo n.º 20
0
 def tag_3(self, c):
     # 创建 检查框
     self.is_scan_url_path_folders_box = JCheckBox(
         u'扫描URL路径作为参数', XssConfig.IS_SCAN_URL_PATH_FOLDERS)
     self.setFontBold(self.is_scan_url_path_folders_box)
     self.is_scan_url_path_folders_box.setForeground(Color(0, 0, 153))
     c.insets = Insets(5, 5, 5, 5)
     c.gridx = 0
     c.gridy = 3
     self.scan_type_settings.add(self.is_scan_url_path_folders_box, c)
Exemplo n.º 21
0
class JTabTitle(JPanel, ActionListener):
    def __init__(self, ui, tabName):
        self._ui = ui

        self.jStatusBtn = JButton()
        #self.jStatusBtn.setMargin(Insets(2,0,2,0))

        self.jStatusBtn = JCheckBox()
        self.jStatusBtn.setToolTipText(Strings.jStatusBtn_tooltip)
        self.jStatusBtn.setMargin(Insets(1, 5, 1, 5))  #enlarged clickable zone
        self.jStatusBtn.setBackground(Color.RED)  #transparent background
        self.add(self.jStatusBtn)
        self.jStatusBtn.addActionListener(self)

        self.jLabel = JDoubleClickTextField(self, tabName)

        self.add(self.jLabel)
        self.setOpaque(False)

    def actionPerformed(self, event):
        #Check box was clicked
        if self.jStatusBtn == event.getSource():
            if self.jStatusBtn.isSelected():
                self._ui.initVars(self)
            pass  #do nothing for now

    def setTabName(self, tabName):
        self.jLabel.setText(tabName)

    def getTabName(self):
        return self.jLabel.getText()
Exemplo n.º 22
0
 def tag_4_8(self, c):
     # 创建 检查框
     self.is_options_forward_requests_box = JCheckBox(
         u'转发OPTIONS请求', ForwardRequestsConfig.IS_OPTIONS_FORWARD_REQUESTS)
     self.setFontBold(self.is_options_forward_requests_box)
     self.is_options_forward_requests_box.setForeground(Color(0, 0, 153))
     c.insets = Insets(5, 5, 5, 5)
     c.gridx = 0
     c.gridy = 8
     self.white_list_http_method_settings.add(
         self.is_options_forward_requests_box, c)
Exemplo n.º 23
0
 def tag_4_15(self, c):
     # 创建 检查框
     self.is_view_forward_requests_box = JCheckBox(
         u'转发VIEW请求', ForwardRequestsConfig.IS_VIEW_FORWARD_REQUESTS)
     self.setFontBold(self.is_view_forward_requests_box)
     self.is_view_forward_requests_box.setForeground(Color(0, 0, 153))
     c.insets = Insets(5, 5, 5, 5)
     c.gridx = 0
     c.gridy = 15
     self.white_list_http_method_settings.add(
         self.is_view_forward_requests_box, c)
Exemplo n.º 24
0
 def __init__(self, amgui):
     self.amgui = amgui
     self.am = amgui.acctmanager
     self.buildgwinfo()
     self.autologin = JCheckBox("Automatically Log In")
     self.acctname = JTextField()
     self.gwoptions = JPanel(doublebuffered)
     self.gwoptions.border = TitledBorder("Gateway Options")
     self.buildgwoptions("Twisted")
     self.mainframe = JFrame("New Account Window")
     self.buildpane()
Exemplo n.º 25
0
 def tag_4_14(self, c):
     # 创建 检查框
     self.is_propfind_forward_requests_box = JCheckBox(
         u'转发PROPFIND请求',
         ForwardRequestsConfig.IS_PROPFIND_FORWARD_REQUESTS)
     self.setFontBold(self.is_propfind_forward_requests_box)
     self.is_propfind_forward_requests_box.setForeground(Color(0, 0, 153))
     c.insets = Insets(5, 5, 5, 5)
     c.gridx = 0
     c.gridy = 14
     self.white_list_http_method_settings.add(
         self.is_propfind_forward_requests_box, c)
Exemplo n.º 26
0
    def initConfigurationTab(self):
        #
        ##  init configuration tab
        #
        self.prevent304 = JCheckBox("Prevent 304 Not Modified status code")
        self.prevent304.setBounds(290, 25, 300, 30)

        self.ignore304 = JCheckBox("Ignore 304/204 status code responses")
        self.ignore304.setBounds(290, 5, 300, 30)
        self.ignore304.setSelected(True)

        self.autoScroll = JCheckBox("Auto Scroll")
        #self.autoScroll.setBounds(290, 45, 140, 30)
        self.autoScroll.setBounds(160, 40, 140, 30)

        self.doUnauthorizedRequest = JCheckBox("Check unauthenticated")
        self.doUnauthorizedRequest.setBounds(290, 45, 300, 30)
        self.doUnauthorizedRequest.setSelected(True)

        startLabel = JLabel("Authorization checks:")
        startLabel.setBounds(10, 10, 140, 30)
        self.startButton = JButton("Autorize is off",actionPerformed=self.startOrStop)
        self.startButton.setBounds(160, 10, 120, 30)
        self.startButton.setBackground(Color(255, 100, 91, 255))

        self.clearButton = JButton("Clear List",actionPerformed=self.clearList)
        self.clearButton.setBounds(10, 40, 100, 30)

        self.replaceString = JTextArea("Cookie: Insert=injected; header=here;", 5, 30)
        self.replaceString.setWrapStyleWord(True);
        self.replaceString.setLineWrap(True)
        self.replaceString.setBounds(10, 80, 470, 180)

        self.filtersTabs = JTabbedPane()
        self.filtersTabs.addTab("Enforcement Detector", self.EDPnl)
        self.filtersTabs.addTab("Detector Unauthenticated", self.EDPnlUnauth)
        self.filtersTabs.addTab("Interception Filters", self.filtersPnl)
        self.filtersTabs.addTab("Export", self.exportPnl)

        self.filtersTabs.setBounds(0, 280, 2000, 700)

        self.pnl = JPanel()
        self.pnl.setBounds(0, 0, 1000, 1000);
        self.pnl.setLayout(None);
        self.pnl.add(self.startButton)
        self.pnl.add(self.clearButton)
        self.pnl.add(self.replaceString)
        self.pnl.add(startLabel)
        self.pnl.add(self.autoScroll)
        self.pnl.add(self.ignore304)
        self.pnl.add(self.prevent304)
        self.pnl.add(self.doUnauthorizedRequest)
        self.pnl.add(self.filtersTabs)
Exemplo n.º 27
0
 def build_options_row(self):
     '''
     Builds the panel with ignore case, regex, etc. options.
     '''
     panel = JPanel(FlowLayout())
     self.ignore_case_box = JCheckBox('Ignore Case')
     self.regex_box = JCheckBox('Regular Expression')
     self.selection_box = JCheckBox('Selection only')
     panel.add(self.ignore_case_box)
     panel.add(self.regex_box)
     panel.add(self.selection_box)
     return panel
Exemplo n.º 28
0
class ArloIngestModuleSettingsPanel(IngestModuleIngestJobSettingsPanel):
    # Note, we can't use a self.settings instance variable.
    # Rather, self.local_settings is used.
    # https://wiki.python.org/jython/UserGuide#javabean-properties
    # Jython Introspector generates a property - 'settings' on the basis
    # of getSettings() defined in this class. Since only getter function
    # is present, it creates a read-only 'settings' property. This auto-
    # generated read-only property overshadows the instance-variable -
    # 'settings'

    # We get passed in a previous version of the settings so that we can
    # prepopulate the UI
    # TODO: Update this for your UI
    def __init__(self, settings):
        self.local_settings = settings
        self.initComponents()
        self.customizeComponents()

    # TODO: Update this for your UI
    def cache_checkbox_event(self, event):
        if self.cache_parse_checkbox.isSelected():
            self.local_settings.set_parse_cache(True)
        else:
            self.local_settings.set_parse_cache(False)

    def settings_checkbox_event(self, event):
        if self.settings_parse_checkbox.isSelected():
            self.local_settings.set_parse_settings(True)
        else:
            self.local_settings.set_parse_settings(False)

    # TODO: Update this for your UI
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        self.cache_parse_checkbox = JCheckBox(
            "Parse Cached Files", actionPerformed=self.cache_checkbox_event)
        self.add(self.cache_parse_checkbox)
        self.settings_parse_checkbox = JCheckBox(
            "Parse Setting Files",
            actionPerformed=self.settings_checkbox_event)
        self.add(self.settings_parse_checkbox)

    # TODO: Update this for your UI
    def customizeComponents(self):
        self.cache_parse_checkbox.setSelected(
            self.local_settings.get_parse_cache())
        self.settings_parse_checkbox.setSelected(
            self.local_settings.get_parse_settings())

    # Return the settings used
    def getSettings(self):
        return self.local_settings
Exemplo n.º 29
0
    def __init__(self, extender):
        self._callbacks = extender._callbacks
        self._helpers = extender._callbacks.getHelpers()
        self._callbacks.registerScannerCheck(self)
        # Creamos el contenedor de paneles.
        self.contenedor = JTabbedPane()

        # Campos del sub-tab 1 (mash up)
        self._tab1_nombre = JTextField()
        self._tab1_apellido = JTextField()
        self._tab1_FNacimiento = JTextField()
        self._tab1_mascota = JTextField()
        self._tab1_otro = JTextField()

        self._tab1_feedback_ta = JTextArea('This may take a while . . .')
        self._tab1_feedback_ta.setEditable(False)
        self._tab1_feedback_sp = JScrollPane(self._tab1_feedback_ta)

        self._tab1_minsize = JSlider(4, 16, 6)
        self._tab1_minsize.setMajorTickSpacing(1)
        self._tab1_minsize.setPaintLabels(True)

        self._tab1_maxsize = JSlider(4, 16, 10)
        self._tab1_maxsize.setMajorTickSpacing(1)
        self._tab1_maxsize.setPaintLabels(True)

        self._tab1_specialchars = JTextField('!,@,#,$,&,*')
        self._tab1_transformations = JCheckBox('1337 mode')
        self._tab1_firstcapital = JCheckBox('first capital letter')

        # Campos del sub-tab 2 (redirect)
        self._tab2_JTFa = JTextField()
        self._tab2_JTFaa = JTextField()
        self._tab2_JTFb = JTextField()
        self._tab2_JTFbb = JTextField()
        self._tab2_boton = JButton(' Redirect is Off ',
                                   actionPerformed=self.switch_redirect)
        self._tab2_boton.background = Color.lightGray
        self._tab2_encendido = False

        # Campos del sub-tab 3 (loader)
        self._tab3_urls_ta = JTextArea(15, 5)
        self._tab3_urls_sp = JScrollPane(self._tab3_urls_ta)

        # Campos del sub-tab 4 (headers)
        self._tab4_tabla_model = DefaultTableModel()
        self._tab4_headers_dict = {}

        # Campos del sub-tab 5 (reverse ip)
        self._tab5_target = JTextArea(15, 5)
        self._tab5_target_sp = JScrollPane(self._tab5_target)
Exemplo n.º 30
0
    def registerExtenderCallbacks(self, callbacks):
        self.callbacks = callbacks
        self.helpers = callbacks.helpers

        self.checkboxEnable = JCheckBox('Enabled')
        self.checkboxEnable.setSelected(False)
        self.checkboxEnable.setEnabled(True)

        self.scriptpane = JTextPane()
        self.scriptpane.setFont(Font('Monospaced', Font.PLAIN, 11))

        self.scrollpane = JScrollPane()
        self.scrollpane.setViewportView(self.scriptpane)

        self.tab = JPanel()
        layout = GroupLayout(self.tab)
        self.tab.setLayout(layout)
        layout.setAutoCreateGaps(True)
        layout.setAutoCreateContainerGaps(True)

        layout.setHorizontalGroup(layout.createParallelGroup().addComponent(
            self.checkboxEnable).addComponent(self.scrollpane))
        layout.setVerticalGroup(layout.createSequentialGroup().addComponent(
            self.checkboxEnable).addComponent(self.scrollpane))

        self._code = compile('', '<string>', 'exec')
        self._script = ''

        script = callbacks.loadExtensionSetting('script')

        if script:
            script = base64.b64decode(script)

            self.scriptpane.document.insertString(
                self.scriptpane.document.length, script, SimpleAttributeSet())

            self._script = script
            try:
                self._code = compile(script, '<string>', 'exec')
            except Exception as e:
                traceback.print_exc(file=self.callbacks.getStderr())

        callbacks.setExtensionName("Python Scripter (modified)")
        callbacks.registerSessionHandlingAction(self)
        callbacks.registerExtensionStateListener(self)
        callbacks.registerHttpListener(self)
        callbacks.customizeUiComponent(self.getUiComponent())
        callbacks.addSuiteTab(self)

        self.scriptpane.requestFocus()
        return
Exemplo n.º 31
0
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        # self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        panel1 = JPanel()
        panel1.setLayout(BoxLayout(panel1, BoxLayout.Y_AXIS))
        panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.labelPythonPathText = JLabel("Python path: ")
        self.textFieldPythonPath = JTextField(1)
        self.buttonSavePythonPath = JButton("Save", actionPerformed=self.textFieldEventPythonPath)

        self.labelCheckText = JLabel("Run recoveries: ")

        self.checkboxUndark = JCheckBox("Undark", actionPerformed=self.checkBoxEventUndark)
        self.checkboxMdg = JCheckBox("MGD Delete Parser", actionPerformed=self.checkBoxEventMdg)
        self.checkboxCrawler = JCheckBox("WAL Crawler", actionPerformed=self.checkBoxEventCrawler)
        self.checkboxB2l = JCheckBox("bring2lite", actionPerformed=self.checkBoxEventB2l)
        
        self.checkboxUndark.setSelected(True)
        self.checkboxMdg.setSelected(True)
        
        self.add(self.labelPythonPathText)
        panel1.add(self.textFieldPythonPath)
        panel1.add(self.buttonSavePythonPath)

        panel1.add(self.labelCheckText)
        panel1.add(self.checkboxUndark)
        panel1.add(self.checkboxMdg)
        panel1.add(self.checkboxCrawler)
        panel1.add(self.checkboxB2l)
        self.add(panel1)
Exemplo n.º 32
0
 def initComponents(self):
     self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
     #self.setLayout(GridLayout(0,1))
     self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
     self.panel1 = JPanel()
     self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
     self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
     self.checkbox = JCheckBox("Associate File Entries", actionPerformed=self.checkBoxEvent)
     self.checkbox1 = JCheckBox("Program Entries", actionPerformed=self.checkBoxEvent)
     self.checkbox2 = JCheckBox("Unassociated Programs", actionPerformed=self.checkBoxEvent)
     self.panel1.add(self.checkbox)
     self.panel1.add(self.checkbox1)
     self.panel1.add(self.checkbox2)
     self.add(self.panel1)
Exemplo n.º 33
0
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel = JPanel()
        self.panel.setLayout(BoxLayout(self.panel, BoxLayout.Y_AXIS))
        self.panel.setAlignmentY(JComponent.LEFT_ALIGNMENT)

        self.labelTop = JLabel("Choose file extensions to look for:")
        self.panel.add(self.labelTop)
        self.checkboxJPG = JCheckBox(".jpg",
                                     actionPerformed=self.checkBoxEvent)
        self.panel.add(self.checkboxJPG)
        self.checkboxJPEG = JCheckBox(".jpeg",
                                      actionPerformed=self.checkBoxEvent)
        self.panel.add(self.checkboxJPEG)
        self.checkboxPNG = JCheckBox(".png",
                                     actionPerformed=self.checkBoxEvent)
        self.panel.add(self.checkboxPNG)
        self.labelBlank = JLabel(" ")
        self.panel.add(self.labelBlank)
        self.checkboxDelete = JCheckBox("Delete files after use",
                                        actionPerformed=self.checkBoxEvent)
        self.panel.add(self.checkboxDelete)
        self.labelBlank1 = JLabel(" ")
        self.panel.add(self.labelBlank1)
        self.label = JLabel(
            "Provide folder for trainning face (if none will only do detection)"
        )
        self.openb = JButton("Choose", actionPerformed=self.onClick)
        self.panel.add(self.label)
        self.panel.add(self.openb)

        self.add(self.panel)
Exemplo n.º 34
0
 def __init__(self, chartFun, isTemporal = False):
     self.isTemporal = isTemporal
     JPanel()
     #self.setBackground(Color.LIGHT_GRAY)
     self.chartFun = chartFun
     self.enableChartFun = False
     self.setLayout(GridLayout(6,2))
     self.add(JLabel('CPU Cores'))
     cores = JComboBox(['1', '2', '4', '8', '16', '32', '64', '128'])
     nprocs = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors()
     pos = min([7, log(ceil(nprocs)) / log(2)])
     cores.setSelectedIndex(int(pos))
     cores.setMaximumSize(cores.getPreferredSize())
     self.cores = cores
     self.add(self.cores)
     self.add(JLabel('# of sims (x1000)  '))
     numSims = JComboBox(
         map(lambda x: str((10+x)*5), range(10)) +
         map(lambda x: str(x*100), range(1,11))
     )
     numSims.setMaximumSize(numSims.getPreferredSize())
     self.numSims = numSims
     self.add(self.numSims)
     if isTemporal:
         self.add(JLabel('"Neutral" Ne'))
         self.neutral = JCheckBox()
         self.neutral.addActionListener(self)
         self.add(self.neutral)
     else:
         self.add(JLabel('"Neutral" mean Fst'))
         self.neutral = JCheckBox()
         self.neutral.addActionListener(self)
         self.add(self.neutral)
         self.add(JLabel('Force mean Fst'))
         self.force = JCheckBox()
         self.force.addActionListener(self)
         self.add(self.force)
     self.add(JLabel('Confidence interval '))
     ci = JComboBox(['0.95', '0.99', '0.995'])
     ci.addItemListener(self)
     ci.setMaximumSize(cores.getPreferredSize())
     self.ci = ci
     self.add(self.ci)
     self.add(JLabel('False Disc. Rate'))
     fdr = JFormattedTextField(
         NumberFormat.getNumberInstance(Locale.US))
     fdr.setValue(0.1)
     fdr.addPropertyChangeListener(self)
     self.add(fdr)
     self.fdr = fdr
Exemplo n.º 35
0
class IMDbUISettingsPanel(IngestModuleIngestJobSettingsPanel):
    def __init__(self, settings):
        self.local_settings = settings
        self.initComponents()
        self.customizeComponents()
        self.area.setText("message, call, user, chat")
        self.local_settings.setSetting('tableList', self.area.getText())

    def checkBoxEvent(self, event):
        if self.checkbox.isSelected():
            self.local_settings.setSetting('Flag', 'true')
            self.local_settings.setSetting('tableList', self.area.getText())
        else:
            self.local_settings.setSetting('Flag', 'false')

    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("Искать таблицы?".decode('UTF-8'),
                                  actionPerformed=self.checkBoxEvent)
        self.label0 = JLabel(" ")
        self.label1 = JLabel(
            "Введите названия интересуемых таблиц".decode('UTF-8'))
        self.label2 = JLabel(
            "через запятую, после чего установите флажок".decode('UTF-8'))
        self.label3 = JLabel(" ")
        self.panel1.add(self.checkbox)
        self.panel1.add(self.label0)
        self.panel1.add(self.label1)
        self.panel1.add(self.label2)
        self.panel1.add(self.label3)
        self.add(self.panel1)
        self.local_settings.setSetting('Flag', 'false')

        self.area = JTextArea(5, 25)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        self.add(self.pane)

    def customizeComponents(self):
        self.checkbox.setSelected(
            self.local_settings.getSetting('Flag') == 'true')
        self.area.setText(self.local_settings.getSetting('tableList'))

    def getSettings(self):
        return self.local_settings
Exemplo n.º 36
0
class EditCurveAttr(JPanel):
    def __init__(self, cattr):
	self.attr = cattr
	self.cbox = JColorChooser(self.attr.color)
	self.sym_panel = EditSymbolAttr(cattr.sym_prop)
	self.thickness_field = JTextField(str(cattr.thickness),2)
	self.draw_symbol_box = JCheckBox("Draw Symbol?",cattr.draw_symbol)
	self.dps_field = JTextField(str(self.attr.data_per_symbol),2)
	self.dash_box = JComboBox(CurveProps.DASH_TYPES.keys())
	self.dash_box.setSelectedItem(self.attr.dash_type)
	self.dash_box.setBorder(BorderFactory.createTitledBorder("Dash type: (Only JDK2 & Slow!)"))
	tpanelx = JPanel()
	tpanelx.add(self.thickness_field)
	tpanelx.setBorder(BorderFactory.createTitledBorder("curve thickness (integer)"))
	tpanely = JPanel()
	tpanely.add(self.dps_field)
	tpanely.setBorder(BorderFactory.createTitledBorder("data per symbol(integer)"))
	tpanel = JPanel();tpanel.setLayout(GridLayout(2,2));
	tpanel.add(self.draw_symbol_box); tpanel.add(tpanelx);
	tpanel.add(tpanely); tpanel.add(self.dash_box);
	panel1 = JPanel()
	panel1.setLayout(BorderLayout())
	panel1.add(self.cbox,BorderLayout.CENTER)
	panel1.add(tpanel, BorderLayout.SOUTH)
	panel2 = JPanel()
	panel2.setLayout(BorderLayout())
	panel2.add(self.sym_panel,BorderLayout.CENTER)
	tp1 = JTabbedPane()
	tp1.addTab("Curve Attributes",panel1)
	tp1.addTab("Symbol Attributes",panel2)
	tp1.setSelectedComponent(panel1)
	self.setLayout(BorderLayout())
	self.add(tp1,BorderLayout.CENTER)
    def setAttribute(self,cattr):
	self.attr = cattr
	self.cbox.color = self.attr.color
	self.sym_panel.setAttribute(cattr.sym_prop)
	self.thickness_field.text = str(cattr.thickness)
	self.dps_field.text = str(cattr.data_per_symbol)
	self.draw_symbol_box.setSelected(cattr.draw_symbol)
	self.dash_box.setSelectedItem(cattr.dash_type)
    def update(self):
	self.attr.color = self.cbox.getColor()
	self.attr.thickness = string.atoi(self.thickness_field.text)
	self.attr.data_per_symbol = string.atoi(self.dps_field.text)
	self.attr.draw_symbol = self.draw_symbol_box.isSelected()
	self.attr.dash_type = self.dash_box.getSelectedItem()
	#print 'Updating Self.draw_symbol',self.draw_symbol,self.attr
	self.sym_panel.update()
Exemplo n.º 37
0
    def tag_2_3(self, c):
        self.url_forward_xray = JCheckBox(
            u'是否将请求转发到xray', ForwardRequestsConfig.URL_FORWARD_XRAY)
        self.setFontBold(self.url_forward_xray)
        self.url_forward_xray.setForeground(Color(0, 0, 153))
        c.insets = Insets(5, 5, 5, 5)
        c.gridx = 0
        c.gridy = 5
        self.forward_requests_settings.add(self.url_forward_xray, c)

        self.xray_listen_text_field = JTextField(u"127.0.0.1:7777")
        c.fill = GridBagConstraints.BOTH
        c.gridx = 0
        c.gridy = 6
        self.forward_requests_settings.add(self.xray_listen_text_field, c)
Exemplo n.º 38
0
    def __init__(self, eventHandler=None):
        """Creates a TristateCheckBox object

        Arguments
        ---------
            eventHandler : ActionListener
                If supplied, the event handler will be called when
                the tristate checkbox state changes.
        """
        JCheckBox.__init__(self)

        if eventHandler:
            addActionListener(self, eventHandler)

        addActionListener(self, self.actionPerformed)
Exemplo n.º 39
0
    def initializeGUI(self):
        # table panel of scope entries
        self._url_table = Table(self)
        table_popup = JPopupMenu();
        remove_item_menu = JMenuItem(self._remove_description, actionPerformed=self.removeFromScope)
        table_popup.add(remove_item_menu)
        self._url_table.setComponentPopupMenu(table_popup)
        self._url_table.addMouseListener(TableMouseListener(self._url_table))
        scrollPane = JScrollPane(self._url_table)

        # setting panel              

        ##  locate checkboxes
        ### for constants, see: https://portswigger.net/burp/extender/api/constant-values.html#burp.IBurpExtenderCallbacks.TOOL_PROXY          
        self._checkboxes = {
            2:    JCheckBox('Target'),
            4:    JCheckBox('Proxy'),
            8:    JCheckBox('Spider'),
            16:   JCheckBox('Scanner'),
            32:   JCheckBox('Intruder'),            
            64:   JCheckBox('Repeater'),
            128:  JCheckBox('Sequencer'),
            1024: JCheckBox('Extender')
        }
        checkboxes_components = {0: dict(zip(range(1,len(self._checkboxes) + 1), self._checkboxes.values()))}

        self._label_value_regex_now_1 = JLabel("(1) Regex for the value to store: ")
        self._label_value_regex_now_2 = JLabel("")
        self._label_value_regex = JLabel("(1) New regex:")
        self._form_value_regex = JTextField("", 64)
        self._button_value_regex = JButton('Update', actionPerformed=self.updateTokenSourceRegex)        
        self._label_header_now_1 = JLabel("(2) Header for sending the value: ")
        self._label_header_now_2 = JLabel("")
        self._label_header = JLabel("(2) New header key: ")
        self._form_header = JTextField("", 64)
        self._button_header = JButton('Update', actionPerformed=self.updateHeaderName)
        self._label_add_url = JLabel("Add this URL: ")
        self._form_add_url = JTextField("", 64)
        self._button_add_url = JButton('Add', actionPerformed=self.addURLDirectly)
                
        ## logate regex settings
        ui_components_for_settings_pane = {
            0: { 0: JLabel("Local Settings:") },
            1: { 0: self._label_value_regex_now_1, 1: self._label_value_regex_now_2 },
            2: { 0: self._label_value_regex, 1: self._form_value_regex, 2: self._button_value_regex},
            3: { 0: self._label_header_now_1, 1: self._label_header_now_2 },
            4: { 0: self._label_header, 1: self._form_header, 2: self._button_header},
            5: { 0: {'item': JSeparator(JSeparator.HORIZONTAL), 'width': 3, }},
            6: { 0: JLabel("General Settings:") },
            7: { 0: self._label_add_url, 1: self._form_add_url, 2: self._button_add_url},
            8: { 0: JLabel("Use this extender in:"), 1: {'item': self.compose_ui(checkboxes_components), 'width': 3} }
        }
        # build a split panel & set UI component
        self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT)
        self._splitpane.setResizeWeight(0.85)
        self._splitpane.setLeftComponent(scrollPane)
        self._splitpane.setRightComponent(self.compose_ui(ui_components_for_settings_pane))
        self._callbacks.customizeUiComponent(self._splitpane)
Exemplo n.º 40
0
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        #self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("Check to activate/deactivate TextArea", actionPerformed=self.checkBoxEvent)
        self.label0 = JLabel(" ")
        self.label1 = JLabel("Input in SQLite DB's in area below,")
        self.label2 = JLabel("seperate values by commas.")
        self.label3 = JLabel("then check the box above.")
        self.label4 = JLabel(" ")
        self.panel1.add(self.checkbox)
        self.panel1.add(self.label0)
        self.panel1.add(self.label1)
        self.panel1.add(self.label2)
        self.panel1.add(self.label3)
        self.panel1.add(self.label4)
        self.add(self.panel1)
 
        self.area = JTextArea(5,25)
        #self.area.getDocument().addDocumentListener(self.area)
        #self.area.addKeyListener(listener)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        #self.pane.addKeyListener(self.area)
        #self.add(self.area)
        self.add(self.pane)
Exemplo n.º 41
0
class EditSymbolAttr(JPanel):
    def __init__(self, sattr):
	self.attr = sattr
	self.cbox = JColorChooser(self.attr.color)
	self.sz_field = JTextField(str(self.attr.size))
	szpanel = JPanel()
	szpanel.add(self.sz_field)
	szpanel.setBorder(BorderFactory.createTitledBorder("symbol size (integer)"))
	self.filled_box = JCheckBox("Filled ?:",self.attr.filled)
	self.shape_cbox = JComboBox(SymbolProps.sym_shape_map.keys())
	self.shape_cbox.setSelectedItem(self.attr.shape)
	self.shape_cbox.setBorder(BorderFactory.createTitledBorder("Shape"))
	panel1 = JPanel()
	panel1.setLayout(BorderLayout())
	panel1.add(szpanel,BorderLayout.NORTH)
	panel2 = JPanel()
	panel2.setLayout(GridLayout(1,2))
	panel2.add(self.shape_cbox)
	panel2.add(self.filled_box)
	panel1.add(panel2,BorderLayout.SOUTH)
	self.setLayout(BorderLayout())
	self.add(self.cbox,BorderLayout.CENTER)
	self.add(panel1,BorderLayout.SOUTH)
    def setAttribute(self,sattr):
	self.attr = sattr
	self.cbox.color = self.attr.color
	self.sz_field.text = str(self.attr.size)
	self.shape_cbox.setSelectedItem(self.attr.shape)
    def update(self):
	self.attr.color = self.cbox.getColor()
	self.attr.size = string.atoi(self.sz_field.getText())
	self.attr.filled = self.filled_box.isSelected()
	self.attr.shape = self.shape_cbox.getSelectedItem()
	self.attr.sym = self.attr.createSymbol()
Exemplo n.º 42
0
 def __init__(self,view):
     self.view=view
     self.layout=BorderLayout()
     self.run_sim=JCheckBox('generate more data',False)
     self.add(self.run_sim)
     self.thread=java.lang.Thread(self)
     self.thread.priority=java.lang.Thread.MIN_PRIORITY
     self.thread.start()
Exemplo n.º 43
0
 def __init__(self, amgui):
     self.amgui = amgui
     self.am = amgui.acctmanager
     self.buildgwinfo()
     self.autologin = JCheckBox("Automatically Log In")
     self.acctname = JTextField()
     self.gwoptions = JPanel(doublebuffered)
     self.gwoptions.border = TitledBorder("Gateway Options")
     self.buildgwoptions("Twisted")
     self.mainframe = JFrame("New Account Window")
     self.buildpane()
Exemplo n.º 44
0
    def changeDomainPopup(self, oldDomain, index):
        hostField = JTextField(25)
        checkbox = JCheckBox()
        domainPanel = JPanel(GridLayout(0,1))
        domainPanel.add(JLabel("Request %s: Domain %s inaccessible. Enter new domain." % (str(index),oldDomain)))

        firstline = JPanel()
        firstline.add(JLabel("Host:"))
        firstline.add(hostField)
        domainPanel.add(firstline)
        secondline = JPanel()
        secondline.add(JLabel("Replace domain for all requests?"))
        secondline.add(checkbox)
        domainPanel.add(secondline)
        result = JOptionPane.showConfirmDialog(
            self._splitpane,domainPanel, "Domain Inaccessible", JOptionPane.OK_CANCEL_OPTION)
        cancelled = (result == JOptionPane.CANCEL_OPTION)
        if cancelled:
            return (False, None, False)
        return (True, hostField.getText(), checkbox.isSelected())
class SampleFileIngestModuleWithUISettingsPanel(IngestModuleIngestJobSettingsPanel):
    # Note, we can't use a self.settings instance variable.
    # Rather, self.local_settings is used.
    # https://wiki.python.org/jython/UserGuide#javabean-properties
    # Jython Introspector generates a property - 'settings' on the basis
    # of getSettings() defined in this class. Since only getter function
    # is present, it creates a read-only 'settings' property. This auto-
    # generated read-only property overshadows the instance-variable -
    # 'settings'

    # We get passed in a previous version of the settings so that we can
    # prepopulate the UI
    # TODO: Update this for your UI
    def __init__(self, settings):
        self.local_settings = settings
        self.initComponents()
        self.customizeComponents()

    # TODO: Update this for your UI
    def checkBoxEvent(self, event):
        if self.checkbox.isSelected():
            self.local_settings.setFlag(True)
        else:
            self.local_settings.setFlag(False)

    # TODO: Update this for your UI
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        self.checkbox = JCheckBox("Flag", actionPerformed=self.checkBoxEvent)
        self.add(self.checkbox)

    # TODO: Update this for your UI
    def customizeComponents(self):
        self.checkbox.setSelected(self.local_settings.getFlag())

    # Return the settings used
    def getSettings(self):
        return self.local_settings
Exemplo n.º 46
0
class RunPanel(JPanel, java.lang.Runnable):
    def __init__(self,view):
        self.view=view
        self.layout=BorderLayout()
        self.run_sim=JCheckBox('generate more data',False)
        self.add(self.run_sim)
        self.thread=java.lang.Thread(self)
        self.thread.priority=java.lang.Thread.MIN_PRIORITY
        self.thread.start()
    def run(self):
        while True:
            if self.run_sim.isSelected():
                name=self.view.stats.name
                params=self.view.selected_params()
                print params
                self.view.stats(**params).run(call_after=self.view.graph.update)
            else:
                time.sleep(0.1)
Exemplo n.º 47
0
    def __init__(self, sattr):
	self.attr = sattr
	self.cbox = JColorChooser(self.attr.color)
	self.sz_field = JTextField(str(self.attr.size))
	szpanel = JPanel()
	szpanel.add(self.sz_field)
	szpanel.setBorder(BorderFactory.createTitledBorder("symbol size (integer)"))
	self.filled_box = JCheckBox("Filled ?:",self.attr.filled)
	self.shape_cbox = JComboBox(SymbolProps.sym_shape_map.keys())
	self.shape_cbox.setSelectedItem(self.attr.shape)
	self.shape_cbox.setBorder(BorderFactory.createTitledBorder("Shape"))
	panel1 = JPanel()
	panel1.setLayout(BorderLayout())
	panel1.add(szpanel,BorderLayout.NORTH)
	panel2 = JPanel()
	panel2.setLayout(GridLayout(1,2))
	panel2.add(self.shape_cbox)
	panel2.add(self.filled_box)
	panel1.add(panel2,BorderLayout.SOUTH)
	self.setLayout(BorderLayout())
	self.add(self.cbox,BorderLayout.CENTER)
	self.add(panel1,BorderLayout.SOUTH)
Exemplo n.º 48
0
    def _initializeGui(self, callbacks):
        tab = JPanel()

        jLabel1 = JLabel("Original Hash:")
        jLabel2 = JLabel("Original message:")
        jLabel3 = JLabel("Message to append:")
        jLabel5 = JLabel("Max key length:")
        jTextField1 = JTextField("")
        jTextField2 = JTextField("")
        jTextField3 = JTextField("")
        jTextField4 = JTextField("128")
        jLabel4 = JLabel("Hashing functions")
        jCheckBox1 = JCheckBox("MD4")
        jCheckBox2 = JCheckBox("MD5")
        jCheckBox3 = JCheckBox("SHA1")
        jCheckBox4 = JCheckBox("SHA256")
        jCheckBox5 = JCheckBox("SHA512")
        jCheckBox1.setEnabled(False)
        jCheckBox2.setEnabled(False)
        jCheckBox3.setEnabled(False)
        jCheckBox4.setEnabled(False)
        jCheckBox5.setEnabled(False)
        jScrollPane1 = JScrollPane()
        jTable1 = JTable()
        jButton1 = JButton("Generate", actionPerformed=self.generate_attack)
        jButton1.setEnabled(False)
        jButton2 = JButton("Copy messages", actionPerformed=self.copy_messages)
        jButton3 = JButton("Copy hashes", actionPerformed=self.copy_hashes)

        self._tab = tab
        self._textfields = {
            "original_hash": jTextField1,
            "original_msg": jTextField2,
            "append_msg": jTextField3,
            "max_key_len": jTextField4,
        }
        self._checkboxes = {
            md4: jCheckBox1,
            md5: jCheckBox2,
            sha1: jCheckBox3,
            sha256: jCheckBox4,
            sha512: jCheckBox5,
        }

        self._table = jTable1
        self._extensions = {}
        self._hashes, self._messages = [], []

        # Hash field change event
        jTextField1.getDocument().addDocumentListener(HashChangeListener(self._checkboxes, self._textfields['original_hash'], jButton1))

        # Table columns
        jTable1.setModel(DefaultTableModel([],["#", "Type","New Message", "Hash"]))
        jScrollPane1.setViewportView(jTable1)
        # Table column width
        jTable1.getColumnModel().getColumn(0).setMaxWidth(50)
        jTable1.getColumnModel().getColumn(1).setMaxWidth(60)

        layout = GroupLayout(tab)
        tab.setLayout(layout)

        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(jTextField3, GroupLayout.DEFAULT_SIZE, 425, 32767)
                    .addComponent(jTextField2)
                    .addComponent(jTextField1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jTextField4, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 32767)))
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jCheckBox1)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox2)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox3)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox4)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jCheckBox5))
                    .addComponent(jLabel4)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2)))
                .addGap(167, 167, 167))
            .addComponent(jScrollPane1)
        )
        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jTextField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                        .addComponent(jCheckBox2)
                        .addComponent(jCheckBox3)
                        .addComponent(jCheckBox1)
                        .addComponent(jCheckBox4)
                        .addComponent(jCheckBox5)))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jTextField4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton2)
                    .addComponent(jButton3)
                    .addComponent(jButton1))
                .addGap(13, 13, 13)
                .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 971, 32767))
        )

        callbacks.customizeUiComponent(tab)
        callbacks.addSuiteTab(self)
 def initComponents(self):
     self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
     self.checkbox = JCheckBox("Flag", actionPerformed=self.checkBoxEvent)
     self.add(self.checkbox)
Exemplo n.º 50
0
class BurpExtender(IBurpExtender, ITab, IHttpListener, IMessageEditorController, AbstractTableModel, IContextMenuFactory):

    def registerExtenderCallbacks(self, callbacks):
        # keep a reference to our callbacks object
        self._callbacks = callbacks
        # obtain an extension helpers object
        self._helpers = callbacks.getHelpers()
        
        # set our extension name
        callbacks.setExtensionName("Autorize")
        
        # create the log and a lock on which to synchronize when adding log entries
        self._log = ArrayList()
        self._lock = Lock()
        self._enfocementStatuses = ["Authorization bypass!","Authorization enforced??? (please configure enforcement detector)","Authorization enforced!"]
        self.intercept = 0

        self.initInterceptionFilters()

        self.initEnforcementDetector()

        self.initEnforcementDetectorUnauthorized()

        self.initExport()

        self.initConfigurationTab()

        self.initTabs()
        
        self.initCallbacks()

        self.currentRequestNumber = 1
        
        print "Thank you for installing Autorize v0.12 extension"
        print "Created by Barak Tawily" 
        print "Contributors: Barak Tawily, Federico Dotta"
        print "\nGithub:\nhttps://github.com/Quitten/Autorize"
        return
        

    def initExport(self):
        #
        ## init enforcement detector tab
        #

        exportLType = JLabel("File Type:")
        exportLType.setBounds(10, 10, 100, 30)
       
        exportLES = JLabel("Enforcement Statuses:")
        exportLES.setBounds(10, 50, 160, 30)

        exportFileTypes = ["HTML","CSV"]
        self.exportType = JComboBox(exportFileTypes)
        self.exportType.setBounds(100, 10, 200, 30)

        exportES = ["All Statuses", self._enfocementStatuses[0], self._enfocementStatuses[1], self._enfocementStatuses[2]]
        self.exportES = JComboBox(exportES)
        self.exportES.setBounds(100, 50, 200, 30)

        exportLES = JLabel("Statuses:")
        exportLES.setBounds(10, 50, 100, 30)

        self.exportButton = JButton("Export",actionPerformed=self.export)
        self.exportButton.setBounds(390, 25, 100, 30)

        self.exportPnl = JPanel()
        self.exportPnl.setLayout(None);
        self.exportPnl.setBounds(0, 0, 1000, 1000);
        self.exportPnl.add(exportLType)
        self.exportPnl.add(self.exportType)
        self.exportPnl.add(exportLES)
        self.exportPnl.add(self.exportES)
        self.exportPnl.add(self.exportButton)

    def initEnforcementDetector(self):
        #
        ## init enforcement detector tab
        #

        # These two variable appears to be unused...
        self.EDFP = ArrayList()
        self.EDCT = ArrayList()

        EDLType = JLabel("Type:")
        EDLType.setBounds(10, 10, 140, 30)

        EDLContent = JLabel("Content:")
        EDLContent.setBounds(10, 50, 140, 30)

        EDLabelList = JLabel("Filter List:")
        EDLabelList.setBounds(10, 165, 140, 30)

        EDStrings = ["Headers (simple string): (enforced message headers contains)", "Headers (regex): (enforced messege headers contains)", "Body (simple string): (enforced messege body contains)", "Body (regex): (enforced messege body contains)", "Full request (simple string): (enforced messege contains)", "Full request (regex): (enforced messege contains)", "Content-Length: (constant Content-Length number of enforced response)"]
        self.EDType = JComboBox(EDStrings)
        self.EDType.setBounds(80, 10, 430, 30)
       
        self.EDText = JTextArea("", 5, 30)
        self.EDText.setBounds(80, 50, 300, 110)

        self.EDModel = DefaultListModel();
        self.EDList = JList(self.EDModel);
        self.EDList.setBounds(80, 175, 300, 110)
        self.EDList.setBorder(LineBorder(Color.BLACK))

        self.EDAdd = JButton("Add filter",actionPerformed=self.addEDFilter)
        self.EDAdd.setBounds(390, 85, 120, 30)
        self.EDDel = JButton("Remove filter",actionPerformed=self.delEDFilter)
        self.EDDel.setBounds(390, 210, 120, 30)

        self.EDPnl = JPanel()
        self.EDPnl.setLayout(None);
        self.EDPnl.setBounds(0, 0, 1000, 1000);
        self.EDPnl.add(EDLType)
        self.EDPnl.add(self.EDType)
        self.EDPnl.add(EDLContent)
        self.EDPnl.add(self.EDText)
        self.EDPnl.add(self.EDAdd)
        self.EDPnl.add(self.EDDel)
        self.EDPnl.add(EDLabelList)
        self.EDPnl.add(self.EDList)

    def initEnforcementDetectorUnauthorized(self):
        #
        ## init enforcement detector tab
        #

        EDLType = JLabel("Type:")
        EDLType.setBounds(10, 10, 140, 30)

        EDLContent = JLabel("Content:")
        EDLContent.setBounds(10, 50, 140, 30)

        EDLabelList = JLabel("Filter List:")
        EDLabelList.setBounds(10, 165, 140, 30)

        EDStrings = ["Headers (simple string): (enforced message headers contains)", "Headers (regex): (enforced messege headers contains)", "Body (simple string): (enforced messege body contains)", "Body (regex): (enforced messege body contains)", "Full request (simple string): (enforced messege contains)", "Full request (regex): (enforced messege contains)", "Content-Length: (constant Content-Length number of enforced response)"]
        self.EDTypeUnauth = JComboBox(EDStrings)
        self.EDTypeUnauth.setBounds(80, 10, 430, 30)
       
        self.EDTextUnauth = JTextArea("", 5, 30)
        self.EDTextUnauth.setBounds(80, 50, 300, 110)

        self.EDModelUnauth = DefaultListModel();
        self.EDListUnauth = JList(self.EDModelUnauth);
        self.EDListUnauth.setBounds(80, 175, 300, 110)
        self.EDListUnauth.setBorder(LineBorder(Color.BLACK))

        self.EDAddUnauth = JButton("Add filter",actionPerformed=self.addEDFilterUnauth)
        self.EDAddUnauth.setBounds(390, 85, 120, 30)
        self.EDDelUnauth = JButton("Remove filter",actionPerformed=self.delEDFilterUnauth)
        self.EDDelUnauth.setBounds(390, 210, 120, 30)

        self.EDPnlUnauth = JPanel()
        self.EDPnlUnauth.setLayout(None);
        self.EDPnlUnauth.setBounds(0, 0, 1000, 1000);
        self.EDPnlUnauth.add(EDLType)
        self.EDPnlUnauth.add(self.EDTypeUnauth)
        self.EDPnlUnauth.add(EDLContent)
        self.EDPnlUnauth.add(self.EDTextUnauth)
        self.EDPnlUnauth.add(self.EDAddUnauth)
        self.EDPnlUnauth.add(self.EDDelUnauth)
        self.EDPnlUnauth.add(EDLabelList)
        self.EDPnlUnauth.add(self.EDListUnauth)        

    def initInterceptionFilters(self):
        #
        ##  init interception filters tab
        #

        IFStrings = ["Scope items only: (Content is not required)","URL Contains (simple string): ","URL Contains (regex): ","URL Not Contains (simple string): ","URL Not Contains (regex): "]
        self.IFType = JComboBox(IFStrings)
        self.IFType.setBounds(80, 10, 430, 30)
       
        self.IFModel = DefaultListModel();
        self.IFList = JList(self.IFModel);
        self.IFList.setBounds(80, 175, 300, 110)
        self.IFList.setBorder(LineBorder(Color.BLACK))

        self.IFText = JTextArea("", 5, 30)
        self.IFText.setBounds(80, 50, 300, 110)

        IFLType = JLabel("Type:")
        IFLType.setBounds(10, 10, 140, 30)

        IFLContent = JLabel("Content:")
        IFLContent.setBounds(10, 50, 140, 30)

        IFLabelList = JLabel("Filter List:")
        IFLabelList.setBounds(10, 165, 140, 30)

        self.IFAdd = JButton("Add filter",actionPerformed=self.addIFFilter)
        self.IFAdd.setBounds(390, 85, 120, 30)
        self.IFDel = JButton("Remove filter",actionPerformed=self.delIFFilter)
        self.IFDel.setBounds(390, 210, 120, 30)

        self.filtersPnl = JPanel()
        self.filtersPnl.setLayout(None);
        self.filtersPnl.setBounds(0, 0, 1000, 1000);
        self.filtersPnl.add(IFLType)
        self.filtersPnl.add(self.IFType)
        self.filtersPnl.add(IFLContent)
        self.filtersPnl.add(self.IFText)
        self.filtersPnl.add(self.IFAdd)
        self.filtersPnl.add(self.IFDel)
        self.filtersPnl.add(IFLabelList)
        self.filtersPnl.add(self.IFList)


    def initConfigurationTab(self):
        #
        ##  init configuration tab
        #
        self.prevent304 = JCheckBox("Prevent 304 Not Modified status code")
        self.prevent304.setBounds(290, 25, 300, 30)

        self.ignore304 = JCheckBox("Ignore 304/204 status code responses")
        self.ignore304.setBounds(290, 5, 300, 30)
        self.ignore304.setSelected(True)

        self.autoScroll = JCheckBox("Auto Scroll")
        #self.autoScroll.setBounds(290, 45, 140, 30)
        self.autoScroll.setBounds(160, 40, 140, 30)

        self.doUnauthorizedRequest = JCheckBox("Check unauthenticated")
        self.doUnauthorizedRequest.setBounds(290, 45, 300, 30)
        self.doUnauthorizedRequest.setSelected(True)

        startLabel = JLabel("Authorization checks:")
        startLabel.setBounds(10, 10, 140, 30)
        self.startButton = JButton("Autorize is off",actionPerformed=self.startOrStop)
        self.startButton.setBounds(160, 10, 120, 30)
        self.startButton.setBackground(Color(255, 100, 91, 255))

        self.clearButton = JButton("Clear List",actionPerformed=self.clearList)
        self.clearButton.setBounds(10, 40, 100, 30)

        self.replaceString = JTextArea("Cookie: Insert=injected; header=here;", 5, 30)
        self.replaceString.setWrapStyleWord(True);
        self.replaceString.setLineWrap(True)
        self.replaceString.setBounds(10, 80, 470, 180)

        self.filtersTabs = JTabbedPane()
        self.filtersTabs.addTab("Enforcement Detector", self.EDPnl)
        self.filtersTabs.addTab("Detector Unauthenticated", self.EDPnlUnauth)
        self.filtersTabs.addTab("Interception Filters", self.filtersPnl)
        self.filtersTabs.addTab("Export", self.exportPnl)

        self.filtersTabs.setBounds(0, 280, 2000, 700)

        self.pnl = JPanel()
        self.pnl.setBounds(0, 0, 1000, 1000);
        self.pnl.setLayout(None);
        self.pnl.add(self.startButton)
        self.pnl.add(self.clearButton)
        self.pnl.add(self.replaceString)
        self.pnl.add(startLabel)
        self.pnl.add(self.autoScroll)
        self.pnl.add(self.ignore304)
        self.pnl.add(self.prevent304)
        self.pnl.add(self.doUnauthorizedRequest)
        self.pnl.add(self.filtersTabs)

    def initTabs(self):
        #
        ##  init autorize tabs
        #
        
        self.logTable = Table(self)

        self.logTable.setAutoCreateRowSorter(True)        

        tableWidth = self.logTable.getPreferredSize().width        
        self.logTable.getColumn("ID").setPreferredWidth(Math.round(tableWidth / 50 * 2))
        self.logTable.getColumn("URL").setPreferredWidth(Math.round(tableWidth / 50 * 24))
        self.logTable.getColumn("Orig. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
        self.logTable.getColumn("Modif. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
        self.logTable.getColumn("Unauth. Length").setPreferredWidth(Math.round(tableWidth / 50 * 4))
        self.logTable.getColumn("Authorization Enforcement Status").setPreferredWidth(Math.round(tableWidth / 50 * 4))
        self.logTable.getColumn("Authorization Unauth. Status").setPreferredWidth(Math.round(tableWidth / 50 * 4))

        self._splitpane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT)
        self._splitpane.setResizeWeight(1)
        self.scrollPane = JScrollPane(self.logTable)
        self._splitpane.setLeftComponent(self.scrollPane)
        self.scrollPane.getVerticalScrollBar().addAdjustmentListener(autoScrollListener(self))
        self.menuES0 = JCheckBoxMenuItem(self._enfocementStatuses[0],True)
        self.menuES1 = JCheckBoxMenuItem(self._enfocementStatuses[1],True)
        self.menuES2 = JCheckBoxMenuItem(self._enfocementStatuses[2],True)
        self.menuES0.addItemListener(menuTableFilter(self))
        self.menuES1.addItemListener(menuTableFilter(self))
        self.menuES2.addItemListener(menuTableFilter(self))

        copyURLitem = JMenuItem("Copy URL");
        copyURLitem.addActionListener(copySelectedURL(self))
        self.menu = JPopupMenu("Popup")
        self.menu.add(copyURLitem)
        self.menu.add(self.menuES0)
        self.menu.add(self.menuES1)
        self.menu.add(self.menuES2)

        self.tabs = JTabbedPane()
        self._requestViewer = self._callbacks.createMessageEditor(self, False)
        self._responseViewer = self._callbacks.createMessageEditor(self, False)

        self._originalrequestViewer = self._callbacks.createMessageEditor(self, False)
        self._originalresponseViewer = self._callbacks.createMessageEditor(self, False)

        self._unauthorizedrequestViewer = self._callbacks.createMessageEditor(self, False)
        self._unauthorizedresponseViewer = self._callbacks.createMessageEditor(self, False)        

        self.tabs.addTab("Modified Request", self._requestViewer.getComponent())
        self.tabs.addTab("Modified Response", self._responseViewer.getComponent())

        self.tabs.addTab("Original Request", self._originalrequestViewer.getComponent())
        self.tabs.addTab("Original Response", self._originalresponseViewer.getComponent())

        self.tabs.addTab("Unauthenticated Request", self._unauthorizedrequestViewer.getComponent())
        self.tabs.addTab("Unauthenticated Response", self._unauthorizedresponseViewer.getComponent())        

        self.tabs.addTab("Configuration", self.pnl)
        self.tabs.setSelectedIndex(6)
        self._splitpane.setRightComponent(self.tabs)

    def initCallbacks(self):
        #
        ##  init callbacks
        #

        # customize our UI components
        self._callbacks.customizeUiComponent(self._splitpane)
        self._callbacks.customizeUiComponent(self.logTable)
        self._callbacks.customizeUiComponent(self.scrollPane)
        self._callbacks.customizeUiComponent(self.tabs)
        self._callbacks.customizeUiComponent(self.filtersTabs)
        self._callbacks.registerContextMenuFactory(self)
        # add the custom tab to Burp's UI
        self._callbacks.addSuiteTab(self)


    #
    ## Events functions
    #
    def startOrStop(self, event):
        if self.startButton.getText() == "Autorize is off":
            self.startButton.setText("Autorize is on")
            self.startButton.setBackground(Color.GREEN)
            self.intercept = 1
            self._callbacks.registerHttpListener(self)
        else:
            self.startButton.setText("Autorize is off")
            self.startButton.setBackground(Color(255, 100, 91, 255))
            self.intercept = 0
            self._callbacks.removeHttpListener(self)

    def addEDFilter(self, event):
        typeName = self.EDType.getSelectedItem().split(":")[0]
        self.EDModel.addElement(typeName + ": " + self.EDText.getText())

    def delEDFilter(self, event):
        index = self.EDList.getSelectedIndex();
        if not index == -1:
            self.EDModel.remove(index);

    def addEDFilterUnauth(self, event):
        typeName = self.EDTypeUnauth.getSelectedItem().split(":")[0]
        self.EDModelUnauth.addElement(typeName + ": " + self.EDTextUnauth.getText())

    def delEDFilterUnauth(self, event):
        index = self.EDListUnauth.getSelectedIndex();
        if not index == -1:
            self.EDModelUnauth.remove(index);            

    def addIFFilter(self, event):
        typeName = self.IFType.getSelectedItem().split(":")[0]
        self.IFModel.addElement(typeName + ": " + self.IFText.getText())

    def delIFFilter(self, event):
        index = self.IFList.getSelectedIndex();
        if not index == -1:
            self.IFModel.remove(index);

    def clearList(self, event):
        self._lock.acquire()
        oldSize = self._log.size()
        self._log.clear()
        self.fireTableRowsDeleted(0, oldSize - 1)
        self._lock.release()

    def export(self, event):
        if self.exportType.getSelectedItem() == "HTML":
            self.exportToHTML()
        else:
            self.exportToCSV()

    def exportToCSV(self):
        parentFrame = JFrame()
        fileChooser = JFileChooser()
        fileChooser.setSelectedFile(File("AutorizeReprort.csv"));
        fileChooser.setDialogTitle("Save Autorize Report")
        userSelection = fileChooser.showSaveDialog(parentFrame)
        if userSelection == JFileChooser.APPROVE_OPTION:
            fileToSave = fileChooser.getSelectedFile()

        enforcementStatusFilter = self.exportES.getSelectedItem()
        csvContent = "id\tURL\tOriginal length\tModified length\tUnauthorized length\tAuthorization Enforcement Status\tAuthorization Unauthenticated Status\n"

        for i in range(0,self._log.size()):

            if enforcementStatusFilter == "All Statuses":
                csvContent += "%d\t%s\t%d\t%d\t%d\t%s\t%s\n" % (self._log.get(i)._id,self._log.get(i)._url, len(self._log.get(i)._originalrequestResponse.getResponse()) if self._log.get(i)._originalrequestResponse != None else 0, len(self._log.get(i)._requestResponse.getResponse()) if self._log.get(i)._requestResponse != None else 0, len(self._log.get(i)._unauthorizedRequestResponse.getResponse()) if self._log.get(i)._unauthorizedRequestResponse != None else 0, self._log.get(i)._enfocementStatus, self._log.get(i)._enfocementStatusUnauthorized)
                
            else:
                if (enforcementStatusFilter == self._log.get(i)._enfocementStatus) or (enforcementStatusFilter == self._log.get(i)._enfocementStatusUnauthorized):
                    csvContent += "%d\t%s\t%d\t%d\t%d\t%s\t%s\n" % (self._log.get(i)._id,self._log.get(i)._url, len(self._log.get(i)._originalrequestResponse.getResponse()) if self._log.get(i)._originalrequestResponse != None else 0, len(self._log.get(i)._requestResponse.getResponse()) if self._log.get(i)._requestResponse != None else 0, len(self._log.get(i)._unauthorizedRequestResponse.getResponse()) if self._log.get(i)._unauthorizedRequestResponse != None else 0, self._log.get(i)._enfocementStatus, self._log.get(i)._enfocementStatusUnauthorized)
        
        f = open(fileToSave.getAbsolutePath(), 'w')
        f.writelines(csvContent)
        f.close()


    def exportToHTML(self):
        parentFrame = JFrame()
        fileChooser = JFileChooser()
        fileChooser.setSelectedFile(File("AutorizeReprort.html"));
        fileChooser.setDialogTitle("Save Autorize Report")
        userSelection = fileChooser.showSaveDialog(parentFrame)
        if userSelection == JFileChooser.APPROVE_OPTION:
            fileToSave = fileChooser.getSelectedFile()

        enforcementStatusFilter = self.exportES.getSelectedItem()
        htmlContent = """<html><title>Autorize Report by Barak Tawily</title>
        <style>
        .datagrid table { border-collapse: collapse; text-align: left; width: 100%; }
         .datagrid {font: normal 12px/150% Arial, Helvetica, sans-serif; background: #fff; overflow: hidden; border: 1px solid #006699; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
         .datagrid table td, .datagrid table th { padding: 3px 10px; }
         .datagrid table thead th {background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #00557F) );background:-moz-linear-gradient( center top, #006699 5%, #00557F 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#006699', endColorstr='#00557F');background-color:#006699; color:#FFFFFF; font-size: 15px; font-weight: bold; border-left: 1px solid #0070A8; } .datagrid table thead th:first-child { border: none; }.datagrid table tbody td { color: #00496B; border-left: 1px solid #E1EEF4;font-size: 12px;font-weight: normal; }.datagrid table tbody .alt td { background: #E1EEF4; color: #00496B; }.datagrid table tbody td:first-child { border-left: none; }.datagrid table tbody tr:last-child td { border-bottom: none; }.datagrid table tfoot td div { border-top: 1px solid #006699;background: #E1EEF4;} .datagrid table tfoot td { padding: 0; font-size: 12px } .datagrid table tfoot td div{ padding: 2px; }.datagrid table tfoot td ul { margin: 0; padding:0; list-style: none; text-align: right; }.datagrid table tfoot  li { display: inline; }.datagrid table tfoot li a { text-decoration: none; display: inline-block;  padding: 2px 8px; margin: 1px;color: #FFFFFF;border: 1px solid #006699;-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #00557F) );background:-moz-linear-gradient( center top, #006699 5%, #00557F 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#006699', endColorstr='#00557F');background-color:#006699; }.datagrid table tfoot ul.active, .datagrid table tfoot ul a:hover { text-decoration: none;border-color: #006699; color: #FFFFFF; background: none; background-color:#00557F;}div.dhtmlx_window_active, div.dhx_modal_cover_dv { position: fixed !important; }
        table {
        width: 100%;
        table-layout: fixed;
        }
        td {
            border: 1px solid #35f;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        td.a {
            width: 13%;
            white-space: nowrap;
        }
        td.b {
            width: 9%;
            word-wrap: break-word;
        }
        </style>
        <body>
        <h1>Autorize Report<h1>
        <div class="datagrid"><table>
        <thead><tr><th width=\"3%\">ID</th><th width=\"48%\">URL</th><th width=\"9%\">Original length</th><th width=\"9%\">Modified length</th><th width=\"9%\">Unauthorized length</th><th width=\"11%\">Authorization Enforcement Status</th><th width=\"11%\">Authorization Unauthenticated Status</th></tr></thead>
        <tbody>"""

        for i in range(0,self._log.size()):
            color_modified = ""
            if self._log.get(i)._enfocementStatus == self._enfocementStatuses[0]:
                color_modified = "red"
            if self._log.get(i)._enfocementStatus == self._enfocementStatuses[1]:
                color_modified = "yellow"
            if self._log.get(i)._enfocementStatus == self._enfocementStatuses[2]:
                color_modified = "LawnGreen"

            color_unauthorized = ""
            if self._log.get(i)._enfocementStatusUnauthorized == self._enfocementStatuses[0]:
                color_unauthorized = "red"
            if self._log.get(i)._enfocementStatusUnauthorized == self._enfocementStatuses[1]:
                color_unauthorized = "yellow"
            if self._log.get(i)._enfocementStatusUnauthorized == self._enfocementStatuses[2]:
                color_unauthorized = "LawnGreen"

            if enforcementStatusFilter == "All Statuses":
                htmlContent += "<tr><td>%d</td><td><a href=\"%s\">%s</a></td><td>%d</td><td>%d</td><td>%d</td><td bgcolor=\"%s\">%s</td><td bgcolor=\"%s\">%s</td></tr>" % (self._log.get(i)._id,self._log.get(i)._url,self._log.get(i)._url, len(self._log.get(i)._originalrequestResponse.getResponse()) if self._log.get(i)._originalrequestResponse != None else 0, len(self._log.get(i)._requestResponse.getResponse()) if self._log.get(i)._requestResponse != None else 0, len(self._log.get(i)._unauthorizedRequestResponse.getResponse()) if self._log.get(i)._unauthorizedRequestResponse != None else 0, color_modified, self._log.get(i)._enfocementStatus, color_unauthorized, self._log.get(i)._enfocementStatusUnauthorized)
            else:
                if (enforcementStatusFilter == self._log.get(i)._enfocementStatus) or (enforcementStatusFilter == self._log.get(i)._enfocementStatusUnauthorized):
                    htmlContent += "<tr><td>%d</td><td><a href=\"%s\">%s</a></td><td>%d</td><td>%d</td><td>%d</td><td bgcolor=\"%s\">%s</td><td bgcolor=\"%s\">%s</td></tr>" % (self._log.get(i)._id,self._log.get(i)._url,self._log.get(i)._url, len(self._log.get(i)._originalrequestResponse.getResponse()) if self._log.get(i)._originalrequestResponse != None else 0, len(self._log.get(i)._requestResponse.getResponse()) if self._log.get(i)._requestResponse != None else 0, len(self._log.get(i)._unauthorizedRequestResponse.getResponse()) if self._log.get(i)._unauthorizedRequestResponse != None else 0, color_modified, self._log.get(i)._enfocementStatus, color_unauthorized, self._log.get(i)._enfocementStatusUnauthorized)

        htmlContent += "</tbody></table></div></body></html>"
        f = open(fileToSave.getAbsolutePath(), 'w')
        f.writelines(htmlContent)
        f.close()




    #
    # implement IContextMenuFactory
    #
    def createMenuItems(self, invocation):
        responses = invocation.getSelectedMessages();
        if responses > 0:
            ret = LinkedList()
            requestMenuItem = JMenuItem("Send request to Autorize");
            cookieMenuItem = JMenuItem("Send cookie to Autorize");
            requestMenuItem.addActionListener(handleMenuItems(self,responses[0], "request"))
            cookieMenuItem.addActionListener(handleMenuItems(self, responses[0], "cookie"))   
            ret.add(requestMenuItem);
            ret.add(cookieMenuItem);
            return(ret);
        return null;


    #
    # implement ITab
    #
    def getTabCaption(self):
        return "Autorize"
    
    def getUiComponent(self):
        return self._splitpane
        
    #
    # extend AbstractTableModel
    #
    
    def getRowCount(self):
        try:
            return self._log.size()
        except:
            return 0

    def getColumnCount(self):
        return 7

    def getColumnName(self, columnIndex):
        if columnIndex == 0:
            return "ID"
        if columnIndex == 1:
            return "URL"
        if columnIndex == 2:
            return "Orig. Length"            
        if columnIndex == 3:
            return "Modif. Length" 
        if columnIndex == 4:
            return "Unauth. Length"           
        if columnIndex == 5:
            return "Authorization Enforcement Status"
        if columnIndex == 6:
            return "Authorization Unauth. Status"
        return ""

    def getColumnClass(self, columnIndex):
        if columnIndex == 0:
            return Integer
        if columnIndex == 1:
            return String
        if columnIndex == 2:
            return Integer           
        if columnIndex == 3:
            return Integer 
        if columnIndex == 4:
            return Integer          
        if columnIndex == 5:
            return String
        if columnIndex == 6:
            return String
        return String

    def getValueAt(self, rowIndex, columnIndex):
        logEntry = self._log.get(rowIndex)
        if columnIndex == 0:
            return logEntry._id
        if columnIndex == 1:
            return logEntry._url.toString()
        if columnIndex == 2:
            return len(logEntry._originalrequestResponse.getResponse())
        if columnIndex == 3:
            return len(logEntry._requestResponse.getResponse())
        if columnIndex == 4:
            if logEntry._unauthorizedRequestResponse != None:
                return len(logEntry._unauthorizedRequestResponse.getResponse())
            else:
                #return "-"
                return 0
        if columnIndex == 5:
            return logEntry._enfocementStatus   
        if columnIndex == 6:
            return logEntry._enfocementStatusUnauthorized        
        return ""

    #
    # implement IMessageEditorController
    # this allows our request/response viewers to obtain details about the messages being displayed
    #
    
    def getHttpService(self):
        return self._currentlyDisplayedItem.getHttpService()

    def getRequest(self):
        return self._currentlyDisplayedItem.getRequest()

    def getResponse(self):
        return self._currentlyDisplayedItem.getResponse()


    #
    # implement IHttpListener
    #
    def processHttpMessage(self, toolFlag, messageIsRequest, messageInfo):

        #if (self.intercept == 1) and (toolFlag != self._callbacks.TOOL_EXTENDER):
        if (self.intercept == 1) and (toolFlag == self._callbacks.TOOL_PROXY):
            if self.prevent304.isSelected():
                if messageIsRequest:
                    requestHeaders = list(self._helpers.analyzeRequest(messageInfo).getHeaders())
                    newHeaders = list()
                    found = 0
                    for header in requestHeaders:
                        if not "If-None-Match:" in header and not "If-Modified-Since:" in header:
                            newHeaders.append(header)
                            found = 1
                    if found == 1:
                        requestInfo = self._helpers.analyzeRequest(messageInfo)
                        bodyBytes = messageInfo.getRequest()[requestInfo.getBodyOffset():]
                        bodyStr = self._helpers.bytesToString(bodyBytes)
                        messageInfo.setRequest(self._helpers.buildHttpMessage(newHeaders, bodyStr))


            if not messageIsRequest:
                if not self.replaceString.getText() in self._helpers.analyzeRequest(messageInfo).getHeaders():
                    if self.ignore304.isSelected():
                        firstHeader = self._helpers.analyzeResponse(messageInfo.getResponse()).getHeaders()[0]
                        if "304" in firstHeader or "204" in firstHeader:
                           return
                    if self.IFList.getModel().getSize() == 0:
                        self.checkAuthorization(messageInfo,self._helpers.analyzeResponse(messageInfo.getResponse()).getHeaders(),self.doUnauthorizedRequest.isSelected())
                    else:
                        urlString = str(self._helpers.analyzeRequest(messageInfo).getUrl())
                        
                        do_the_check = 1

                        for i in range(0,self.IFList.getModel().getSize()):

                            if self.IFList.getModel().getElementAt(i).split(":")[0] == "Scope items only":
                                currentURL = URL(urlString)
                                if not self._callbacks.isInScope(currentURL):
                                    do_the_check = 0
                            if self.IFList.getModel().getElementAt(i).split(":")[0] == "URL Contains (simple string)":
                                if self.IFList.getModel().getElementAt(i)[30:] not in urlString:
                                    do_the_check = 0
                            if self.IFList.getModel().getElementAt(i).split(":")[0] == "URL Contains (regex)":
                                regex_string = self.IFList.getModel().getElementAt(i)[22:]
                                p = re.compile(regex_string, re.IGNORECASE)
                                if not p.search(urlString):
                                    do_the_check = 0  
                            if self.IFList.getModel().getElementAt(i).split(":")[0] == "URL Not Contains (simple string)":
                                if self.IFList.getModel().getElementAt(i)[34:] in urlString:
                                    do_the_check = 0
                            if self.IFList.getModel().getElementAt(i).split(":")[0] == "URL Not Contains (regex)":
                                regex_string = self.IFList.getModel().getElementAt(i)[26:]
                                p = re.compile(regex_string, re.IGNORECASE)
                                if p.search(urlString):
                                    do_the_check = 0                                                                       

                        if do_the_check:
                            self.checkAuthorization(messageInfo,self._helpers.analyzeResponse(messageInfo.getResponse()).getHeaders(),self.doUnauthorizedRequest.isSelected())

        return

    def sendRequestToAutorizeWork(self,messageInfo):

        if messageInfo.getResponse() == None:
            message = self.makeMessage(messageInfo,False,False)
            requestResponse = self.makeRequest(messageInfo, message)
            self.checkAuthorization(requestResponse,self._helpers.analyzeResponse(requestResponse.getResponse()).getHeaders(),self.doUnauthorizedRequest.isSelected())
        else:
            self.checkAuthorization(messageInfo,self._helpers.analyzeResponse(messageInfo.getResponse()).getHeaders(),self.doUnauthorizedRequest.isSelected())


    def makeRequest(self, messageInfo, message):
        requestURL = self._helpers.analyzeRequest(messageInfo).getUrl()
        return self._callbacks.makeHttpRequest(self._helpers.buildHttpService(str(requestURL.getHost()), int(requestURL.getPort()), requestURL.getProtocol() == "https"), message)

    def makeMessage(self, messageInfo, removeOrNot, authorizeOrNot):
        requestInfo = self._helpers.analyzeRequest(messageInfo)
        headers = requestInfo.getHeaders()
        if removeOrNot:
            headers = list(headers)
            removeHeaders = ArrayList()
            removeHeaders.add(self.replaceString.getText()[0:self.replaceString.getText().index(":")])

            for header in headers[:]:
                for removeHeader in removeHeaders:
                    if removeHeader in header:
                        headers.remove(header)

            if authorizeOrNot:
                headers.append(self.replaceString.getText())

        msgBody = messageInfo.getRequest()[requestInfo.getBodyOffset():]
        return self._helpers.buildHttpMessage(headers, msgBody)

    def checkBypass(self,oldStatusCode,newStatusCode,oldContentLen,newContentLen,filters,requestResponse):

        analyzedResponse = self._helpers.analyzeResponse(requestResponse.getResponse())
        impression = ""

        if oldStatusCode == newStatusCode:
            if oldContentLen == newContentLen:
                impression = self._enfocementStatuses[0]
            else:

                auth_enforced = 1
                
                for filter in filters:

                    if str(filter).startswith("Headers (simple string): "):
                        if not(filter[25:] in self._helpers.bytesToString(requestResponse.getResponse()[0:analyzedResponse.getBodyOffset()])):
                            auth_enforced = 0

                    if str(filter).startswith("Headers (regex): "):
                        regex_string = filter[17:]
                        p = re.compile(regex_string, re.IGNORECASE)
                        if not p.search(self._helpers.bytesToString(requestResponse.getResponse()[0:analyzedResponse.getBodyOffset()])):
                            auth_enforced = 0

                    if str(filter).startswith("Body (simple string): "):
                        if not(filter[22:] in self._helpers.bytesToString(requestResponse.getResponse()[analyzedResponse.getBodyOffset():])):
                            auth_enforced = 0

                    if str(filter).startswith("Body (regex): "):
                        regex_string = filter[14:]
                        p = re.compile(regex_string, re.IGNORECASE)
                        if not p.search(self._helpers.bytesToString(requestResponse.getResponse()[analyzedResponse.getBodyOffset():])):
                            auth_enforced = 0

                    if str(filter).startswith("Full request (simple string): "):
                        if not(filter[30:] in self._helpers.bytesToString(requestResponse.getResponse())):
                            auth_enforced = 0

                    if str(filter).startswith("Full request (regex): "):
                        regex_string = filter[22:]
                        p = re.compile(regex_string, re.IGNORECASE)
                        if not p.search(self._helpers.bytesToString(requestResponse.getResponse())):
                            auth_enforced = 0

                    if str(filter).startswith("Content-Length: "):
                        if newContentLen != filter:
                            auth_enforced = 0
                
                if auth_enforced:
                    impression = self._enfocementStatuses[2]
                else:
                    impression = self._enfocementStatuses[1]
                         
        else:
            impression = self._enfocementStatuses[2]

        return impression

    def checkAuthorization(self, messageInfo, originalHeaders, checkUnauthorized):
        message = self.makeMessage(messageInfo,True,True)
        requestResponse = self.makeRequest(messageInfo, message)
        analyzedResponse = self._helpers.analyzeResponse(requestResponse.getResponse())
        
        oldStatusCode = originalHeaders[0]
        newStatusCode = analyzedResponse.getHeaders()[0]
        oldContentLen = self.getContentLength(originalHeaders)
        newContentLen = self.getContentLength(analyzedResponse.getHeaders())

        # Check unauthorized request
        if checkUnauthorized:
            messageUnauthorized = self.makeMessage(messageInfo,True,False)
            requestResponseUnauthorized = self.makeRequest(messageInfo, messageUnauthorized)
            analyzedResponseUnauthorized = self._helpers.analyzeResponse(requestResponseUnauthorized.getResponse())  
            statusCodeUnauthorized = analyzedResponseUnauthorized.getHeaders()[0]
            contentLenUnauthorized = self.getContentLength(analyzedResponseUnauthorized.getHeaders())

        EDFilters = self.EDModel.toArray()
        impression = self.checkBypass(oldStatusCode,newStatusCode,oldContentLen,newContentLen,EDFilters,requestResponse)

        if checkUnauthorized:
            EDFiltersUnauth = self.EDModelUnauth.toArray()
            impressionUnauthorized = self.checkBypass(oldStatusCode,statusCodeUnauthorized,oldContentLen,contentLenUnauthorized,EDFiltersUnauth,requestResponseUnauthorized)

        self._lock.acquire()
        
        row = self._log.size()
        
        if checkUnauthorized:
            self._log.add(LogEntry(self.currentRequestNumber,self._callbacks.saveBuffersToTempFiles(requestResponse), self._helpers.analyzeRequest(requestResponse).getUrl(),messageInfo,impression,self._callbacks.saveBuffersToTempFiles(requestResponseUnauthorized),impressionUnauthorized)) # same requests not include again.
        else:
            self._log.add(LogEntry(self.currentRequestNumber,self._callbacks.saveBuffersToTempFiles(requestResponse), self._helpers.analyzeRequest(requestResponse).getUrl(),messageInfo,impression,None,"Disabled")) # same requests not include again.
        
        self.fireTableRowsInserted(row, row)
        self.currentRequestNumber = self.currentRequestNumber + 1
        self._lock.release()
        
    def getContentLength(self, analyzedResponseHeaders):
        for header in analyzedResponseHeaders:
            if "Content-Length:" in header:
                return header;
        return "null"

    def getCookieFromMessage(self, messageInfo):
        headers = list(self._helpers.analyzeRequest(messageInfo.getRequest()).getHeaders())
        for header in headers:
            if "Cookie:" in header:
                return header
        return None
Exemplo n.º 51
0
class GUI_PSQLiteUISettingsPanel(IngestModuleIngestJobSettingsPanel):
    # Note, we can't use a self.settings instance variable.
    # Rather, self.local_settings is used.
    # https://wiki.python.org/jython/UserGuide#javabean-properties
    # Jython Introspector generates a property - 'settings' on the basis
    # of getSettings() defined in this class. Since only getter function
    # is present, it creates a read-only 'settings' property. This auto-
    # generated read-only property overshadows the instance-variable -
    # 'settings'
    
    # We get passed in a previous version of the settings so that we can
    # prepopulate the UI
    # TODO: Update this for your UI
    def __init__(self, settings):
        self.local_settings = settings
        self.initComponents()
        self.customizeComponents()
    
    # TODO: Update this for your UI
    def checkBoxEvent(self, event):
        if self.checkbox.isSelected():
            self.local_settings.setSetting('Flag', 'true')
            self.local_settings.setSetting('plists', self.area.getText());
        else:
            self.local_settings.setSetting('Flag', 'false')

    # TODO: Update this for your UI
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        #self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("Check to activate/deactivate TextArea", actionPerformed=self.checkBoxEvent)
        self.label0 = JLabel(" ")
        self.label1 = JLabel("Input in SQLite DB's in area below,")
        self.label2 = JLabel("seperate values by commas.")
        self.label3 = JLabel("then check the box above.")
        self.label4 = JLabel(" ")
        self.panel1.add(self.checkbox)
        self.panel1.add(self.label0)
        self.panel1.add(self.label1)
        self.panel1.add(self.label2)
        self.panel1.add(self.label3)
        self.panel1.add(self.label4)
        self.add(self.panel1)
 
        self.area = JTextArea(5,25)
        #self.area.getDocument().addDocumentListener(self.area)
        #self.area.addKeyListener(listener)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        #self.pane.addKeyListener(self.area)
        #self.add(self.area)
        self.add(self.pane)
		


    # TODO: Update this for your UI
    def customizeComponents(self):
        self.checkbox.setSelected(self.local_settings.getSetting('Flag') == 'true')
        self.area.setText(self.local_settings.getSetting('plists'))

    # Return the settings used
    def getSettings(self):
        return self.local_settings
Exemplo n.º 52
0
class FindView(JDialog):
    '''
    Prompt user to choose some options to find and replace text in ATF area.
    '''
    def __init__(self, controller):
        self.logger = logging.getLogger("NammuController")
        self.setAlwaysOnTop(True)
        self.controller = controller
        self.pane = self.getContentPane()

        # Get key bindings configuration from settings
        key_strokes = self.controller.config['find_keystrokes']

        # Configure key bindings for undo/redo
        # First decide when key bindings can be triggered:
        condition = JComponent.WHEN_IN_FOCUSED_WINDOW

        # InputMap maps key strokes to actions in string format (e.g. 'undo')
        # ActionMap maps string actions (e.g. 'undo') with a custom
        # AbstractAction subclass.
        pane = self.getContentPane()
        for action, key in key_strokes.iteritems():
            key_stroke = KeyStroke.getKeyStroke(
                        getattr(KeyEvent, key),
                        Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())
            pane.getInputMap(condition).put(key_stroke, action)
            pane.getActionMap().put(action, KeyStrokeAction(self, action))

    def display(self):
        '''
        Displays window.
        '''
        self.build()
        self.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
        self.setResizable(False)
        self.setTitle("Find/Replace")
        self.pack()
        self.setLocationRelativeTo(None)
        self.visible = 1

    def build(self):
        layout = BoxLayout(self.getContentPane(), BoxLayout.Y_AXIS)
        self.setLayout(layout)

        # Create all necessary panels
        find_panel = self.build_find_row()
        replace_panel = self.build_replace_row()
        options_panel = self.build_options_row()
        buttons_panel = self.build_buttons_row()
        # replace_panel = self.build_find_panel()

        # Add panels to main JFrame
        self.add(find_panel)
        self.add(replace_panel)
        self.add(options_panel)
        self.add(buttons_panel)
        # self.add(self.build_find_replace_rows())

    def build_find_replace_rows(self):
        labels = ("Find: ", "Replace: ")

        # Create and populate the panel.
        panel = JPanel()
        for label in labels:
            row_panel = JPanel(FlowLayout())
            label = JLabel(label, JLabel.TRAILING)
            row_panel.add(label, FlowLayout.LEFT)
            textfield = JTextField(20)
            label.setLabelFor(textfield)
            row_panel.add(textfield, FlowLayout.RIGHT)
            panel.add(row_panel)

        return panel

    def build_find_row(self):
        '''
        Builds the find row.
        '''
        panel = JPanel(FlowLayout())
        label = JLabel("Find:     ")
        panel.add(label)
        self.find_field = JTextField(20, actionPerformed=self.find_next)
        label.setLabelFor(self.find_field)
        panel.add(self.find_field)
        return panel

    def build_replace_row(self):
        '''
        Builds the replace row.
        '''
        panel = JPanel(FlowLayout())
        label = JLabel("Replace: ")
        panel.add(label)
        self.replace_field = JTextField(20, actionPerformed=self.find_next)
        label.setLabelFor(self.replace_field)
        panel.add(self.replace_field)
        return panel

    def build_options_row(self):
        '''
        Builds the panel with ignore case, regex, etc. options.
        '''
        panel = JPanel(FlowLayout())
        self.ignore_case_box = JCheckBox('Ignore Case')
        self.regex_box = JCheckBox('Regular Expression')
        self.selection_box = JCheckBox('Selection only')
        panel.add(self.ignore_case_box)
        panel.add(self.regex_box)
        panel.add(self.selection_box)
        return panel

    def build_buttons_row(self):
        '''
        Builds the buttons row.
        '''
        panel = JPanel()
        layout = SpringLayout()
        panel.setLayout(layout)
        # Create necessary components and add them to panel.
        find_next_button = JButton('Find Next',
                                   actionPerformed=self.find_next)
        replace_one_button = JButton('Replace',
                                     actionPerformed=self.replace_one)
        replace_all_button = JButton('Replace All',
                                     actionPerformed=self.replace_all)
        done_button = JButton('Done', actionPerformed=self.done)
        panel.add(find_next_button)
        panel.add(replace_one_button)
        panel.add(replace_all_button)
        panel.add(done_button)

        # Set up constraints to tell panel how to position components.
        layout.putConstraint(SpringLayout.WEST,
                             find_next_button,
                             15,
                             SpringLayout.WEST,
                             panel)
        layout.putConstraint(SpringLayout.NORTH,
                             find_next_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             replace_one_button,
                             5,
                             SpringLayout.EAST,
                             find_next_button)
        layout.putConstraint(SpringLayout.NORTH,
                             replace_one_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             replace_all_button,
                             5,
                             SpringLayout.EAST,
                             replace_one_button)
        layout.putConstraint(SpringLayout.NORTH,
                             replace_all_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.WEST,
                             done_button,
                             5,
                             SpringLayout.EAST,
                             replace_all_button)
        layout.putConstraint(SpringLayout.NORTH,
                             done_button,
                             15,
                             SpringLayout.NORTH,
                             panel)
        layout.putConstraint(SpringLayout.EAST,
                             panel,
                             15,
                             SpringLayout.EAST,
                             done_button)
        layout.putConstraint(SpringLayout.SOUTH,
                             panel,
                             10,
                             SpringLayout.SOUTH,
                             done_button)
        # Add this to NewAtf JFrame
        return panel

    def find_next(self, event=None):
        self.controller.find_next(self.find_field.getText(),
                                  self.ignore_case_box.isSelected(),
                                  self.regex_box.isSelected(),
                                  self.selection_box.isSelected())

    def replace_one(self, event=None):
        self.controller.replace_one(self.find_field.getText(),
                                    self.replace_field.getText(),
                                    self.ignore_case_box.isSelected(),
                                    self.regex_box.isSelected(),
                                    self.selection_box.isSelected())

    def replace_all(self, event=None):
        self.controller.replace_all(self.find_field.getText(),
                                    self.replace_field.getText(),
                                    self.ignore_case_box.isSelected(),
                                    self.regex_box.isSelected(),
                                    self.selection_box.isSelected())

    def done(self, event):
        '''
        Reset list of matches and close window.
        '''
        self.controller.matches = None
        self.controller.text = None
        self.controller.controller.find_controller = None
        self.controller.atfAreaController.restore_highlight()
        self.dispose()
    def initComponents(self):
        self.panel0 = JPanel()

        self.rbgPanel0 = ButtonGroup() 
        self.gbPanel0 = GridBagLayout() 
        self.gbcPanel0 = GridBagConstraints() 
        self.panel0.setLayout( self.gbPanel0 ) 

        self.Exec_Program_CB = JCheckBox("Execute Program", actionPerformed=self.checkBoxEvent)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 1 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Exec_Program_CB, self.gbcPanel0 ) 
        self.panel0.add( self.Exec_Program_CB ) 

        self.Program_Executable_TF = JTextField(20) 
        self.Program_Executable_TF.setEnabled(False)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 3 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) 
        self.panel0.add( self.Program_Executable_TF ) 

        self.Find_Program_Exec_BTN = JButton( "Find Exec", actionPerformed=self.onClick)
        self.Find_Program_Exec_BTN.setEnabled(False)
        self.rbgPanel0.add( self.Find_Program_Exec_BTN ) 
        self.gbcPanel0.gridx = 6 
        self.gbcPanel0.gridy = 3 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) 
        self.panel0.add( self.Find_Program_Exec_BTN ) 

        self.Blank_1 = JLabel( " ") 
        self.Blank_1.setEnabled(True)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 5
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) 
        self.panel0.add( self.Blank_1 ) 

        self.Save_Settings_BTN = JButton( "Save Settings", actionPerformed=self.SaveSettings) 
        self.Save_Settings_BTN.setEnabled(True)
        self.rbgPanel0.add( self.Save_Settings_BTN ) 
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 7
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Save_Settings_BTN, self.gbcPanel0 ) 
        self.panel0.add( self.Save_Settings_BTN ) 

        self.Blank_2 = JLabel( " ") 
        self.Blank_2.setEnabled(True)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 9
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) 
        self.panel0.add( self.Blank_2 ) 

        self.Label_1 = JLabel( "Error Message:") 
        self.Label_1.setEnabled(True)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 11
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) 
        self.panel0.add( self.Label_1 ) 
		
        self.Error_Message = JLabel( "") 
        self.Error_Message.setEnabled(True)
        self.gbcPanel0.gridx = 6
        self.gbcPanel0.gridy = 11
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH
        self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) 
        self.panel0.add( self.Error_Message ) 

        self.add(self.panel0)
Exemplo n.º 54
0
    def	registerExtenderCallbacks(self, callbacks):
    
        # keep a reference to our callbacks object
        self._callbacks = callbacks
        
        # obtain an extension helpers object
        self._helpers = callbacks.getHelpers()
        
        # set our extension name
        callbacks.setExtensionName("Otter")
        
        # create the log and a lock on which to synchronize when adding log entries
        self._log = ArrayList()
        self._lock = Lock()
       
        # main split pane for log entries and request/response viewing
        self._settingPanel = JPanel()
        self._logPane = JSplitPane(JSplitPane.VERTICAL_SPLIT)

        # setup settings pane ui
        self._settingPanel.setBounds(0,0,1000,1000)
        self._settingPanel.setLayout(None)

        self._isRegexp = JCheckBox("Use regexp for matching.")
        self._isRegexp.setBounds(10, 10, 220, 20)

        matchLabel = JLabel("String to Match:")
        matchLabel.setBounds(10, 40, 200, 20)
        self._matchString = JTextArea("User 1 Session Information")
        self._matchString.setWrapStyleWord(True)
        self._matchString.setLineWrap(True)
        matchString = JScrollPane(self._matchString)
        matchString.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED)
        matchString.setBounds(10, 60, 400, 200)

        replaceLabel = JLabel("String to Replace:")
        replaceLabel.setBounds(10, 270, 200, 20)
        self._replaceString = JTextArea("User 2 Session Information")
        self._replaceString.setWrapStyleWord(True)
        self._replaceString.setLineWrap(True)
        replaceString = JScrollPane(self._replaceString)
        replaceString.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED)
        replaceString.setBounds(10, 290, 400, 200)

        self._settingPanel.add(self._isRegexp)
        self._settingPanel.add(matchLabel)
        self._settingPanel.add(matchString)
        self._settingPanel.add(replaceLabel)
        self._settingPanel.add(replaceString)
        
        # table of log entries
        logTable = Table(self)
        logTable.getColumnModel().getColumn(0).setPreferredWidth(700)
        logTable.getColumnModel().getColumn(1).setPreferredWidth(150)
        logTable.getColumnModel().getColumn(2).setPreferredWidth(100)
        logTable.getColumnModel().getColumn(3).setPreferredWidth(130)
        logTable.getColumnModel().getColumn(4).setPreferredWidth(100)
        logTable.getColumnModel().getColumn(5).setPreferredWidth(130)
        scrollPane = JScrollPane(logTable)
        self._logPane.setLeftComponent(scrollPane)

        # tabs with request/response viewers
        logTabs = JTabbedPane()
        self._origRequestViewer = callbacks.createMessageEditor(self, False)
        self._origResponseViewer = callbacks.createMessageEditor(self, False)
        self._modRequestViewer = callbacks.createMessageEditor(self, False)
        self._modResponseViewer = callbacks.createMessageEditor(self, False)
        logTabs.addTab("Original Request", self._origRequestViewer.getComponent())
        logTabs.addTab("Original Response", self._origResponseViewer.getComponent())
        logTabs.addTab("Modified Request", self._modRequestViewer.getComponent())
        logTabs.addTab("Modified Response", self._modResponseViewer.getComponent())
        self._logPane.setRightComponent(logTabs)
        
        # top most tab interface that seperates log entries from settings
        maintabs = JTabbedPane()
        maintabs.addTab("Log Entries", self._logPane)
        maintabs.addTab("Settings", self._settingPanel)
        self._maintabs = maintabs
       
        # customize the UI components
        callbacks.customizeUiComponent(maintabs)
        
        # add the custom tab to Burp's UI
        callbacks.addSuiteTab(self)
        
        # register ourselves as an HTTP listener
        callbacks.registerHttpListener(self)
        
        return
class Process_EVTX1WithUISettingsPanel(IngestModuleIngestJobSettingsPanel):
    # Note, we can't use a self.settings instance variable.
    # Rather, self.local_settings is used.
    # https://wiki.python.org/jython/UserGuide#javabean-properties
    # Jython Introspector generates a property - 'settings' on the basis
    # of getSettings() defined in this class. Since only getter function
    # is present, it creates a read-only 'settings' property. This auto-
    # generated read-only property overshadows the instance-variable -
    # 'settings'
    
    # We get passed in a previous version of the settings so that we can
    # prepopulate the UI
    # TODO: Update this for your UI
    def __init__(self, settings):
        self.local_settings = settings
        self.initComponents()
        self.customizeComponents()
    
    # TODO: Update this for your UI
    def checkBoxEvent(self, event):
        if self.checkbox.isSelected():
            self.local_settings.setSetting('All', 'true')
        else:
            self.local_settings.setSetting('All', 'false')
        if self.checkbox4.isSelected():
            self.local_settings.setSetting('Other', 'true')
            self.local_settings.setSetting('Eventids', self.area.getText());
            # self.local_settings.setFlag(False)
            # self.checkbox.setSelected(self.local_settings.getFlag())
        else:
            self.local_settings.setSetting('Other', 'false')
            
    def keyPressed(self, event):
        self.local_settings.setArea('Eventids', self.area.getText())

    # TODO: Update this for your UI
    def initComponents(self):
        self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS))
        #self.setLayout(GridLayout(0,1))
        self.setAlignmentX(JComponent.LEFT_ALIGNMENT)
        self.panel1 = JPanel()
        self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS))
        self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT)
        self.checkbox = JCheckBox("Create Content View of Unique Event Id's", actionPerformed=self.checkBoxEvent)
        self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent)
        self.text1 = JLabel("*** Only run this once otherwise it adds it to the data again.")
        self.text2 = JLabel(" ")
        self.text3 = JLabel("*** Format is a comma delimited text ie:  8001, 8002")
        self.panel1.add(self.checkbox)
        self.panel1.add(self.text1)
        self.panel1.add(self.text2)
        self.panel1.add(self.checkbox4)
        self.panel1.add(self.text3)
        self.add(self.panel1)
		
        self.area = JTextArea(5,25)
        #self.area.addKeyListener(self)
        self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0))
        self.pane = JScrollPane()
        self.pane.getViewport().add(self.area)
        #self.pane.addKeyListener(self)
        #self.add(self.area)
        self.add(self.pane)
		
    # TODO: Update this for your UI
    def customizeComponents(self):
        self.checkbox.setSelected(self.local_settings.getSetting('All') == 'true')
        self.checkbox4.setSelected(self.local_settings.getSetting('Other') == 'true')
        self.area.setText(self.local_settings.getSetting('Eventids'))

    # Return the settings used
    def getSettings(self):
        return self.local_settings
Exemplo n.º 56
0
	def createMainWindow(self):
		self.frame = JFrame('Select cells and ROIs',
			defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE
		)
		self.frame.setLayout(GridBagLayout())
		self.frame.addWindowListener(self)

		self.frame.add(JLabel("Cells"),
			GridBagConstraints(0, 0, 1, 1, 0, 0,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(5, 2, 2, 0), 0, 0
		))
		
		self.cellList = JList(DelegateListModel([]),
			selectionMode = ListSelectionModel.SINGLE_SELECTION,
			cellRenderer = MyRenderer(),
			selectedIndex = 0,
			valueChanged = self.selectCell
		)
		self.frame.add(JScrollPane(self.cellList),
			GridBagConstraints(0, 1, 1, 5, .5, 1,
				GridBagConstraints.CENTER, GridBagConstraints.BOTH,
				Insets(0, 2, 2, 0), 0, 0
		))

		self.frame.add(JButton('Add cell', actionPerformed = self.addCell),
			GridBagConstraints(1, 2, 1, 2, 0, .25,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(0, 0, 0, 0), 0, 0
		))
    	
		self.frame.add(JButton('Remove cell', actionPerformed = self.removeCell),
			GridBagConstraints(1, 4, 1, 2, 0, .25,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(0, 5, 0, 5), 0, 0
		))
		
		self.frame.add(JLabel("Slices"),
			GridBagConstraints(0, 6, 1, 1, 0, 0,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(5, 2, 2, 0), 0, 0
		))
		
		self.sliceList = JList(DelegateListModel([]),
			selectionMode = ListSelectionModel.SINGLE_SELECTION,
			cellRenderer = MyRenderer(),
			selectedIndex = 0,
			valueChanged = self.selectSlice
		)
		self.frame.add(JScrollPane(self.sliceList),
			GridBagConstraints(0, 7, 1, 5, .5, 1,
				GridBagConstraints.CENTER, GridBagConstraints.BOTH,
				Insets(0, 2, 2, 0), 0, 0
		))

		self.frame.add(JButton('Update ROI', actionPerformed = self.updateSlice),
			GridBagConstraints(1, 8, 1, 2, 0, .25,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(0, 0, 0, 0), 0, 0
		))

		self.frame.add(JButton('Done', actionPerformed = self.doneSelecting),
			GridBagConstraints(1, 10, 1, 2, 0, .25,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(0, 0, 0, 0), 0, 0
		))

		self.checkbox3D = JCheckBox('3D selection mode', True, actionPerformed=self.toggle3D)
		self.frame.add(self.checkbox3D,
			GridBagConstraints(0, 13, 2, 1, 0, 1,
				GridBagConstraints.WEST, GridBagConstraints.NONE,
				Insets(0, 0, 0, 0), 0, 0
		))
Exemplo n.º 57
0
class MandersPlugin(ImageListener, WindowAdapter):

	def __init__(self):
		self.imp = None
		self.preview = None
		self.createMainWindow()
		self.cells = None
		self.files = []
		self.results = ResultsTable()
		ImagePlus.addImageListener(self)
		self.selectInputDir()
		self.selectOutputDir()
		self.pairs = []
		self.methods = []
		self.processNextFile()

	def selectInputDir(self):
		inputDialog = DirectoryChooser("Please select a directory contaning your images")
		inputDir = inputDialog.getDirectory()
		for imageFile in os.listdir(inputDir):
			self.files.append(inputDir + imageFile)

	def selectOutputDir(self):
		outputDialog = DirectoryChooser("Please select a directory to save your results")
		self.outputDir = outputDialog.getDirectory()
		
	def closeImage(self):
		if self.imp is not None:
			self.imp.close()
			self.imp = None
		if self.preview is not None:
			self.preview.close()
			self.preview = None

	def openImage(self, imageFile):
		try:
			images = BF.openImagePlus(imageFile)
			self.imp = images[0]
		except UnknownFormatException:
			return None
		if self.imp.getNChannels() < 2:
			IJ.error("Bad image format", "Image must contain at lease 2 channels!")
			return None
		if not self.pairs or \
			not self.methods:
			self.getOptionsDialog(self.imp)
		title = self.imp.title
		self.imp.title = title[:title.rfind('.')]
		return self.imp

	def getOptionsDialog(self, imp):
		thr_methods = ["None", "Default", "Huang", "Intermodes", "IsoData",  "Li", "MaxEntropy","Mean", "MinError(I)", "Minimum", "Moments", "Otsu", "Percentile", "RenyiEntropy", "Shanbhag" , "Triangle", "Yen"]
		gd = GenericDialog("Please select channels to collocalize")
		for i in range(1, imp.getNChannels() + 1):
			gd.addChoice("Threshold method for channel %i" % i, thr_methods, "None")
		gd.showDialog()
		if gd.wasCanceled():
			self.exit()
		channels = []
		for i in range(1, imp.getNChannels() + 1):
			method = gd.getNextChoice()
			self.methods.append(method)
			if method != "None":
				channels.append(i)
		for x in channels:
			for y in channels:
				if x < y:
					self.pairs.append((x, y))

	def processNextFile(self):
		if self.files:
			imageFile = self.files.pop(0)
			return self.processFile(imageFile)
		else:
			return False
			
	def processFile(self, imageFile):
		imp = self.openImage(imageFile)
		if imp is not None:
			cell = Cell(imp.NSlices, 1)
			self.cells = DelegateListModel([])
			self.cells.append(cell)
			self.showMainWindow(self.cells)
			if self.checkbox3D.isSelected():
				self.displayImage(imp)
			else:
				self.displayImage(imp, False)
				self.preview = self.previewImage(imp)
				self.displayImage(self.preview)
			return True
		else:
			return self.processNextFile()
	
	def displayImage(self, imp, show = True):
		imp.setDisplayMode(IJ.COMPOSITE)
		enhancer = ContrastEnhancer()
		enhancer.setUseStackHistogram(True)
		splitter = ChannelSplitter()
		for c in range(1, imp.getNChannels() + 1):
			imp.c = c
			enhancer.stretchHistogram(imp, 0.35)
		if show:
			imp.show()

	def previewImage(self, imp):
		roi = imp.getRoi()
		splitter = ChannelSplitter()
		channels = []
		for c in range(1, imp.getNChannels() + 1):
			channel = ImagePlus("Channel %i" % c, splitter.getChannel(imp, c))
			projector = ZProjector(channel)
			projector.setMethod(ZProjector.MAX_METHOD)
			projector.doProjection()
			channels.append(projector.getProjection())
		image = RGBStackMerge.mergeChannels(channels, False)
		image.title = imp.title + " MAX Intensity"
		image.luts = imp.luts
		imp.setRoi(roi)
		return image

	def getCroppedChannels(self, imp, cell):
		splitter = ChannelSplitter()
		imp.setRoi(None)
		if cell.mode3D:
			cropRoi = cell.getCropRoi()
		else:
			cropRoi = cell.roi
		if cropRoi is None:
			return None
		crop = cropRoi.getBounds()
		channels = []
		for c in range(1, imp.getNChannels() + 1):
			slices = ImageStack(crop.width, crop.height)
			channel = splitter.getChannel(imp, c)
			for z in range(1, channel.getSize() + 1):
				zslice = channel.getProcessor(z)
				zslice.setRoi(cropRoi)
				nslice = zslice.crop()
				if cell.mode3D:
					oroi = cell.slices[z - 1].roi	
				else:
					oroi = cell.roi
				if oroi is not None:
					roi = oroi.clone()
					bounds = roi.getBounds()
					roi.setLocation(bounds.x - crop.x, bounds.y - crop.y)
					nslice.setColor(Color.black)
					nslice.fillOutside(roi)
					slices.addSlice(nslice)
			channels.append(ImagePlus("Channel %i" % c, slices))
		return channels

	def getThreshold(self, imp, method):
		thresholder = Auto_Threshold()
		duplicator = Duplicator()
		tmp = duplicator.run(imp)
		return thresholder.exec(tmp, method, False, False, True, False, False, True)

	def getContainer(self, impA, impB):
		imgA = ImagePlusAdapter.wrap(impA)
		imgB = ImagePlusAdapter.wrap(impB)
		return DataContainer(imgA, imgB, 1, 1, "imageA", "imageB")

	def getManders(self, imp, cell):
	
		### Crop channels according to cell mask
		channels = self.getCroppedChannels(imp, cell)
		if channels is None:
			return None
			
		### Calculate channel thresholds
		thrs = []
		thrimps = []
		for c, method in enumerate(self.methods):
			if method != "None":
				thr, thrimp = self.getThreshold(channels[c], method)
			else:
				thr, thrimp = None, None
			thrs.append(thr)
			thrimps.append(thrimp)
		
		### Calculate manders colocalization
		manders = MandersColocalization()
		raws = []
		thrds = []
		for chA, chB in self.pairs:
			container = self.getContainer(channels[chA - 1], channels[chB - 1])
			img1 = container.getSourceImage1()
			img2 = container.getSourceImage2()
			mask = container.getMask()
			cursor = TwinCursor(img1.randomAccess(), img2.randomAccess(), Views.iterable(mask).localizingCursor())
			rtype = img1.randomAccess().get().createVariable()
			raw = manders.calculateMandersCorrelation(cursor, rtype)
			rthr1 = rtype.copy()
			rthr2 = rtype.copy()
			rthr1.set(thrs[chA - 1])
			rthr2.set(thrs[chB - 1])
			cursor.reset()
			thrd = manders.calculateMandersCorrelation(cursor, rthr1, rthr2, ThresholdMode.Above)
			raws.append(raw)
			thrds.append(thrd)
		
		return (channels, thrimps, thrs, raws, thrds)

	def saveMultichannelImage(self, title, channels, luts):
		tmp = RGBStackMerge.mergeChannels(channels, False)
		tmp.luts = luts
		saver = FileSaver(tmp)
		saver.saveAsTiffStack(self.outputDir + title + ".tif")
		tmp.close()

	def createMainWindow(self):
		self.frame = JFrame('Select cells and ROIs',
			defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE
		)
		self.frame.setLayout(GridBagLayout())
		self.frame.addWindowListener(self)

		self.frame.add(JLabel("Cells"),
			GridBagConstraints(0, 0, 1, 1, 0, 0,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(5, 2, 2, 0), 0, 0
		))
		
		self.cellList = JList(DelegateListModel([]),
			selectionMode = ListSelectionModel.SINGLE_SELECTION,
			cellRenderer = MyRenderer(),
			selectedIndex = 0,
			valueChanged = self.selectCell
		)
		self.frame.add(JScrollPane(self.cellList),
			GridBagConstraints(0, 1, 1, 5, .5, 1,
				GridBagConstraints.CENTER, GridBagConstraints.BOTH,
				Insets(0, 2, 2, 0), 0, 0
		))

		self.frame.add(JButton('Add cell', actionPerformed = self.addCell),
			GridBagConstraints(1, 2, 1, 2, 0, .25,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(0, 0, 0, 0), 0, 0
		))
    	
		self.frame.add(JButton('Remove cell', actionPerformed = self.removeCell),
			GridBagConstraints(1, 4, 1, 2, 0, .25,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(0, 5, 0, 5), 0, 0
		))
		
		self.frame.add(JLabel("Slices"),
			GridBagConstraints(0, 6, 1, 1, 0, 0,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(5, 2, 2, 0), 0, 0
		))
		
		self.sliceList = JList(DelegateListModel([]),
			selectionMode = ListSelectionModel.SINGLE_SELECTION,
			cellRenderer = MyRenderer(),
			selectedIndex = 0,
			valueChanged = self.selectSlice
		)
		self.frame.add(JScrollPane(self.sliceList),
			GridBagConstraints(0, 7, 1, 5, .5, 1,
				GridBagConstraints.CENTER, GridBagConstraints.BOTH,
				Insets(0, 2, 2, 0), 0, 0
		))

		self.frame.add(JButton('Update ROI', actionPerformed = self.updateSlice),
			GridBagConstraints(1, 8, 1, 2, 0, .25,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(0, 0, 0, 0), 0, 0
		))

		self.frame.add(JButton('Done', actionPerformed = self.doneSelecting),
			GridBagConstraints(1, 10, 1, 2, 0, .25,
				GridBagConstraints.CENTER, GridBagConstraints.NONE,
				Insets(0, 0, 0, 0), 0, 0
		))

		self.checkbox3D = JCheckBox('3D selection mode', True, actionPerformed=self.toggle3D)
		self.frame.add(self.checkbox3D,
			GridBagConstraints(0, 13, 2, 1, 0, 1,
				GridBagConstraints.WEST, GridBagConstraints.NONE,
				Insets(0, 0, 0, 0), 0, 0
		))

	def showMainWindow(self, cells = None):
		if cells is not None:
			self.cellList.model = cells
			if cells:
				self.cellList.selectedIndex = 0
		self.frame.pack()
		self.frame.visible = True

	def hideMainWindow(self):
		self.frame.visible = False

	def closeMainWindow(self):
		self.frame.dispose()

	def toggle3D(self, event):
		mode3D = self.checkbox3D.isSelected()
		if mode3D:
			self.sliceList.enabled = True
			if self.imp is not None:
				self.imp.show()
			if self.preview is not None:
				self.preview.hide()
		else:
			self.sliceList.enabled = False
			if self.preview is None:
				self.preview = self.previewImage(self.imp)
				self.displayImage(self.preview)
			else:
				self.preview.show()
			if self.imp is not None:
				self.imp.hide()
		selectedCell = self.cellList.selectedIndex
		if selectedCell >= 0:
			cell = self.cells[selectedCell]
			self.sliceList.model = cell.slices
			self.sliceList.selectedIndex = 0
		
	def addCell(self, event):
		size = len(self.cells)
		if (size > 0):
			last = self.cells[size - 1]
			n = last.n + 1
		else:
			n = 1
		self.cells.append(Cell(self.imp.NSlices, n))
		self.cellList.selectedIndex = size

	def removeCell(self, event):
		selected = self.cellList.selectedIndex
		if selected >= 0:
			self.cells.remove(self.cells[selected])
			if (selected >= 1):
				self.cellList.selectedIndex = selected - 1
			else:
				self.cellList.selectedIndex = 0

	def selectCell(self, event):
		selected = self.cellList.selectedIndex
		if selected >= 0:
			cell = self.cells[selected]
			self.sliceList.model = cell.slices
			self.sliceList.selectedIndex = 0
		else:
			self.sliceList.model = DelegateListModel([])
		if self.preview is not None:
			self.preview.setRoi(cell.roi)

	def selectSlice(self, event):
		selectedCell = self.cellList.selectedIndex
		selectedSlice = self.sliceList.selectedIndex
		if selectedCell >= 0 and selectedSlice >= 0:
			cell = self.cells[selectedCell]
			image = self.imp
			mode3D = self.checkbox3D.isSelected()
			if image is not None and cell is not None and mode3D:
				roi = cell.slices[selectedSlice].roi
				if (image.z - 1 != selectedSlice):
					image.z = selectedSlice + 1				
				image.setRoi(roi, True)
			if self.preview is not None and not mode3D:
				self.preview.setRoi(cell.roi, True)

	def updateSlice(self, event):
		if self.checkbox3D.isSelected():
			self.updateSlice3D(self.imp)
		else:
			self.updateSlice2D(self.preview)

	def updateSlice3D(self, imp):
		selectedCell = self.cellList.selectedIndex
		selectedSlice = self.sliceList.selectedIndex
		if selectedCell >= 0 and selectedSlice >= 0 and imp is not None:
			cell = self.cells[selectedCell]
			impRoi = imp.getRoi()
			if cell is not None and impRoi is not None:
				index = selectedSlice + 1
				roi = ShapeRoi(impRoi, position = index)
				cell.mode3D = True
				cell.name = "Cell %i (3D)" % cell.n
				cell.slices[selectedSlice].roi = roi
				if (index + 1 <= len(cell.slices)):
					imp.z = index + 1			
			self.cellList.repaint(self.cellList.getCellBounds(selectedCell, selectedCell))
			self.sliceList.repaint(self.sliceList.getCellBounds(selectedSlice, selectedSlice))

	def updateSlice2D(self, imp):
		selectedCell = self.cellList.selectedIndex
		if selectedCell >= 0 and imp is not None:
			cell = self.cells[selectedCell]
			impRoi = imp.getRoi()
			if cell is not None and impRoi is not None:
				roi = ShapeRoi(impRoi, position = 1)
				cell.mode3D = False
				cell.name = "Cell %i (2D)" % cell.n
				cell.roi = roi	
			self.cellList.repaint(self.cellList.getCellBounds(selectedCell, selectedCell))
	
	def imageOpened(self, imp):
		pass

	def imageClosed(self, imp):
		pass

	def imageUpdated(self, imp):
		if self.checkbox3D.isSelected():
			if imp is not None:
				selectedCell = self.cellList.selectedIndex
				selectedSlice = imp.z - 1
			if imp == self.imp and selectedSlice != self.sliceList.selectedIndex:
				self.sliceList.selectedIndex = selectedSlice

	def doneSelecting(self, event):
		oluts = self.imp.luts
		luts = []
		channels = []
		for c, method in enumerate(self.methods):
			if method != "None":
				luts.append(oluts[c])
				channels.append(c)
		for cell in self.cells:
			manders = self.getManders(self.imp, cell)
			if manders is not None:
				chimps, thrimps, thrs, raws, thrds = manders
				index = self.cells.index(cell) + 1
				title = "Cell_%i-" % index + self.imp.title
				self.saveMultichannelImage(title, chimps, oluts)
				title = "Cell_%i_thrd-" % index + self.imp.title
				self.saveMultichannelImage(title, thrimps, luts)
				self.results.incrementCounter()
				row = self.results.getCounter() - 1
				for i, thr in enumerate(thrs):
					if thr is not None:
						self.results.setValue("Threshold %i" % (i + 1), row, int(thr))
				for i, pair in enumerate(self.pairs):
					self.results.setValue("%i-%i M1 raw" % pair, row, float(raws[i].m1))
					self.results.setValue("%i-%i M2 raw" % pair, row, float(raws[i].m2))
					self.results.setValue("%i-%i M1 thrd" % pair, row, float(thrds[i].m1))
					self.results.setValue("%i-%i M2 thrd" % pair, row, float(thrds[i].m2))
		self.closeImage()
		if not self.processNextFile():
			print "All done - happy analysis!"
			self.results.show("Manders collocalization results")
			self.exit()

	def windowClosing(self, e):
		print "Closing plugin - BYE!!!"
		self.exit()

	def exit(self):
		ImagePlus.removeImageListener(self)
		self.closeImage()
		self.closeMainWindow()
Exemplo n.º 58
0
    def initComponents(self):
        self.panel0 = JPanel()

        self.rbgPanel0 = ButtonGroup() 
        self.gbPanel0 = GridBagLayout() 
        self.gbcPanel0 = GridBagConstraints() 
        self.panel0.setLayout( self.gbPanel0 ) 

        self.Exec_Program_CB = JCheckBox("Execute Program", actionPerformed=self.checkBoxEvent)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 1 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Exec_Program_CB, self.gbcPanel0 ) 
        self.panel0.add( self.Exec_Program_CB ) 

        self.Program_Executable_TF = JTextField(20) 
        self.Program_Executable_TF.setEnabled(False)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 3 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) 
        self.panel0.add( self.Program_Executable_TF ) 

        self.Find_Program_Exec_BTN = JButton( "Find Exec", actionPerformed=self.onClick)
        self.Find_Program_Exec_BTN.setEnabled(False)
        self.rbgPanel0.add( self.Find_Program_Exec_BTN ) 
        self.gbcPanel0.gridx = 6 
        self.gbcPanel0.gridy = 3 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) 
        self.panel0.add( self.Find_Program_Exec_BTN ) 

        self.Imp_File_CB = JCheckBox( "Import File", actionPerformed=self.checkBoxEvent) 
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 5 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Imp_File_CB, self.gbcPanel0 ) 
        self.panel0.add( self.Imp_File_CB ) 

        self.File_Imp_TF = JTextField(20) 
        self.File_Imp_TF.setEnabled(False)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 7 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.File_Imp_TF, self.gbcPanel0 ) 
        self.panel0.add( self.File_Imp_TF ) 

        self.Find_Imp_File_BTN = JButton( "Find File", actionPerformed=self.onClick) 
        self.Find_Imp_File_BTN.setEnabled(False)
        self.rbgPanel0.add( self.Find_Imp_File_BTN ) 
        self.gbcPanel0.gridx = 6 
        self.gbcPanel0.gridy = 7 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Find_Imp_File_BTN, self.gbcPanel0 ) 
        self.panel0.add( self.Find_Imp_File_BTN ) 

        self.Check_Box_CB = JCheckBox( "Check Box 1", actionPerformed=self.checkBoxEvent) 
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 9 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Check_Box_CB, self.gbcPanel0 ) 
        self.panel0.add( self.Check_Box_CB ) 

        self.dataComboBox_CB = ("Chocolate", "Ice Cream", "Apple Pie") 
        self.ComboBox_CB = JComboBox( self.dataComboBox_CB)
        self.ComboBox_CB.itemStateChanged = self.onchange_cb        
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 11 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.ComboBox_CB, self.gbcPanel0 ) 
        self.panel0.add( self.ComboBox_CB ) 
        
        self.dataList_Box_LB = ("Chocolate", "Ice Cream", "Apple Pie", "Pudding", "Candy" )
        self.List_Box_LB = JList( self.dataList_Box_LB, valueChanged=self.onchange_lb)
        #self.List_Box_LB.itemStateChanged = self.onchange_lb
        self.List_Box_LB.setVisibleRowCount( 3 ) 
        self.scpList_Box_LB = JScrollPane( self.List_Box_LB ) 
        self.gbcPanel0.gridx = 6 
        self.gbcPanel0.gridy = 15 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 1 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.scpList_Box_LB, self.gbcPanel0 ) 
        self.panel0.add( self.scpList_Box_LB ) 

        # self.Radio_Button_RB = JRadioButton( "Radio Button"  ) 
        # self.rbgPanel0.add( self.Radio_Button_RB ) 
        # self.gbcPanel0.gridx = 7 
        # self.gbcPanel0.gridy = 17
        # self.gbcPanel0.gridwidth = 1 
        # self.gbcPanel0.gridheight = 1 
        # self.gbcPanel0.fill = GridBagConstraints.BOTH 
        # self.gbcPanel0.weightx = 1 
        # self.gbcPanel0.weighty = 0 
        # self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        # self.gbPanel0.setConstraints( self.Radio_Button_RB, self.gbcPanel0 ) 
        # self.panel0.add( self.Radio_Button_RB ) 

        # self.Label_1 = JLabel( "Error Message:") 
        # self.Label_1.setEnabled(True)
        # self.gbcPanel0.gridx = 2 
        # self.gbcPanel0.gridy = 19
        # self.gbcPanel0.gridwidth = 1 
        # self.gbcPanel0.gridheight = 1 
        # self.gbcPanel0.fill = GridBagConstraints.BOTH 
        # self.gbcPanel0.weightx = 1 
        # self.gbcPanel0.weighty = 0 
        # self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        # self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) 
        # self.panel0.add( self.Label_1 ) 
		
        # self.Error_Message = JLabel( "") 
        # self.Error_Message.setEnabled(True)
        # self.gbcPanel0.gridx = 6
        # self.gbcPanel0.gridy = 19
        # self.gbcPanel0.gridwidth = 1 
        # self.gbcPanel0.gridheight = 1 
        # self.gbcPanel0.fill = GridBagConstraints.BOTH 
        # self.gbcPanel0.weightx = 1 
        # self.gbcPanel0.weighty = 0 
        # self.gbcPanel0.anchor = GridBagConstraints.NORTH
        # self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) 
        # self.panel0.add( self.Error_Message ) 
		
        self.add(self.panel0)
Exemplo n.º 59
0
class BurpExtender(IBurpExtender, ITab, IHttpListener, IMessageEditorController, AbstractTableModel):
    
    #
    # implement IBurpExtender
    #
    
    def	registerExtenderCallbacks(self, callbacks):
    
        # keep a reference to our callbacks object
        self._callbacks = callbacks
        
        # obtain an extension helpers object
        self._helpers = callbacks.getHelpers()
        
        # set our extension name
        callbacks.setExtensionName("Otter")
        
        # create the log and a lock on which to synchronize when adding log entries
        self._log = ArrayList()
        self._lock = Lock()
       
        # main split pane for log entries and request/response viewing
        self._settingPanel = JPanel()
        self._logPane = JSplitPane(JSplitPane.VERTICAL_SPLIT)

        # setup settings pane ui
        self._settingPanel.setBounds(0,0,1000,1000)
        self._settingPanel.setLayout(None)

        self._isRegexp = JCheckBox("Use regexp for matching.")
        self._isRegexp.setBounds(10, 10, 220, 20)

        matchLabel = JLabel("String to Match:")
        matchLabel.setBounds(10, 40, 200, 20)
        self._matchString = JTextArea("User 1 Session Information")
        self._matchString.setWrapStyleWord(True)
        self._matchString.setLineWrap(True)
        matchString = JScrollPane(self._matchString)
        matchString.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED)
        matchString.setBounds(10, 60, 400, 200)

        replaceLabel = JLabel("String to Replace:")
        replaceLabel.setBounds(10, 270, 200, 20)
        self._replaceString = JTextArea("User 2 Session Information")
        self._replaceString.setWrapStyleWord(True)
        self._replaceString.setLineWrap(True)
        replaceString = JScrollPane(self._replaceString)
        replaceString.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED)
        replaceString.setBounds(10, 290, 400, 200)

        self._settingPanel.add(self._isRegexp)
        self._settingPanel.add(matchLabel)
        self._settingPanel.add(matchString)
        self._settingPanel.add(replaceLabel)
        self._settingPanel.add(replaceString)
        
        # table of log entries
        logTable = Table(self)
        logTable.getColumnModel().getColumn(0).setPreferredWidth(700)
        logTable.getColumnModel().getColumn(1).setPreferredWidth(150)
        logTable.getColumnModel().getColumn(2).setPreferredWidth(100)
        logTable.getColumnModel().getColumn(3).setPreferredWidth(130)
        logTable.getColumnModel().getColumn(4).setPreferredWidth(100)
        logTable.getColumnModel().getColumn(5).setPreferredWidth(130)
        scrollPane = JScrollPane(logTable)
        self._logPane.setLeftComponent(scrollPane)

        # tabs with request/response viewers
        logTabs = JTabbedPane()
        self._origRequestViewer = callbacks.createMessageEditor(self, False)
        self._origResponseViewer = callbacks.createMessageEditor(self, False)
        self._modRequestViewer = callbacks.createMessageEditor(self, False)
        self._modResponseViewer = callbacks.createMessageEditor(self, False)
        logTabs.addTab("Original Request", self._origRequestViewer.getComponent())
        logTabs.addTab("Original Response", self._origResponseViewer.getComponent())
        logTabs.addTab("Modified Request", self._modRequestViewer.getComponent())
        logTabs.addTab("Modified Response", self._modResponseViewer.getComponent())
        self._logPane.setRightComponent(logTabs)
        
        # top most tab interface that seperates log entries from settings
        maintabs = JTabbedPane()
        maintabs.addTab("Log Entries", self._logPane)
        maintabs.addTab("Settings", self._settingPanel)
        self._maintabs = maintabs
       
        # customize the UI components
        callbacks.customizeUiComponent(maintabs)
        
        # add the custom tab to Burp's UI
        callbacks.addSuiteTab(self)
        
        # register ourselves as an HTTP listener
        callbacks.registerHttpListener(self)
        
        return
        
    #
    # implement ITab
    #
    
    def getTabCaption(self):
        return "Otter"
    
    def getUiComponent(self):
        return self._maintabs
        
    #
    # implement IHttpListener
    #
    
    def processHttpMessage(self, toolFlag, messageIsRequest, messageInfo):
   
        # Only process responses that came from the proxy. This will
        # ignore request/responses made by Otter itself.
        if not messageIsRequest and toolFlag == self._callbacks.TOOL_PROXY:
            # create a new log entry with the message details
            row = self._log.size()

            # analyze and store information about the original request/response
            responseBytes = messageInfo.getResponse()
            requestBytes = messageInfo.getRequest()
            request = self._helpers.analyzeRequest(messageInfo)
            response = self._helpers.analyzeResponse(responseBytes)
            
            # ignore out-of-scope requests.
            if not self._callbacks.isInScope(request.getUrl()):
                return

            wasModified = False
            ms = self._matchString.getText()
            rs = self._replaceString.getText()
            mss = ms.split(",")
            rss = rs.split(",")
            if len(rss) != len(mss):
                mss = [""]
                
            for i,x in enumerate(mss):
                if x == "":
                    continue
                if self._isRegexp.isSelected():
                    if search(x, requestBytes):
                        requestBytes = sub(x, rss[i], requestBytes)
                        wasModified = True
                else:
                    if fromBytes(requestBytes).find(x) >= 0:
                        requestBytes = toBytes(replace(fromBytes(requestBytes), x, rss[i]))
                        wasModified = True

            # make a modified request to test for authorization issues
            entry = None
            if wasModified:
                modReqResp = self._callbacks.makeHttpRequest(messageInfo.getHttpService(), requestBytes)
                modRequestBytes = modReqResp.getRequest()
                modResponseBytes = modReqResp.getResponse()
                modResponse = self._helpers.analyzeResponse(modResponseBytes)
                orig = self._callbacks.saveBuffersToTempFiles(messageInfo)
                mod = self._callbacks.saveBuffersToTempFiles(modReqResp)
                entry = LogEntry(orig, mod, request.getUrl(), response.getStatusCode(), len(responseBytes), modResponse.getStatusCode(), len(modResponseBytes), wasModified)
            else:
                orig = self._callbacks.saveBuffersToTempFiles(messageInfo)
                entry = LogEntry(orig, None, request.getUrl(), response.getStatusCode(), len(responseBytes), "None", 0, wasModified)

            self._lock.acquire()
            self._log.add(entry)
            self.fireTableRowsInserted(row, row)
            self._lock.release()
        return

    #
    # extend AbstractTableModel
    #
    
    def getRowCount(self):
        try:
            return self._log.size()
        except:
            return 0

    def getColumnCount(self):
        return 6

    def getColumnName(self, columnIndex):
        if columnIndex == 0:
            return "URL"
        if columnIndex == 1:
            return "Request Modified?"
        if columnIndex == 2:
            return "Orig. Status"
        if columnIndex == 3:
            return "Orig. Length"
        if columnIndex == 4:
            return "Mod. Status"
        if columnIndex == 5:
            return "Mod. Length"
        return ""

    def getValueAt(self, rowIndex, columnIndex):
        logEntry = self._log.get(rowIndex)
        if columnIndex == 0:
            return logEntry._url.toString()
        if columnIndex == 1:
            return str(logEntry._wasModified)
        if columnIndex == 2:
            return str(logEntry._origStatus)
        if columnIndex == 3:
            return str(logEntry._origLength)
        if columnIndex == 4:
            return str(logEntry._modStatus)
        if columnIndex == 5:
            return str(logEntry._modLength)
        return ""

    #
    # implement IMessageEditorController
    # this allows our request/response viewers to obtain details about the messages being displayed
    #
    
    def getHttpService(self):
        return self._currentlyDisplayedItem.getHttpService()

    def getRequest(self):
        return self._currentlyDisplayedItem.getRequest()

    def getResponse(self):
        return self._currentlyDisplayedItem.getResponse()
Exemplo n.º 60
0
class GUI_TestWithUISettingsPanel(IngestModuleIngestJobSettingsPanel):
    # Note, we can't use a self.settings instance variable.
    # Rather, self.local_settings is used.
    # https://wiki.python.org/jython/UserGuide#javabean-properties
    # Jython Introspector generates a property - 'settings' on the basis
    # of getSettings() defined in this class. Since only getter function
    # is present, it creates a read-only 'settings' property. This auto-
    # generated read-only property overshadows the instance-variable -
    # 'settings'
    
    # We get passed in a previous version of the settings so that we can
    # prepopulate the UI
    # TODO: Update this for your UI
    def __init__(self, settings):
        self.local_settings = settings
        self.initComponents()
        self.customizeComponents()
    
    # TODO: Update this for your UI
    def checkBoxEvent(self, event):
        if self.Exec_Program_CB.isSelected():
            self.local_settings.setSetting('Exec_Prog_Flag', 'true')
            self.Program_Executable_TF.setEnabled(True)
            self.Find_Program_Exec_BTN.setEnabled(True)
        else:
            self.local_settings.setSetting('Exec_Prog_Flag', 'false')
            self.Program_Executable_TF.setText("")
            self.Program_Executable_TF.setEnabled(False)
            self.Find_Program_Exec_BTN.setEnabled(False)

        if self.Imp_File_CB.isSelected():
            self.local_settings.setSetting('Imp_File_Flag', 'true')
            self.File_Imp_TF.setEnabled(True)
            self.Find_Imp_File_BTN.setEnabled(True)
        else:
            self.local_settings.setSetting('Imp_File_Flag', 'false')
            self.File_Imp_TF.setText("")
            self.local_settings.setSetting('File_Imp_TF', "")
            self.File_Imp_TF.setEnabled(False)
            self.Find_Imp_File_BTN.setEnabled(False)

    def keyPressed(self, event):
        self.local_settings.setSetting('Area', self.area.getText()) 

    def onchange_cb(self, event):
        self.local_settings.setSetting('ComboBox', event.item) 
        #self.Error_Message.setText(event.item)

    def onchange_lb(self, event):
        self.local_settings.setSetting('ListBox', "")
        list_selected = self.List_Box_LB.getSelectedValuesList()
        self.local_settings.setSetting('ListBox', str(list_selected))      
        # if (len(list_selected) > 0):
            # self.Error_Message.setText(str(list_selected))
        # else:
            # self.Error_Message.setText("")

    def onClick(self, e):

       chooseFile = JFileChooser()
       filter = FileNameExtensionFilter("SQLite", ["sqlite"])
       chooseFile.addChoosableFileFilter(filter)

       ret = chooseFile.showDialog(self.panel0, "Select SQLite")

       if ret == JFileChooser.APPROVE_OPTION:
           file = chooseFile.getSelectedFile()
           Canonical_file = file.getCanonicalPath()
           #text = self.readPath(file)
           if self.File_Imp_TF.isEnabled():
              self.File_Imp_TF.setText(Canonical_file)
              self.local_settings.setSetting('File_Imp_TF', Canonical_file)
           else:
              self.local_settings.setSetting('ExecFile', Canonical_file)
              self.Program_Executable_TF.setText(Canonical_file)

    # TODO: Update this for your UI
    def initComponents(self):
        self.panel0 = JPanel()

        self.rbgPanel0 = ButtonGroup() 
        self.gbPanel0 = GridBagLayout() 
        self.gbcPanel0 = GridBagConstraints() 
        self.panel0.setLayout( self.gbPanel0 ) 

        self.Exec_Program_CB = JCheckBox("Execute Program", actionPerformed=self.checkBoxEvent)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 1 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Exec_Program_CB, self.gbcPanel0 ) 
        self.panel0.add( self.Exec_Program_CB ) 

        self.Program_Executable_TF = JTextField(20) 
        self.Program_Executable_TF.setEnabled(False)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 3 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) 
        self.panel0.add( self.Program_Executable_TF ) 

        self.Find_Program_Exec_BTN = JButton( "Find Exec", actionPerformed=self.onClick)
        self.Find_Program_Exec_BTN.setEnabled(False)
        self.rbgPanel0.add( self.Find_Program_Exec_BTN ) 
        self.gbcPanel0.gridx = 6 
        self.gbcPanel0.gridy = 3 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) 
        self.panel0.add( self.Find_Program_Exec_BTN ) 

        self.Imp_File_CB = JCheckBox( "Import File", actionPerformed=self.checkBoxEvent) 
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 5 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Imp_File_CB, self.gbcPanel0 ) 
        self.panel0.add( self.Imp_File_CB ) 

        self.File_Imp_TF = JTextField(20) 
        self.File_Imp_TF.setEnabled(False)
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 7 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.File_Imp_TF, self.gbcPanel0 ) 
        self.panel0.add( self.File_Imp_TF ) 

        self.Find_Imp_File_BTN = JButton( "Find File", actionPerformed=self.onClick) 
        self.Find_Imp_File_BTN.setEnabled(False)
        self.rbgPanel0.add( self.Find_Imp_File_BTN ) 
        self.gbcPanel0.gridx = 6 
        self.gbcPanel0.gridy = 7 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Find_Imp_File_BTN, self.gbcPanel0 ) 
        self.panel0.add( self.Find_Imp_File_BTN ) 

        self.Check_Box_CB = JCheckBox( "Check Box 1", actionPerformed=self.checkBoxEvent) 
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 9 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.Check_Box_CB, self.gbcPanel0 ) 
        self.panel0.add( self.Check_Box_CB ) 

        self.dataComboBox_CB = ("Chocolate", "Ice Cream", "Apple Pie") 
        self.ComboBox_CB = JComboBox( self.dataComboBox_CB)
        self.ComboBox_CB.itemStateChanged = self.onchange_cb        
        self.gbcPanel0.gridx = 2 
        self.gbcPanel0.gridy = 11 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 0 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.ComboBox_CB, self.gbcPanel0 ) 
        self.panel0.add( self.ComboBox_CB ) 
        
        self.dataList_Box_LB = ("Chocolate", "Ice Cream", "Apple Pie", "Pudding", "Candy" )
        self.List_Box_LB = JList( self.dataList_Box_LB, valueChanged=self.onchange_lb)
        #self.List_Box_LB.itemStateChanged = self.onchange_lb
        self.List_Box_LB.setVisibleRowCount( 3 ) 
        self.scpList_Box_LB = JScrollPane( self.List_Box_LB ) 
        self.gbcPanel0.gridx = 6 
        self.gbcPanel0.gridy = 15 
        self.gbcPanel0.gridwidth = 1 
        self.gbcPanel0.gridheight = 1 
        self.gbcPanel0.fill = GridBagConstraints.BOTH 
        self.gbcPanel0.weightx = 1 
        self.gbcPanel0.weighty = 1 
        self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        self.gbPanel0.setConstraints( self.scpList_Box_LB, self.gbcPanel0 ) 
        self.panel0.add( self.scpList_Box_LB ) 

        # self.Radio_Button_RB = JRadioButton( "Radio Button"  ) 
        # self.rbgPanel0.add( self.Radio_Button_RB ) 
        # self.gbcPanel0.gridx = 7 
        # self.gbcPanel0.gridy = 17
        # self.gbcPanel0.gridwidth = 1 
        # self.gbcPanel0.gridheight = 1 
        # self.gbcPanel0.fill = GridBagConstraints.BOTH 
        # self.gbcPanel0.weightx = 1 
        # self.gbcPanel0.weighty = 0 
        # self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        # self.gbPanel0.setConstraints( self.Radio_Button_RB, self.gbcPanel0 ) 
        # self.panel0.add( self.Radio_Button_RB ) 

        # self.Label_1 = JLabel( "Error Message:") 
        # self.Label_1.setEnabled(True)
        # self.gbcPanel0.gridx = 2 
        # self.gbcPanel0.gridy = 19
        # self.gbcPanel0.gridwidth = 1 
        # self.gbcPanel0.gridheight = 1 
        # self.gbcPanel0.fill = GridBagConstraints.BOTH 
        # self.gbcPanel0.weightx = 1 
        # self.gbcPanel0.weighty = 0 
        # self.gbcPanel0.anchor = GridBagConstraints.NORTH 
        # self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) 
        # self.panel0.add( self.Label_1 ) 
		
        # self.Error_Message = JLabel( "") 
        # self.Error_Message.setEnabled(True)
        # self.gbcPanel0.gridx = 6
        # self.gbcPanel0.gridy = 19
        # self.gbcPanel0.gridwidth = 1 
        # self.gbcPanel0.gridheight = 1 
        # self.gbcPanel0.fill = GridBagConstraints.BOTH 
        # self.gbcPanel0.weightx = 1 
        # self.gbcPanel0.weighty = 0 
        # self.gbcPanel0.anchor = GridBagConstraints.NORTH
        # self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) 
        # self.panel0.add( self.Error_Message ) 
		
        self.add(self.panel0)

    # TODO: Update this for your UI
    def customizeComponents(self):
        self.Exec_Program_CB.setSelected(self.local_settings.getSetting('Exec_Prog_Flag') == 'true')
        self.Imp_File_CB.setSelected(self.local_settings.getSetting('Imp_File_Flag') == 'true')
        self.Check_Box_CB.setSelected(self.local_settings.getSetting('Check_Box_1') == 'true')

    # Return the settings used
    def getSettings(self):
        return self.local_settings