def friendsList(self, username): self.window = swing.JFrame(username) self.window.layout = awt.BorderLayout() statusPanel = swing.JPanel() statusPanel.layout = awt.GridLayout(4, 1) # Set status placeholder UI statusPanel.border = swing.BorderFactory.createTitledBorder("Status") buttonGroup = swing.ButtonGroup() radioButton = swing.JRadioButton("Away", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) radioButton = swing.JRadioButton("Here", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) #Wizard of Oz incoming chat request radioButton = swing.JButton("Page Boss", actionPerformed=self.callBoss) buttonGroup.add(radioButton) statusPanel.add(radioButton) statusPanel.add(self.status) #statusPanel.add(swing.JButton("Update Status", actionPerformed=self.updateStatus)) #Buddy list panel = swing.JPanel() panel.layout = awt.BorderLayout() panel.border = swing.BorderFactory.createTitledBorder("Friends Online") ##TODO: fix threading so that friends load before the window print self.friendsData self.friendsData.append('guest') print '2' self.list = swing.JList(self.friendsData) panel.add("Center", swing.JScrollPane(self.list)) launchChatButton = swing.JButton("Launch chat?", actionPerformed=self.launchChatOut) panel.add("South", launchChatButton) self.window.windowClosing = self.goodbye pane = JScrollPane() pane.getViewport().add(self.list) panel.add(pane) self.window.add("North", statusPanel) self.window.add("South", panel) self.window.pack() self.window.visible = True return self.window
def registerExtenderCallbacks(self, callbacks): # keep a reference to our callbacks object self._callbacks = callbacks # set our extension name self._callbacks.setExtensionName("Payload Parser") # build UI self._jPanel = swing.JPanel() self._jPanel.layout = awt.BorderLayout() self._jPanel.border = swing.BorderFactory.createTitledBorder( "Input characters to display payload strings with characters included or excluded" ) inputPanel = swing.JPanel() inputPanel.layout = awt.BorderLayout() radioPanel = swing.JPanel() self.text1 = swing.JTextField(actionPerformed=self.radioCallback) inputPanel.add(self.text1, inputPanel.layout.CENTER) buttonGroup = swing.ButtonGroup() self._radioButtonInclude = swing.JRadioButton("Include") buttonGroup.add(self._radioButtonInclude) radioPanel.add(self._radioButtonInclude) self._radioButtonExclude = swing.JRadioButton("Exclude") buttonGroup.add(self._radioButtonExclude) radioPanel.add(self._radioButtonExclude) self._radioButtonInclude.setSelected(True) inputPanel.add(radioPanel, inputPanel.layout.LINE_END) self._jPanel.add(inputPanel, self._jPanel.layout.PAGE_START) self.textArea = swing.JTextArea() scrollPane = swing.JScrollPane(self.textArea) self._jPanel.add(scrollPane, self._jPanel.layout.CENTER) boxVertical = swing.Box.createVerticalBox() saveLabel = swing.JLabel( "Save Payloads (In Burp Root Dir): Can be Imported into Intruder") boxVertical.add(saveLabel) boxHorizontal = swing.Box.createHorizontalBox() saveLabel2 = swing.JLabel("Save As:") boxHorizontal.add(saveLabel2) self._saveTextField = swing.JTextField('', 30) boxHorizontal.add(self._saveTextField) submitSaveButton = swing.JButton('Save', actionPerformed=self.savePayload) boxHorizontal.add(submitSaveButton) boxVertical.add(boxHorizontal) self._jPanel.add(boxVertical, self._jPanel.layout.PAGE_END) # add the custom tab to Burp's UI self._callbacks.addSuiteTab(self) return
def __init__(self): ######################################################### # # set up the overall frame (the window itself) # self.window = swing.JFrame("Swing Sampler!") self.window.windowClosing = self.goodbye self.window.contentPane.layout = awt.BorderLayout() ######################################################### # # under this will be a tabbed pane; each tab is named # and contains a panel with other stuff in it. # tabbedPane = swing.JTabbedPane() self.window.contentPane.add("Center", tabbedPane) ######################################################### # # The first tabbed panel will be named "Some Basic # Widgets", and is referenced by variable 'firstTab' # firstTab = swing.JPanel() firstTab.layout = awt.BorderLayout() tabbedPane.addTab("Some Basic Widgets", firstTab) # # slap in some labels, a list, a text field, etc... Some # of these are contained in their own panels for # layout purposes. # tmpPanel = swing.JPanel() tmpPanel.layout = awt.GridLayout(3, 1) tmpPanel.border = swing.BorderFactory.createTitledBorder( "Labels are simple") tmpPanel.add(swing.JLabel("I am a label. I am quite boring.")) tmpPanel.add( swing.JLabel( "<HTML><FONT COLOR='blue'>HTML <B>labels</B></FONT> are <I>somewhat</I> <U>less boring</U>.</HTML>" )) tmpPanel.add( swing.JLabel("Labels can also be aligned", swing.JLabel.RIGHT)) firstTab.add(tmpPanel, "North") # # Notice that the variable "tmpPanel" gets reused here. # This next line creates a new panel, but we reuse the # "tmpPanel" name to refer to it. The panel that # tmpPanel used to refer to still exists, but we no # longer have a way to name it (but that's ok, since # we don't need to refer to it any more). # tmpPanel = swing.JPanel() tmpPanel.layout = awt.BorderLayout() tmpPanel.border = swing.BorderFactory.createTitledBorder( "Tasty tasty lists") # # Note that here we stash a reference to the list in # "self.list". This puts it in the scope of the object, # rather than this function. This is because we'll be # referring to it later from outside this function, so # it needs to be "bumped up a level." # listData = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ] self.list = swing.JList(listData) tmpPanel.add("Center", swing.JScrollPane(self.list)) button = swing.JButton("What's Selected?") button.actionPerformed = self.whatsSelectedCallback tmpPanel.add("East", button) firstTab.add("Center", tmpPanel) tmpPanel = swing.JPanel() tmpPanel.layout = awt.BorderLayout() # # The text field also goes in self, since the callback # that displays the contents will need to get at it. # # Also note that because the callback is a function inside # the SwingSampler object, you refer to it through self. # (The callback could potentially be outside the object, # as a top-level function. In that case you wouldn't # use the 'self' selector; any variables that it uses # would have to be in the global scope. # self.field = swing.JTextField() tmpPanel.add(self.field) tmpPanel.add( swing.JButton("Click Me", actionPerformed=self.clickMeCallback), "East") firstTab.add(tmpPanel, "South") ######################################################### # # The second tabbed panel is next... This shows # how to build a basic web browser in about 20 lines. # secondTab = swing.JPanel() secondTab.layout = awt.BorderLayout() tabbedPane.addTab("HTML Fanciness", secondTab) tmpPanel = swing.JPanel() tmpPanel.add(swing.JLabel("Go to:")) self.urlField = swing.JTextField(40, actionPerformed=self.goToCallback) tmpPanel.add(self.urlField) tmpPanel.add(swing.JButton("Go!", actionPerformed=self.goToCallback)) secondTab.add(tmpPanel, "North") self.htmlPane = swing.JEditorPane("http://www.google.com", editable=0, hyperlinkUpdate=self.followHyperlink, preferredSize=(400, 400)) secondTab.add(swing.JScrollPane(self.htmlPane), "Center") self.statusLine = swing.JLabel("(status line)") secondTab.add(self.statusLine, "South") ######################################################### # # The third tabbed panel is next... # thirdTab = swing.JPanel() tabbedPane.addTab("Other Widgets", thirdTab) imageLabel = swing.JLabel( swing.ImageIcon( net.URL("http://www.gatech.edu/images/logo-gatech.gif"))) imageLabel.toolTipText = "Labels can have images! Every widget can have a tooltip!" thirdTab.add(imageLabel) tmpPanel = swing.JPanel() tmpPanel.layout = awt.GridLayout(3, 2) tmpPanel.border = swing.BorderFactory.createTitledBorder( "Travel Checklist") tmpPanel.add( swing.JCheckBox("Umbrella", actionPerformed=self.checkCallback)) tmpPanel.add( swing.JCheckBox("Rain coat", actionPerformed=self.checkCallback)) tmpPanel.add( swing.JCheckBox("Passport", actionPerformed=self.checkCallback)) tmpPanel.add( swing.JCheckBox("Airline tickets", actionPerformed=self.checkCallback)) tmpPanel.add( swing.JCheckBox("iPod", actionPerformed=self.checkCallback)) tmpPanel.add( swing.JCheckBox("Laptop", actionPerformed=self.checkCallback)) thirdTab.add(tmpPanel) tmpPanel = swing.JPanel() tmpPanel.layout = awt.GridLayout(4, 1) tmpPanel.border = swing.BorderFactory.createTitledBorder("My Pets") # # A ButtonGroup is used to indicate which radio buttons # go together. # buttonGroup = swing.ButtonGroup() radioButton = swing.JRadioButton("Dog", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) tmpPanel.add(radioButton) radioButton = swing.JRadioButton("Cat", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) tmpPanel.add(radioButton) radioButton = swing.JRadioButton("Pig", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) tmpPanel.add(radioButton) radioButton = swing.JRadioButton("Capybara", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) tmpPanel.add(radioButton) thirdTab.add(tmpPanel) self.window.pack() self.window.show()
def registerExtenderCallbacks(self, callbacks): self._callbacks = callbacks self._helpers = callbacks.getHelpers() callbacks.setExtensionName("Encoder") callbacks.registerContextMenuFactory(self) callbacks.registerIntruderPayloadProcessor(self) #Create Jpanel self._jPanel = swing.JPanel() self._jPanel.setLayout(None) self._jPanel.setPreferredSize(awt.Dimension(1200, 1200)) #Values for the combination boxes algOptions = [ 'Algorithm...', 'UTF-7', 'UTF-8', 'URL', 'Base64', 'XML', 'Binary', 'Overlong', 'zlib deflate' ] hashOptions = [ 'Hash...', 'md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512' ] #GUI Components self.jEncode = swing.JRadioButton('Encode', actionPerformed=self.encodeButton) self.jDecode = swing.JRadioButton('Decode', actionPerformed=self.decodeButton) self.jAlgMenu = swing.JComboBox(algOptions) self.jInput = swing.JTextArea() self.jInputLabel = swing.JLabel() self.jOutput = swing.JTextArea() self.jInputScroll = swing.JScrollPane(self.jOutput) self.jOutputScroll = swing.JScrollPane(self.jOutput) self.jOutputLabel = swing.JLabel() self.jHashLabel = swing.JLabel() self.jHashMenu = swing.JComboBox(hashOptions) self.jStart = swing.JButton('Go', actionPerformed=self.doStart) self.jHex = swing.JRadioButton('Hex', actionPerformed=self.toHex) self.jString = swing.JRadioButton('String', actionPerformed=self.toString) self.jOutputFormat = swing.ButtonGroup() self.jSendToRequest = swing.JButton('Send to request', actionPerformed=self.sendToRequest) self.jToInput = swing.JButton('Send to Input', actionPerformed=self.toInput) self.jNextHistory = swing.JButton('>', actionPerformed=self.nextHistory) self.jPreviousHistory = swing.JButton( '<', actionPerformed=self.previousHistory) #Input and Ouptut scroll self.jOutputScroll = swing.JScrollPane( swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) self.jOutputScroll.viewport.view = self.jOutput self.jInputScroll = swing.JScrollPane( swing.JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, swing.JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) self.jInputScroll.viewport.view = self.jInput #Add buttons to group self.jOutputFormat.add(self.jString) self.jOutputFormat.add(self.jHex) #Configure GUIs self.jEncode.setSelected(True) self.jDecode.setSelected(False) self.jAlgMenu.setSelectedIndex(0) self.jInput.setLineWrap(True) self.jOutput.setLineWrap(True) self.jOutput.setEditable(False) self.jHashMenu.setSelectedIndex(0) self.jString.setSelected(True) #Component Locations self.jEncode.setBounds(15, 15, 70, 20) self.jDecode.setBounds(85, 15, 70, 20) self.jAlgMenu.setBounds(15, 45, 140, 25) self.jHashMenu.setBounds(15, 80, 140, 25) self.jStart.setBounds(15, 115, 140, 20) self.jSendToRequest.setBounds(15, 145, 140, 20) self.jHex.setBounds(15, 175, 70, 20) self.jString.setBounds(85, 175, 70, 20) self.jInputScroll.setBounds(165, 15, 800, 200) self.jOutputScroll.setBounds(165, 225, 800, 200) self.jToInput.setBounds(15, 405, 140, 20) self.jNextHistory.setBounds(85, 465, 70, 20) self.jPreviousHistory.setBounds(15, 465, 70, 20) #Add components to Panel self._jPanel.add(self.jEncode) self._jPanel.add(self.jDecode) self._jPanel.add(self.jAlgMenu) self._jPanel.add(self.jHashMenu) self._jPanel.add(self.jInputScroll) self._jPanel.add(self.jOutputScroll) self._jPanel.add(self.jStart) self._jPanel.add(self.jHex) self._jPanel.add(self.jString) self._jPanel.add(self.jSendToRequest) self._jPanel.add(self.jToInput) self._jPanel.add(self.jNextHistory) self._jPanel.add(self.jPreviousHistory) callbacks.customizeUiComponent(self._jPanel) callbacks.addSuiteTab(self) # set some values self._inputHex = False self._outputHex = False return
def defineRadioButton(self, caption, selected=True): radioButton = swing.JRadioButton(caption, selected) return radioButton
def initUI(self): self.tab = swing.JPanel() # UI for Decrypt Key self.decryptLabel = swing.JLabel("Decrypt Key:") self.decryptLabel.setFont(Font("Tahoma", Font.BOLD, 14)) self.decryptLabel.setForeground(Color(255,102,52)) self.urlLabel = swing.JLabel("URL:") self.urlTxtField = swing.JTextField("http://localhost/Telerik.Web.UI.DialogHandler.aspx", 40) self.charLabel = swing.JLabel("Character Set:") self.hexRadio = swing.JRadioButton("Hex", True) self.asciiRadio = swing.JRadioButton("ASCII", False) self.btnGroup = swing.ButtonGroup() self.btnGroup.add(self.hexRadio) self.btnGroup.add(self.asciiRadio) self.decryptBtn = swing.JButton("Decrypt Key", actionPerformed=self.mode_brutekey) self.cancelBtn = swing.JButton("Cancel", actionPerformed=self.cancel) # UI for Output self.outputLabel = swing.JLabel("Log:") self.outputLabel.setFont(Font("Tahoma", Font.BOLD, 14)) self.outputLabel.setForeground(Color(255,102,52)) self.logPane = swing.JScrollPane() self.outputTxtArea = swing.JTextArea() self.outputTxtArea.setFont(Font("Consolas", Font.PLAIN, 12)) self.outputTxtArea.setLineWrap(True) self.logPane.setViewportView(self.outputTxtArea) self.clearBtn = swing.JButton("Clear Log", actionPerformed=self.clearLog) # Layout layout = swing.GroupLayout(self.tab) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) self.tab.setLayout(layout) layout.setHorizontalGroup( layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(self.decryptLabel) .addComponent(self.urlLabel) .addComponent(self.urlTxtField, swing.GroupLayout.PREFERRED_SIZE, swing.GroupLayout.DEFAULT_SIZE, swing.GroupLayout.PREFERRED_SIZE) .addComponent(self.charLabel) .addGroup(layout.createSequentialGroup() .addComponent(self.hexRadio) .addComponent(self.asciiRadio) ) .addGroup(layout.createSequentialGroup() .addComponent(self.decryptBtn) .addComponent(self.cancelBtn) ) ) .addGroup(layout.createParallelGroup() .addComponent(self.outputLabel) .addComponent(self.logPane) .addComponent(self.clearBtn) ) ) ) layout.setVerticalGroup( layout.createParallelGroup() .addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addComponent(self.decryptLabel) .addComponent(self.urlLabel) .addComponent(self.urlTxtField, swing.GroupLayout.PREFERRED_SIZE, swing.GroupLayout.DEFAULT_SIZE, swing.GroupLayout.PREFERRED_SIZE) .addComponent(self.charLabel) .addGroup(layout.createParallelGroup() .addComponent(self.hexRadio) .addComponent(self.asciiRadio) ) .addGroup(layout.createParallelGroup() .addComponent(self.decryptBtn) .addComponent(self.cancelBtn) ) ) .addGroup(layout.createSequentialGroup() .addComponent(self.outputLabel) .addComponent(self.logPane) .addComponent(self.clearBtn) ) ) )
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)))
def tabDesign(self,callbacks): topPanel=swing.JPanel(BorderLayout()) #create HMAC Key Text Area: keyPanel=swing.JPanel(BorderLayout()) # Create the label for the text area boxVertical = swing.Box.createVerticalBox() boxHorizontal = swing.Box.createHorizontalBox() textLabel = swing.JLabel("HMAC Key") boxHorizontal.add(textLabel) boxVertical.add(boxHorizontal) # Create the text area itself boxHorizontal = swing.Box.createHorizontalBox() keyText = swing.JTextField(512) keyText.setText("secretkey") boxHorizontal.add(keyText) boxVertical.add(boxHorizontal) # Add the text label and area to the text panel keyPanel.add(boxVertical) # Add the text panel to the top of the main tab topPanel.add(keyPanel, BorderLayout.NORTH) #create HMAC Key Text Area: hsPanel=swing.JPanel(BorderLayout()) # Create the label for the text area boxVertical = swing.Box.createVerticalBox() boxHorizontal = swing.Box.createHorizontalBox() textLabel = swing.JLabel("HashString") boxHorizontal.add(textLabel) boxVertical.add(boxHorizontal) # Create the text area itself boxHorizontal = swing.Box.createHorizontalBox() hsText = swing.JTextField(512) hsText.setText("<header>:<body>:<header:timestamp>") boxHorizontal.add(hsText) boxVertical.add(boxHorizontal) # Add the text label and area to the text panel hsPanel.add(boxVertical) # Add the text panel to the top of the main tab topPanel.add(hsPanel, BorderLayout.CENTER) bTopPanel= swing.JPanel() #create HMAC Key Text Area: slPanel=swing.JPanel(BorderLayout()) # Create the label for the text area boxVertical = swing.Box.createVerticalBox() boxHorizontal = swing.Box.createHorizontalBox() textLabel = swing.JLabel("Signature Location") boxHorizontal.add(textLabel) boxVertical.add(boxHorizontal) # Create the text area itself boxHorizontal = swing.Box.createHorizontalBox() hsText = swing.JTextField(75) hsText.setText("<header:signature>") boxHorizontal.add(hsText) boxVertical.add(boxHorizontal) # Add the text label and area to the text panel slPanel.add(boxVertical) # Add the text panel to the top of the main tab bTopPanel.add(slPanel, BorderLayout.NORTH) #create HMAC Key Text Area: haPanel=swing.JPanel() # Create the label for the text area boxVertical = swing.Box.createVerticalBox() boxHorizontal = swing.Box.createHorizontalBox() textLabel = swing.JLabel("Hash Algorithm") boxHorizontal.add(textLabel) boxVertical.add(boxHorizontal) # Create the text area itself boxHorizontal = swing.Box.createHorizontalBox() rbPanel = swing.JPanel() radio1=swing.JRadioButton("SHA-1") radio2=swing.JRadioButton("SHA-256",True) radio3=swing.JRadioButton("SHA-512") group = swing.ButtonGroup() group.add(radio1) group.add(radio2) group.add(radio3) rbPanel.add(radio1) rbPanel.add(radio2) rbPanel.add(radio3) boxHorizontal.add(rbPanel) boxVertical.add(boxHorizontal) # Add the text label and area to the text panel haPanel.add(boxVertical) # Add the text panel to the top of the main tab bTopPanel.add(haPanel, BorderLayout.CENTER) #create HMAC Key Text Area: sPanel=swing.JPanel() # Create the label for the text area boxVertical = swing.Box.createVerticalBox() boxHorizontal = swing.Box.createHorizontalBox() textLabel = swing.JLabel("Signature") boxHorizontal.add(textLabel) boxVertical.add(boxHorizontal) # Create the text area itself boxHorizontal = swing.Box.createHorizontalBox() rbPanel = swing.JPanel() radio1=swing.JRadioButton("HEX",True) radio2=swing.JRadioButton("BASE64") group = swing.ButtonGroup() group.add(radio1) group.add(radio2) rbPanel.add(radio1) rbPanel.add(radio2) boxHorizontal.add(rbPanel) boxVertical.add(boxHorizontal) # Add the text label and area to the text panel sPanel.add(boxVertical) # Add the text panel to the top of the main tab bTopPanel.add(sPanel, BorderLayout.SOUTH) topPanel.add(bTopPanel, BorderLayout.SOUTH) self.tab.add(topPanel, BorderLayout.NORTH) #create HMAC Key Text Area: logPanel=swing.JPanel(BorderLayout()) # Create the label for the text area boxVertical = swing.Box.createVerticalBox() boxHorizontal = swing.Box.createHorizontalBox() textLabel = swing.JLabel("Logs") boxHorizontal.add(textLabel) boxVertical.add(boxHorizontal) # Create the text area itself boxHorizontal = swing.Box.createHorizontalBox() logText = swing.JTextArea("",10,100) boxHorizontal.add(logText) boxVertical.add(boxHorizontal) # Add the text label and area to the text panel logPanel.add(boxVertical) # Add the text panel to the top of the main tab self.tab.add(logPanel, BorderLayout.SOUTH) # Add the custom tab to Burp's UI callbacks.addSuiteTab(self)
def widgetFactory(self, *args, **kwds): return swing.JRadioButton()
def generateUI(file_list): # window frame = swing.JFrame("Marcksl1 prescreen tool") frame.setDefaultCloseOperation(swing.JFrame.DISPOSE_ON_CLOSE) frame.setPreferredSize(Dimension(700, 500)) frame.setSize(Dimension(700, 500)) frame.setLocationByPlatform(True) layout = GridBagLayout() frame.setLayout(layout) # image list lst_constraints = quickSetGridBagConstraints(GridBagConstraints(), 0, 0, 0.5, 0.33) lst_constraints.fill = GridBagConstraints.BOTH lst = swing.JList(file_list) lst_scrollpane = swing.JScrollPane(lst) layout.setConstraints(lst_scrollpane, lst_constraints) frame.add(lst_scrollpane) # radio buttons radio_panel_constraints = quickSetGridBagConstraints( GridBagConstraints(), 1, 0, 0.25, 0.33) radio_panel_constraints.fill = GridBagConstraints.HORIZONTAL isvButton = swing.JRadioButton("ISV", True) dlavButton = swing.JRadioButton("DLAV") radio_group = swing.ButtonGroup() radio_group.add(isvButton) radio_group.add(dlavButton) radio_panel = swing.JPanel() radio_panel_layout = GridLayout(2, 1) radio_panel.setLayout(radio_panel_layout) radio_panel.add(isvButton) radio_panel.add(dlavButton) radio_panel.setBorder( swing.BorderFactory.createTitledBorder( swing.BorderFactory.createEtchedBorder(), "Vessel type")) layout.setConstraints(radio_panel, radio_panel_constraints) frame.add(radio_panel) # checkboxes chk_constraints = quickSetGridBagConstraints(GridBagConstraints(), 2, 0, 0.25, 0.33) chk_constraints.fill = GridBagConstraints.HORIZONTAL chkbox = swing.JCheckBox("Is lumenised?", True) layout.setConstraints(chkbox, chk_constraints) frame.add(chkbox) # add ROI button roi_but_constraints = quickSetGridBagConstraints(GridBagConstraints(), 0, 1, 1, 0.16) roi_but_constraints.gridwidth = 3 roi_but_constraints.fill = GridBagConstraints.BOTH roi_but = swing.JButton("Add current ROI") layout.setConstraints(roi_but, roi_but_constraints) frame.add(roi_but) # metadata display table mdtbl_constraints = quickSetGridBagConstraints(GridBagConstraints(), 0, 2, 1, 0.33) mdtbl_constraints.gridwidth = 3 mdtbl_constraints.fill = GridBagConstraints.BOTH mdtbl_colnames = [ 'Experiment', 'Embryo', 'Imaged region index', 'ROI index', 'Vessel type', 'Lumenised?' ] mdtbl_model = swing.table.DefaultTableModel(mdtbl_colnames, 10) mdtbl = swing.JTable() mdtbl_scrollpane = swing.JScrollPane(mdtbl) layout.setConstraints(mdtbl_scrollpane, mdtbl_constraints) frame.add(mdtbl_scrollpane) # buttons del_but_constraints = quickSetGridBagConstraints(GridBagConstraints(), 1, 3, 0.25, 0.16) del_but_constraints.fill = GridBagConstraints.BOTH del_but = swing.JButton("Delete selected ROI") layout.setConstraints(del_but, del_but_constraints) frame.add(del_but) save_but_constraints = quickSetGridBagConstraints(GridBagConstraints(), 2, 3, 0.25, 0.16) save_but_constraints.fill = GridBagConstraints.BOTH save_but = swing.JButton("Save...") layout.setConstraints(save_but, save_but_constraints) frame.add(save_but) # show window frame.setVisible(True) frame.pack()
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 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 )