Beispiel #1
0
 def __init__(self):
     self.usernameLabel = JLabel('Username : '******'Password : '******'Login', actionPerformed=self.login)
     self.initComponents()
Beispiel #2
0
    def registerExtenderCallbacks(self, callbacks):
        self.callbacks = callbacks
        self.helpers = callbacks.getHelpers()
        self.callbacks.setExtensionName("KkMultiProxy")
        self.PROXY_LIST = []

        self.jPanel = JPanel()
        boxVertical = Box.createVerticalBox()
        boxHorizontal = Box.createHorizontalBox()

        boxHorizontal.add(JButton("File", actionPerformed=self.getFile))
        self.FileText = JTextField("")
        boxHorizontal.add(self.FileText)
        boxVertical.add(boxHorizontal)

        TableHeader = ('IP', 'PORT')
        TableModel = DefaultTableModel(self.PROXY_LIST, TableHeader)
        self.Table = JTable(TableModel)
        boxVertical.add(self.Table)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JButton("Add", actionPerformed=self.addIP))
        boxHorizontal.add(JButton("Delete", actionPerformed=self.deleteIP))
        boxHorizontal.add(JButton("Save", actionPerformed=self.saveIP))
        boxVertical.add(boxHorizontal)

        self.jPanel.add(boxVertical)

        self.callbacks.addSuiteTab(self)
        self.callbacks.registerHttpListener(self)
        return
Beispiel #3
0
def insertFloatFields(panel, gb, gc, params, strings):
  """
  strings: an array of arrays, which each array having at least 2 strings,
           with the first string being the title of the section,
           and subsequent strings being the label of the parameter
           as well as the key in the params dictionary to retrieve the value
           to show as default in the textfield.
  When a value is typed in and it is a valid float number, the entry in params is updated.
  When invalid, the text field background is turned red.
  """
  for block in strings:
    title = JLabel(block[0])
    gc.gridx = 0
    gc.gridy += 1
    gc.gridwidth = 2
    gc.anchor = GBC.WEST
    gb.setConstraints(title, gc)
    panel.add(title)
    for param in block[1:]:
      gc.gridy += 1
      gc.gridwidth = 1
      gc.gridx = 0
      gc.anchor = GBC.EAST
      name = JLabel(param + ": ")
      gb.setConstraints(name, gc)
      panel.add(name)
      gc.gridx = 1
      gc.anchor = GBC.WEST
      tf = JTextField(str(params[param]), 10)
      tf.addKeyListener(NumberTextFieldListener(param, params, parse=float))
      gb.setConstraints(tf, gc)
      panel.add(tf)
Beispiel #4
0
 class SetKey(JDialog):
     def __init__(self, button=None):
         super(ConfigPanel.SetKey, self).__init__()
         self.setTitle('Enter version label')
         self.setModal(True)
         if button is None:
             self.button = JButton()
         else:
             self.button = button
         self.initUI()
         
     def initUI(self):
         self.JP = JPanel()
         self.JL = JLabel('Set version label: enter to validate')
         self.JP.add(self.JL)
         self.JTF = JTextField(self.button.getText(), 10)
         self.JTF.actionPerformed = self.doit
         self.JP.add(self.JTF)
         self.add(self.JP)
         self.pack()
         self.setLocation(150,150)
         self.setVisible(True)
         
     def doit(self,event):
         key = self.JTF.getText()
         self.button.setText(self.JTF.getText())
         self.dispose()
Beispiel #5
0
    def __init__(self,table):

        self.setTitle("Add Proxy")
        self.setSize(200,100)
        self.setVisible(True)
        self.table = table
        #self.getContentPane().add(about,BorderLayout.CENTER)

        boxHorizontal = Box.createHorizontalBox()
        boxVertical = Box.createVerticalBox()
        boxHorizontal.add(JLabel("IP:"))
        self.jIpText = JTextField(20)
        boxHorizontal.add(self.jIpText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JLabel("PROT:"))
        self.jPortText = JTextField(20)
        boxHorizontal.add(self.jPortText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JButton("Add",actionPerformed=self.addIP))
        boxVertical.add(boxHorizontal)

        self.getContentPane().add(boxVertical,BorderLayout.CENTER)
Beispiel #6
0
class DialogDemo(JDialog):
    def __init__(self, table):

        self.setTitle("Add Proxy")
        self.setSize(200, 100)
        self.setVisible(True)
        self.table = table
        #self.getContentPane().add(about,BorderLayout.CENTER)

        boxHorizontal = Box.createHorizontalBox()
        boxVertical = Box.createVerticalBox()
        boxHorizontal.add(JLabel("IP:"))
        self.jIpText = JTextField(20)
        boxHorizontal.add(self.jIpText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JLabel("PROT:"))
        self.jPortText = JTextField(20)
        boxHorizontal.add(self.jPortText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JButton("Add", actionPerformed=self.addIP))
        boxVertical.add(boxHorizontal)

        self.getContentPane().add(boxVertical, BorderLayout.CENTER)

    def addIP(self, button):
        TableModel = self.table.getModel()
        TableModel.addRow([self.jIpText.getText(), self.jPortText.getText()])
Beispiel #7
0
 def UI(self):
     self.val=""
     self.tabbedPane = JTabbedPane(JTabbedPane.TOP)
     self.panel = JPanel()
     self.tabbedPane.addTab("App Details", None, self.panel, None) # Details of app currently under pentest would be pulled into here through API
     self.panel_1 =  JPanel()
     self.tabbedPane.addTab("Results", None, self.panel_1, None) # passed results would go inside this and connected to reporting system via API
     self.panel_2 =  JPanel()
     self.tabbedPane.addTab("Failed Cases", None, self.panel_2, None) #list of failed tests would go inside this
     self.textField = JTextField()
     self.textField.setBounds(12, 13, 207, 39)
     self.panel.add(self.textField)
     self.textField.setColumns(10)
     self.comboBox = JComboBox()
     self.comboBox.setEditable(True)
     self.comboBox.addItem("Default")
     self.comboBox.addItem("High")
     self.comboBox.addItem("Low")
     self.comboBox.setBounds(46, 65, 130, 28)
     self.comboBox.addActionListener(self)
     self.panel.add(self.comboBox) 
     self.btnNewButton = JButton("Submit")
     self.btnNewButton.setBounds(60, 125, 97, 25)
     self.panel.add(self.btnNewButton)
     editorPane = JEditorPane();
     editorPane.setBounds(12, 35, 1000, 800);
     self.panel_2.add(editorPane);
     self.panel_2.setLayout(BorderLayout())
     return self.tabbedPane
Beispiel #8
0
class PTTextField(JPanel):

    def getName(self):
        return self._name

    def setText(self, text):
        self._textfield.setText(text)

    def getText(self):
        return self._textfield.getText()

    def __init__(self, name, label, text, function=None, button1=None, button2=None):

        length = 1000
        self._name = name
        self._label = JLabel(label)
        self._textfield = JTextField(length) \
            if function is None \
            else JTextField(length, actionPerformed=function)
        self.add(self._label)
        self.add(self._textfield)
        if button1 is not None:
            self._button1 = button1
            self.add(self._button1)
        if button2 is not None:
            self._button2 = button2
            self.add(self._button2)
        self.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5))
        self._textfield.setText("0" * length)
        self._textfield.setMaximumSize(self._textfield.getPreferredSize())
        self.setMaximumSize(self.getPreferredSize())
        self.setText(text)
        self.setLayout(BoxLayout(self, BoxLayout.X_AXIS))
Beispiel #9
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)
Beispiel #10
0
 def __init__(self):
     # Launches the login screen, initializes self.window, the primary frame
     self.done = False
     self.friendsData = ['']
     self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     self.chatHistory = {}
     self.usernameField = JTextField('guest', 20)
     self.status = JTextField(text='setStatus', editable=True)
     self.portNumber = "6666"
     self.IP = "127.0.0.1"
     self.window = swing.JFrame("Catchy Messenger Name")
     self.chatWindow = swing.JFrame()
     self.window.windowClosing = self.goodbye
     tempPanel = swing.JPanel()
     tempPanel = awt.BorderLayout()
     loginPage = JPanel(GridLayout(0, 2))
     self.window.add(loginPage)
     loginPage.add(JLabel("Enter today's username", SwingConstants.RIGHT))
     loginPage.add(self.usernameField)
     textIP = swing.JTextField(text=self.IP, editable=True)
     #chatHistory = swing.JTextArea(text = "new chat instance!", editable = False, lineWrap = True, size = (300,1))
     loginButton = JButton('Log in', actionPerformed=self.login)
     loginPage.add(JLabel(""))
     loginPage.add(loginButton)
     loginPage.add(textIP)
     loginPage.add(JLabel("Change IP from default?", SwingConstants.LEFT))
     loginPage.add(swing.JTextField(text=self.portNumber, editable=True))
     loginPage.add(JLabel("Change Port from default?"))
     self.window.pack()
     self.window.visible = True
     return
Beispiel #11
0
    def __init__(self, plugin):
        super(EmulatorComponentProvider,
              self).__init__(plugin.getTool(), "Emulator", "emulate_function")
        self.plugin = plugin

        self.panel = JPanel(GridBagLayout())
        c = GridBagConstraints()
        c.fill = GridBagConstraints.HORIZONTAL
        c.gridy = 0

        c.gridx = 0
        c.weightx = 0.8
        self.panel_label = JLabel("")
        self.panel.add(self.panel_label, c)

        c.gridx = 1
        c.weightx = 0.2
        self.panel_btn = JButton("Start")
        self.panel_btn.addActionListener(EmulatorBtnAction(self))
        self.panel.add(self.panel_btn, c)

        c.gridy = 1
        c.gridx = 0
        c.gridwidth = 2
        self.panel_input = JTextField()
        self.panel_input.addActionListener(EmulatorInputAction(self))
        self.panel.add(self.panel_input, c)

        self.setStatus("Stopped")
Beispiel #12
0
    def initPanelConfig(self):
        self._jPanel.setBounds(0, 0, 1000, 1000)
        self._jPanel.setLayout(GridBagLayout())

        self._jAboutPanel.setBounds(0, 0, 1000, 1000)
        self._jAboutPanel.setLayout(GridBagLayout())

        self._jLabelAdditionalCmdLine = JLabel("set url:")
        self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL
        self._jPanelConstraints.gridx = 0
        self._jPanelConstraints.gridy = 0
        self._jPanel.add(self._jLabelAdditionalCmdLine, self._jPanelConstraints)

        self._jTextFieldParameters = JTextField("",20)
        self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL
        self._jPanelConstraints.gridx = 1
        self._jPanelConstraints.gridy = 0
        self._jPanel.add(self._jTextFieldParameters, self._jPanelConstraints)

        self._jButtonSetCommandLine = JButton('go to test', actionPerformed=self.createNewInstance)
        self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL
        self._jPanelConstraints.gridx = 0
        self._jPanelConstraints.gridy = 5
        self._jPanelConstraints.gridwidth = 2
        self._jPanel.add(self._jButtonSetCommandLine, self._jPanelConstraints)

        self._jLabelAbout = JLabel("<html><body>%s</body></html>" % self.aboutText)
        self._jPanelConstraints.fill = GridBagConstraints.HORIZONTAL
        self._jPanelConstraints.gridx = 0
        self._jPanelConstraints.gridy = 0
        self._jAboutPanel.add(self._jLabelAbout, self._jPanelConstraints)
Beispiel #13
0
    def build_edit_area_font_panel(self, constraints, panel):
        '''
        Font size on a textfield.
        '''
        fontzise_label = JLabel("Edit area font size:")
        constraints = self.add_constraints(constraints,
                                           weightx=0.20,
                                           gridx=0,
                                           gridy=4)
        panel.add(fontzise_label, constraints)

        self.edit_area_fs_field = JTextField()
        self.edit_area_fs_field.setEditable(True)
        if self.edit_area_fontsize:
            self.edit_area_fs_field.setText("{}".format(
                self.edit_area_fontsize))
        else:
            self.edit_area_fs_field.setText(
                self.controller.config['edit_area_style']['fontsize']
                ['default'])

        constraints = self.add_constraints(constraints,
                                           weightx=0.80,
                                           gridx=1,
                                           gridy=4,
                                           fill=GridBagConstraints.HORIZONTAL)
        panel.add(self.edit_area_fs_field, constraints)
    def testJTextField(self):
        firstNameField = JTextField()
        lastNameField = JTextField()
        birthYearField = JFormattedTextField()
        self.group.bind(self.person, u'firstName', firstNameField,
                        u'text', mode=TWOWAY)
        self.group.bind(self.person, u'lastName', lastNameField,
                        u'text', mode=TWOWAY)
        self.group.bind(self.person, u'birthYear', birthYearField,
                        u'value', mode=TWOWAY)
        self.group.bind(self.person,
                        u'"%s %s, %s" % (firstName, lastName, birthYear)',
                        self.dummy, u'value')
        assert firstNameField.text == u'Joe'

        firstNameField.text = u'Mary'
        assert self.person.firstName == u'Mary'
        assert self.dummy.value == u'Mary Average, 1970'

        self.person.firstName = u'Susan'
        assert firstNameField.text == u'Susan'
        assert self.dummy.value == u'Susan Average, 1970'

        self.person.lastName = u'Mediocre'
        assert lastNameField.text == u'Mediocre'
        assert self.dummy.value == u'Susan Mediocre, 1970'
Beispiel #15
0
class DialogDemo(JDialog):
    def __init__(self,table):

        self.setTitle("Add Proxy")
        self.setSize(200,100)
        self.setVisible(True)
        self.table = table
        #self.getContentPane().add(about,BorderLayout.CENTER)

        boxHorizontal = Box.createHorizontalBox()
        boxVertical = Box.createVerticalBox()
        boxHorizontal.add(JLabel("IP:"))
        self.jIpText = JTextField(20)
        boxHorizontal.add(self.jIpText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JLabel("PROT:"))
        self.jPortText = JTextField(20)
        boxHorizontal.add(self.jPortText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JButton("Add",actionPerformed=self.addIP))
        boxVertical.add(boxHorizontal)

        self.getContentPane().add(boxVertical,BorderLayout.CENTER)
    def addIP(self,button):
        TableModel = self.table.getModel()
        TableModel.addRow([self.jIpText.getText(),self.jPortText.getText()])
Beispiel #16
0
    def __init__(self, app):
        strings = app.strings

        self.setLayout(GridLayout(3, 2, 5, 5))
        userLbl = JLabel(strings.getString("osmose_pref_username"))
        self.userTextField = JTextField(20)
        self.userTextField.setToolTipText(
            strings.getString("osmose_pref_username_tooltip"))

        levelLbl = JLabel(strings.getString("osmose_pref_level"))
        self.levels = ["1", "1,2", "1,2,3", "2", "3"]
        self.levelsCombo = JComboBox(self.levels)
        self.levelsCombo.setToolTipText(
            strings.getString("osmose_pref_level_tooltip"))

        limitLbl = JLabel(strings.getString("osmose_pref_limit"))
        self.limitTextField = JTextField(20)
        self.limitTextField.setToolTipText(
            strings.getString("osmose_pref_limit_tooltip"))

        self.add(userLbl)
        self.add(self.userTextField)
        self.add(levelLbl)
        self.add(self.levelsCombo)
        self.add(limitLbl)
        self.add(self.limitTextField)
Beispiel #17
0
    def __init__(self, table):

        self.setTitle("Add Proxy")
        self.setSize(200, 100)
        self.setVisible(True)
        self.table = table
        #self.getContentPane().add(about,BorderLayout.CENTER)

        boxHorizontal = Box.createHorizontalBox()
        boxVertical = Box.createVerticalBox()
        boxHorizontal.add(JLabel("IP:"))
        self.jIpText = JTextField(20)
        boxHorizontal.add(self.jIpText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JLabel("PROT:"))
        self.jPortText = JTextField(20)
        boxHorizontal.add(self.jPortText)
        boxVertical.add(boxHorizontal)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JButton("Add", actionPerformed=self.addIP))
        boxVertical.add(boxHorizontal)

        self.getContentPane().add(boxVertical, BorderLayout.CENTER)
Beispiel #18
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)
Beispiel #19
0
def getControlPanel():
    global controlPanel
    controlPanel = JPanel()
    controlPanel.setLayout(BoxLayout(controlPanel, BoxLayout.Y_AXIS))
    for row in keyLayout:
        rowPanel = JPanel()
        rowPanel.setLayout(BoxLayout(rowPanel, BoxLayout.X_AXIS))
        controlPanel.add(rowPanel)
        for key in row:
            button = JButton(key[0], actionPerformed=handleKeyButton)
            button.setActionCommand(key[1])
            rowPanel.add(button)

    global terminalResult
    terminalResult = JTextArea()
    scroller = JScrollPane(terminalResult)
    terminalResult.setLineWrap(True)
    scroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS)
    scroller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER)
    controlPanel.add(scroller)

    global terminalInput
    termInputPanel = JPanel()
    termInputPanel.setLayout(BoxLayout(termInputPanel, BoxLayout.X_AXIS))
    termInputLabel = JLabel("Command")
    termInputPanel.add(termInputLabel)
    terminalInput = JTextField(actionPerformed=handleTerminalInput)
    minimumSize = terminalInput.getMinimumSize()
    maximumSize = terminalInput.getMaximumSize()
    terminalInput.setMaximumSize(Dimension(maximumSize.width, minimumSize.height))

    termInputPanel.add(terminalInput)
    controlPanel.add(termInputPanel)

    return controlPanel
Beispiel #20
0
        def getMainComponent(self):
            self._mainPanel = JPanel(BorderLayout())
            # input
            self._consolePwd = JTextField()
            self._consolePwd.setEditable(False)
            self._consolePwd.setText("Not initialized")
            self._consoleInput = JTextField()
            #Remove 'tab' low-level tab-function of jumping to other component, so I can use it
            self._consoleInput.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, Collections.EMPTY_SET)
            self._consoleInput.addActionListener(self.EnterPress())
            self._consoleInput.addKeyListener(self.KeyPress())
            self._inputPanel = JPanel(BorderLayout())
            self._inputPanel.add(self._consolePwd, BorderLayout.WEST)
            self._inputPanel.add(self._consoleInput, BorderLayout.CENTER)
            # output
            self._consoleOutput = JTextArea()
            self._consoleOutput.setEditable(False)
            self._consoleOutput.setForeground(Color.WHITE)
            self._consoleOutput.setBackground(Color.BLACK)
            self._consoleOutput.setFont(self._consoleOutput.getFont().deriveFont(12.0))

            self._scrollPaneConsoleOutput = JScrollPane(self._consoleOutput)

            # Add to main panel and return the main panel
            self._mainPanel.add(self._scrollPaneConsoleOutput, BorderLayout.CENTER)
            self._mainPanel.add(self._inputPanel, BorderLayout.SOUTH)
            return self._mainPanel
Beispiel #21
0
    def run(self):
        frame = JFrame('Console timeout',
                       defaultCloseOperation=JFrame.EXIT_ON_CLOSE)

        #-----------------------------------------------------------------------
        # The frame (i.e., it's ContentPane) should use a vertically aligned
        # BoxLayout layout manager (i.e., along the Y_AXIS)
        #-----------------------------------------------------------------------
        cp = frame.getContentPane()
        cp.setLayout(BoxLayout(cp, BoxLayout.Y_AXIS))

        #-----------------------------------------------------------------------
        # The JTextField will be preceeded, and followed by JLabel components
        # identifying the value being displayed, and the associated time units.
        # However, we want them displayed horizontally, so we put them into a
        # single JPanel instance using a FlowLayout layout manager
        #-----------------------------------------------------------------------
        input = JPanel(layout=FlowLayout())
        input.add(JLabel('Timeout:'))
        self.text = JTextField(3, actionPerformed=self.update)
        input.add(self.text)
        self.text.setText(getTimeout())
        input.add(JLabel('minutes'))
        cp.add(input)

        #-----------------------------------------------------------------------
        # Then, we add a message area beneath
        #-----------------------------------------------------------------------
        self.msg = cp.add(JLabel())

        frame.setSize(290, 100)
        frame.setVisible(1)
def makeUI(model):
    table = JTable(model)
    jsp = JScrollPane(table)
    regex_label = JLabel("Search: ")
    regex_field = JTextField(20)
    top = JPanel()
    top.add(regex_label)
    top.add(regex_field)
    top.setLayout(BoxLayout(top, BoxLayout.X_AXIS))
    base_path_label = JLabel("Base path:")
    base_path_field = JTextField(50)
    bottom = JPanel()
    bottom.add(base_path_label)
    bottom.add(base_path_field)
    bottom.setLayout(BoxLayout(bottom, BoxLayout.X_AXIS))
    all = JPanel()
    all.add(top)
    all.add(jsp)
    all.add(bottom)
    all.setLayout(BoxLayout(all, BoxLayout.Y_AXIS))
    frame = JFrame("File paths")
    frame.getContentPane().add(all)
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
    frame.addWindowListener(Closing())
    frame.pack()
    frame.setVisible(True)
    # Listeners
    regex_field.addKeyListener(EnterListener(table, model, frame))
    table.addMouseListener(RowClickListener(base_path_field))
    #
    return model, table, regex_field, frame
Beispiel #23
0
class HumanDetailPanel(DetailPanel):
    """ generated source for class HumanDetailPanel """
    moveTable = JZebraTable()
    moveTextField = JTextField()
    selectButton = JButton()
    selection = Move()
    timerBar = JTimerBar()

    def __init__(self):
        """ generated source for method __init__ """
        super(HumanDetailPanel, self).__init__(GridBagLayout())
        model = DefaultTableModel()
        model.addColumn("Legal Moves")
        self.moveTable = JZebraTable(model)
        self.selectButton = JButton(selectButtonMethod())
        self.moveTextField = JTextField()
        self.timerBar = JTimerBar()
        self.selection = None
        self.moveTable.setShowHorizontalLines(True)
        self.moveTable.setShowVerticalLines(True)
        self.moveTextField.setEditable(False)
        self.add(JScrollPane(self.moveTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, Insets(5, 5, 5, 5), 5, 5))
        self.add(self.selectButton, GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, Insets(5, 5, 5, 5), 0, 0))
        self.add(self.moveTextField, GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, Insets(5, 5, 5, 5), 5, 5))
        self.add(self.timerBar, GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, Insets(5, 5, 5, 5), 5, 5))

    @overloaded
    def observe(self, event):
        """ generated source for method observe """
        if isinstance(event, (HumanNewMovesEvent, )):
            self.observe(event)
        elif isinstance(event, (HumanTimeoutEvent, )):
            self.observe(event)
        elif isinstance(event, (PlayerTimeEvent, )):
            self.observe(event)

    @observe.register(object, HumanNewMovesEvent)
    def observe_0(self, event):
        """ generated source for method observe_0 """
        model = self.moveTable.getModel()
        model.setRowCount(0)
        for move in event.getMoves():
            model.addRow([None]*)
        self.selection = event.getSelection()
        self.moveTextField.setText(self.selection.__str__())

    @observe.register(object, HumanTimeoutEvent)
    def observe_1(self, event):
        """ generated source for method observe_1 """
        event.getHumanPlayer().setMove(self.selection)

    @observe.register(object, PlayerTimeEvent)
    def observe_2(self, event):
        """ generated source for method observe_2 """
        self.timerBar.time(event.getTime(), 500)

    def selectButtonMethod(self):
        """ generated source for method selectButtonMethod """
        return AbstractAction("Select")
Beispiel #24
0
class ConversationWindow(Conversation):
    """A GUI window of a conversation with a specific person"""
    def __init__(self, person, chatui):
        """ConversationWindow(basesupport.AbstractPerson:person)"""
        Conversation.__init__(self, person, chatui)
        self.mainframe = JFrame("Conversation with "+person.name)
        self.display = JTextArea(columns=100,
                                 rows=15,
                                 editable=0,
                                 lineWrap=1)
        self.typepad = JTextField()
        self.buildpane()
        self.lentext = 0

    def buildpane(self):
        buttons = JPanel(doublebuffered)
        buttons.add(JButton("Send", actionPerformed=self.send))
        buttons.add(JButton("Hide", actionPerformed=self.hidewindow))

        mainpane = self.mainframe.getContentPane()
        mainpane.setLayout(BoxLayout(mainpane, BoxLayout.Y_AXIS))
        mainpane.add(JScrollPane(self.display))
        self.typepad.actionPerformed = self.send
        mainpane.add(self.typepad)
        mainpane.add(buttons)

    def show(self):
        self.mainframe.pack()
        self.mainframe.show()

    def hide(self):
        self.mainframe.hide()

    def sendText(self, text):
        self.displayText("\n"+self.person.client.name+": "+text)
        Conversation.sendText(self, text)

    def showMessage(self, text, metadata=None):
        self.displayText("\n"+self.person.name+": "+text)

    def contactChangedNick(self, person, newnick):
        Conversation.contactChangedNick(self, person, newnick)
        self.mainframe.setTitle("Conversation with "+newnick)

    #GUI code
    def displayText(self, text):
        self.lentext = self.lentext + len(text)
        self.display.append(text)
        self.display.setCaretPosition(self.lentext)

    #actionlisteners
    def hidewindow(self, ae):
        self.hide()

    def send(self, ae):
        text = self.typepad.getText()
        self.typepad.setText("")
        if text != "" and text != None:
            self.sendText(text)
Beispiel #25
0
 def __init__(self, person, chatui):
     """ConversationWindow(basesupport.AbstractPerson:person)"""
     Conversation.__init__(self, person, chatui)
     self.mainframe = JFrame("Conversation with " + person.name)
     self.display = JTextArea(columns=100, rows=15, editable=0, lineWrap=1)
     self.typepad = JTextField()
     self.buildpane()
     self.lentext = 0
 def _prepare_components(self, values):
     self._text_field = JTextField()
     self._text_field.setColumns(30)
     self._text_field.setEditable(True)
     self._text_field.setText(
         InfrastructureHelpers.join(values[self._get_domain_dict_key()]))
     self._text_field.addFocusListener(self)
     self.add(self._text_field)
Beispiel #27
0
 def display(self, values):
     self.add(JLabel('<html><b>Tags:</b></html>'))
     self._text_field = JTextField()
     self._text_field.setColumns(20)
     self._text_field.setEditable(True)
     self._text_field.setText(InfrastructureHelpers.join(values['tags']))
     self._text_field.getDocument().addDocumentListener(self)
     self.add(self._text_field)
Beispiel #28
0
 def __init__(self):
     self.usernameLabel = JLabel('Username : '******'Super Password : '******'Delete',
                                   actionPerformed=self.deleteAdmin)
     self.initComponents()
Beispiel #29
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)
Beispiel #30
0
class PrefsPanel(JPanel):
    """JPanle with gui for tool preferences
    """
    def __init__(self, app):
        strings = app.strings

        self.setLayout(GridLayout(3, 2, 5, 5))
        userLbl = JLabel(strings.getString("osmose_pref_username"))
        self.userTextField = JTextField(20)
        self.userTextField.setToolTipText(
            strings.getString("osmose_pref_username_tooltip"))

        levelLbl = JLabel(strings.getString("osmose_pref_level"))
        self.levels = ["1", "1,2", "1,2,3", "2", "3"]
        self.levelsCombo = JComboBox(self.levels)
        self.levelsCombo.setToolTipText(
            strings.getString("osmose_pref_level_tooltip"))

        limitLbl = JLabel(strings.getString("osmose_pref_limit"))
        self.limitTextField = JTextField(20)
        self.limitTextField.setToolTipText(
            strings.getString("osmose_pref_limit_tooltip"))

        self.add(userLbl)
        self.add(self.userTextField)
        self.add(levelLbl)
        self.add(self.levelsCombo)
        self.add(limitLbl)
        self.add(self.limitTextField)

    def update_gui(self, preferences):
        """Update preferences gui
        """
        self.userTextField.setText(preferences["username"])
        self.levelsCombo.setSelectedIndex(
            self.levels.index(preferences["level"]))
        self.limitTextField.setText(str(preferences["limit"]))

    def read_gui(self):
        """Read preferences from gui
        """
        username = self.userTextField.getText()
        level = self.levelsCombo.getSelectedItem()
        limit = self.limitTextField.getText()
        try:
            limit = Integer.parseInt(limit)
            if limit > 500:
                limit = 500
            limit = str(limit)
        except NumberFormatException:
            limit = ""

        preferences = {
            "username": username.strip(),
            "level": level,
            "limit": limit
        }
        return preferences
Beispiel #31
0
 def _prepare_components(self, values):
     self._text_field = JTextField()
     self._text_field.setColumns(30)
     self._text_field.setEditable(False)
     self._text_field.setText(values['database_path'])
     self.add(self._text_field)
     button = JButton('Save as...')
     button.addActionListener(self)
     self.add(button)
Beispiel #32
0
 def __init__(self, group, chatui):
     GroupConversation.__init__(self, group, chatui)
     self.mainframe = JFrame(self.group.name)
     self.headers = ["Member"]
     self.memberdata = UneditableTableModel([], self.headers)
     self.display = JTextArea(columns=100, rows=15, editable=0, lineWrap=1)
     self.typepad = JTextField()
     self.buildpane()
     self.lentext = 0
Beispiel #33
0
    def __init__(self):  # constructor
        # origing of coordinates
        self.coordx = 10
        self.coordy = 10

        # inintialize values
        self.Canvas = None
        self.default_naming = 'MouseID_ExperimentalGroup_slide-X'

        # create panel (what is inside the GUI)
        self.panel = self.getContentPane()
        self.panel.setLayout(GridLayout(8, 2))
        self.setTitle('Subdividing ROIs')

        # define buttons here:
        self.subimage_number = DefaultListModel()
        mylist = JList(self.subimage_number, valueChanged=self.open_lowres_image)
        # mylist.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        mylist.setLayoutOrientation(JList.VERTICAL)
        mylist.setVisibleRowCount(1)
        listScroller1 = JScrollPane(mylist)
        listScroller1.setPreferredSize(Dimension(200, 90))

        quitButton = JButton("Quit", actionPerformed=self.quit)
        selectInputFolderButton = JButton("Select Input", actionPerformed=self.select_input)
        cubifyROIButton = JButton("Cubify ROI", actionPerformed=self.cubify_ROI)
        saveButton = JButton("Save ROIs", actionPerformed=self.save_ROIs)

        self.textfield1 = JTextField('18')
        self.textfield2 = JTextField(self.default_naming)
        self.textfield3 = JTextField('R-Tail')
        self.textfield4 = JTextField('6, 4, 22.619')
        self.textfield5 = JTextField('0')

        # add buttons here
        self.panel.add(Label("Name your image, or use filename"))
        self.panel.add(self.textfield2)
        self.panel.add(selectInputFolderButton)
        self.panel.add(listScroller1)
        self.panel.add(Label("Adjust the size of the squared ROIs"))
        self.panel.add(self.textfield1)
        self.panel.add(Label("give a name of your hand-drawn ROI"))
        self.panel.add(self.textfield3)
        self.panel.add(Label("For ARA: piram, ch, res"))
        # piramid number (high to low), channel number, final resolution (um/px)"))
        self.panel.add(self.textfield4)
        self.panel.add(Label("Piramid to check (0:none; 1:highest)"))
        self.panel.add(self.textfield5)
        self.panel.add(cubifyROIButton)
        self.panel.add(saveButton)
        self.panel.add(quitButton)

        # other stuff to improve the look
        self.pack()  # packs the frame
        self.setVisible(True)  # shows the JFrame
        self.setLocation(self.coordx, self.coordy)
    def getUiComponent(self):
        self.spePanel = JPanel()
        self.spePanel.setBorder(None)
        self.spePanel.setLayout(None)

        self.logPane = JScrollPane()
        self.outputTxtArea = JTextArea()
        self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12))
        self.outputTxtArea.setLineWrap(True)
        self.logPane.setViewportView(self.outputTxtArea)
        self.spePanel.add(self.logPane)

        self.clearBtn = JButton("Clear", actionPerformed=self.clearRst)
        self.exportBtn = JButton("Export", actionPerformed=self.exportRst)
        self.parentFrm = JFileChooser()

        self.spePanel.add(self.clearBtn)
        self.spePanel.add(self.exportBtn)

        self.logPane.setBounds(20, 50, 800, 600)

        self.clearBtn.setBounds(20, 650, 100, 30)
        self.exportBtn.setBounds(600, 650, 100, 30)

        self.sensitiveParamsRegularListPanel = JList(self.sensitiveParamR)
        self.sensitiveParamsRegularListPanel.setVisibleRowCount(
            len(self.sensitiveParamR))

        #self.spePanel.add(self.sensitiveParamsRegularListPanel)

        #self.sensitiveParamsRegularListPanel.setBounds(850,50,150,600)

        self.sensitiveParamsRegularListScrollPanel = JScrollPane()
        self.sensitiveParamsRegularListScrollPanel.setViewportView(
            self.sensitiveParamsRegularListPanel)
        self.spePanel.add(self.sensitiveParamsRegularListScrollPanel)
        self.sensitiveParamsRegularListScrollPanel.setBounds(850, 50, 150, 600)

        self.addAndSaveNewParamRegularButton = JButton(
            'add&&save', actionPerformed=self.addAndSaveNewParamRegular)
        self.spePanel.add(self.addAndSaveNewParamRegularButton)
        self.addAndSaveNewParamRegularButton.setBounds(1000, 50, 150, 30)

        self.addAndSaveNewParamRegularTextField = JTextField('NewParamRegular')
        self.spePanel.add(self.addAndSaveNewParamRegularTextField)
        self.addAndSaveNewParamRegularTextField.setBounds(1150, 50, 100, 30)

        self.alertSaveSuccess = JOptionPane()
        self.spePanel.add(self.alertSaveSuccess)

        self.delParamRegularButton = JButton(
            "delete", actionPerformed=self.delParamRegular)
        self.spePanel.add(self.delParamRegularButton)
        self.delParamRegularButton.setBounds(1000, 90, 100, 30)

        return self.spePanel
Beispiel #35
0
class ConversationWindow(Conversation):
    """A GUI window of a conversation with a specific person"""
    def __init__(self, person, chatui):
        """ConversationWindow(basesupport.AbstractPerson:person)"""
        Conversation.__init__(self, person, chatui)
        self.mainframe = JFrame("Conversation with " + person.name)
        self.display = JTextArea(columns=100, rows=15, editable=0, lineWrap=1)
        self.typepad = JTextField()
        self.buildpane()
        self.lentext = 0

    def buildpane(self):
        buttons = JPanel(doublebuffered)
        buttons.add(JButton("Send", actionPerformed=self.send))
        buttons.add(JButton("Hide", actionPerformed=self.hidewindow))

        mainpane = self.mainframe.getContentPane()
        mainpane.setLayout(BoxLayout(mainpane, BoxLayout.Y_AXIS))
        mainpane.add(JScrollPane(self.display))
        self.typepad.actionPerformed = self.send
        mainpane.add(self.typepad)
        mainpane.add(buttons)

    def show(self):
        self.mainframe.pack()
        self.mainframe.show()

    def hide(self):
        self.mainframe.hide()

    def sendText(self, text):
        self.displayText("\n" + self.person.client.name + ": " + text)
        Conversation.sendText(self, text)

    def showMessage(self, text, metadata=None):
        self.displayText("\n" + self.person.name + ": " + text)

    def contactChangedNick(self, person, newnick):
        Conversation.contactChangedNick(self, person, newnick)
        self.mainframe.setTitle("Conversation with " + newnick)

    #GUI code
    def displayText(self, text):
        self.lentext = self.lentext + len(text)
        self.display.append(text)
        self.display.setCaretPosition(self.lentext)

    #actionlisteners
    def hidewindow(self, ae):
        self.hide()

    def send(self, ae):
        text = self.typepad.getText()
        self.typepad.setText("")
        if text != "" and text != None:
            self.sendText(text)
Beispiel #36
0
def textfield(text = "", actionListener = None):
    txt = JTextField(text, 15)
    class Focuser(FocusListener):
        def focusGained(self,e):
            pass
        def focusLost(self,e):
            if actionListener: actionListener(e)
    txt.addFocusListener(Focuser())
#    if actionListener: txt.addActionListener(actionListener)
    return txt
Beispiel #37
0
class PrefsPanel(JPanel):
    """JPanle with gui for tool preferences
    """
    def __init__(self, app):
        strings = app.strings

        self.setLayout(GridLayout(3, 2, 5, 5))
        userLbl = JLabel(strings.getString("osmose_pref_username"))
        self.userTextField = JTextField(20)
        self.userTextField.setToolTipText(strings.getString("osmose_pref_username_tooltip"))

        levelLbl = JLabel(strings.getString("osmose_pref_level"))
        self.levels = ["1", "1,2", "1,2,3", "2", "3"]
        self.levelsCombo = JComboBox(self.levels)
        self.levelsCombo.setToolTipText(strings.getString("osmose_pref_level_tooltip"))

        limitLbl = JLabel(strings.getString("osmose_pref_limit"))
        self.limitTextField = JTextField(20)
        self.limitTextField.setToolTipText(strings.getString("osmose_pref_limit_tooltip"))

        self.add(userLbl)
        self.add(self.userTextField)
        self.add(levelLbl)
        self.add(self.levelsCombo)
        self.add(limitLbl)
        self.add(self.limitTextField)

    def update_gui(self, preferences):
        """Update preferences gui
        """
        self.userTextField.setText(preferences["username"])
        self.levelsCombo.setSelectedIndex(self.levels.index(preferences["level"]))
        self.limitTextField.setText(str(preferences["limit"]))

    def read_gui(self):
        """Read preferences from gui
        """
        username = self.userTextField.getText()
        level = self.levelsCombo.getSelectedItem()
        limit = self.limitTextField.getText()
        try:
            limit = Integer.parseInt(limit)
            if limit > 500:
                limit = 500
            limit = str(limit)
        except NumberFormatException:
            limit = ""

        preferences = {"username": username.strip(),
                       "level": level,
                       "limit": limit}
        return preferences
Beispiel #38
0
class _AccountAdder:
    def __init__(self, contactslist):
        self.contactslist = contactslist
        self.mainframe = JFrame("Add New Contact")
        self.account = JComboBox(self.contactslist.clientsByName.keys())
        self.contactname = JTextField()
        self.buildpane()

    def buildpane(self):
        buttons = JPanel()
        buttons.add(JButton("OK", actionPerformed=self.add))
        buttons.add(JButton("Cancel", actionPerformed=self.cancel))

        acct = JPanel(GridLayout(1, 2), doublebuffered)
        acct.add(JLabel("Account"))
        acct.add(self.account)

        mainpane = self.mainframe.getContentPane()
        mainpane.setLayout(BoxLayout(mainpane, BoxLayout.Y_AXIS))
        mainpane.add(self.contactname)
        mainpane.add(acct)
        mainpane.add(buttons)
        self.mainframe.pack()
        self.mainframe.show()

    #action listeners
    def add(self, ae):
        acct = self.contactslist.clientsByName[self.account.getSelectedItem()]
        acct.addContact(self.contactname.getText())
        self.mainframe.dispose()

    def cancel(self, ae):
        self.mainframe.dispose()
Beispiel #39
0
    def build_working_dir_panel(self, constraints, panel):
        '''
        Working directory row: label + field + button
        This is for users to browse for their preferred default directory
        when opening/creating a new file.
        '''
        working_dir_label = JLabel("Working directory:")
        constraints = self.add_constraints(constraints, weightx=0.30,
                                           gridx=0, gridy=0,
                                           anchor=GridBagConstraints.EAST)

        panel.add(working_dir_label, constraints)

        self.wd_field = JTextField()
        self.wd_field.setEditable(False)
        # Can't find an elegant way to default to something that would be
        # crossplatform, and I can't leave the default field empty.
        if self.working_dir['default'] != "None":
            self.wd_field.setText(self.working_dir['default'])
        else:
            self.wd_field.setText(os.getcwd())

        constraints = self.add_constraints(constraints, weightx=0.60,
                                           gridx=1, gridy=0,
                                           fill=GridBagConstraints.HORIZONTAL,
                                           insets=Insets(10, 10, 10, 5))
        panel.add(self.wd_field, constraints)

        constraints.fill = 0
        button = JButton("Browse", actionPerformed=self.browse)
        constraints = self.add_constraints(constraints, weightx=0.10,
                                           gridx=2, gridy=0,
                                           insets=Insets(10, 0, 10, 10))
        panel.add(button, constraints)
Beispiel #40
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()
Beispiel #41
0
    def registerExtenderCallbacks(self,callbacks):
        self.callbacks = callbacks
        self.helpers = callbacks.getHelpers()
        self.callbacks.setExtensionName("KkMultiProxy")
        self.PROXY_LIST = []

        self.jPanel = JPanel()
        boxVertical = Box.createVerticalBox()
        boxHorizontal = Box.createHorizontalBox()

        boxHorizontal.add(JButton("File",actionPerformed=self.getFile))
        self.FileText = JTextField("")
        boxHorizontal.add(self.FileText)
        boxVertical.add(boxHorizontal)

        TableHeader = ('IP','PORT')
        TableModel = DefaultTableModel(self.PROXY_LIST,TableHeader)
        self.Table = JTable(TableModel)
        boxVertical.add(self.Table)

        boxHorizontal = Box.createHorizontalBox()
        boxHorizontal.add(JButton("Add",actionPerformed=self.addIP))
        boxHorizontal.add(JButton("Delete",actionPerformed=self.deleteIP))
        boxHorizontal.add(JButton("Save",actionPerformed=self.saveIP))
        boxVertical.add(boxHorizontal)

        self.jPanel.add(boxVertical)

        self.callbacks.addSuiteTab(self)
        self.callbacks.registerHttpListener(self)
        return
Beispiel #42
0
    def __init__(self, p):
        self.cellCounter = 1
        self.olay = Overlay()
        self.position = p
        print p.getRoiPath()
        if p.getRoiPath() != None:         # check if there is an existing overlay file and load it!
            p.loadRois()

        self.frame = JFrame("CellCropper", size=(200,200))
        self.frame.setLocation(20,120)
        self.Panel = JPanel(GridLayout(0,1))
        self.frame.add(self.Panel)
        #self.nameField = JTextField("p" + "_c",15)
        self.nameField = JTextField("p" + str(self.position.getID()) + "_c",15)
        self.Panel.add(self.nameField)
        self.cutoutButton = JButton("Cut out cell",actionPerformed=cut)
        self.Panel.add(self.cutoutButton)
        self.delOlButton = JButton("Delete Overlay",actionPerformed=delOverlay)
        self.Panel.add(self.delOlButton)
        self.saveOlButton = JButton("Save Overlay",actionPerformed=saveOverlay)
        self.Panel.add(self.saveOlButton) 
        self.quitButton = JButton("Quit script",actionPerformed=quit)
        self.Panel.add(self.quitButton)
        self.frame.pack()
        WindowManager.addWindow(self.frame)
        self.show()
Beispiel #43
0
 def __init__(self, group, chatui):
     GroupConversation.__init__(self, group, chatui)
     self.mainframe = JFrame(self.group.name)
     self.headers = ["Member"]
     self.memberdata = UneditableTableModel([], self.headers)
     self.display = JTextArea(columns=100, rows=15, editable=0, lineWrap=1)
     self.typepad = JTextField()
     self.buildpane()
     self.lentext = 0
    def initUI(self):
       
        self.panel = JPanel(size=(50,50))
        

        self.panel.setLayout(FlowLayout( ))
        self.panel.setToolTipText("GPU Demo")

#TODO- change this so that it deletes itself when text is entered
        self.textfield1 = JTextField('Smoothing Parameter',15)        
        self.panel.add(self.textfield1)
      
        joclButton = JButton("JOCL",actionPerformed=self.onJocl)
        joclButton.setBounds(100, 500, 100, 30)
        joclButton.setToolTipText("JOCL Button")
        self.panel.add(joclButton)
        
        javaButton = JButton("Java",actionPerformed=self.onJava)
        javaButton.setBounds(100, 500, 100, 30)
        javaButton.setToolTipText("Java Button")
        self.panel.add(javaButton)

        qButton = JButton("Quit", actionPerformed=self.onQuit)
        qButton.setBounds(200, 500, 80, 30)
        qButton.setToolTipText("Quit Button")
        self.panel.add(qButton)
        newImage = ImageIO.read(io.File(getDataDir() + "input.png"))
        resizedImage =  newImage.getScaledInstance(600, 600,10)
        newIcon = ImageIcon(resizedImage)
        label1 = JLabel("Input Image",newIcon, JLabel.CENTER)

        label1.setVerticalTextPosition(JLabel.TOP)
        label1.setHorizontalTextPosition(JLabel.RIGHT)
        label1.setSize(10,10)
        label1.setBackground(Color.orange)
        self.panel.add(label1)
        
        self.getContentPane().add(self.panel)
        
        self.clockLabel = JLabel()
        self.clockLabel.setSize(1,1)
        self.clockLabel.setBackground(Color.orange)
        
        self.clockLabel.setVerticalTextPosition(JLabel.BOTTOM)
        self.clockLabel.setHorizontalTextPosition(JLabel.LEFT)
        
        myClockFont = Font("Serif", Font.PLAIN, 50)
        self.clockLabel.setFont(myClockFont)
        
        
        self.panel.add(self.clockLabel)
        
        self.setTitle("Structure-oriented smoothing OpenCL Demo")
        self.setSize(1200, 700)
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setLocationRelativeTo(None)
        self.setVisible(True)
    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
Beispiel #46
0
def loadStiData(idv):
	hostField = JTextField('',30);
	userField = JTextField('',30);
	passwordField = JPasswordField('',30);
	comps = ArrayList();
	comps.add(JLabel("Database Host:"));
	comps.add(GuiUtils.inset(hostField,4));
	comps.add(JLabel("User Name:"));
	comps.add(GuiUtils.inset(userField,5));
	comps.add(JLabel("Password:"));
	comps.add(GuiUtils.inset(passwordField,5));
	contents = GuiUtils.doLayout(comps, 2,GuiUtils.WT_N, GuiUtils.WT_N);	
	contents =GuiUtils.inset(contents,5);
	ok = GuiUtils.showOkCancelDialog(None,'foo',	contents, None);
	if(ok==0):
		return;
	url = 'jdbc:mysql://' + hostField.getText() +':3306/typhoon?zeroDateTimeBehavior=convertToNull&user='******'&password='******'DB.STORMTRACK', None);
Beispiel #47
0
   def initUI(self):

       global outputTextField
       self.panel = JPanel()
       self.panel.setLayout(BorderLayout())

       toolbar = JToolBar()
       openb = JButton("Choose input file", actionPerformed=self.onClick)
       outputLabel = JLabel("   Enter output file name:  ")
       outputTextField = JTextField("hl7OutputReport.txt", 5)
       print outputTextField.getText()


     


       toolbar.add(openb)
       toolbar.add(outputLabel)
       toolbar.add(outputTextField)
      

       self.area = JTextArea()
       self.area.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10))
       self.area.setText("Select your HL7 ORU messages text file to be converted to tab-delimited flat \nfile with select HL7 fields.\n")
       self.area.append("You can enter the path + file name for your output file or it will default to the current \nfile name in the text field above in your current working directory.")

       pane = JScrollPane()
       pane.getViewport().add(self.area)

       self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10))
       self.panel.add(pane)
       self.add(self.panel)

       self.add(toolbar, BorderLayout.NORTH)


       self.setTitle("HL7 ORU Results Reporter")
       self.setSize(600, 300)
       self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
       self.setLocationRelativeTo(None)
       self.setVisible(True)
       return outputTextField.getText()
    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())
Beispiel #49
0
 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
Beispiel #50
0
 def __init__(self, person, chatui):
     """ConversationWindow(basesupport.AbstractPerson:person)"""
     Conversation.__init__(self, person, chatui)
     self.mainframe = JFrame("Conversation with "+person.name)
     self.display = JTextArea(columns=100,
                              rows=15,
                              editable=0,
                              lineWrap=1)
     self.typepad = JTextField()
     self.buildpane()
     self.lentext = 0
Beispiel #51
0
    def __init__(self, app):
        strings = app.strings

        self.setLayout(GridLayout(3, 2, 5, 5))
        userLbl = JLabel(strings.getString("osmose_pref_username"))
        self.userTextField = JTextField(20)
        self.userTextField.setToolTipText(strings.getString("osmose_pref_username_tooltip"))

        levelLbl = JLabel(strings.getString("osmose_pref_level"))
        self.levels = ["1", "1,2", "1,2,3", "2", "3"]
        self.levelsCombo = JComboBox(self.levels)
        self.levelsCombo.setToolTipText(strings.getString("osmose_pref_level_tooltip"))

        limitLbl = JLabel(strings.getString("osmose_pref_limit"))
        self.limitTextField = JTextField(20)
        self.limitTextField.setToolTipText(strings.getString("osmose_pref_limit_tooltip"))

        self.add(userLbl)
        self.add(self.userTextField)
        self.add(levelLbl)
        self.add(self.levelsCombo)
        self.add(limitLbl)
        self.add(self.limitTextField)
Beispiel #52
0
 def __init__(self):
     """ generated source for method __init__ """
     super(HumanDetailPanel, self).__init__(GridBagLayout())
     model = DefaultTableModel()
     model.addColumn("Legal Moves")
     self.moveTable = JZebraTable(model)
     self.selectButton = JButton(selectButtonMethod())
     self.moveTextField = JTextField()
     self.timerBar = JTimerBar()
     self.selection = None
     self.moveTable.setShowHorizontalLines(True)
     self.moveTable.setShowVerticalLines(True)
     self.moveTextField.setEditable(False)
     self.add(JScrollPane(self.moveTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, Insets(5, 5, 5, 5), 5, 5))
     self.add(self.selectButton, GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, Insets(5, 5, 5, 5), 0, 0))
     self.add(self.moveTextField, GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, Insets(5, 5, 5, 5), 5, 5))
     self.add(self.timerBar, GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, Insets(5, 5, 5, 5), 5, 5))
def getGUI(sym_dict):
	global frame, outCheckbox, fillCheckbox, slider, colorTF, widthTF
	frame = JFrame("Border Symbology", defaultCloseOperation=JFrame.DISPOSE_ON_CLOSE, 
		       bounds=(100, 100, 450, 200), layout=FlowLayout(), resizable=0)

	colorL = JLabel('Color: ')
	colorTF = JTextField(20)
	color = sym_dict["color"]
	color = Color(color.getRed(), color.getGreen(), color.getBlue(), sym_dict["alpha"])
	colorTF.setBackground(color)
	colorTF.setText(color.toString())

	colorB = JButton('...', actionPerformed=colorChooser)
	frame.add(colorL)
	frame.add(colorTF)
	frame.add(colorB)

	widthL = JLabel('Width: ')
	widthTF = JTextField(3)
	widthTF.setText(str(sym_dict["width"]))
	frame.add(widthL)
	frame.add(widthTF)

	alphaL = JLabel('Transparency: ')
	frame.add(alphaL)

	# Create a horizontal slider with min=0, max=100, value=50
	slider = JSlider()
	slider.setPreferredSize(Dimension(200, 50))
	slider.setValue(sym_dict["alpha"]*100/255)
	slider.setMajorTickSpacing(25)
	slider.setMinorTickSpacing(5)
	slider.setPaintTicks(1)
	slider.setPaintLabels(1)

	applyButton = JButton("Apply", actionPerformed=action)
	acceptButton = JButton("Accept", actionPerformed=accept)

	frame.add(slider)
	frame.add(applyButton)
	frame.add(acceptButton)

	frame.show()
Beispiel #54
0
	def __init__(self): # constructor 
		#origing of coordinates
		self.coordx = 300
		self.coordy = 50

		self.imageCount = 0 #a counter for the image list
		self.listendFlag = 0 #some values to check
		#inintialize values
		self.imLeft = None
		self.imRight = None
		self.chosenOne = None
		self.chosenIm = None
		#create panel (what is inside the GUI)
		self.panel = self.getContentPane()
		self.panel.setLayout(GridLayout(5,2))

		#define buttons here:
		quitButton = JButton("Quit", actionPerformed=self.quit)
		loadButton = JButton("Load", actionPerformed=self.load)
		leftButton = JButton("Choose Left", actionPerformed = self.ChooseLeft)
		rightButton = JButton("Choose Right", actionPerformed = self.ChooseRight)
		ThresButton = JButton("Threshold",actionPerformed = self.ImThresh)
		self.ThreshField = JTextField("5", 1)
		StartConversionButton = JButton("Start Conversion", actionPerformed = self.StartConv)
		ConvertButton = JButton("Convert Image", actionPerformed = self.ImConvert)
		
		#Zslider = JSlider(JSlider.HORIZONTAL,0, 100, 0)

		#add buttons here
		self.panel.add(loadButton)
		self.panel.add(quitButton)
		self.panel.add(leftButton)
		self.panel.add(rightButton)
		self.panel.add(self.ThreshField)
		self.panel.add(ThresButton)
		self.panel.add(StartConversionButton)
		self.panel.add(ConvertButton)
		#self.panel.add(Zslider)

       	#other stuff to improve the look
		self.pack() # packs the frame
		self.setVisible(True) # shows the JFrame
		self.setLocation(0,self.coordy+200)
Beispiel #55
0
class SwingLoginDialog(JDialog):
    
    def __init__(self):
        self.username=""
        self.password=""
        self.okPressed=False
        self.userField=JTextField(15)
        self.passField=JPasswordField(15)
        
        self.setTitle("Login")
        self.setModal(True)
        self.setAlwaysOnTop(True)
        self.setLocationRelativeTo(None)
        pane = self.getContentPane()
        pane.setLayout(GridLayout(4,2))
        pane.add(JLabel("Username:"******"Password:"******"OK", actionPerformed=self.okClick)
        pane.add(okButton)
        cancelButton=JButton("Cancel", actionPerformed=self.cancelClick)
        pane.add(cancelButton)
        self.pack() 
        
    def okClick(self, e):
        self.okPressed=True
        self.username=self.userField.getText()
        self.password=str(String(self.passField.getPassword()))
        self.setVisible(False)
    
    def cancelClick(self, e):
        self.okPressed=False
        self.setVisible(False)
        
        
    def getLoginInfo(self):
        if self.okPressed:            
            return [self.username, self.password]
        return None
Beispiel #56
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)
Beispiel #57
0
    def build_edit_area_font_panel(self, constraints, panel):
        '''
        Font size on a textfield.
        '''
        fontzise_label = JLabel("Edit area font size:")
        constraints = self.add_constraints(constraints, weightx=0.20,
                                           gridx=0, gridy=4)
        panel.add(fontzise_label, constraints)

        self.edit_area_fs_field = JTextField()
        self.edit_area_fs_field.setEditable(True)
        if self.edit_area_fontsize:
            self.edit_area_fs_field.setText(
                                    "{}".format(self.edit_area_fontsize))
        else:
            self.edit_area_fs_field.setText(self.controller.config[
                                    'edit_area_style']['fontsize']['default'])

        constraints = self.add_constraints(constraints, weightx=0.80,
                                           gridx=1, gridy=4,
                                           fill=GridBagConstraints.HORIZONTAL)
        panel.add(self.edit_area_fs_field, constraints)
Beispiel #58
0
 def __init__(self):
     self.username=""
     self.password=""
     self.okPressed=False
     self.userField=JTextField(15)
     self.passField=JPasswordField(15)
     
     self.setTitle("Login")
     self.setModal(True)
     self.setAlwaysOnTop(True)
     self.setLocationRelativeTo(None)
     pane = self.getContentPane()
     pane.setLayout(GridLayout(4,2))
     pane.add(JLabel("Username:"******"Password:"******"OK", actionPerformed=self.okClick)
     pane.add(okButton)
     cancelButton=JButton("Cancel", actionPerformed=self.cancelClick)
     pane.add(cancelButton)
     self.pack() 
Beispiel #59
0
 def __init__(self, title=""):
     JFrame.__init__(self, title)
     self.size = 400,500
     self.windowClosing = self.closing
     
     label = JLabel(text="Class Name:") 
     label.horizontalAlignment = JLabel.RIGHT
     tpanel = JPanel(layout = awt.FlowLayout())
     self.text = JTextField(20, actionPerformed = self.entered)
     btn = JButton("Enter", actionPerformed = self.entered)
     tpanel.add(label)
     tpanel.add(self.text)
     tpanel.add(btn)
 
     bpanel = JPanel()
     self.tree = JTree(default_tree())
     scrollpane = JScrollPane(self.tree)
     scrollpane.setMinimumSize(awt.Dimension(200,200))
     scrollpane.setPreferredSize(awt.Dimension(350,400))
     bpanel.add(scrollpane)
     
     bag = GridBag(self.contentPane)
     bag.addRow(tpanel, fill='HORIZONTAL', weightx=1.0, weighty=0.5)
     bag.addRow(bpanel, fill='BOTH', weightx=0.5, weighty=1.0) 
Beispiel #60
0
    def registerExtenderCallbacks(self, callbacks):
        # Initialize the global stdout stream
        global stdout

        # 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("Burpsuite Yara Scanner")

        # Create the log and a lock on which to synchronize when adding log entries
        self._log = ArrayList()
        self._lock = Lock()

        # main split pane
        splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT)

        # table of log entries
        logTable = Table(self)
        scrollPane = JScrollPane(logTable)
        splitpane.setLeftComponent(scrollPane)

        # Options panel
        optionsPanel = JPanel()
        optionsPanel.setLayout(GridBagLayout())
        constraints = GridBagConstraints()

        yara_exe_label = JLabel("Yara Executable Location:")
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.gridx = 0
        constraints.gridy = 0
        optionsPanel.add(yara_exe_label, constraints)

        self._yara_exe_txtField = JTextField(25)
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.gridx = 1
        constraints.gridy = 0
        optionsPanel.add(self._yara_exe_txtField, constraints)

        yara_rules_label = JLabel("Yara Rules File:")
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.gridx = 0
        constraints.gridy = 1
        optionsPanel.add(yara_rules_label, constraints)
		
        self._yara_rules_files = Vector()
        self._yara_rules_files.add("< None >")
        self._yara_rules_fileList = JList(self._yara_rules_files)
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.gridx = 1
        constraints.gridy = 1
        optionsPanel.add(self._yara_rules_fileList, constraints)
        
        self._yara_rules_select_files_button = JButton("Select Files")
        self._yara_rules_select_files_button.addActionListener(self)
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.gridx = 1
        constraints.gridy = 2
        optionsPanel.add(self._yara_rules_select_files_button, constraints)

        self._yara_clear_button = JButton("Clear Yara Results Table")
        self._yara_clear_button.addActionListener(self)
        constraints.fill = GridBagConstraints.HORIZONTAL
        constraints.gridx = 1
        constraints.gridy = 3
        optionsPanel.add(self._yara_clear_button, constraints)

        # Tabs with request/response viewers
        viewerTabs = JTabbedPane()
        self._requestViewer = callbacks.createMessageEditor(self, False)
        self._responseViewer = callbacks.createMessageEditor(self, False)
        viewerTabs.addTab("Request", self._requestViewer.getComponent())
        viewerTabs.addTab("Response", self._responseViewer.getComponent())
        splitpane.setRightComponent(viewerTabs)

        # Tabs for the Yara output and the Options
        self._mainTabs = JTabbedPane()
        self._mainTabs.addTab("Yara Output", splitpane)
        self._mainTabs.addTab("Options", optionsPanel)

        # customize our UI components
        callbacks.customizeUiComponent(splitpane)
        callbacks.customizeUiComponent(logTable)
        callbacks.customizeUiComponent(scrollPane)
        callbacks.customizeUiComponent(viewerTabs)
        callbacks.customizeUiComponent(self._mainTabs)

        # add the custom tab to Burp's UI
        callbacks.addSuiteTab(self)

        # add ourselves as a context menu factory
        callbacks.registerContextMenuFactory(self)

        # Custom Menu Item
        self.menuItem = JMenuItem("Scan with Yara")
        self.menuItem.addActionListener(self)

        # obtain our output stream
        stdout = PrintWriter(callbacks.getStdout(), True)

        # Print a startup notification
        stdout.println("Burpsuite Yara scanner initialized.")