Пример #1
0
    def __init__(self, parent):
        self.parent = parent

        Panel = swing.JPanel()
        Panel.layout = awt.BorderLayout()
        Panel.border = swing.BorderFactory.createTitledBorder(
            "Payload Encoder")
        self.text = swing.JTextField(actionPerformed=self.encodePayload)
        Panel.add(self.text, Panel.layout.PAGE_START)

        self.textArea = swing.JTextArea()
        scrollPane = swing.JScrollPane(self.textArea)

        Panel.add(scrollPane, Panel.layout.CENTER)

        Panel1 = swing.JPanel()
        Panel1.layout = awt.BorderLayout()
        Panel1.border = swing.BorderFactory.createTitledBorder(
            "Payload Parser")
        self.text1 = swing.JTextField(actionPerformed=self.parsePayload)
        Panel1.add(self.text1, Panel1.layout.PAGE_START)

        self.textArea1 = swing.JTextArea()
        scrollPane1 = swing.JScrollPane(self.textArea1)

        Panel1.add(scrollPane1, Panel1.layout.CENTER)

        self.splitPane = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT)

        self.splitPane.setDividerLocation(250)
        self.splitPane.setLeftComponent(Panel)
        self.splitPane.setRightComponent(Panel1)

        self.parent.addTabPanel("Options", self.splitPane)
Пример #2
0
    def __init__(self,
                 locals={},
                 fullColoringLimit=sys.maxint,
                 *args,
                 **kwargs):
        swing.JPanel.__init__(self, *args, **kwargs)
        self.diff_func = None
        self.locals = locals
        self.input = JScrapbookInput(self, fullColoringLimit=fullColoringLimit)
        self.output = JScrapbookOutput()

        self.split_pane = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
        self.split_pane.setLeftComponent(self.input)
        self.split_pane.setRightComponent(self.output)
        self.input.setMinimumSize(java.awt.Dimension(100, 100))
        self.output.setMinimumSize(java.awt.Dimension(100, 100))

        self.setLayout(BorderLayout())
        self.add(self.split_pane, BorderLayout.CENTER)

        header = "Jython %(version)s on %(platform)s\n\n\n" % {
            'version': sys.version,
            'platform': sys.platform
        }
        self.output.print_to_stdout(header)
Пример #3
0
    def __init__(self):
        self.frame=swing.JFrame(title="Simple Jython Interpreter", size=(600,500))
        self.frame.defaultCloseOperation=swing.JFrame.EXIT_ON_CLOSE;
        self.frame.layout=awt.BorderLayout()
        self.panel1=swing.JPanel(awt.BorderLayout())
        self.panel2=swing.JPanel(awt.BorderLayout())


        self.title=swing.JLabel("Jython Code")
        self.title2 = swing.JLabel("Interpreter Output")
        self.button1=swing.JButton("Run", actionPerformed=self.printMessage)
        self.button2=swing.JButton("Clear Output", actionPerformed=self.clearMessage)

        self.buttonPane = swing.JPanel()
        self.buttonPane.layout = swing.BoxLayout(self.buttonPane, swing.BoxLayout.LINE_AXIS)
        self.buttonPane.border = swing.BorderFactory.createEmptyBorder(0, 10, 10, 10)
        self.buttonPane.add(swing.Box.createHorizontalGlue())
        self.buttonPane.add(self.button1)
        self.buttonPane.add(swing.Box.createRigidArea(awt.Dimension(10, 0)))
        self.buttonPane.add(self.button2)

        self.textField=swing.JTextArea(4,15)
        self.textField.lineWrap = True
        self.scrollPaneOne = swing.JScrollPane(self.textField)
        self.scrollPaneOne.verticalScrollBarPolicy = swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
        self.outputText=swing.JTextArea(4,15)
        self.outputText.lineWrap = True
        self.outputText.editable = False
        self.scrollPane2 = swing.JScrollPane(self.outputText)
        self.scrollPane2.verticalScrollBarPolicy = swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS
        

        self.panel1.add(self.title, awt.BorderLayout.PAGE_START)
        self.panel1.add(self.scrollPaneOne, awt.BorderLayout.CENTER)
        self.panel2.add(self.title2, awt.BorderLayout.PAGE_START)
        self.panel2.add(self.scrollPane2, awt.BorderLayout.CENTER)

        self.splitPane = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT,
                         self.panel1, self.panel2)
        self.splitPane.oneTouchExpandable = True
        self.minimumSize = awt.Dimension(50, 100)
        self.panel1.minimumSize = self.minimumSize
        self.panel2.minimumSize = self.minimumSize

        self.frame.contentPane.add(self.splitPane, awt.BorderLayout.CENTER)
        self.frame.contentPane.add(self.buttonPane, awt.BorderLayout.PAGE_END)
Пример #4
0
    def __init__(self, client, gameName):
        swing.JFrame.__init__(self)
        self.server = client.server
        self.client = client
        self.gameName = gameName
        self.players = []
        self.calcTitle()
        self.windowClosing = self.onClose

        self.field = Field(self.server)
        self.infoArea = InfoArea(self.server)
        self.field.selectedCardPanel = self.infoArea.selectedCardPanel
        self.infoArea.selectedCardPanel.field = self.field

        self.split = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT,
                                      self.infoArea, self.field)
        self.split.oneTouchExpandable = 1

        self.contentPane.add(self.split)
        self.size = 600, 400
        self.show()
        #        self.extendedState=awt.Frame.MAXIMIZED_BOTH
        self.split.setDividerLocation(150)
Пример #5
0
    def registerExtenderCallbacks(self, callbacks):

        # Make available to whole class
        self._callbacks = callbacks

        # obtain an extension helpers object
        self._helpers = callbacks.getHelpers()

        # set our extension name
        callbacks.setExtensionName("MitM helper plugin for drozer")

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

        # Split pane
        self._splitpane = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)

        # Create Tab
        topPanel = swing.JPanel()
        topPanel.setLayout(swing.BoxLayout(topPanel, swing.BoxLayout.Y_AXIS))

        # Define all tools
        self.tools = []
        self.tools.append(
            Tool(180, "JavaScript Injection",
                 "Inject Remote JS into HTTP Responses", self.nothing,
                 self.injectJs, "JS Location", "http://x.x.x.x:31415/dz.js"))
        self.tools.append(
            Tool(180, "APK Replacement",
                 "Replace APK with specified one when requested",
                 self.modifyAPKRequest, self.injectAPK, "APK Location", "",
                 True))
        self.tools.append(
            Tool(
                170, "Invoke drozer using pwn://",
                "Inject code into HTTP Responses that invokes installed drozer agent",
                self.nothing, self.injectPwn, None, None, None,
                "Perform active invocation (required for Chromium >= 25)"))
        self.tools.append(
            Tool(
                220, "Custom URI Handler Injection",
                "Inject code into HTTP Responses that invokes specified URI handler",
                self.nothing, self.injectCustomURI, "URI", "pwn://me", None,
                "Perform active invocation (required for Chromium >= 25)"))

        # Add all tools to panel
        for i in self.tools:
            topPanel.add(i.getPanel())
        self._splitpane.setLeftComponent(topPanel)

        # table of log entries
        logTable = Table(self)
        logTable.setAutoResizeMode(swing.JTable.AUTO_RESIZE_ALL_COLUMNS)

        logTable.getColumn("Time").setPreferredWidth(120)
        logTable.getColumn("URL").setPreferredWidth(500)

        scrollPane = swing.JScrollPane(logTable)
        self._splitpane.setRightComponent(scrollPane)

        # customize our UI components
        callbacks.customizeUiComponent(self._splitpane)
        callbacks.customizeUiComponent(logTable)
        callbacks.customizeUiComponent(scrollPane)
        callbacks.customizeUiComponent(topPanel)

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

        # register ourselves as an HTTP listener
        callbacks.registerHttpListener(self)

        return
Пример #6
0
    def showGui(self):
        self.rtvIntJobs()

        self.btnRef = swing.JButton("Refresh List", \
                                    actionPerformed = self.btnActRef, \
                                    minimumSize=(100,25), \
                                    preferredSize=(100, 25))
        self.btnRef.setMnemonic('R')
        self.btnSnd = swing.JButton("Send Message", \
                                    actionPerformed = self.btnActSnd)
        self.btnSnd.setMnemonic('S')
        self.label1 = swing.JLabel("Send To:", minimumSize=(50, 25), \
                                   preferredSize=(50, 25))
        self.rootPane.setDefaultButton(self.btnSnd)
        self.rpyTxt.setEditable(0)      # <Scrollable message reply text area>
        self.statusTxt = swing.JTextField(text='Welcome to CHAT400 - An AS/400 Instant Messenger',\
                                          editable=0, horizontalAlignment=swing.JTextField.CENTER)

        gbc = awt.GridBagConstraints()
        # Build the screen
        # Label 'send to'
        gbc.insets = awt.Insets(10, 10, 5, 5)
        self.contentPane.add(self.label1, gbc)
        # Combobox list of users
        gbc.insets = awt.Insets(10, 5, 5, 5)
        self.contentPane.add(self.users, gbc)
        # Refresh User-List Button
        gbc.insets = awt.Insets(10, 5, 5, 10)
        self.contentPane.add(self.btnRef, gbc)
        # Active Users checkbox
        gbc.gridx = 0
        gbc.gridwidth = 3
        gbc.insets = awt.Insets(0, 0, 5, 0)
        self.contentPane.add(self.chkActive, gbc)
        # Send Message Button
        gbc.gridx = 0
        gbc.gridwidth = 3
        gbc.insets = awt.Insets(5, 0, 5, 0)
        self.contentPane.add(self.btnSnd, gbc)
        # Build the SplitPane (2 scrollpanes)
        scrollPane1 = swing.JScrollPane(self.chatTxt, swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, \
        swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)
        scrollPane1.setViewportView(self.chatTxt)
        scrollPane2 = swing.JScrollPane(self.rpyTxt, swing.JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, \
        swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER)
        scrollPane2.setViewportView(self.rpyTxt)
        splitPane = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT, scrollPane1, scrollPane2)
        # Add the SplitPane
        gbc.gridx = 0
        gbc.gridwidth = 3
        gbc.fill = awt.GridBagConstraints.HORIZONTAL
        gbc.insets = awt.Insets(5, 10, 10, 10)
        self.contentPane.add(splitPane, gbc)
        # Add a status-textfield on the bottom, to display status or errors
        gbc.gridx = 0
        gbc.gridwidth = 3
        gbc.fill = awt.GridBagConstraints.HORIZONTAL
        gbc.insets = awt.Insets(0, 10, 10, 10)
        self.contentPane.add(self.statusTxt, gbc)

        self.pack()
        self.polchat.start()

        self.show()
Пример #7
0
    def drawUI(self):
        self.tab = swing.JPanel()
        self.uiLabel = swing.JLabel('Site Map Extractor Options')
        self.uiLabel.setFont(Font('Tahoma', Font.BOLD, 14))
        self.uiLabel.setForeground(Color(235, 136, 0))

        self.uiScopeOnly = swing.JRadioButton('In-scope only', True)
        self.uiScopeAll = swing.JRadioButton('Full site map', False)
        self.uiScopeButtonGroup = swing.ButtonGroup()
        self.uiScopeButtonGroup.add(self.uiScopeOnly)
        self.uiScopeButtonGroup.add(self.uiScopeAll)

        self.uipaneA = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
        self.uipaneA.setMaximumSize(Dimension(900, 125))
        self.uipaneA.setDividerSize(2)
        self.uipaneB = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
        self.uipaneB.setDividerSize(2)
        self.uipaneA.setRightComponent(self.uipaneB)
        self.uipaneA.setBorder(BorderFactory.createLineBorder(Color.black))

        # UI for Export <a href Links
        self.uiLinksPanel = swing.JPanel()
        self.uiLinksPanel.setPreferredSize(Dimension(200, 75))
        self.uiLinksPanel.setBorder(EmptyBorder(10, 10, 10, 10))
        self.uiLinksPanel.setLayout(BorderLayout())
        self.uiLinksLabel = swing.JLabel("Extract '<a href=' Links")
        self.uiLinksLabel.setFont(Font('Tahoma', Font.BOLD, 14))
        self.uiLinksAbs = swing.JCheckBox('Absolute     ', True)
        self.uiLinksRel = swing.JCheckBox('Relative     ', True)
        # create a subpanel so Run button will be centred
        self.uiLinksRun = swing.JButton('Run',
                                        actionPerformed=self.extractLinks)
        self.uiLinksSave = swing.JButton('Save Log to CSV File',
                                         actionPerformed=self.savetoCsvFile)
        self.uiLinksClear = swing.JButton('Clear Log',
                                          actionPerformed=self.clearLog)
        self.uiLinksButtonPanel = swing.JPanel()
        self.uiLinksButtonPanel.add(self.uiLinksRun)
        self.uiLinksButtonPanel.add(self.uiLinksSave)
        self.uiLinksButtonPanel.add(self.uiLinksClear)
        # add all elements to main Export Links panel
        self.uiLinksPanel.add(self.uiLinksLabel, BorderLayout.NORTH)
        self.uiLinksPanel.add(self.uiLinksAbs, BorderLayout.WEST)
        self.uiLinksPanel.add(self.uiLinksRel, BorderLayout.CENTER)
        self.uiLinksPanel.add(self.uiLinksButtonPanel, BorderLayout.SOUTH)
        self.uipaneA.setLeftComponent(
            self.uiLinksPanel)  # add Export Links panel to splitpane

        # UI for Export Response Codes
        self.uiCodesPanel = swing.JPanel()
        self.uiCodesPanel.setPreferredSize(Dimension(200, 75))
        self.uiCodesPanel.setBorder(EmptyBorder(10, 10, 10, 10))
        self.uiCodesPanel.setLayout(BorderLayout())
        self.uiCodesLabel = swing.JLabel('Extract Response Codes')
        self.uiCodesLabel.setFont(Font('Tahoma', Font.BOLD, 14))
        self.uiRcodePanel = swing.JPanel()
        self.uiRcodePanel.setLayout(GridLayout(1, 1))
        self.uiRcode1xx = swing.JCheckBox('1XX  ', False)
        self.uiRcode2xx = swing.JCheckBox('2XX  ', True)
        self.uiRcode3xx = swing.JCheckBox('3XX  ', True)
        self.uiRcode4xx = swing.JCheckBox('4XX  ', True)
        self.uiRcode5xx = swing.JCheckBox('5XX  ', True)
        self.uiCodesRun = swing.JButton('Run',
                                        actionPerformed=self.exportCodes)
        self.uiCodesSave = swing.JButton('Save Log to CSV File',
                                         actionPerformed=self.savetoCsvFile)
        self.uiCodesClear = swing.JButton('Clear Log',
                                          actionPerformed=self.clearLog)
        self.uiCodesButtonPanel = swing.JPanel()
        self.uiCodesButtonPanel.add(self.uiCodesRun)
        self.uiCodesButtonPanel.add(self.uiCodesSave)
        self.uiCodesButtonPanel.add(self.uiCodesClear)
        self.uiRcodePanel.add(self.uiRcode1xx)
        self.uiRcodePanel.add(self.uiRcode2xx)
        self.uiRcodePanel.add(self.uiRcode3xx)
        self.uiRcodePanel.add(self.uiRcode4xx)
        self.uiRcodePanel.add(self.uiRcode5xx)
        self.uiCodesPanel.add(self.uiCodesLabel, BorderLayout.NORTH)
        self.uiCodesPanel.add(self.uiRcodePanel, BorderLayout.WEST)
        self.uiCodesPanel.add(self.uiCodesButtonPanel, BorderLayout.SOUTH)
        self.uipaneB.setLeftComponent(self.uiCodesPanel)

        # Option 3 UI for Export Sitemap
        self.uiExportPanel = swing.JPanel()
        self.uiExportPanel.setPreferredSize(Dimension(200, 75))
        self.uiExportPanel.setBorder(EmptyBorder(10, 10, 10, 10))
        self.uiExportPanel.setLayout(BorderLayout())
        self.uiExportLabel = swing.JLabel('Export Site Map to File')
        self.uiExportLabel.setFont(Font('Tahoma', Font.BOLD, 14))
        self.uiMustHaveResponse = swing.JRadioButton(
            'Must have a response     ', True)
        self.uiAllRequests = swing.JRadioButton('All     ', False)
        self.uiResponseButtonGroup = swing.ButtonGroup()
        self.uiResponseButtonGroup.add(self.uiMustHaveResponse)
        self.uiResponseButtonGroup.add(self.uiAllRequests)
        self.uiExportRun = swing.JButton('Run',
                                         actionPerformed=self.exportSiteMap)
        self.uiExportClear = swing.JButton('Clear Log',
                                           actionPerformed=self.clearLog)
        self.uiExportButtonPanel = swing.JPanel()
        self.uiExportButtonPanel.add(self.uiExportRun)
        self.uiExportButtonPanel.add(self.uiExportClear)
        self.uiExportPanel.add(self.uiExportLabel, BorderLayout.NORTH)
        self.uiExportPanel.add(self.uiMustHaveResponse, BorderLayout.WEST)
        self.uiExportPanel.add(self.uiAllRequests, BorderLayout.CENTER)
        self.uiExportPanel.add(self.uiExportButtonPanel, BorderLayout.SOUTH)
        self.uipaneB.setRightComponent(self.uiExportPanel)

        # UI Common Elements
        self.uiLogLabel = swing.JLabel('Log:')
        self.uiLogLabel.setFont(Font('Tahoma', Font.BOLD, 14))
        self.uiLogPane = swing.JScrollPane()
        layout = swing.GroupLayout(self.tab)
        self.tab.setLayout(layout)

        # Thank you to Smeege (https://github.com/SmeegeSec/Burp-Importer/) for helping me figure out how this works.
        # He in turn gave credit to Antonio Sanchez (https://github.com/Dionach/HeadersAnalyzer/)
        layout.setHorizontalGroup(
            layout.createParallelGroup(
                swing.GroupLayout.Alignment.LEADING).addGroup(
                    layout.createSequentialGroup().addGap(10, 10, 10).addGroup(
                        layout.createParallelGroup(
                            swing.GroupLayout.Alignment.LEADING).addComponent(
                                self.uiLabel).addGroup(
                                    layout.createSequentialGroup().addGap(
                                        10, 10, 10).addComponent(
                                            self.uiScopeOnly).addGap(
                                                10, 10, 10).addComponent(
                                                    self.uiScopeAll)).
                        addGap(15, 15,
                               15).addComponent(self.uipaneA).addComponent(
                                   self.uiLogLabel).addComponent(
                                       self.uiLogPane)).addContainerGap(
                                           26, lang.Short.MAX_VALUE)))

        layout.setVerticalGroup(
            layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING).
            addGroup(layout.createSequentialGroup().addGap(
                15, 15,
                15).addComponent(self.uiLabel).addGap(15, 15, 15).addGroup(
                    layout.createParallelGroup().addComponent(
                        self.uiScopeOnly).addComponent(
                            self.uiScopeAll)).addGap(
                                20, 20, 20).addComponent(self.uipaneA).addGap(
                                    20, 20,
                                    20).addComponent(self.uiLogLabel).addGap(
                                        5, 5,
                                        5).addComponent(self.uiLogPane).addGap(
                                            20, 20, 20)))
Пример #8
0
    def __init__(self, movie):
        try:
            self.size = (600, 400)
            self.movie = movie
            self.fps = 30

            # The buttons on the right side

            self.clearButton = swing.JButton(
                COMMAND_CLEAR_IMG, actionPerformed=self.actionPerformed)
            self.addButton = swing.JButton(
                COMMAND_ADD_IMG, actionPerformed=self.actionPerformed)
            self.addDirectoryButton = swing.JButton(
                COMMAND_ADD_DIR, actionPerformed=self.actionPerformed)
            self.deleteButton = swing.JButton(
                COMMAND_DELETE_IMG, actionPerformed=self.actionPerformed)
            self.playButton = swing.JButton(
                COMMAND_PLAY_MOVIE, actionPerformed=self.actionPerformed)
            self.moveUpButton = swing.JButton(
                COMMAND_MOVE_UP, actionPerformed=self.actionPerformed)
            self.moveDownButton = swing.JButton(
                COMMAND_MOVE_DOWN, actionPerformed=self.actionPerformed)
            self.changeFPSButton = swing.JButton(
                COMMAND_CHANGE_FPS, actionPerformed=self.actionPerformed)

            self.buttonpane = swing.JPanel()
            self.buttonpane.setLayout(
                swing.BoxLayout(self.buttonpane, swing.BoxLayout.Y_AXIS))

            self.buttonpane.add(self.clearButton)
            self.buttonpane.add(self.deleteButton)
            self.buttonpane.add(self.addDirectoryButton)
            self.buttonpane.add(self.addButton)
            self.buttonpane.add(self.playButton)
            self.buttonpane.add(self.moveUpButton)
            self.buttonpane.add(self.moveDownButton)
            self.buttonpane.add(self.changeFPSButton)

            # The images on the left side

            self.listModel = swing.DefaultListModel()
            self.list = swing.JList(self.listModel)

            self.listpane = swing.JScrollPane(self.list)
            #self.listpane.setLayout(swing.BoxLayout(self.listpane, swing.BoxLayout.X_AXIS))
            # self.listpane.add(self.list)

            # The splitter pane

            splitterPane = swing.JSplitPane()
            splitterPane.orientation = swing.JSplitPane.HORIZONTAL_SPLIT
            splitterPane.leftComponent = self.listpane
            splitterPane.rightComponent = self.buttonpane
            splitterPane.setDividerSize(SPLITTER_SIZE)
            splitterPane.setDividerLocation(VSPLITTER_LOCATION)
            splitterPane.setResizeWeight(1.0)

            self.add(splitterPane)
            self.addFramesIntoListModel(self.movie)
            self.show()

        except:
            import traceback
            import sys
            a, b, c = sys.exc_info()
            print "FrameSequencerTool exception:"
            traceback.print_exception(a, b, c)
Пример #9
0
    def showQSSPN(self, model):#w# open graph building tabs
        table_node = QSSPNTable(); table_node.write(model, 'Node')
        tab_node = swing.JScrollPane(table_node)
        table_int = QSSPNTable(); table_int.write(model, 'Intact')
        tab_int = swing.JScrollPane(table_int)
        table_sub = QSSPNTable(); table_sub.write(model, 'Sub')
        tab_sub = swing.JScrollPane(table_sub)
        table_actS = QSSPNTable(); table_actS.write(model, 'ActS')
        tab_actS = swing.JScrollPane(table_actS)
        table_met = QSSPNTable(); table_met.write(model, 'Met')
        tab_met = swing.JScrollPane(table_met)
        table_actM = QSSPNTable(); table_actM.write(model, 'ActM')
        tab_actM = swing.JScrollPane(table_actM)
        table_enz = QSSPNTable(); table_enz.write(model, 'Enz')
        tab_enz = swing.JScrollPane(table_enz)
        table_actE = QSSPNTable(); table_actE.write(model, 'ActE')
        tab_actE = swing.JScrollPane(table_actE)
        table_list = QSSPNTable(); table_list.write(model, 'List')
        tab_list = swing.JScrollPane(table_list)
        splitPane_int = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
        splitPane_sub = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT)
        panel_int = swing.JPanel().add(tab_int)
        splitPane_int.setLeftComponent(panel_int)
        panel_sub = swing.JPanel().add(tab_sub)
        panel_actS = swing.JPanel().add(tab_actS)
        splitPane_sub.setTopComponent(panel_sub)
        splitPane_sub.setBottomComponent(panel_actS)
        splitPane_int.setRightComponent(splitPane_sub)
        splitPane_int.setDividerLocation(520)
        splitPane_sub.setDividerLocation(300)
#        splitPane_int.setResizeWeight(1)
#        splitPane_sub.setResizeWeight(0.5)

        splitPane_met = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
        panel_met = swing.JPanel().add(tab_met)
        splitPane_met.setLeftComponent(panel_met)
        panel_actM = swing.JPanel().add(tab_actM)
        splitPane_met.setRightComponent(panel_actM)
        splitPane_met.setDividerLocation(500)

        splitPane_enz = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
        splitPane_actList = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT)
        panel_enz = swing.JPanel().add(tab_enz)
        splitPane_enz.setLeftComponent(panel_enz)
        panel_actE = swing.JPanel().add(tab_actE)
        panel_list = swing.JPanel().add(tab_list)
        splitPane_actList.setTopComponent(panel_actE)
        splitPane_actList.setBottomComponent(panel_list)
        splitPane_enz.setRightComponent(splitPane_actList)
        splitPane_enz.setDividerLocation(500)
        splitPane_actList.setDividerLocation(250)

        self.addTab('PN nodes', tab_node)
        self.addTab('Interactions', splitPane_int)
        self.addTab('Metabolites', splitPane_met)
        self.addTab('Enzymes', splitPane_enz)
#        tabs.setToolTipTextAt(tabs.indexOfTab('PN nodes'), 'define reactions into graph-groups ')
#        tabs.setToolTipTextAt(tabs.indexOfTab('Interactions'), 'list of graph-groups')
#        tabs.setToolTipTextAt(tabs.indexOfTab('Metabolites'), 'reactions and related metabolites for a group')
#        tabs.setToolTipTextAt(tabs.indexOfTab('Enzymes'), 'map between name and tag')
#        TabCloser('QSSPN').put(tabs, self)
        table_actS.setRowSorter(None)
        table_actM.setRowSorter(None)
        table_actE.setRowSorter(None)
        table_node.setColWidths_gsa(self.getWidth())
        table_int.setColWidths_gsa(self.getWidth())
        table_sub.setColWidths_gsa(self.getWidth())
        table_actS.setColWidths_gsa(self.getWidth())
        table_met.setColWidths_gsa(self.getWidth())
        table_actM.setColWidths_gsa(self.getWidth())
        table_enz.setColWidths_gsa(self.getWidth())
        table_actE.setColWidths_gsa(self.getWidth())
        table_list.setColWidths_gsa(self.getWidth())
        #add listeners
        SeModel = table_int.getSelectionModel()
        SeModel.addListSelectionListener(QSSPN.Table.SelectionListenerInt(table_int, table_sub, table_actS, self.qsspn, self.curtable))
        SeModel = table_sub.getSelectionModel()
        SeModel.addListSelectionListener(QSSPN.Table.SelectionListenerSub(table_sub, table_actS, self.curtable))
        SeModel = table_actS.getSelectionModel()
        SeModel.addListSelectionListener(QSSPN.Table.SelectionListenerActS(table_actS, self.curtable))
        SeModel = table_met.getSelectionModel()
        SeModel.addListSelectionListener(QSSPN.Table.SelectionListenerMet(table_met, table_actM, self.curtable))
        SeModel = table_actM.getSelectionModel()
        SeModel.addListSelectionListener(QSSPN.Table.SelectionListenerActM(table_actM, self.curtable))
        SeModel = table_enz.getSelectionModel()
        SeModel.addListSelectionListener(QSSPN.Table.SelectionListenerEnz(table_enz, table_actE, table_list, self.curtable))
        SeModel = table_actE.getSelectionModel()
        SeModel.addListSelectionListener(QSSPN.Table.SelectionListenerActE(table_actE, self.curtable))
        SeModel = table_list.getSelectionModel()
        SeModel.addListSelectionListener(QSSPN.Table.SelectionListenerList(table_list, self.curtable))
Пример #10
0
    def getUiComponent(self):
        # Create the tab
        self.tab = swing.JPanel(BorderLayout())

        # Created a tabbed pane to go in the center of the
        # main tab, below the text area
        tabbedPane = swing.JTabbedPane()
        self.tab.add("Center", tabbedPane)

        # First tab
        parseTab = swing.JPanel(BorderLayout())
        tabbedPane.addTab("Parser", parseTab)

        # Second tab
        enumTab = swing.JPanel(BorderLayout())
        tabbedPane.addTab("Enumerate Functions", enumTab)

        # Create a vertical box to house GWT message and label
        # Create a horizontal box for GWT-RPC text box's label
        # Add the label to the horizontal box
        # Add the horizontal box to the vertical box
        gwtMessageBoxVertical = swing.Box.createVerticalBox()
        gwtLabelBoxHorizontal = swing.Box.createHorizontalBox()
        gwtRPCTextLabel = swing.JLabel("GWT-RPC Message")
        gwtLabelBoxHorizontal.add(gwtRPCTextLabel)
        gwtMessageBoxVertical.add(gwtLabelBoxHorizontal)

        # Create a horizontal text box to house the GWT message itself
        # Add text area to message box
        # Add new box to gwtMessageBoxVertical
        gwtMessageTextBoxHorizontal = swing.Box.createHorizontalBox()
        self.gwtTextArea = swing.JTextArea('', 4, 120)
        self.gwtTextArea.setLineWrap(True)
        gwtMessageTextBoxHorizontal.add(self.gwtTextArea)
        gwtMessageBoxVertical.add(gwtMessageTextBoxHorizontal)

        #
        gwtParseButtonBoxHorizontal = swing.Box.createHorizontalBox()
        parseButtonPanel = swing.JPanel()
        parseButtonPanel.add(
            swing.JButton('Parse', actionPerformed=self.parseGWT))
        gwtParseButtonBoxHorizontal.add(parseButtonPanel)
        gwtMessageBoxVertical.add(gwtParseButtonBoxHorizontal)

        # Panel for the boxes. Each label and text field
        # will go in horizontal boxes which will then go in
        # a vertical box

        parseTabGWTMessageBoxHorizontal = swing.Box.createHorizontalBox()
        parseTabGWTMessageBoxHorizontal.add(gwtMessageBoxVertical)
        parseTab.add("North", parseTabGWTMessageBoxHorizontal)

        parsedBoxVertical = swing.Box.createVerticalBox()

        parsedBoxHorizontal = swing.Box.createHorizontalBox()
        self.parsedGWTField = swing.JTextArea()
        parsedBoxHorizontal.add(self.parsedGWTField)
        parsedBoxVertical.add(parsedBoxHorizontal)

        # Label for the insertion points box
        # horizontal box (label)
        # horizontal box (textarea)
        # inside a vertical box (insertBoxVertical)
        insertBoxVertical = swing.Box.createVerticalBox()

        insertPointBoxHorizontal = swing.Box.createHorizontalBox()
        self.insertPointField = swing.JTextArea()
        insertPointBoxHorizontal.add(self.insertPointField)
        insertBoxVertical.add(insertPointBoxHorizontal)

        functions = ["test", "test2"]
        functionList = swing.JList(functions)

        # Create and set split pane contents for enumerate tab
        spl = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
        spl.leftComponent = swing.JScrollPane(functionList)
        spl.rightComponent = swing.JLabel("right")

        enumTab.add("Center", spl)

        parseTabTabbedPane = swing.JTabbedPane()
        parseTab.add(parseTabTabbedPane)

        # Parse tab
        parsedRPCTab = swing.JPanel(BorderLayout())
        parseTabTabbedPane.addTab("Parsed", parsedRPCTab)

        # Insert points tab
        insertPointsTab = swing.JPanel(BorderLayout())
        parseTabTabbedPane.addTab("Insertion Points", insertPointsTab)

        parsedRPCTab.add("Center", parsedBoxVertical)
        insertPointsTab.add("Center", insertBoxVertical)

        return self.tab
Пример #11
0
    def registerExtenderCallbacks(self, callbacks):

        # Required for easier debugging:
        sys.stdout = callbacks.getStdout()

        # Keep a reference to our callbacks object
        self.callbacks = callbacks

        # Obtain an extension helpers object
        self.helpers = callbacks.getHelpers()

        # Set our extension name
        self.callbacks.setExtensionName("ExampleRepeaterExtension")

        # Create a context menu
        callbacks.registerContextMenuFactory(self)

        # Create the tab
        self.tab = swing.JPanel(BorderLayout())

        # Create a split panel
        splitPane = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT)

        # Create the top panel containing the text area
        box = swing.Box.createVerticalBox()

        # Make the text area
        row = swing.Box.createHorizontalBox()
        textPanel = swing.JPanel()
        self.textArea = swing.JTextArea('', 15, 100)
        self.textArea.setLineWrap(True)
        scroll = swing.JScrollPane(self.textArea)
        row.add(scroll)
        box.add(row)

        # Make a button
        row = swing.Box.createHorizontalBox()
        row.add(swing.JButton('Go!', actionPerformed=self.handleButtonClick))
        box.add(row)

        # Set the top pane
        splitPane.setTopComponent(box)

        # Bottom panel for the response.
        box = swing.Box.createVerticalBox()

        # Make the text box for the HTTP response
        row = swing.Box.createHorizontalBox()
        self.responseTextArea = swing.JTextArea('', 15, 100)
        self.responseTextArea.setLineWrap(True)
        scroll = swing.JScrollPane(self.responseTextArea)
        row.add(scroll)
        box.add(row)

        # Set the bottom pane
        splitPane.setBottomComponent(box)

        # Start the divider roughly in the middle
        splitPane.setDividerLocation(250)

        # Add everything to the custom tab
        self.tab.add(splitPane)

        # Add the custom tab to Burp's UI
        callbacks.addSuiteTab(self)
        return
 def drawUI(self):
     # Make a whole Burp Suite tab just for this plugin
     self.tab = swing.JPanel()
     # Draw title area
     self.uiLabel = swing.JLabel('Site Map to CSV Options')
     self.uiLabel.setFont(Font('Tahoma', Font.BOLD, 14))
     self.uiLabel.setForeground(Color(235,136,0))
     # UI for high-level options
     self.uiScopeOnly = swing.JRadioButton('In-scope only', True)
     self.uiScopeAll = swing.JRadioButton('All (disregard scope)', False)
     self.uiScopeButtonGroup = swing.ButtonGroup()
     self.uiScopeButtonGroup.add(self.uiScopeOnly)
     self.uiScopeButtonGroup.add(self.uiScopeAll)
     # Draw areas in the tab to keep different UI commands separate
     self.uipaneA = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
     self.uipaneA.setMaximumSize(Dimension(900,125))
     self.uipaneA.setDividerSize(2)
     self.uipaneB = swing.JSplitPane(swing.JSplitPane.HORIZONTAL_SPLIT)
     self.uipaneB.setDividerSize(2)
     self.uipaneA.setRightComponent(self.uipaneB)
     self.uipaneA.setBorder(BorderFactory.createLineBorder(Color.black))
     # Fill in UI area for response code filters
     self.uiCodesPanel = swing.JPanel()
     self.uiCodesPanel.setPreferredSize(Dimension(200, 75))
     self.uiCodesPanel.setBorder(EmptyBorder(10,10,10,10))
     self.uiCodesPanel.setLayout(BorderLayout())
     self.uiCodesLabel = swing.JLabel('Response code filters')
     self.uiCodesLabel.setFont(Font('Tahoma', Font.BOLD, 14))
     self.uiRcodePanel = swing.JPanel()
     self.uiRcodePanel.setLayout(GridLayout(1,1))
     self.uiRcode1xx = swing.JCheckBox('1XX  ', False)
     self.uiRcode2xx = swing.JCheckBox('2XX  ', True)
     self.uiRcode3xx = swing.JCheckBox('3XX  ', True)
     self.uiRcode4xx = swing.JCheckBox('4XX  ', True)
     self.uiRcode5xx = swing.JCheckBox('5XX     ', True)
     self.uiRcodePanel.add(self.uiRcode1xx)
     self.uiRcodePanel.add(self.uiRcode2xx)
     self.uiRcodePanel.add(self.uiRcode3xx)
     self.uiRcodePanel.add(self.uiRcode4xx)
     self.uiRcodePanel.add(self.uiRcode5xx)
     self.uiCodesPanel.add(self.uiCodesLabel,BorderLayout.NORTH)
     self.uiCodesPanel.add(self.uiRcodePanel,BorderLayout.WEST)
     self.uipaneA.setLeftComponent(self.uiCodesPanel)
     # Fill in UI area for initiating export to CSV
     self.uiExportPanel = swing.JPanel()
     self.uiExportPanel.setPreferredSize(Dimension(200, 75))
     self.uiExportPanel.setBorder(EmptyBorder(10,10,10,10))
     self.uiExportPanel.setLayout(BorderLayout())
     self.uiExportLabel = swing.JLabel('Export')
     self.uiExportLabel.setFont(Font('Tahoma', Font.BOLD, 14))
     self.uiMustHaveResponse = swing.JRadioButton('Must have a response     ', True)
     self.uiAllRequests = swing.JRadioButton('All (overrides response code filters)     ', False)
     self.uiResponseButtonGroup = swing.ButtonGroup()
     self.uiResponseButtonGroup.add(self.uiMustHaveResponse)
     self.uiResponseButtonGroup.add(self.uiAllRequests)
     self.uiExportRun = swing.JButton('Export',actionPerformed=self.exportAndSaveCsv)
     self.uiExportButtonPanel = swing.JPanel()
     self.uiExportButtonPanel.add(self.uiExportRun)    
     self.uiExportPanel.add(self.uiExportLabel,BorderLayout.NORTH)
     self.uiExportPanel.add(self.uiMustHaveResponse,BorderLayout.WEST)
     self.uiExportPanel.add(self.uiAllRequests,BorderLayout.CENTER)
     self.uiExportPanel.add(self.uiExportButtonPanel,BorderLayout.SOUTH)
     self.uipaneB.setLeftComponent(self.uiExportPanel)
     # Common UI stuff
     layout = swing.GroupLayout(self.tab)
     self.tab.setLayout(layout)
     # Thank you to Smeege (https://github.com/SmeegeSec/Burp-Importer/) for helping me figure out how this works.
     # He in turn gave credit to Antonio Sanchez (https://github.com/Dionach/HeadersAnalyzer/)
     layout.setHorizontalGroup(
         layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
         .addGroup(layout.createSequentialGroup()
             .addGap(10, 10, 10)
             .addGroup(layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
                 .addComponent(self.uiLabel)
                 .addGroup(layout.createSequentialGroup()
                     .addGap(10,10,10)
                     .addComponent(self.uiScopeOnly)
                     .addGap(10,10,10)
                     .addComponent(self.uiScopeAll))
                 .addGap(15,15,15)
                 .addComponent(self.uipaneA))
             .addContainerGap(26, lang.Short.MAX_VALUE)))
     layout.setVerticalGroup(
         layout.createParallelGroup(swing.GroupLayout.Alignment.LEADING)
         .addGroup(layout.createSequentialGroup()
             .addGap(15,15,15)
             .addComponent(self.uiLabel)
             .addGap(15,15,15)
             .addGroup(layout.createParallelGroup()
                 .addComponent(self.uiScopeOnly)
                 .addComponent(self.uiScopeAll))
             .addGap(20,20,20)
             .addComponent(self.uipaneA)
             .addGap(20,20,20)
             .addGap(5,5,5)
             .addGap(20,20,20)))
    def registerExtenderCallbacks(self, callbacks):

        # Required for easier debugging:
        # https://github.com/securityMB/burp-exceptions
        sys.stdout = callbacks.getStdout()

        # Keep a reference to our callbacks object
        self.callbacks = callbacks

        # Set our extension name
        self.callbacks.setExtensionName("Request-as-Python-or-PowerShell")

        # Create a context menu
        callbacks.registerContextMenuFactory(self)

        # Create the tab
        self.tab = swing.JPanel(BorderLayout())

        # Create a split panel where you can manually
        # adjust the panel size.
        splitPane = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT)

        # Create the top panel containing the text area
        textPanel = swing.JPanel()

        # An empty text area 12 columns deep and
        # full screen length.
        self.textArea = swing.JTextArea('', 12, 100)

        # Wrap the lines in the text area
        self.textArea.setLineWrap(True)

        # When the lines get bigger than the area
        # implement a scroll pane and put the text area
        # in the pane.
        scroll = swing.JScrollPane(self.textArea)

        # Set this scroll pane as the top of our split panel
        splitPane.setTopComponent(scroll)

        # Create the bottom panel for the transformed request.
        # Each label and text field will go in horizontal
        # boxes (rows) which will then go in a bigger box (box)

        # The big box
        box = swing.Box.createVerticalBox()

        # Row containing the button that calls transformRequestsAs
        row = swing.Box.createHorizontalBox()
        row.add(
            swing.JButton('Transform',
                          actionPerformed=self.transformRequestsAs))

        # Add the row to the big box
        box.add(row)

        # Row containing label and text area
        row = swing.Box.createHorizontalBox()
        self.pythonRequests = swing.JTextArea('', 2, 100)
        self.pythonRequests.setLineWrap(True)
        scroll = swing.JScrollPane(self.pythonRequests)
        row.add(
            swing.JLabel("<html><pre>  Python<br/>  Requests   </pre></html>"))
        row.add(scroll)
        box.add(row)

        # Row containing label and text area
        row = swing.Box.createHorizontalBox()
        self.pythonUrlLib = swing.JTextArea('', 2, 100)
        self.pythonUrlLib.setLineWrap(True)
        scroll = swing.JScrollPane(self.pythonUrlLib)
        row.add(
            swing.JLabel("<html><pre>  Python<br/>  Urllib2    </pre></html>"))
        row.add(scroll)
        box.add(row)

        # Row containing label and text area
        row = swing.Box.createHorizontalBox()
        self.powershellIwr = swing.JTextArea('', 2, 100)
        self.powershellIwr.setLineWrap(True)
        scroll = swing.JScrollPane(self.powershellIwr)
        row.add(
            swing.JLabel(
                "<html><pre>  PowerShell<br/>  IWR        </pre></html>"))
        row.add(scroll)
        box.add(row)

        # Add this Panel to the bottom of the split panel
        splitPane.setBottomComponent(box)
        splitPane.setDividerLocation(150)

        self.tab.add(splitPane)

        # Add the custom tab to Burp's UI
        callbacks.addSuiteTab(self)
        return
Пример #14
0
    def registerExtenderCallbacks(self, callbacks):
        # for error handling
        sys.stdout = callbacks.getStdout()
        sys.stderr = callbacks.getStderr()

        self._callbacks = callbacks
        self._helpers = callbacks.getHelpers()

        jsonFilter = FileNameExtensionFilter("JSON files", ['json'])

        basePath = self._callbacks.loadExtensionSetting(SETTING_LAST_PATH)
        # print("got last path {}".format(basePath))

        self._collectionChooser = swing.JFileChooser(basePath)
        self._collectionChooser.setFileFilter(jsonFilter)

        self._environmentChooser = swing.JFileChooser(basePath)
        self._environmentChooser.setFileFilter(jsonFilter)

        # ### Top "buttons" pane
        controlPane = swing.JPanel()
        controlPane.setBorder(EmptyBorder(10, 20, 0, 10))
        controlPane.setLayout(
            swing.BoxLayout(controlPane, swing.BoxLayout.PAGE_AXIS))
        controlPane.setAlignmentX(swing.Box.LEFT_ALIGNMENT)

        box1 = swing.Box.createHorizontalBox()
        box1.setAlignmentX(swing.Box.LEFT_ALIGNMENT)
        box1.add(
            swing.JButton('Load Collection',
                          actionPerformed=self.loadCollection))
        self._collectionLabel = swing.JLabel("Choose a collection file")
        box1.add(self._collectionLabel)
        controlPane.add(box1)

        box2 = swing.Box.createHorizontalBox()
        box2.setAlignmentX(swing.Box.LEFT_ALIGNMENT)
        box2.add(
            swing.JButton('Load Environment',
                          actionPerformed=self.loadEnvironment))
        self._environmentLabel = swing.JLabel("Choose an environment file")
        box2.add(self._environmentLabel)
        controlPane.add(box2)

        # ### end Top "controls" pane

        # ### instructions
        instructionsPane = swing.JPanel(BorderLayout())
        instructions = swing.JLabel()
        instructions.setText("""<html><body>
<h3>Usage:</h3>
<ol>
<li>Select the Collection Postman JSON file. This should extract all discovered environment variables.</li>
<li>(Optional) Select an Environment Postman JSON file. This can be the same as the Collection file.</li>
<li>Set environment variables below.</li>
<li>Choose 'Create Requests' to create Repeater tabs.</li>
</ol>
</body></html>""")
        instructionsPane.add(instructions, BorderLayout.NORTH)
        # ### end instructions

        # ### environment variables
        envTablePane = swing.JPanel(BorderLayout())
        envLabel = swing.JLabel("Environment Variables")
        envLabel.setBorder(EmptyBorder(5, 5, 5, 5))
        envLabel.setFont(
            Font(envLabel.getFont().getName(), Font.BOLD,
                 envLabel.getFont().getSize() + 2))
        envTablePane.add(envLabel, BorderLayout.NORTH)

        self._envTable = swing.JTable(DefaultTableModel([], self._envCols))
        self._envTable.setAutoCreateRowSorter(True)
        self._envTable.getTableHeader().setReorderingAllowed(False)
        tableMenu = swing.JPopupMenu()
        tableMenu.add(swing.JMenuItem("Add New", actionPerformed=self._addEnv))
        tableMenu.add(
            swing.JMenuItem("Clear All", actionPerformed=self._clearEnv))
        deleteMenuItem = swing.JMenuItem("Delete Row",
                                         actionPerformed=self._deleteEnv)
        deleteMenuItem.setEnabled(False)
        tableMenu.add(deleteMenuItem)
        self._envTable.setComponentPopupMenu(tableMenu)
        listener = self._envTableListener(self)
        self._envTable.addMouseListener(listener)
        renderer = self._envTableRenderer()
        self._envTable.setDefaultRenderer(Class.forName('java.lang.Object'),
                                          renderer)

        envTablePaneMenu = swing.JPopupMenu()
        envTablePaneMenu.add(
            swing.JMenuItem("Add New", actionPerformed=self._addEnv))
        envTablePaneMenu.add(
            swing.JMenuItem("Clear All", actionPerformed=self._clearEnv))
        scrl = swing.JScrollPane(self._envTable)
        scrl.setComponentPopupMenu(envTablePaneMenu)
        envTablePane.add(scrl)
        # ### end environment variables

        # ### requests
        reqTablePane = swing.JPanel(BorderLayout())
        reqLabel = swing.JLabel("Requests")
        reqLabel.setBorder(EmptyBorder(5, 5, 5, 5))
        reqLabel.setFont(envLabel.getFont())
        reqTablePane.add(reqLabel, BorderLayout.NORTH)

        self._reqTable = self._reqTableClass(
            DefaultTableModel([], self._reqCols))
        self._reqTable.setAutoCreateRowSorter(True)
        self._reqTable.getTableHeader().setReorderingAllowed(False)
        self._reqTable.setAutoResizeMode(swing.JTable.AUTO_RESIZE_LAST_COLUMN)
        self._reqTable.getTableHeader().setReorderingAllowed(False)
        self._reqTable.getColumnModel().getColumn(0).setMaxWidth(150)
        self._reqTable.getColumnModel().getColumn(0).setMinWidth(150)
        self._reqTable.getColumnModel().getColumn(2).setMaxWidth(150)
        self._reqTable.getColumnModel().getColumn(2).setMinWidth(150)
        scrl2 = swing.JScrollPane(self._reqTable)
        reqTablePane.add(scrl2)
        # ### end requests

        # ### Logs
        logPane = swing.JPanel(BorderLayout())

        buttonBox = swing.JPanel(FlowLayout(FlowLayout.LEFT, 20, 0))
        requestButtonBox = swing.Box.createHorizontalBox()
        self._selectButtons = [
            swing.JButton('Select All', actionPerformed=self.selectAll),
            swing.JButton('Select None', actionPerformed=self.selectNone),
            swing.JButton('Invert Selection',
                          actionPerformed=self.selectInvert)
        ]
        for btn in self._selectButtons:
            requestButtonBox.add(btn)
            btn.setEnabled(False)

        buttonBox.add(requestButtonBox)

        self._createRequestsButton = swing.JButton(
            'Create Requests', actionPerformed=self.createRequests)
        self._createRequestsButton.setEnabled(False)
        requestButtonBox.add(self._createRequestsButton)

        buttonBox.add(self._createRequestsButton)

        self._logButton = swing.JButton('Clear Log',
                                        actionPerformed=self.clearLog)
        self._logButton.setEnabled(False)
        buttonBox.add(self._logButton)

        logPane.add(buttonBox, BorderLayout.NORTH)

        self._log = swing.JTextPane()
        self._log.setEditable(False)
        self._log.setFont(Font("monospaced", Font.PLAIN, 12))
        logPane.add(swing.JScrollPane(self._log))
        # ### end Logs

        # ### add panels
        self._topControlsPane = swing.JSplitPane(
            swing.JSplitPane.HORIZONTAL_SPLIT, controlPane, instructionsPane)
        p1 = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT,
                              self._topControlsPane, envTablePane)
        p2 = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT, p1,
                              reqTablePane)
        p2.setResizeWeight(0.5)
        self._panel = swing.JSplitPane(swing.JSplitPane.VERTICAL_SPLIT, p2,
                                       logPane)
        self._panel.setResizeWeight(0.6)
        # ### end add panels

        callbacks.setExtensionName(NAME)
        callbacks.addSuiteTab(self)
Пример #15
0
 def createFrame (self):
 
     # Create the find panel...
     #outer = Tk.Frame(self.frame,relief="groove",bd=2)
     #outer.pack(padx=2,pady=2)
     self.top = swing.JFrame()
     g.app.gui.addLAFListener( self.top )
     #self.top.setDefaultCloseOperation( swing.JFrame.EXIT_ON_CLOSE )
     self.top.title = self.title
     jtab = swing.JTabbedPane()
     self.top.add( jtab )
     cpane = swing.JPanel()
     jtab.addTab( "regular search", cpane )
     clnsearch = swing.JPanel()
     clnsearch.setName( "Leodialog" )
     jtab.addTab( "node search", clnsearch )
     #cpane = outer.getContentPane()
     cpane.setName( "Leodialog" )
     cpane.setLayout( awt.GridLayout( 3, 1 ) )
 
     
     #@    << Create the Find and Change panes >>
     #@+node:mork.20050127121143.6:<< Create the Find and Change panes >>
     #fc = Tk.Frame(outer, bd="1m")
     #fc.pack(anchor="n", fill="x", expand=1)
     findPanel = self.findPanel = swing.JTextArea()
     self.CutCopyPaste( findPanel )
     fspane = swing.JScrollPane( findPanel )
     
     self.changePanel = changePanel = swing.JTextArea()
     self.CutCopyPaste( changePanel )
     cpane2 = swing.JScrollPane( changePanel )
     splitpane = swing.JSplitPane( swing.JSplitPane.VERTICAL_SPLIT, fspane, cpane2 )
     splitpane.setDividerLocation( .5 )
     #outer.getContentPane().add( splitpane )
     cpane.add( splitpane )
     #outer.pack()
     
     
     # Removed unused height/width params: using fractions causes problems in some locales!
     #fpane = Tk.Frame(fc, bd=1)
     #cpane = Tk.Frame(fc, bd=1)
     
     #fpane.pack(anchor="n", expand=1, fill="x")
     #cpane.pack(anchor="s", expand=1, fill="x")
     
     # Create the labels and text fields...
     #flab = Tk.Label(fpane, width=8, text="Find:")
     #clab = Tk.Label(cpane, width=8, text="Change:")
     
     # Use bigger boxes for scripts.
     #self.find_text   = ftxt = Tk.Text(fpane,bd=1,relief="groove",height=4,width=20)
     #3self.change_text = ctxt = Tk.Text(cpane,bd=1,relief="groove",height=4,width=20)
     
     #fBar = Tk.Scrollbar(fpane,name='findBar')
     #cBar = Tk.Scrollbar(cpane,name='changeBar')
     
     # Add scrollbars.
     #for bar,txt in ((fBar,ftxt),(cBar,ctxt)):
     #    txt['yscrollcommand'] = bar.set
     #    bar['command'] = txt.yview
     #    bar.pack(side="right", fill="y")
     
     #flab.pack(side="left")
     #clab.pack(side="left")
     #ctxt.pack(side="right", expand=1, fill="both")
     #ftxt.pack(side="right", expand=1, fill="both")
     #@nonl
     #@-node:mork.20050127121143.6:<< Create the Find and Change panes >>
     #@nl
     #@    << Create four columns of radio and checkboxes >>
     #@+node:mork.20050127121143.7:<< Create four columns of radio and checkboxes >>
     #columnsFrame = Tk.Frame(outer,relief="groove",bd=2)
     #columnsFrame.pack(anchor="e",expand=1,padx="7p",pady="2p") # Don't fill.
     columnsFrame = swing.JPanel()
     columnsFrame.setLayout( swing.BoxLayout( columnsFrame, swing.BoxLayout.X_AXIS ) )
     cpane.add( columnsFrame, awt.BorderLayout.SOUTH )
     
     numberOfColumns = 4 # Number of columns
     columns = [] ; radioLists = [] ; checkLists = []; buttonGroups = []
     for i in xrange(numberOfColumns):
         #columns.append(Tk.Frame(columnsFrame,bd=1))
         jp = swing.JPanel()
         jp.setLayout( swing.BoxLayout( jp, swing.BoxLayout.Y_AXIS ) )
         columns.append( jp )
         radioLists.append([])
         checkLists.append([])
         buttonGroups.append( swing.ButtonGroup() )
     
     for i in xrange(numberOfColumns):
         columnsFrame.add( columns[ i ] )
         #columns[i].pack(side="left",padx="1p") # fill="y" Aligns to top. padx expands columns.
     
     radioLists[0] = [
         (self.dict["radio-find-type"],"Plain Search","plain-search"),  
         (self.dict["radio-find-type"],"Pattern Match Search","pattern-search"),
         (self.dict["radio-find-type"],"Script Search","script-search")]
     checkLists[0] = [
         ("Script Change",self.dict["script_change"])]
     checkLists[1] = [
         ("Whole Word",  self.dict["whole_word"]),
         ("Ignore Case", self.dict["ignore_case"]),
         ("Wrap Around", self.dict["wrap"]),
         ("Reverse",     self.dict["reverse"])]
     radioLists[2] = [
         (self.dict["radio-search-scope"],"Entire Outline","entire-outine"),
         (self.dict["radio-search-scope"],"Suboutline Only","suboutline-only"),  
         (self.dict["radio-search-scope"],"Node Only","node-only"),
         # I don't know what selection-only is supposed to do.
         (self.dict["radio-search-scope"],"Selection Only","selection-only")]
     checkLists[2] = []
     checkLists[3] = [
         ("Search Headline Text", self.dict["search_headline"]),
         ("Search Body Text",     self.dict["search_body"]),
         ("Mark Finds",           self.dict["mark_finds"]),
         ("Mark Changes",         self.dict["mark_changes"])]
         
         
     class rAction( swing.AbstractAction ):
         
         def __init__( self, name, var , val ):
             swing.AbstractAction.__init__( self, name )
             self.name = name
             self.var = var
             self.val = val
             
         def actionPerformed( self, aE ):
             self.var.set( self.val )
             
     class jcbAction( swing.AbstractAction ):
         
         def __init__( self, name, var ):
             swing.AbstractAction.__init__( self, name )
             self.var = var
             
         def actionPerformed( self, ae ):
         
             val = self.var.get()
             if val:
                 self.var.set( 0 )
             else:
                 self.var.set( 1 )
     
     for i in xrange(numberOfColumns):
         for var,name,val in radioLists[i]:
             aa = rAction( name, var, val )
             but = swing.JRadioButton( aa )
             columns[ i ].add( but )
             buttonGroups[ i ].add( but )
             #box = Tk.Radiobutton(columns[i],anchor="w",text=name,variable=var,value=val)
             #box.pack(fill="x")
             #box.bind("<1>", self.resetWrap)
             #if val == None: box.configure(state="disabled")
         for name, var in checkLists[i]:
             cbut = swing.JCheckBox( jcbAction( name, var ) )
             columns[ i ].add( cbut )
             #box = Tk.Checkbutton(columns[i],anchor="w",text=name,variable=var)
             #box.pack(fill="x")
             #box.bind("<1>", self.resetWrap)
             #if var is None: box.configure(state="disabled")
     
     for z in buttonGroups:
         
         elements = z.getElements()
         for x in elements:
             x.setSelected( True )
             break
     #@-node:mork.20050127121143.7:<< Create four columns of radio and checkboxes >>
     #@nl
     #@    << Create two rows of buttons >>
     #@+node:mork.20050127121143.8:<< Create two rows of buttons >>
     # Create the button panes
     secondGroup = swing.JPanel()
     secondGroup.setLayout( awt.GridLayout( 2, 3 , 10, 10 ) )
     cpane.add( secondGroup )
     #buttons  = Tk.Frame(outer,bd=1)
     #buttons2 = Tk.Frame(outer,bd=1)
     #buttons.pack (anchor="n",expand=1,fill="x")
     #buttons2.pack(anchor="n",expand=1,fill="x")
     class commandAA( swing.AbstractAction ):
         
         def __init__( self, name, command ):
             swing.AbstractAction.__init__( self, name )
             self.command = command
             
         def actionPerformed( self, aE ):
             self.command()
     
     
     # Create the first row of buttons
     #findButton=Tk.Button(buttons,width=8,text="Find",bd=4,command=self.findButton) # The default.
     #contextBox=Tk.Checkbutton(buttons,anchor="w",text="Show Context",variable=self.dict["batch"])
     #findAllButton=Tk.Button(buttons,width=8,text="Find All",command=self.findAllButton)
     findButton = swing.JButton( commandAA( "Find", self.findButton ) )
     contextBox = swing.JCheckBox( "Show Context" )
     findAllButton = swing.JButton( commandAA( "Find All", self.findAllButton ) )
     secondGroup.add( findButton )
     secondGroup.add( contextBox )
     secondGroup.add( findAllButton )
     
     #findButton.pack   (pady="1p",padx="25p",side="left")
     #contextBox.pack   (pady="1p",           side="left",expand=1)
     #findAllButton.pack(pady="1p",padx="25p",side="right",fill="x",)
     
     # Create the second row of buttons
     #changeButton    =Tk.Button(buttons2,width=8,text="Change",command=self.changeButton)
     #changeFindButton=Tk.Button(buttons2,        text="Change, Then Find",command=self.changeThenFindButton)
     #changeAllButton =Tk.Button(buttons2,width=8,text="Change All",command=self.changeAllButton)
     changeButton = swing.JButton( commandAA( "Change", self.changeButton ) )
     changeFindButton = swing.JButton( commandAA( "Change, Then Find", self.changeThenFindButton ) )
     changeAllButton = swing.JButton( commandAA( "Change All", self.changeAllButton ) )
     secondGroup.add( changeButton )
     secondGroup.add( changeFindButton )
     secondGroup.add( changeAllButton )
     
     #changeButton.pack    (pady="1p",padx="25p",side="left")
     #changeFindButton.pack(pady="1p",           side="left",expand=1)
     #changeAllButton.pack (pady="1p",padx="25p",side="right")
     #@nonl
     #@-node:mork.20050127121143.8:<< Create two rows of buttons >>
     #@nl
     
     self.createNodeSearchFrame( clnsearch )
     #self.top.setSize( 500, 500 )
     self.top.pack()
     size = self.top.getSize()
     size.width = size.width + 50
     self.top.setSize( size )
     splitpane.setDividerLocation( .5 )