def warn(self, e): errorNumber = self.textfield.getText() if errorNumber == "": self.textfield.setBorder(self.defaultborder) return try: Integer.parseInt(errorNumber) except NumberFormatException: self.textfield.setBorder(BorderFactory.createLineBorder(Color.RED, 1)) return self.textfield.setBorder(BorderFactory.createLineBorder(Color.GREEN, 1))
def warn(self, e): errorNumber = self.textfield.getText() if errorNumber == "": self.textfield.setBorder(self.defaultborder) return try: Integer.parseInt(errorNumber) except NumberFormatException: self.textfield.setBorder( BorderFactory.createLineBorder(Color.RED, 1)) return self.textfield.setBorder(BorderFactory.createLineBorder( Color.GREEN, 1))
def __init__(self): UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); size = Dimension(800, 800) self.setPreferredSize(size) screenSize = Toolkit.getDefaultToolkit().getScreenSize(); self.setLocation(screenSize.getSize().width/2 - size.width/2, 100) self.setTitle("bashED Terminal HQ EXTREME"); self.setUndecorated(True) self.getRootPane().setOpaque(False) #self.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); self.setBackground(Color(0,128,0, 198)) #j = JDesktopPane() #j.setOpaque(False) self.setLayout(None) self.setIconImage(ImageIcon('bin/gui/media/' + "icon.png").getImage()) mp = MainPanel() self.add(mp) mp.setBounds(0, 0, size.width, size.height) imageTest = ImageIcon('bin/gui/media/' + "image.png") imageTestLabel = JLabel(imageTest) self.add(imageTestLabel) imageTestLabel.setBounds(0, 0, size.width, size.height) #self.getContentPane().add(mp) #self.getContentPane().add(JLabel("Iglo")) bb = BorderFactory.createLineBorder(Color.BLACK, 5) bw1 = BorderFactory.createLineBorder(Color.WHITE, 1) bw2 = BorderFactory.createLineBorder(Color.WHITE, 1) mp.setBorder( BorderFactory.createCompoundBorder( bw1, BorderFactory.createCompoundBorder(bb, bw2) )) #make the window viewable self.defaultCloseOperation=JFrame.EXIT_ON_CLOSE self.pack() self.setVisible(True)
def common_label(display, image_file, i, j, value, colorizer): return JLabel(display, image_file or None, JLabel.CENTER, border=BorderFactory.createLineBorder(Color.black), toolTipText=make_position(i, j), opaque=True, background=colorizer(value, i, j))
def __init__(self): UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()) size = Dimension(800, 800) self.setPreferredSize(size) screenSize = Toolkit.getDefaultToolkit().getScreenSize() self.setLocation(screenSize.getSize().width / 2 - size.width / 2, 100) self.setTitle("bashED Terminal HQ EXTREME") self.setUndecorated(True) self.getRootPane().setOpaque(False) #self.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); self.setBackground(Color(0, 128, 0, 198)) #j = JDesktopPane() #j.setOpaque(False) self.setLayout(None) self.setIconImage(ImageIcon('bin/gui/media/' + "icon.png").getImage()) mp = MainPanel() self.add(mp) mp.setBounds(0, 0, size.width, size.height) imageTest = ImageIcon('bin/gui/media/' + "image.png") imageTestLabel = JLabel(imageTest) self.add(imageTestLabel) imageTestLabel.setBounds(0, 0, size.width, size.height) #self.getContentPane().add(mp) #self.getContentPane().add(JLabel("Iglo")) bb = BorderFactory.createLineBorder(Color.BLACK, 5) bw1 = BorderFactory.createLineBorder(Color.WHITE, 1) bw2 = BorderFactory.createLineBorder(Color.WHITE, 1) mp.setBorder( BorderFactory.createCompoundBorder( bw1, BorderFactory.createCompoundBorder(bb, bw2))) #make the window viewable self.defaultCloseOperation = JFrame.EXIT_ON_CLOSE self.pack() self.setVisible(True)
def createColoredLabel(self, text, color): return JLabel(text, opaque=1, size=(150, 130), background=color, foreground=Color.black, verticalAlignment=JLabel.TOP, horizontalAlignment=JLabel.CENTER, border=BorderFactory.createLineBorder(Color.black))
def __init__(self, extender): # Initialize self super(MainPanel, self).__init__() self.extender = extender self.setLayout(BorderLayout()) self.setBorder(BorderFactory.createLineBorder(Color.BLACK)); # Create children self.tree = ResultTree(extender) # Add children self.add(JScrollPane(self.tree), BorderLayout.CENTER)
def generateTextBox(defaultTxt, editable): sample = JTextArea(5, 20) scrollPane1 = JScrollPane(sample) sample.setBounds(0, 0, 400, 400) sample.setEditable(editable) sample.setLineWrap(True) sample.setWrapStyleWord(True) sample.setBorder(BorderFactory.createLineBorder(Color.BLACK)) sample.setText(defaultTxt) return sample
def __init__(self,view,name,values,default): self.view=view self.layout=BorderLayout() self.name=name self.values_data=values self.values=JList(values,border=BorderFactory.createLineBorder(Color.black,1), valueChanged=self.adjust) self.add(JLabel(name,horizontalAlignment=SwingConstants.LEFT),BorderLayout.NORTH) self.new_value=JTextField('',actionPerformed=self.create_new_value) self.add(self.new_value,BorderLayout.SOUTH) self.add(self.values) self.values.setSelectedValue(default,True)
def buildConfigPane(self, state, callbacks): """ Builds the config pane, section per section. """ configPage = Box.createVerticalBox() configPage.setBorder(BorderFactory.createLineBorder(Color.black)) configPage.add(self.buildScope(state, callbacks)) configPage.add(self.buildReplacementRules(state, callbacks)) configPage.add(self.buildSessionCheck(state, callbacks)) return configPage
def __init__(self, gameplayer): FormPanel.__init__(self, os.path.join(os.path.dirname(__file__), "gameplayer.xml")) self.setPreferredSize(400, 175) self.pgbGame.setMaximum(len(gameplayer.getQuestions())) self.pgbGame.setValue(1) self.pgbGame.setString("1/" + str(len(gameplayer.getQuestions()))) self.pgbGame.setStringPainted(1) self.pnlQuestion.setLayout(BorderLayout()) self.pnlQuestion.setBorder(BorderFactory.createLineBorder(Color.lightGray, 1, 1)) self.index = 0 self.questionslist = gameplayer.getQuestions() self.viewslist = gameplayer.getViews() self.report = Report(gameplayer.getUserRole(), gameplayer.getUserId()) self.fillPanel(gameplayer.getQuestions()[0]) self.updateView(gameplayer.getViews()[0])
def getMainComponent(self): self._mainPanel = JPanel(BorderLayout()) #Left panel self._leftPanel = JPanel(BorderLayout()) self._leftPanel.setBorder(EmptyBorder(10, 10, 10, 10)) #Left subpanel - Positions editor self._positionsEditor = Utils.callbacks.createTextEditor() #TODO Remove a normal editor? self._positionsEditor = Utils.callbacks.createMessageEditor(self, True) self._positionsEditor.getComponent().setBorder(BorderFactory.createLineBorder(Color.BLACK)) #Left subpanel - Title pane self._leftTitlePanel = JPanel(GridLayout(0, 1)) self._leftTitlePanel.setBorder(EmptyBorder(0, 10, 10, 10)) self._titleText = JLabel("Commands Position") self._titleText.setForeground(COLOR_BURP_TITLE_ORANGE) self._titleText.setFont(self._titleText.getFont().deriveFont(16.0)) self._titleSubtitleText = JTextArea("Configure the position where commands will be inserted into the base request. Select the requests that were send Shell in the dropdown, then select the part of the request where commands need to be inserted and click the 'Add $' button.") self._titleSubtitleText.setEditable(False) self._titleSubtitleText.setLineWrap(True) self._titleSubtitleText.setWrapStyleWord(True) self._titleSubtitleText.setHighlighter(None) self._titleSubtitleText.setBorder(None) self._leftTitlePanel.add(self._titleText) self._leftTitlePanel.add(self._titleSubtitleText) #Left subpanel - Add positions editor and title self._leftPanel.add(self._leftTitlePanel, BorderLayout.NORTH) self._leftPanel.add(self._positionsEditor.getComponent(), BorderLayout.CENTER) #Right panel #self._rightPanel = JPanel(GridLayout(20, 1)) self._rightPanel = JPanel() self._rightPanel.setLayout(BoxLayout(self._rightPanel, BoxLayout.Y_AXIS)) #self._rightPanel.setPreferredSize(Dimension(150, 30)) self._rightPanel.setBorder(EmptyBorder(10, 10, 10, 10)) #Right panel - buttons self._buttonAdd = JButton(" Add $ ", actionPerformed=self.buttonAddClick) self._buttonClear = JButton(" Clear $ ", actionPerformed=self.buttonClearClick) #, actionPerformed=None # Right panel - add components self._rightPanel.add(self._buttonAdd) self._rightPanel.add(self._buttonClear) self._mainPanel.add(self._rightPanel, BorderLayout.EAST) self._mainPanel.add(self._leftPanel, BorderLayout.CENTER) return self._mainPanel
def __init__(self): self.jScrollPane1 = JScrollPane() self.jTable1 = JTable() self.jPanel1 = JPanel() self.labelName = JLabel() self.textName = JTextField() self.labelSeverity = JLabel() self.comboSeverity = None self.labelHost = JLabel() self.labelPath = JLabel() self.textHost = JTextField() self.textPath = JTextField() self.tabIssue = JTabbedPane() self.panelDescription = JPanel() self.panelRequest = JPanel() self.panelResponse = JPanel() self.panelRemediation = JPanel() # setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE) # setting up the table # initial data in the table tableData = [[None, None, None, None, None], [None, None, None, None, None], [None, None, None, None, None]] tableColumns = ["#", "Issue Type/Name", "Severity", "Host", "Path"] # create the table model tableModel = table.DefaultTableModel(tableData, tableColumns) # model.types = array.array([java.lang.Integer.class, java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.Object.class], java.lang.Class) # model.canEdit = array.array([False, False, False, False, False], java.lang.Boolean) # public Class getColumnClass(int columnIndex) { # return types [columnIndex] # } # # public boolean isCellEditable(int rowIndex, int columnIndex) { # return canEdit [columnIndex] # } # set the table model # if this fails, we have to use self.jTable1.setModel(tableModel) self.jTable1.setAutoCreateRowSorter(True) # wrap the table in a scrollpane self.jScrollPane1.setViewportView(self.jTable1) # top panel containing the table from java.awt import Color self.jPanel1.setBorder(BorderFactory.createLineBorder(Color(0, 0, 0))) # create the labels and textfields self.labelName.text = "Issue Type/Name" self.textName.text = "Issue Name/Type" self.labelSeverity.text = "Severity" # create and populate the combobox self.comboSeverity = JComboBox( ["Critical", "High", "Medium", "Low", "Info"]) self.labelHost.text = "Host" self.labelPath.text = "Path" self.textHost.text = "Issue Host" self.textPath.text = "Issue Path" from java.lang import Short # description panel panelDescriptionLayout = GroupLayout(self.panelDescription) self.panelDescription.setLayout(panelDescriptionLayout) panelDescriptionLayout.setHorizontalGroup( panelDescriptionLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelDescriptionLayout.setVerticalGroup( panelDescriptionLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Description", self.panelDescription) # request tab panelRequestLayout = GroupLayout(self.panelRequest) self.panelRequest.setLayout(panelRequestLayout) panelRequestLayout.setHorizontalGroup( panelRequestLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelRequestLayout.setVerticalGroup( panelRequestLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Request", self.panelRequest) # response tab panelResponseLayout = GroupLayout(self.panelResponse) self.panelResponse.setLayout(panelResponseLayout) panelResponseLayout.setHorizontalGroup( panelResponseLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelResponseLayout.setVerticalGroup( panelResponseLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Response", self.panelResponse) # remediation tab panelRemediationLayout = GroupLayout(self.panelRemediation) self.panelRemediation.setLayout(panelRemediationLayout) panelRemediationLayout.setHorizontalGroup( panelRemediationLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelRemediationLayout.setVerticalGroup( panelRemediationLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Remediation", self.panelRemediation) # jpanel1? jPanel1Layout = GroupLayout(self.jPanel1) self.jPanel1.setLayout(jPanel1Layout) jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addContainerGap( ).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.TRAILING).addComponent( self.labelHost).addComponent( self.labelSeverity).addComponent( self.labelName) ).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.LEADING). addComponent(self.textName).addGroup( jPanel1Layout.createSequentialGroup().addComponent( self.comboSeverity, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE).addGap( 0, 0, Short.MAX_VALUE)). addGroup( jPanel1Layout.createSequentialGroup().addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, 330, GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18). addComponent(self.labelPath).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(self.textPath)))).addComponent( self.tabIssue)).addContainerGap())) jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addContainerGap( ).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelName).addComponent( self.textName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelSeverity).addComponent( self.comboSeverity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelHost).addComponent( self.labelPath).addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.textPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)). addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addComponent( self.tabIssue).addContainerGap())) # create the main panel self.panel = JPanel() layout = GroupLayout(self.panel) self.panel.setLayout(layout) layout.setAutoCreateGaps(True) layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addContainerGap().addGroup( layout.createParallelGroup( GroupLayout.Alignment.LEADING).addComponent( self.jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent( self.jScrollPane1)).addContainerGap())) layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addContainerGap().addComponent( self.jScrollPane1, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE).addGap( 18, 18, 18).addComponent(self.jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addContainerGap()))
def common_label(display, image_file, i, j, value, colorizer): return JLabel(display, image_file or None, JLabel.CENTER, border = BorderFactory.createLineBorder(Color.black), toolTipText = make_position(i, j), opaque = True, background = colorizer(value, i, j))
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 clientUI(self): '''ClientUI and Widget creation ''' # Colours foreground_colour = Color(30,57,68) background_colour = Color(247,246,242) window_background = Color(145,190,210) # Borders self.border2=BorderFactory.createLineBorder(foreground_colour,1, True) # Fonts self.font= Font("Ubuntu Light", Font.BOLD, 20) self.label_font= Font("Ubuntu Light", Font.BOLD, 17) self.label_2_font= Font( "Ubuntu Light",Font.BOLD, 12) self.btn_font=Font("Ubuntu Light", Font.BOLD, 15) # Set the layout parameters self.client_layout=GroupLayout(self.getContentPane()) self.getContentPane().setLayout(self.client_layout) self.getContentPane().setBackground(window_background) self.client_layout.setAutoCreateGaps(True) self.client_layout.setAutoCreateContainerGaps(True) self.setPreferredSize(Dimension(400, 450)) # Create widgets and assemble the GUI # Main display area self.main_content=JTextPane() self.main_content.setBackground(background_colour) #self.main_content.setForeground(foreground_colour) self.main_content.setEditable(False) # Message entry area self.message=JTextArea( 2,2, border=self.border2, font=self.label_font, keyPressed=self.returnKeyPress) self.message.requestFocusInWindow() self.message.setBackground(background_colour) self.message.setForeground(foreground_colour) self.message.setLineWrap(True) self.message.setWrapStyleWord(True) self.message.setBorder(BorderFactory.createEmptyBorder(3,3,3,3)) self.message.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0), self.returnKeyPress) # BUttons quit_btn=JButton("Quit!", actionPerformed=ChatApp().closeEvent, border=self.border2, font=self.btn_font) go_btn=JButton("Send", actionPerformed=self.grabText, border=self.border2, font=self.btn_font) quit_btn.setBackground(background_colour) go_btn.setBackground(background_colour) quit_btn.setForeground(foreground_colour) go_btn.setForeground(foreground_colour) # Make scrollable self.scroll_content=JScrollPane(self.main_content) self.scroll_content.setPreferredSize(Dimension(150,275)) self.scroll_content.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) self.scroll_content.setViewportView(self.main_content) self.scroll_content.setBackground(Color.WHITE) self.scroll_message=JScrollPane(self.message) self.scroll_message.setPreferredSize(Dimension(150,20)) self.scroll_message.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) # Test user label, still not updating after first round of messages self.user_label=JLabel(" Users online : %s "%(str(len(self.no_users))),JLabel.RIGHT, font=self.label_2_font) # Assemble the components # Horizontal layout self.client_layout.setHorizontalGroup(self.client_layout.createParallelGroup() .addComponent(self.scroll_content) .addGroup(self.client_layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(self.scroll_message)) .addGroup(self.client_layout.createSequentialGroup() .addComponent(quit_btn) .addComponent(go_btn).addGap(20)) .addGroup(self.client_layout.createParallelGroup() .addComponent(self.user_label)) ) # Vertical layout self.client_layout.setVerticalGroup(self.client_layout.createSequentialGroup() .addGroup(self.client_layout.createParallelGroup() .addComponent(self.scroll_content)) .addComponent(self.scroll_message) .addGroup(self.client_layout.createParallelGroup() .addComponent(quit_btn) .addComponent(go_btn)) .addGroup(self.client_layout.createParallelGroup() .addComponent(self.user_label)) ) # Finalise the GUI self.client_layout.linkSize(SwingConstants.HORIZONTAL, [quit_btn,go_btn, self.user_label]) self.pack() self.message.requestFocusInWindow() self.setTitle(">>> Client %s <<<"%self.username) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True) # Display the server greeting self.appendText('\n'+self.greeting+'\n')
c.fill = GridBagConstraints.NONE c.weightx = 0.0 # let the previous ('path') component stretch as much as possible parent = JButton("Open folder", actionPerformed=openAtFolder) gb.setConstraints(parent, c) all.add(parent) # Middle-right textarea showing the text of a note associated with the selected table row image c.gridx = 1 c.gridy = 1 c.weighty = 1.0 c.gridwidth = 3 c.fill = GridBagConstraints.BOTH textarea = JTextArea() textarea.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.BLACK), BorderFactory.createEmptyBorder(10, 10, 10, 10))) textarea.setLineWrap(True) textarea.setWrapStyleWord(True) # wrap text by cutting lines at whitespace textarea.setEditable(False) font = textarea.getFont().deriveFont(18.0) textarea.setFont(font) textarea.setPreferredSize(Dimension(500, 500)) gb.setConstraints(textarea, c) all.add(textarea) # Bottom text label showing the status of the note: whether it's being edited, or saved. c.gridx = 1 c.gridy = 2 c.gridwidth = 1 c.weightx = 0.5
def drawPluginUI(self): # Create the plugin user interface self.pluginTab = JPanel() self.uiTitle = JLabel('UPnP BHunter Load, Aim and Fire Console') self.uiTitle.setFont(Font('Tahoma', Font.BOLD, 14)) self.uiTitle.setForeground(Color(250, 100, 0)) self.uiPanelA = JSplitPane(JSplitPane.VERTICAL_SPLIT) self.uiPanelA.setMaximumSize(Dimension(2500, 1000)) self.uiPanelA.setDividerSize(2) self.uiPanelB = JSplitPane(JSplitPane.VERTICAL_SPLIT) self.uiPanelB.setDividerSize(2) self.uiPanelA.setBottomComponent(self.uiPanelB) self.uiPanelA.setBorder(BorderFactory.createLineBorder(Color.gray)) # Create and configure labels and text fields self.labeltitle_step1 = JLabel("[1st STEP] Discover UPnP Locations") self.labeltitle_step1.setFont(Font('Tahoma', Font.BOLD, 14)) self.labeltitle_step2 = JLabel("[2nd STEP] Select an UPnP Service") self.labeltitle_step2.setFont(Font('Tahoma', Font.BOLD, 14)) self.labeltitle_step3 = JLabel("[3rd STEP] Time to Attack it") self.labeltitle_step3.setFont(Font('Tahoma', Font.BOLD, 14)) self.labelsubtitle_step1 = JLabel( "Specify the IP version address in scope and start UPnP discovery") self.labelsubtitle_step2 = JLabel( "Select which of the found UPnP services will be probed") self.labelsubtitle_step3 = JLabel( "Select how to test the extracted UPnP SOAP requests having input arguments" ) self.label_step1 = JLabel("Target IP") self.label_step2 = JLabel("Found UPnp Services") self.label_step3 = JLabel("Send all the extracted SOAP requests ") self.labelstatus = JLabel(" Status") self.labelempty_step1 = JLabel(" ") self.labelempty_step2 = JLabel(" ") self.labelupnp = JLabel("UPnP list") self.labelip = JLabel("IP list") self.labelLANHOST = JLabel( "Send the interesting LANHostConfigManagement SOAP requests ") self.labelWANCONNECTION = JLabel( "Send the interesting WANIP/PPPConnection SOAP requests ") self.labelSOAPnum = JLabel("0") self.labelLANHOSTnum = JLabel("0") self.labelWANCONNECTIONnum = JLabel("0") self.labelNoneServiceFound = JLabel(" ") self.labelNoneServiceFound.setFont(Font('Tahoma', Font.BOLD, 12)) self.labelNoneServiceFound.setForeground(Color.red) # Create combobox for IP version selection self.ip_versions = ["IPv4", "IPv6"] self.combo_ipversion = JComboBox(self.ip_versions) self.combo_ipversion.setSelectedIndex(0) self.combo_ipversion.setEnabled(True) # Create and configure progress bar self.progressbar = JProgressBar(0, 100) self.progressbar.setString("Ready") self.progressbar.setStringPainted(True) # Create and configure buttons self.startbutton = JButton("Start Discovery", actionPerformed=self.startHunting) self.clearbutton = JButton("Clear All", actionPerformed=self.clearAll) self.confirmbutton = JButton("Confirm Selection", actionPerformed=self.selectUPnPService) self.intruderbutton = JButton("to Intruder", actionPerformed=self.sendUPnPToIntruder) self.LANrepeaterbutton = JButton( "to Repeater", actionPerformed=self.sendLANUPnPToRepeater) self.WANrepeaterbutton = JButton( "to Repeater", actionPerformed=self.sendWANUPnPToRepeater) self.confirmbutton.setEnabled(False) self.intruderbutton.setEnabled(False) self.LANrepeaterbutton.setEnabled(False) self.WANrepeaterbutton.setEnabled(False) # Create the combo box, select item at index 0 (first item in list) self.upnpservices = [" "] self.upnpcombo_services = JComboBox(self.upnpservices) self.upnpcombo_services.setSelectedIndex(0) self.upnpcombo_services.setEnabled(False) # Class neeeded to handle the combobox in second step panel class ComboboxListener(ActionListener): def __init__(self, upnpcombo_targets, upnpcombo_services, scope_dict): self.upnpcombo_targets = upnpcombo_targets self.upnpcombo_services = upnpcombo_services self.scope_dict = scope_dict def actionPerformed(self, event): # Update the location url combobox depending on the IP combobox selected_target = self.upnpcombo_targets.getSelectedItem() if self.scope_dict and selected_target: self.upnpcombo_services.removeAllItems() for scope_url in self.scope_dict[selected_target]: self.upnpcombo_services.addItem(scope_url) self.upnpcombo_services.setSelectedIndex(0) # Create the combo box, select item at index 0 (first item in list) self.upnptargets = [" "] self.upnpcombo_targets = JComboBox(self.upnptargets) self.upnpcombo_targets.setSelectedIndex(0) self.upnpcombo_targets.setEnabled(False) self.upnpcombo_targets.addActionListener( ComboboxListener(self.upnpcombo_targets, self.upnpcombo_services, self.scope_dict)) # Configuring first step panel self.panel_step1 = JPanel() self.panel_step1.setPreferredSize(Dimension(2250, 100)) self.panel_step1.setBorder(EmptyBorder(10, 10, 10, 10)) self.panel_step1.setLayout(BorderLayout(15, 15)) self.titlepanel_step1 = JPanel() self.titlepanel_step1.setLayout(BorderLayout()) self.titlepanel_step1.add(self.labeltitle_step1, BorderLayout.NORTH) self.titlepanel_step1.add(self.labelsubtitle_step1) self.targetpanel_step1 = JPanel() self.targetpanel_step1.add(self.label_step1) self.targetpanel_step1.add(self.combo_ipversion) self.targetpanel_step1.add(self.startbutton) self.targetpanel_step1.add(self.clearbutton) self.targetpanel_step1.add(self.labelstatus) self.targetpanel_step1.add(self.progressbar) self.emptypanel_step1 = JPanel() self.emptypanel_step1.setLayout(BorderLayout()) self.emptypanel_step1.add(self.labelempty_step1, BorderLayout.WEST) # Assembling first step panel components self.panel_step1.add(self.titlepanel_step1, BorderLayout.NORTH) self.panel_step1.add(self.targetpanel_step1, BorderLayout.WEST) self.panel_step1.add(self.emptypanel_step1, BorderLayout.SOUTH) self.uiPanelA.setTopComponent(self.panel_step1) # Configure second step panel self.panel_step2 = JPanel() self.panel_step2.setPreferredSize(Dimension(2250, 100)) self.panel_step2.setBorder(EmptyBorder(10, 10, 10, 10)) self.panel_step2.setLayout(BorderLayout(15, 15)) self.titlepanel_step2 = JPanel() self.titlepanel_step2.setLayout(BorderLayout()) self.titlepanel_step2.add(self.labeltitle_step2, BorderLayout.NORTH) self.titlepanel_step2.add(self.labelsubtitle_step2) self.selectpanel_step2 = JPanel() self.selectpanel_step2.add(self.labelip) self.selectpanel_step2.add(self.upnpcombo_targets) self.selectpanel_step2.add(self.labelupnp) self.selectpanel_step2.add(self.upnpcombo_services) self.selectpanel_step2.add(self.confirmbutton) self.emptypanel_step2 = JPanel() self.emptypanel_step2.setLayout(BorderLayout()) self.emptypanel_step2.add(self.labelempty_step2, BorderLayout.WEST) self.emptypanel_step2.add(self.labelNoneServiceFound) # Assembling second step panel components self.panel_step2.add(self.titlepanel_step2, BorderLayout.NORTH) self.panel_step2.add(self.selectpanel_step2, BorderLayout.WEST) self.panel_step2.add(self.emptypanel_step2, BorderLayout.SOUTH) self.uiPanelB.setTopComponent(self.panel_step2) # Configuring third step panel self.panel_step3 = JPanel() self.panel_step3.setPreferredSize(Dimension(2250, 100)) self.panel_step3.setBorder(EmptyBorder(10, 10, 10, 10)) self.panel_step3.setLayout(BorderLayout(15, 15)) self.titlepanel_step3 = JPanel() self.titlepanel_step3.setLayout(BorderLayout()) self.titlepanel_step3.add(self.labeltitle_step3, BorderLayout.NORTH) self.titlepanel_step3.add(self.labelsubtitle_step3) self.underpanel_step3 = JPanel() underlayout = GroupLayout(self.underpanel_step3) self.underpanel_step3.setLayout(underlayout) underlayout.setAutoCreateGaps(True) underlayout.setAutoCreateContainerGaps(True) left2right = underlayout.createSequentialGroup() firstcolumn = underlayout.createParallelGroup() firstcolumn.addComponent(self.label_step3, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) firstcolumn.addComponent(self.labelLANHOST, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) firstcolumn.addComponent(self.labelWANCONNECTION, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) secondcolumn = underlayout.createParallelGroup() secondcolumn.addComponent(self.labelSOAPnum) secondcolumn.addComponent(self.labelLANHOSTnum) secondcolumn.addComponent(self.labelWANCONNECTIONnum) thirdcolumn = underlayout.createParallelGroup() thirdcolumn.addComponent(self.intruderbutton) thirdcolumn.addComponent(self.LANrepeaterbutton) thirdcolumn.addComponent(self.WANrepeaterbutton) left2right.addGroup(firstcolumn) left2right.addGroup(secondcolumn) left2right.addGroup(thirdcolumn) top2bottom = underlayout.createSequentialGroup() firstrow = underlayout.createParallelGroup() firstrow.addComponent(self.label_step3, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) firstrow.addComponent(self.labelSOAPnum) firstrow.addComponent(self.intruderbutton) secondrow = underlayout.createParallelGroup() secondrow.addComponent(self.labelLANHOST, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) secondrow.addComponent(self.labelLANHOSTnum) secondrow.addComponent(self.LANrepeaterbutton) thirdrow = underlayout.createParallelGroup() thirdrow.addComponent(self.labelWANCONNECTION, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) thirdrow.addComponent(self.labelWANCONNECTIONnum) thirdrow.addComponent(self.WANrepeaterbutton) top2bottom.addGroup(firstrow) top2bottom.addGroup(secondrow) top2bottom.addGroup(thirdrow) underlayout.setHorizontalGroup(left2right) underlayout.setVerticalGroup(top2bottom) # Assembling thirdd step panel components self.panel_step3.add(self.titlepanel_step3, BorderLayout.NORTH) self.panel_step3.add(self.underpanel_step3, BorderLayout.WEST) self.uiPanelB.setBottomComponent(self.panel_step3) # Assembling the group of all panels layout = GroupLayout(self.pluginTab) self.pluginTab.setLayout(layout) layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addGap(10, 10, 10).addGroup( layout.createParallelGroup( GroupLayout.Alignment.LEADING).addComponent( self.uiTitle).addGap(15, 15, 15).addComponent( self.uiPanelA)).addContainerGap( 26, Short.MAX_VALUE))) layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addGap(15, 15, 15).addComponent( self.uiTitle).addGap(15, 15, 15).addComponent( self.uiPanelA).addGap(20, 20, 20).addGap(20, 20, 20)))
def registerExtenderCallbacks(self, callbacks): self.out = callbacks.getStdout() self.callbacks = callbacks self.helpers = callbacks.getHelpers() callbacks.setExtensionName("WhatsApp Decoder") self.banner = JLabel("WHATSAPP DECRYPTION AND ENCRYPTION EXTENSION BY DIKLA BARDA, ROMAN ZAIKIN", SwingConstants.CENTER) self.banner.setFont(Font("Serif", Font.PLAIN, 17)) self.banner.setBorder(BorderFactory.createLineBorder(Color.BLACK)) self.statusConn = JLabel("CONNECTION STATUS: ") self.statusConnField = JLabel("NOT CONNECTED") self.statusAct = JLabel("ACTION STATUS: ") self.statusActField = JLabel("OK") self.ref = JLabel("Ref object: ") self.refField = JTextField("", 80) self.refField.setToolTipText("Copy the Ref from burpsuit WebSocket, make sure that the parameter 'secret' is there and you copy only the 'ref' without the connection and other data, if not logout from your whatsapp web and login again.") self.privateKey = JLabel("Private Key:") self.privateKeyField = JTextField("", 80) self.privateKeyField.setToolTipText("Copy the private key list from your whatsapp web according to our blog post.") self.publicKey = JLabel("Public Key: ") self.publicKeyField = JTextField("", 80) self.publicKeyField.setToolTipText("Copy the public key list from your whatsapp web according to our blog post.") self.statusPanel1 = JPanel() self.statusPanel1.add(self.statusConn) self.statusPanel1.add(self.statusConnField) self.statusPanel2 = JPanel() self.statusPanel2.add(self.statusAct) self.statusPanel2.add(self.statusActField) self.privateKeyPanel = JPanel() self.privateKeyPanel.add(self.privateKey) self.privateKeyPanel.add(self.privateKeyField) self.publicKeyPanel = JPanel() self.publicKeyPanel.add(self.publicKey) self.publicKeyPanel.add(self.publicKeyField) self.refPanel = JPanel() self.refPanel.add(self.ref) self.refPanel.add(self.refField) self.messageField = JTextArea('["action", {"add": "relay"}, [{"message": {"conversation": "WhatsApp Protocol Decryption!"}, "participant": "*****@*****.**", "messageTimestamp": "1565193325", "key": {"fromMe": false, "remoteJid": "*****@*****.**", "id": "78CECC5019E81B84B64ED2F6A57217AK"}, "status": "ERROR"}]]', 5, 90) self.messageField.setLineWrap(True) self.messageField.setToolTipText("Incoming traffic is from burp suite websocket, The outgoing traffic is the list from aesCbcEncrypt") self.messageTag = JLabel("Message Tag:") self.messageTagField = JTextField("", 80) self.messageTagField.setToolTipText("Copy the message tag from WebSocket it's the text until first ',' ") self.messageTagFieldButton = JButton("Update Tag", actionPerformed=self.performUpdateTag) self.whatsAppMessagesPanel = JPanel() self.whatsAppMessagesPanel.add(self.messageField) self.messageTagPanel = JPanel() self.messageTagPanel.add(self.messageTag) self.messageTagPanel.add(self.messageTagField) self.messageTagPanel.add(self.messageTagFieldButton) self.btnSave = JButton("Connect", actionPerformed=self.saveConfig) self.btnRestore = JButton("Clear", actionPerformed=self.clearConfig) self.grpConfig = JPanel() self.grpConfig.add(self.btnSave) self.grpConfig.add(self.btnRestore) self.btnIncoming = JButton("Incoming", actionPerformed=self.performAction) self.btnOutgoing = JButton("Outgoing", actionPerformed=self.performAction) self.btnEncrypt = JButton("Encrypt", actionPerformed=self.performAction) self.btnEncrypt.setEnabled(False) # Can't send data without a direction self.btnDecrypt = JButton("Decrypt", actionPerformed=self.performAction) self.btnDecrypt.setEnabled(False) # Can't send data without a direction self.btnCrypt = JPanel() self.btnCrypt.add(self.btnIncoming) self.btnCrypt.add(self.btnEncrypt) self.btnCrypt.add(self.btnDecrypt) self.btnCrypt.add(self.btnOutgoing) self.tab = JPanel() layout = GridBagLayout() self.tab.setLayout(layout) c = GridBagConstraints() c.ipadx = 0 c.ipady = 0 c.fill = GridBagConstraints.BOTH #c.weightx = 0 # gap between the x items #c.weighty = 0 # gap between the y items c.anchor = GridBagConstraints.NORTHWEST c.gridx = 0 c.gridy = 0 self.tab.add(self.banner, c) c.gridx = 0 c.gridy = 1 self.tab.add(self.refPanel, c) c.gridx = 0 c.gridy = 2 self.tab.add(self.privateKeyPanel, c) c.gridx = 0 c.gridy = 3 self.tab.add(self.publicKeyPanel, c) c.gridx = 0 c.gridy = 4 c.anchor = GridBagConstraints.CENTER self.tab.add(self.grpConfig, c) c.gridx = 0 c.gridy = 5 self.tab.add(self.whatsAppMessagesPanel, c) c.gridx = 0 c.gridy = 6 self.tab.add(self.messageTagPanel, c) c.gridx = 0 c.gridy = 7 self.tab.add(self.btnCrypt, c) c.gridx = 0 c.gridy = 8 self.tab.add(self.statusPanel1, c) c.gridx = 0 c.gridy = 9 self.tab.add(self.statusPanel2, c) # restore config self.restoreConfig() callbacks.addSuiteTab(self)
def drawUI(self): # 最外层:垂直盒子,内放一个水平盒子+一个胶水 out_vBox_main = Box.createVerticalBox() # 次外层:水平盒子,使用说明 usage = u''' JC-AntiToken(简单防重放绕过) 适用场景:防重放的方式为,提前向一个页面发送请求取得token,替换到下一个页面中。 适用说明: 1. 请求头中Headers和Data的值必须是JSON字符串,如:{"var":"value"} 2. 左边tokenRegex的格式为: a. .*开头,.*结尾,用()括住要取出的token b. 如:.*,"token":"(.*?)".* 3. 右边tokenRegex的格式为: a. 需要三个(),第二个()括住要替换的token b. 如:(.*,"token":")(.*?)(".*) 详见:https://github.com/chroblert/JC-AntiToken ''' hBox_usage = Box.createHorizontalBox() jpanel_test = JPanel() jTextarea_usage = JTextArea() jTextarea_usage.setText(usage) jTextarea_usage.setRows(13) jTextarea_usage.setEditable(False) # jpanel_test.add(jTextarea_usage) hBox_usage.add(JScrollPane(jTextarea_usage)) # 次外层:水平盒子,内放两个垂直盒子 hBox_main = Box.createHorizontalBox() # 左垂直盒子 vBox_left = Box.createVerticalBox() # 右垂直盒子 vBox_right = Box.createVerticalBox() # 左垂直盒子内部:发送请求包拿token # URL标签 jlabel_url = JLabel(" URL: ") self.jtext_url = JTextField(generWidth) self.jtext_url.setMaximumSize(self.jtext_url.getPreferredSize()) hbox_url = Box.createHorizontalBox() hbox_url.add(jlabel_url) hbox_url.add(self.jtext_url) hglue_url = Box.createHorizontalGlue() hbox_url.add(hglue_url) # 请求方法标签 jlabel_reqMeth = JLabel("ReqMeth: ") self.jcombobox_reqMeth = JComboBox() self.jcombobox_reqMeth.addItem("GET") self.jcombobox_reqMeth.addItem("POST") hbox_reqMeth = Box.createHorizontalBox() hbox_reqMeth.add(jlabel_reqMeth) hbox_reqMeth.add(self.jcombobox_reqMeth) self.jcombobox_reqMeth.setMaximumSize( self.jcombobox_reqMeth.getPreferredSize()) hglue_reqMeth = Box.createHorizontalGlue() hbox_reqMeth.add(hglue_reqMeth) # ContentType标签 jlabel_contentType = JLabel("ConType: ") self.jcombobox_contentType = JComboBox() self.jcombobox_contentType.addItem("application/json") self.jcombobox_contentType.addItem("application/x-www-form-urlencoded") hbox_contentType = Box.createHorizontalBox() hbox_contentType.add(jlabel_contentType) hbox_contentType.add(self.jcombobox_contentType) self.jcombobox_contentType.setMaximumSize( self.jcombobox_contentType.getPreferredSize()) hglue_contentType = Box.createHorizontalGlue() hbox_contentType.add(hglue_contentType) # Charset标签 jlabel_charset = JLabel("CharSet: ") self.jcombobox_charset = JComboBox() self.jcombobox_charset.addItem("UTF-8") self.jcombobox_charset.addItem("GBK") hbox_charset = Box.createHorizontalBox() hbox_charset.add(jlabel_charset) hbox_charset.add(self.jcombobox_charset) self.jcombobox_charset.setMaximumSize( self.jcombobox_charset.getPreferredSize()) hglue_charset = Box.createHorizontalGlue() hbox_charset.add(hglue_charset) # 请求头标签 jlabel_headers = JLabel("Headers: ") self.jtext_headers = JTextField(generWidth) self.jtext_headers.setMaximumSize( self.jtext_headers.getPreferredSize()) hbox_headers = Box.createHorizontalBox() hbox_headers.add(jlabel_headers) hbox_headers.add(self.jtext_headers) hglue_headers = Box.createHorizontalGlue() hbox_headers.add(hglue_headers) # 请求参数标签 jlabel_data = JLabel(" Data: ") self.jtext_data = JTextField(generWidth) self.jtext_data.setPreferredSize(Dimension(20, 40)) self.jtext_data.setMaximumSize(self.jtext_data.getPreferredSize()) hbox_data = Box.createHorizontalBox() hbox_data.add(jlabel_data) hbox_data.add(self.jtext_data) hglue_data = Box.createHorizontalGlue() hbox_data.add(hglue_data) # token标志位置标签 hbox_radiobtn = Box.createHorizontalBox() jlabel_tokenPosition = JLabel("Token Position: ") self.radioBtn01 = JRadioButton("Header") self.radioBtn02 = JRadioButton("Body") btnGroup = ButtonGroup() btnGroup.add(self.radioBtn01) btnGroup.add(self.radioBtn02) self.radioBtn01.setSelected(True) hbox_radiobtn.add(jlabel_tokenPosition) hbox_radiobtn.add(self.radioBtn01) hbox_radiobtn.add(self.radioBtn02) # token正则表达式标签 hbox_token = Box.createHorizontalBox() hbox_token_header = Box.createHorizontalBox() hbox_token_body = Box.createHorizontalBox() # token正则表达式标签:header中 jlabel_tokenName = JLabel("tokenName: ") self.jtext_tokenName = JTextField(tokenWidth) self.jtext_tokenName.setMaximumSize( self.jtext_tokenName.getPreferredSize()) hbox_token_header.add(jlabel_tokenName) hbox_token_header.add(self.jtext_tokenName) hglue_token_header = Box.createHorizontalGlue() hbox_token_header.add(hglue_token_header) # token正则表达式标签:body中 jlabel_tokenRegex = JLabel("tokenRegex: ") self.jtext_tokenRegex = JTextField(tokenWidth) self.jtext_tokenRegex.setMaximumSize( self.jtext_tokenRegex.getPreferredSize()) hbox_token_body.add(jlabel_tokenRegex) hbox_token_body.add(self.jtext_tokenRegex) hglue_token_body = Box.createHorizontalGlue() hbox_token_body.add(hglue_token_body) # token正则表达式标签 hbox_token.add(hbox_token_header) hbox_token.add(hbox_token_body) # test测试按钮 hbox_test = Box.createHorizontalBox() jbtn_test = JButton("TEST", actionPerformed=self.btnTest) self.jlabel_test = JLabel("Result: ") hbox_test.add(jbtn_test) hbox_test.add(self.jlabel_test) # 水平胶水填充 hGlue_test = Box.createHorizontalGlue() hbox_test.add(hGlue_test) hbox_test.setBorder(BorderFactory.createLineBorder(Color.green, 2)) # 响应数据输出 hbox_resp = Box.createHorizontalBox() self.jtextarea_resp = JTextArea() jsp = JScrollPane(self.jtextarea_resp) hbox_resp.add(self.jtextarea_resp) # 左垂直盒子:添加各种水平盒子 vBox_left.add(hbox_url) vBox_left.add(hbox_reqMeth) vBox_left.add(hbox_contentType) vBox_left.add(hbox_charset) vBox_left.add(hbox_headers) vBox_left.add(hbox_data) vBox_left.add(hbox_radiobtn) vBox_left.add(hbox_token) vBox_left.add(hbox_test) vBox_left.add(hbox_resp) # 左垂直盒子:垂直胶水填充 vGlue_test = Box.createGlue() vBox_left.add(vGlue_test) # 右垂直盒子内部:指定token在请求包中的位置 # token标志位置单选按钮 hbox_radiobtn_r = Box.createHorizontalBox() jlabel_tokenPosition_r = JLabel("Token Position: ") self.radioBtn01_r = JRadioButton("Header") self.radioBtn02_r = JRadioButton("Body") btnGroup_r = ButtonGroup() btnGroup_r.add(self.radioBtn01_r) btnGroup_r.add(self.radioBtn02_r) self.radioBtn01_r.setSelected(True) hbox_radiobtn_r.add(jlabel_tokenPosition_r) hbox_radiobtn_r.add(self.radioBtn01_r) hbox_radiobtn_r.add(self.radioBtn02_r) # token正则表达式 hbox_token_r = Box.createHorizontalBox() hbox_token_header_r = Box.createHorizontalBox() hbox_token_body_r = Box.createHorizontalBox() # token正则表达式:在header中 jlabel_tokenName_r = JLabel("tokenName: ") self.jtext_tokenName_r = JTextField(tokenWidth) self.jtext_tokenName_r.setMaximumSize( self.jtext_tokenName_r.getPreferredSize()) hbox_token_header_r.add(jlabel_tokenName_r) hbox_token_header_r.add(self.jtext_tokenName_r) hglue_token_header_r = Box.createHorizontalGlue() hbox_token_header_r.add(hglue_token_header_r) # token正则表达式:在Body中 jlabel_tokenRegex_r = JLabel("tokenRegex: ") self.jtext_tokenRegex_r = JTextField(tokenWidth) self.jtext_tokenRegex_r.setMaximumSize( self.jtext_tokenRegex_r.getPreferredSize()) hbox_token_body_r.add(jlabel_tokenRegex_r) hbox_token_body_r.add(self.jtext_tokenRegex_r) hglue_token_body_r = Box.createHorizontalGlue() hbox_token_body_r.add(hglue_token_body_r) # token正则表达式 hbox_token_r.add(hbox_token_header_r) hbox_token_r.add(hbox_token_body_r) # 测试按钮 hbox_test_r = Box.createHorizontalBox() jbtn_test_r = JButton("SET", actionPerformed=self.btnTest_r) self.jlabel_test_r = JLabel("Result: ") hbox_test_r.add(jbtn_test_r) hbox_test_r.add(self.jlabel_test_r) # 水平胶水填充 hGlue02 = Box.createHorizontalGlue() hbox_test_r.add(hGlue02) hbox_test_r.setBorder(BorderFactory.createLineBorder(Color.green, 2)) # 右垂直盒子:添加各种水平盒子 vBox_right.add(hbox_radiobtn_r) vBox_right.add(hbox_token_r) vBox_right.add(hbox_test_r) vGlue = Box.createVerticalGlue() vBox_right.add(vGlue) vBox_left.setBorder(BorderFactory.createLineBorder(Color.black, 3)) vBox_right.setBorder(BorderFactory.createLineBorder(Color.black, 3)) # 次外层水平盒子:添加左右两个垂直盒子 hBox_main.add(vBox_left) hBox_main.add(vBox_right) # 最外层垂直盒子:添加次外层水平盒子,垂直胶水 out_vBox_main.add(hBox_usage) out_vBox_main.add(hBox_main) self.mainPanel = out_vBox_main self._callbacks.customizeUiComponent(self.mainPanel) self._callbacks.addSuiteTab(self)
def __init__(self): super(WorkHelper, self).__init__() self.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard() #self.initUI() #def initUI(self): #panel = JPanel() #self.getContentPane().add(panel) ############################################################# # Layout layout = GroupLayout(self.getContentPane()) self.getContentPane().setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) ############################################################# ############################################################# # Scroll Area Input + Output Larea1 = JLabel("InputArea:") Larea2 = JLabel("OutputArea:") Sarea1 = JScrollPane() Sarea2 = JScrollPane() self.area1 = JTextArea() self.area1.setToolTipText("Input Area") self.area1.setEditable(True) self.area1.setBorder(BorderFactory.createLineBorder(Color.gray)) Sarea1.setPreferredSize(Dimension(300,100)) Sarea1.getViewport().setView((self.area1)) self.area2 = JTextArea() self.area2.setToolTipText("Output Area") self.area2.setEditable(False) self.area2.setBorder(BorderFactory.createLineBorder(Color.gray)) Sarea2.setPreferredSize(Dimension(300,100)) Sarea2.getViewport().setView((self.area2)) ############################################################# ############################################################# # Buttons self.cCurly = JCheckBox("Curly"); self.cCurly.setToolTipText("When 'Checked' Curly Brackets will surround the Categories") self.cCurly.setSelected(1) self.cCtClipB = JCheckBox("Auto-Copy"); self.cCtClipB.setToolTipText("When 'Checked' after the Categories are created they will added to the clipboard") self.cCtClipB.setSelected(1) self.cSemiC = JCheckBox("SemiColumn"); self.cSemiC.setToolTipText("When 'Checked' after the Categories are created at the end will be a semicolomn") self.cSemiC.setSelected(1) bRemoveNBSP_L = JButton("Clean LText", actionPerformed=self.bRemoveNBSP_L) bRemoveNBSP_L.setToolTipText("Removes Spaces, Tabs from the start of every text line from the input Area") bRemoveNBSP_R = JButton("Clean RText", actionPerformed=self.bRemoveNBSP_R) bRemoveNBSP_R.setToolTipText("Removes Spaces, Tabs from the end of every text line from the input Area") bCopyToInput = JButton("Copy to Input", actionPerformed=self.bCopyToInput) bCopyToInput.setToolTipText("Copy the text from the Output Area to the Input Area for further Operations") bClear = JButton("Clear", actionPerformed=self.bClear) bClear.setToolTipText("Clears the text form both Input and Output text Areas") self.iStart = JTextField(maximumSize=Dimension(40,25)) self.iStart.setToolTipText("The Start Index for the Making of the Categories") self.RThis = JTextField() self.RThis = JTextField(maximumSize=Dimension(120,25)) self.RThis.setToolTipText("Text to be replaced or The Starting C_Index") self.RThat = JTextField() self.RThat = JTextField(maximumSize=Dimension(120,25)) self.RThat.setToolTipText("Text to be placed or The Finish C_Index") bSandReplace = JButton("Replace Text", actionPerformed=self.bSandReplace) bSandReplace.setToolTipText("Replace the text from This with Thext from That in the Text from the Input Area and displays it in the Output Area") bcCat = JButton("CreatCateg", actionPerformed=self.bcCat) bcCat.setToolTipText("Create a categorical form starting C_Index to finish C_Index; Use the above text boxes to define the indexes") bC_S = JButton("Create _Series", actionPerformed=self.bC_S) bC_S.setToolTipText("Create a series form starting C_Index to finish C_Index; Use the above text boxes to define the indexes; It will create a series for every row in the Input Area") bM_Categories = JButton("Categories", actionPerformed=self.mCategories) bM_Categories.setToolTipText("Make Categories using the lines from the Input Area") #bM_Categories = JButton(maximumSize=Dimension(40,25)) # de incercat daca merge cu ; sa grupezi in [dsa] elementele ############################################################# ############################################################# # Aplication Layout 2 groups one Horizontal and one Vertical layout.setHorizontalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(Larea1) .addComponent(Sarea1) .addComponent(Sarea2) .addComponent(bCopyToInput) .addComponent(Larea2)) .addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addComponent(bM_Categories) .addComponent(self.iStart)) .addGroup(layout.createSequentialGroup() .addComponent(self.cCurly) .addComponent(self.cSemiC) .addComponent(self.cCtClipB)) .addGroup(layout.createSequentialGroup() .addComponent(bRemoveNBSP_L) .addComponent(bRemoveNBSP_R)) .addGroup(layout.createSequentialGroup() .addComponent(self.RThis) .addComponent(self.RThat)) .addGroup(layout.createSequentialGroup() .addComponent(bSandReplace) .addComponent(bcCat)) .addGroup(layout.createSequentialGroup() .addComponent(bC_S)) .addComponent(bClear)) ) layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(Larea1) .addGroup(layout.createParallelGroup() .addComponent(Sarea1) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(bM_Categories) .addComponent(self.iStart)) .addGroup(layout.createParallelGroup() .addComponent(self.cCurly) .addComponent(self.cSemiC) .addComponent(self.cCtClipB)) .addGroup(layout.createParallelGroup() .addComponent(bRemoveNBSP_L) .addComponent(bRemoveNBSP_R)) .addGroup(layout.createParallelGroup() .addComponent(self.RThis) .addComponent(self.RThat)) .addGroup(layout.createParallelGroup() .addComponent(bSandReplace) .addComponent(bcCat)) .addGroup(layout.createParallelGroup() .addComponent(bC_S)) ) ) .addGroup(layout.createParallelGroup() .addComponent(bCopyToInput) .addComponent(bClear)) .addComponent(Larea2) .addGroup(layout.createParallelGroup() .addComponent(Sarea2)) ) #layout.linkSize(SwingConstants.HORIZONTAL, [ok, bCopyToInput, close, bM_Categories]) layout.linkSize(SwingConstants.HORIZONTAL, [self.RThis,self.RThat,bRemoveNBSP_L,bRemoveNBSP_R,bCopyToInput,bM_Categories,bSandReplace,bcCat,bC_S]) #layout.linkSize(SwingConstants.HORIZONTAL, [self.cCurly,bM_Categories]) ############################################################# ############################################################# # Aplication Settings self.pack() #self.setPreferredSize(Dimension(1000, 1000)) self.setTitle("Workhelper") self.setSize(800, 500) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
def drawPluginUI(self): # Create the plugin user interface self.pluginTab = JPanel() self.uiTitle = JLabel('UPnP BHunter Load, Aim and Fire Console') self.uiTitle.setFont(Font('Tahoma', Font.BOLD, 14)) self.uiTitle.setForeground(Color(250, 100, 0)) self.uiPanelA = JSplitPane(JSplitPane.VERTICAL_SPLIT) self.uiPanelA.setMaximumSize(Dimension(2500, 1000)) self.uiPanelA.setDividerSize(2) self.uiPanelB = JSplitPane(JSplitPane.VERTICAL_SPLIT) self.uiPanelB.setDividerSize(2) self.uiPanelA.setBottomComponent(self.uiPanelB) self.uiPanelA.setBorder(BorderFactory.createLineBorder(Color.gray)) # Create and configure labels and text fields self.labeltitle_step1 = JLabel("[1st STEP] Discover UPnP Locations") self.labeltitle_step1.setFont(Font('Tahoma', Font.BOLD, 14)) self.labeltitle_step2 = JLabel( "[2nd STEP] Select a UPnP Service and Action") self.labeltitle_step2.setFont(Font('Tahoma', Font.BOLD, 14)) self.labeltitle_step3 = JLabel("[3rd STEP] Time to Attack it") self.labeltitle_step3.setFont(Font('Tahoma', Font.BOLD, 14)) self.labelsubtitle_step1 = JLabel( "Specify the IP version address in scope and start UPnP discovery") self.labelsubtitle_step2 = JLabel( "Select which of the found UPnP services will be probed") self.labelsubtitle_step3 = JLabel( "Review and modify the request, then send it to one of the attack tools" ) self.label_step1 = JLabel("Target IP") self.label_step2 = JLabel("Found UPnp Services") self.labelstatus = JLabel(" Status") self.labelempty_step1 = JLabel(" ") self.labelempty_step2 = JLabel(" ") self.labelupnp = JLabel("UPnP list") self.labelip = JLabel("IP list") self.labelactions = JLabel("Actions") self.labelNoneServiceFound = JLabel(" ") self.labelNoneServiceFound.setFont(Font('Tahoma', Font.BOLD, 12)) self.labelNoneServiceFound.setForeground(Color.red) # Create combobox for IP version selection self.ip_versions = ["IPv4", "IPv6"] self.combo_ipversion = JComboBox(self.ip_versions) self.combo_ipversion.setSelectedIndex(0) self.combo_ipversion.setEnabled(True) # Create and configure progress bar self.progressbar = JProgressBar(0, 100) self.progressbar.setString("Ready") self.progressbar.setStringPainted(True) # Create and configure buttons self.startbutton = JButton("Start Discovery", actionPerformed=self.startHunting) self.clearbutton = JButton("Clear All", actionPerformed=self.clearAll) self.intruderbutton = JButton("Send to Intruder", actionPerformed=self.sendToIntruder) self.repeaterbutton = JButton("Send to Repeater", actionPerformed=self.sendToRepeater) #self.WANrepeaterbutton = JButton("to Repeater", actionPerformed=self.sendWANUPnPToRepeater) self.textarea_request = JTextArea(18, 90) self.intruderbutton.setEnabled(False) self.repeaterbutton.setEnabled(False) # Class neeeded to handle the target combobox in second step panel class TargetComboboxListener(ActionListener): def __init__(self, upnpcombo_targets, upnpcombo_services, ip_service_dict): self.upnpcombo_targets = upnpcombo_targets self.upnpcombo_services = upnpcombo_services self.ip_service_dict = ip_service_dict def actionPerformed(self, event): try: # Update the location url combobox depending on the IP combobox selected_target = self.upnpcombo_targets.getSelectedItem() if self.ip_service_dict and selected_target: self.upnpcombo_services.removeAllItems() for service_url in self.ip_service_dict[ selected_target]: self.upnpcombo_services.addItem(service_url) self.upnpcombo_services.setSelectedIndex(0) except BaseException as e: print("[!] Exception selecting service: \"%s\" ") % e # Class neeeded to handle the service combobox in second step panel class ServiceComboboxListener(ActionListener): def __init__(self, upnpcombo_services, upnpcombo_actions, services_dict): self.upnpcombo_services = upnpcombo_services self.upnpcombo_actions = upnpcombo_actions self.services = services_dict def actionPerformed(self, event): try: # Update the location url combobox depending on the IP combobox selected_service = self.upnpcombo_services.getSelectedItem( ) if self.services and selected_service: self.upnpcombo_actions.removeAllItems() actions = self.services[selected_service] for action in actions: self.upnpcombo_actions.addItem(action) self.upnpcombo_actions.setSelectedIndex(0) except BaseException as e: print("[!] Exception selecting service: \"%s\" ") % e # Class neeeded to handle the action combobox in second step panel class ActionComboboxListener(ActionListener): def __init__(self, upnpcombo_services, upnpcombo_actions, textarea_request, services_dict): self.upnpcombo_services = upnpcombo_services self.upnpcombo_actions = upnpcombo_actions self.textarea_request = textarea_request self.services = services_dict def actionPerformed(self, event): try: # Update the location url combobox depending on the IP combobox selected_action = self.upnpcombo_actions.getSelectedItem() selected_service = self.upnpcombo_services.getSelectedItem( ) if self.services and selected_action: self.textarea_request.setText( self.services[selected_service][selected_action]) except BaseException as e: print("[!] Exception selecting action: \"%s\" ") % e self.upnpactions = [" "] self.upnpcombo_actions = JComboBox(self.upnpactions) self.upnpcombo_actions.setSelectedIndex(0) self.upnpcombo_actions.setEnabled(False) # Create the combo box, select item at index 0 (first item in list) self.upnpservices = [" "] self.upnpcombo_services = JComboBox(self.upnpservices) self.upnpcombo_services.setSelectedIndex(0) self.upnpcombo_services.setEnabled(False) # Create the combo box, select item at index 0 (first item in list) self.upnptargets = [" "] self.upnpcombo_targets = JComboBox(self.upnptargets) self.upnpcombo_targets.setSelectedIndex(0) self.upnpcombo_targets.setEnabled(False) # Set the action listeners for all the comboboxes self.upnpcombo_targets.addActionListener( TargetComboboxListener(self.upnpcombo_targets, self.upnpcombo_services, self.ip_service_dict)) self.upnpcombo_services.addActionListener( ServiceComboboxListener(self.upnpcombo_services, self.upnpcombo_actions, self.services_dict)) self.upnpcombo_actions.addActionListener( ActionComboboxListener(self.upnpcombo_services, self.upnpcombo_actions, self.textarea_request, self.services_dict)) # Configuring first step panel self.panel_step1 = JPanel() self.panel_step1.setPreferredSize(Dimension(2250, 100)) self.panel_step1.setBorder(EmptyBorder(10, 10, 10, 10)) self.panel_step1.setLayout(BorderLayout(15, 15)) self.titlepanel_step1 = JPanel() self.titlepanel_step1.setLayout(BorderLayout()) self.titlepanel_step1.add(self.labeltitle_step1, BorderLayout.NORTH) self.titlepanel_step1.add(self.labelsubtitle_step1) self.targetpanel_step1 = JPanel() self.targetpanel_step1.add(self.label_step1) self.targetpanel_step1.add(self.combo_ipversion) self.targetpanel_step1.add(self.startbutton) self.targetpanel_step1.add(self.clearbutton) self.targetpanel_step1.add(self.labelstatus) self.targetpanel_step1.add(self.progressbar) self.emptypanel_step1 = JPanel() self.emptypanel_step1.setLayout(BorderLayout()) self.emptypanel_step1.add(self.labelempty_step1, BorderLayout.WEST) # Assembling first step panel components self.panel_step1.add(self.titlepanel_step1, BorderLayout.NORTH) self.panel_step1.add(self.targetpanel_step1, BorderLayout.WEST) self.panel_step1.add(self.emptypanel_step1, BorderLayout.SOUTH) self.uiPanelA.setTopComponent(self.panel_step1) # Configure second step panel self.panel_step2 = JPanel() self.panel_step2.setPreferredSize(Dimension(2250, 100)) self.panel_step2.setBorder(EmptyBorder(10, 10, 10, 10)) self.panel_step2.setLayout(BorderLayout(15, 15)) self.titlepanel_step2 = JPanel() self.titlepanel_step2.setLayout(BorderLayout()) self.titlepanel_step2.add(self.labeltitle_step2, BorderLayout.NORTH) self.titlepanel_step2.add(self.labelsubtitle_step2) self.selectpanel_step2 = JPanel() self.selectpanel_step2.add(self.labelip) self.selectpanel_step2.add(self.upnpcombo_targets) self.selectpanel_step2.add(self.labelupnp) self.selectpanel_step2.add(self.upnpcombo_services) self.selectpanel_step2.add(self.labelactions) self.selectpanel_step2.add(self.upnpcombo_actions) self.emptypanel_step2 = JPanel() self.emptypanel_step2.setLayout(BorderLayout()) self.emptypanel_step2.add(self.labelempty_step2, BorderLayout.WEST) self.emptypanel_step2.add(self.labelNoneServiceFound) # Assembling second step panel components self.panel_step2.add(self.titlepanel_step2, BorderLayout.NORTH) self.panel_step2.add(self.selectpanel_step2, BorderLayout.WEST) self.panel_step2.add(self.emptypanel_step2, BorderLayout.SOUTH) self.uiPanelB.setTopComponent(self.panel_step2) # Configuring third step panel self.panel_step3 = JPanel() self.panel_step3.setPreferredSize(Dimension(2250, 100)) self.panel_step3.setBorder(EmptyBorder(10, 10, 10, 10)) self.panel_step3.setLayout(BorderLayout(15, 15)) self.titlepanel_step3 = JPanel() self.titlepanel_step3.setLayout(BorderLayout()) self.titlepanel_step3.add(self.labeltitle_step3, BorderLayout.NORTH) self.titlepanel_step3.add(self.labelsubtitle_step3) self.underpanel_step3 = JPanel() self.underpanel_step3.setLayout(BorderLayout()) self.underpanel_step3.add((JScrollPane(self.textarea_request)), BorderLayout.NORTH) self.actionpanel_step3 = JPanel() self.actionpanel_step3.add(self.intruderbutton) self.actionpanel_step3.add(self.repeaterbutton) self.extrapanel_step3 = JPanel() self.extrapanel_step3.setLayout(BorderLayout()) self.extrapanel_step3.add(self.actionpanel_step3, BorderLayout.WEST) # Assembling thirdd step panel components self.panel_step3.add(self.titlepanel_step3, BorderLayout.NORTH) self.panel_step3.add(self.underpanel_step3, BorderLayout.WEST) self.panel_step3.add(self.extrapanel_step3, BorderLayout.SOUTH) self.uiPanelB.setBottomComponent(self.panel_step3) # Assembling the group of all panels layout = GroupLayout(self.pluginTab) self.pluginTab.setLayout(layout) layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addGap(10, 10, 10).addGroup( layout.createParallelGroup( GroupLayout.Alignment.LEADING).addComponent( self.uiTitle).addGap(15, 15, 15).addComponent( self.uiPanelA)).addContainerGap( 26, Short.MAX_VALUE))) layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addGap(15, 15, 15).addComponent( self.uiTitle).addGap(15, 15, 15).addComponent( self.uiPanelA).addGap(20, 20, 20).addGap(20, 20, 20)))
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 wrongEntry(self): self.textfield.setBorder(BorderFactory.createLineBorder(Color.RED, 1))
def __init__(self): self.jScrollPane1 = JScrollPane() self.jTable1 = JTable() self.jPanel1 = JPanel() self.labelName = JLabel() self.textName = JTextField() self.labelSeverity = JLabel() self.comboSeverity = None self.labelHost = JLabel() self.labelPath = JLabel() self.textHost = JTextField() self.textPath = JTextField() self.tabIssue = JTabbedPane() self.panelDescription = JPanel() self.panelRequest = JPanel() self.panelResponse = JPanel() self.panelRemediation = JPanel() # setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE) # setting up the table # initial data in the table tableData = [ [3, "Issue3", "Severity3", "Host3", "Path3"], [1, "Issue1", "Severity1", "Host1", "Path1"], [2, "Issue2", "Severity2", "Host2", "Path2"], ] tableHeadings = ["#", "Issue Type/Name", "Severity", "Host", "Path"] from IssueTable import IssueTable self.jTable1 = IssueTable(tableData, tableHeadings) # wrap the table in a scrollpane self.jScrollPane1.setViewportView(self.jTable1) # top panel containing the table from java.awt import Color self.jPanel1.setBorder(BorderFactory.createLineBorder(Color(0, 0, 0))) # create the labels and textfields self.labelName.text = "Issue Type/Name" self.textName.text = "Issue Name/Type" self.textName.editable = False self.labelSeverity.text = "Severity" # create and populate the combobox self.comboSeverity = JComboBox( ["Critical", "High", "Medium", "Low", "Info"]) self.labelHost.text = "Host" self.labelPath.text = "Path" self.textHost.text = "Issue Host" self.textHost.editable = False self.textPath.text = "Issue Path" self.textPath.editable = False from java.lang import Short # description panel panelDescriptionLayout = GroupLayout(self.panelDescription) self.panelDescription.setLayout(panelDescriptionLayout) panelDescriptionLayout.setHorizontalGroup( panelDescriptionLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelDescriptionLayout.setVerticalGroup( panelDescriptionLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Description", self.panelDescription) # request tab panelRequestLayout = GroupLayout(self.panelRequest) self.panelRequest.setLayout(panelRequestLayout) panelRequestLayout.setHorizontalGroup( panelRequestLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelRequestLayout.setVerticalGroup( panelRequestLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Request", self.panelRequest) # response tab panelResponseLayout = GroupLayout(self.panelResponse) self.panelResponse.setLayout(panelResponseLayout) panelResponseLayout.setHorizontalGroup( panelResponseLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelResponseLayout.setVerticalGroup( panelResponseLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Response", self.panelResponse) # remediation tab panelRemediationLayout = GroupLayout(self.panelRemediation) self.panelRemediation.setLayout(panelRemediationLayout) panelRemediationLayout.setHorizontalGroup( panelRemediationLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelRemediationLayout.setVerticalGroup( panelRemediationLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Remediation", self.panelRemediation) # jpanel1? jPanel1Layout = GroupLayout(self.jPanel1) self.jPanel1.setLayout(jPanel1Layout) jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addContainerGap( ).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.TRAILING).addComponent( self.labelHost).addComponent( self.labelSeverity).addComponent( self.labelName) ).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.LEADING). addComponent(self.textName).addGroup( jPanel1Layout.createSequentialGroup().addComponent( self.comboSeverity, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE).addGap( 0, 0, Short.MAX_VALUE)). addGroup( jPanel1Layout.createSequentialGroup().addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, 330, GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18). addComponent(self.labelPath).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(self.textPath)))).addComponent( self.tabIssue)).addContainerGap())) jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addContainerGap( ).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelName).addComponent( self.textName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelSeverity).addComponent( self.comboSeverity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelHost).addComponent( self.labelPath).addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.textPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)). addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addComponent( self.tabIssue).addContainerGap())) # create the main panel self.panel = JPanel() layout = GroupLayout(self.panel) self.panel.setLayout(layout) layout.setAutoCreateGaps(True) layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addContainerGap().addGroup( layout.createParallelGroup( GroupLayout.Alignment.LEADING).addComponent( self.jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent( self.jScrollPane1)).addContainerGap())) layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addContainerGap().addComponent( self.jScrollPane1, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE).addGap( 18, 18, 18).addComponent(self.jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addContainerGap()))
def __init__(self, callbacks, table=None): self.callbacks = callbacks self.jScrollPane1 = JScrollPane() self.jPanel1 = JPanel() self.labelName = JLabel("Name") self.textName = JTextField() self.labelSeverity = JLabel("Severity") self.textSeverity = JTextField() self.labelHost = JLabel("Host") self.labelPath = JLabel("Path") self.textHost = JTextField() self.textPath = JTextField() self.tabIssue = JTabbedPane() self.textAreaDescription = JTextArea() self.textAreaRemediation = JTextArea() # JScrollPanes to hold the two jTextAreas # put the textareas in JScrollPanes self.jsPaneDescription = JScrollPane(self.textAreaDescription) self.jsPaneRemediation = JScrollPane(self.textAreaRemediation) self.panelRequest = self.callbacks.createMessageEditor(None, False) self.panelResponse = self.callbacks.createMessageEditor(None, False) self.loadPanel(self.defaultIssue) # buttons self.buttonNewIssue = JButton("New Issue", actionPerformed=self.newIssueAction) self.buttonDeleteIssue = JButton( "Delete Issue", actionPerformed=self.deleteIssueAction) self.buttonImport = JButton("Import", actionPerformed=self.importAction) self.buttonExport = JButton("Export", actionPerformed=self.exportAction) if table is not None: self.tableIssue = table else: from IssueTable import IssueTable self.tableIssue = IssueTable() # wrap the table in a scrollpane self.jScrollPane1.setViewportView(self.tableIssue) # top panel containing the table from java.awt import Color self.jPanel1.setBorder(BorderFactory.createLineBorder(Color(0, 0, 0))) # create the labels and textfields self.textName.editable = False self.textName.setBackground(Color.LIGHT_GRAY) self.textSeverity.editable = False self.textSeverity.setBackground(Color.LIGHT_GRAY) self.textHost.editable = False self.textHost.setBackground(Color.LIGHT_GRAY) self.textPath.editable = False self.textPath.setBackground(Color.LIGHT_GRAY) # description textarea self.textAreaDescription.editable = False self.textAreaDescription.setLineWrap(True) self.textAreaDescription.setWrapStyleWord(True) self.tabIssue.addTab("Description", self.jsPaneDescription) # remediation textarea self.textAreaRemediation.editable = False self.textAreaRemediation.setLineWrap(True) self.textAreaRemediation.setWrapStyleWord(True) self.tabIssue.addTab("Remediation", self.jsPaneRemediation) # request tab self.panelRequest.setMessage("", True) self.tabIssue.addTab("Request", self.panelRequest.getComponent()) # response tab self.panelResponse.setMessage("", False) self.tabIssue.addTab("Response", self.panelResponse.getComponent()) # from java.lang import Short # jpanel1 is the bottom panel jPanel1Layout = GroupLayout(self.jPanel1) self.jPanel1.setLayout(jPanel1Layout) jPanel1Layout.setHorizontalGroup( # GroupLayout.Alignment.CENTER centers the group, in this case it # centers the buttons jPanel1Layout.createParallelGroup( GroupLayout.Alignment.CENTER ).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap( ).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.TRAILING).addComponent( self.labelHost).addComponent(self.labelName) ).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.LEADING).addGroup( jPanel1Layout.createSequentialGroup( ).addComponent(self.textName).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED). addComponent( self.labelSeverity).addPreferredGap( LayoutStyle.ComponentPlacement. RELATED).addComponent( self.textSeverity, GroupLayout.PREFERRED_SIZE, 186, GroupLayout.PREFERRED_SIZE)). addGroup( jPanel1Layout.createSequentialGroup().addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, 330, GroupLayout.PREFERRED_SIZE).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(self.labelPath).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED). addComponent(self.textPath)))).addComponent( self.tabIssue)).addContainerGap() ).addGroup( jPanel1Layout.createSequentialGroup().addComponent( self.buttonNewIssue).addComponent( self.buttonDeleteIssue).addComponent( self.buttonImport).addComponent( self.buttonExport))) # link size of buttons from javax.swing import SwingConstants jPanel1Layout.linkSize(SwingConstants.HORIZONTAL, [ self.buttonDeleteIssue, self.buttonExport, self.buttonImport, self.buttonNewIssue ]) jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup( ).addGroup( jPanel1Layout.createSequentialGroup().addContainerGap().addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelName).addComponent( self.textName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.labelSeverity).addComponent( self.textSeverity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.labelPath).addComponent( self.textPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.labelHost)).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED) .addComponent(self.tabIssue).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addGroup( jPanel1Layout.createParallelGroup().addComponent( self.buttonNewIssue).addComponent( self.buttonDeleteIssue).addComponent( self.buttonImport).addComponent( self.buttonExport)).addContainerGap())) # create the main panel self.panel = JSplitPane(JSplitPane.VERTICAL_SPLIT) # set the top component self.panel.leftComponent = self.jScrollPane1 self.panel.rightComponent = self.jPanel1 self.panel.setDividerLocation(150)
def initUI(self): '''Initial UI and Widget creation takes place here! ''' self.setContentPane = JPanel() #self.setDefaultLookAndFeelDecorated(True) # Borders foreground_colour = Color(30,57,68) background_colour = Color(247,246,242) window_background = Color(145,190,210) self.border = BorderFactory.createLoweredBevelBorder() self.border2 = BorderFactory.createLineBorder(foreground_colour, 1, True) # Fonts self.entry_font= Font("Ubuntu Light", Font.BOLD, 20) self.label_font= Font("Ubuntu Light", Font.BOLD, 17) self.btn_font=Font("Ubuntu Light", Font.BOLD, 15) # Layout start layout=GroupLayout(self.getContentPane()) self.getContentPane().setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) self.setPreferredSize(Dimension(300, 150)) # Create the labels user_label= JLabel(" Username : "******" Server : ", JLabel.LEFT, font=self.label_font) # Colours user_label.setForeground(foreground_colour) server_label.setForeground(foreground_colour) # Create the text entries self.username=JTextField(actionPerformed=self.continueEvent, border=self.border2, font = self.entry_font) self.server=JTextField(actionPerformed=self.continueEvent, border=self.border2, font = self.entry_font) # Colours self.username.setBackground(background_colour) self.server.setBackground(background_colour) self.username.setForeground(foreground_colour) self.server.setForeground(foreground_colour) # Allow editable self.username.setEditable(True) self.server.setEditable(True) # Create the buttons quit_btn=JButton(" Quit! ", actionPerformed=self.closeEvent, border=self.border2, font=self.btn_font) go_btn=JButton(" Go! ", actionPerformed=self.continueEvent, border=self.border2, font=self.btn_font) # Colours quit_btn.setBackground(background_colour) go_btn.setBackground(background_colour) quit_btn.setForeground(foreground_colour) go_btn.setForeground(foreground_colour) # Setting up the horizontal groups parameters layout.setHorizontalGroup(layout.createSequentialGroup() # Left side .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(user_label) .addComponent(server_label)) # Right side .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(self.username) .addComponent(self.server) .addGroup(layout.createSequentialGroup() .addComponent(quit_btn) .addComponent(go_btn))) ) # Setting up Vertical Groups layout.setVerticalGroup(layout.createSequentialGroup() # Top group .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(user_label) .addComponent(self.username)) # Middle group .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER) .addComponent(server_label) .addComponent(self.server)) # Bottom group .addGroup(layout.createParallelGroup() .addComponent(quit_btn) .addComponent(go_btn)) ) # Finalise the GUI layout.linkSize(SwingConstants.HORIZONTAL, [quit_btn,go_btn]) self.getContentPane().setBackground(window_background) self.pack() self.setTitle('Chat Login') self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
def __init__(self, logtable_factory=None, external_filter_action_listener=None, external_start_button_action_listener=None, external_stop_button_action_listener=None, external_clear_button_action_listener=None, tools_keys=None): self.this = JPanel() if tools_keys is None: tools_keys = [] self.external_start_button_action_listener = external_start_button_action_listener self.external_stop_button_action_listener = external_stop_button_action_listener self.external_clear_button_action_listener = external_clear_button_action_listener self.this.setLayout(BoxLayout(self.this, BoxLayout.Y_AXIS)) # main split pane splitPane = JSplitPane(JSplitPane.VERTICAL_SPLIT) # table of log entries logTableModel = LogTableModel() self.logTableModel = logTableModel if logtable_factory is not None: logTable = logtable_factory(logTableModel) else: # XXX: create a generic logtable that works even without burp to made it work standalone raise ValueError("logtable_factory cannot be none") scrollPane = JScrollPane(logTable) splitPane.setLeftComponent(scrollPane) # tabs with request/response viewers tabs = JTabbedPane() tabs.setBorder(BorderFactory.createLineBorder(Color.black)) tabs.addTab("Request", logTable.getRequestViewer().getComponent()) tabs.addTab("Response", logTable.getResponseViewer().getComponent()) splitPane.setRightComponent(tabs) # top control panel controlPanel = JPanel(FlowLayout(FlowLayout.LEFT)) toolLabel = JLabel("Select tool: ") controlPanel.add(toolLabel) tools = JavaArrayList(tools_keys) toolList = JComboBox(tools) toolList.addActionListener(external_filter_action_listener) controlPanel.add(toolList) startButton = JButton("Start") self.startButton = startButton controlPanel.add(startButton) stopButton = JButton("Stop") self.stopButton = stopButton controlPanel.add(stopButton) clearButton = JButton("Clear") self.clearButton = clearButton startButton.setEnabled(False) controlPanel.add(clearButton) scopeLabel = JLabel("In-scope items only?") controlPanel.add(scopeLabel) scopeCheckBox = JCheckBox() self.scopeCheckBox = scopeCheckBox controlPanel.add(scopeCheckBox) filterLabel = JLabel("Filter Query:") controlPanel.add(filterLabel) queryFilterText = JTextField(40) self.queryFilterText = queryFilterText controlPanel.add(queryFilterText) startButton.addActionListener(self.start_button_action_listener) stopButton.addActionListener(self.stop_button_action_listener) clearButton.addActionListener(self.clear_button_action_listener) controlPanel.setAlignmentX(0) self.this.add(controlPanel) self.this.add(splitPane)
def __init__(self): super(WorkHelper, self).__init__() self.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard() ############################################################# # Layout: layout = GroupLayout(self.getContentPane()) self.getContentPane().setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) ############################################################# ############################################################# # Frame Area: Larea1 = JLabel("InputArea:") Sarea1 = JScrollPane() self.area1 = JTextArea() self.area1.setToolTipText("Input Area") self.area1.setEditable(True) self.area1.setBorder(BorderFactory.createLineBorder(Color.gray)) Sarea1.setPreferredSize(Dimension(300,100)) Sarea1.getViewport().setView((self.area1)) bClear = JButton("Clear", actionPerformed=self.bClear) bClear.setToolTipText("Clears the text form both Input and Output text Areas") bCopyToInput = JButton("Copy to Input", actionPerformed=self.bCopyToInput) bCopyToInput.setToolTipText("Copy the text from the Output Area to the Input Area for further Operations") self.cCtClipB = JCheckBox("Auto-Copy"); self.cCtClipB.setToolTipText("When 'Checked' after the Categories are created they will added to the clipboard") self.cCtClipB.setSelected(1) Larea2 = JLabel("OutputArea:") Sarea2 = JScrollPane() self.area2 = JTextArea() self.area2.setToolTipText("Output Area") self.area2.setEditable(False) self.area2.setBorder(BorderFactory.createLineBorder(Color.gray)) Sarea2.setPreferredSize(Dimension(300,100)) Sarea2.getViewport().setView((self.area2)) ############################################################# # Tabbed Area: tabPane = JTabbedPane(JTabbedPane.TOP) self.getContentPane().add(tabPane) ##################################################### # Text Edit pane panel_TEdit = JPanel() layout2 = GroupLayout(panel_TEdit) layout2.setAutoCreateGaps(True) layout2.setAutoCreateContainerGaps(True) panel_TEdit.setLayout(layout2) bRemoveNBSP_L = JButton("Clean LText", actionPerformed=self.bRemoveNBSP_L) bRemoveNBSP_L.setToolTipText("Removes Spaces, Tabs from the start of every text line from the input Area") bRemoveNBSP_R = JButton("Clean RText", actionPerformed=self.bRemoveNBSP_R) bRemoveNBSP_R.setToolTipText("Removes Spaces, Tabs from the end of every text line from the input Area") self.ReplaceThis = JTextField() self.ReplaceThis = JTextField(maximumSize=Dimension(120,25)) self.ReplaceThis.setToolTipText("Text to be replaced") self.ReplaceThat = JTextField() self.ReplaceThat = JTextField(maximumSize=Dimension(120,25)) self.ReplaceThat.setToolTipText("Text to be placed") bSandReplace = JButton("Replace Text", actionPerformed=self.bSandReplace) bSandReplace.setToolTipText("Replace the text from This with Text from That in the Text from the Input Area and displays it in the Output Area") bRemNumbers = JButton("Rem Numbers", actionPerformed=self.RemNumbers) bRemNumbers.setToolTipText("Removes numbers from the start of every line") ##################################################### # Dimension pane panel_Dimensions = JPanel() layout3 = GroupLayout(panel_Dimensions) layout3.setAutoCreateGaps(True) layout3.setAutoCreateContainerGaps(True) panel_Dimensions.setLayout(layout3) self.cCurly = JCheckBox("Curly"); self.cCurly.setToolTipText("When 'Checked' Curly Brackets will surround the Categories") self.cCurly.setSelected(1) self.cSemiC = JCheckBox("SemiColumn"); self.cSemiC.setToolTipText("When 'Checked' after the Categories are created at the end will be a semicolomn") self.cSemiC.setSelected(1) self.iStart = JTextField(maximumSize=Dimension(40,25)) self.iStart.setToolTipText("The Start Index for the Making of the Categories") self.RThis = JTextField() self.RThis = JTextField(maximumSize=Dimension(120,25)) self.RThis.setToolTipText("The Starting Index used in creating the Categorical") self.RThat = JTextField() self.RThat = JTextField(maximumSize=Dimension(120,25)) self.RThat.setToolTipText("The Finish Index used in creating the Categorical") optioncCategories = JLabel("Options:") bcCat = JButton("CreatCateg", actionPerformed=self.bcCat) bcCat.setToolTipText("Create a categorical form starting C_Index to finish C_Index; Use the text boxes to define the indexes") bM_Categories = JButton("Categories", actionPerformed=self.mCategories) bM_Categories.setToolTipText("Make Categories using the lines from the Input Area. Use it to define Categorical questions.") ##################################################### # ConfirmIt pane panel_ConfirmIt = JPanel() layout4 = GroupLayout(panel_ConfirmIt) layout4.setAutoCreateGaps(True) layout4.setAutoCreateContainerGaps(True) panel_ConfirmIt.setLayout(layout4) self.PID = JTextField() self.PID = JTextField(maximumSize=Dimension(120,25)) self.PID.setToolTipText("The PID number used for creating links with PID and ids from every line of the Input Area") bClinks = JButton("Create Links", actionPerformed=self.bClinks) bClinks.setToolTipText("Create links for a project using PID and ID, ID`s are read from every line of the Input Area") bClinksNA = JButton("Create Links NA ", actionPerformed=self.bClinksNA) bClinksNA.setToolTipText("Create links for a project using PID and ID`s from the standard sample test for US") bClinksCA = JButton("Create Links CA", actionPerformed=self.bClinksCA) bClinksCA.setToolTipText("Create links for a project using PID and ID`s from the standard sample test for CA") self.Width = JTextField() self.Width = JTextField(maximumSize=Dimension(120,25)) self.Width.setToolTipText("The Width used in creating the DIV html tag, note the dimension used is in px") baddDIVt = JButton("Add DIV tag", actionPerformed=self.baddDIVt) baddDIVt.setToolTipText("Create a DIV tag for every line in the Input Area") ##################################################### # Statistics pane panel_Statistics = JPanel() layout5 = GroupLayout(panel_Statistics) layout5.setAutoCreateGaps(True) layout5.setAutoCreateContainerGaps(True) panel_Statistics.setLayout(layout5) ##################################################### # TimeTraking pane panel_TimeTraking = JPanel() layout6 = GroupLayout(panel_TimeTraking) layout6.setAutoCreateGaps(True) layout6.setAutoCreateContainerGaps(True) panel_TimeTraking.setLayout(layout6) ##################################################### # Tabbed Area Tabs tabPane.addTab("Text Edit", panel_TEdit) tabPane.addTab("Dimensions", panel_Dimensions) tabPane.addTab("ConfirmIt", panel_ConfirmIt) tabPane.addTab("Statistics", panel_Statistics) tabPane.addTab("TimeTraking", panel_TimeTraking) ############################################################# ############################################################# # Aplication Layouts: 2 groups one Horizontal and one Vertical ############################################################# # Frame Layout: 2 groups one Horizontal and one Vertical layout.setHorizontalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(Larea1) .addComponent(Sarea1) .addComponent(Sarea2) .addGroup(layout.createSequentialGroup() .addComponent(bCopyToInput) .addComponent(bClear) .addComponent(self.cCtClipB)) .addComponent(Larea2)) .addGroup(layout.createParallelGroup() .addComponent(tabPane)) ) layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addComponent(Larea1) .addComponent(Sarea1) .addGroup(layout.createParallelGroup() .addComponent(bCopyToInput) .addComponent(bClear) .addComponent(self.cCtClipB) ) .addComponent(Larea2) .addComponent(Sarea2)) .addGroup(layout.createSequentialGroup() .addComponent(tabPane)) ) ) ############################################################# # TEdit Layout: 2 groups one Horizontal and one Vertical layout2.setHorizontalGroup(layout2.createSequentialGroup() .addGroup(layout2.createParallelGroup() .addGroup(layout2.createSequentialGroup() .addComponent(bRemNumbers) .addComponent(bRemoveNBSP_L) .addComponent(bRemoveNBSP_R)) .addGroup(layout2.createSequentialGroup() .addComponent(bSandReplace) .addComponent(self.ReplaceThis) .addComponent(self.ReplaceThat)) )) layout2.setVerticalGroup(layout2.createSequentialGroup() .addGroup(layout2.createParallelGroup() .addComponent(bRemNumbers) .addComponent(bRemoveNBSP_L) .addComponent(bRemoveNBSP_R)) .addGroup(layout2.createParallelGroup() .addComponent(bSandReplace) .addComponent(self.ReplaceThis) .addComponent(self.ReplaceThat)) ) ############################################################# # Dimensions Layout: 2 groups one Horizontal and one Vertical layout3.setHorizontalGroup(layout3.createSequentialGroup() .addGroup(layout3.createParallelGroup() .addGroup(layout3.createSequentialGroup() .addComponent(bM_Categories) .addComponent(self.iStart)) .addGroup(layout3.createSequentialGroup() .addComponent(optioncCategories) .addComponent(self.cCurly) .addComponent(self.cSemiC) ) .addGroup(layout3.createSequentialGroup() .addComponent(bcCat) .addComponent(self.RThis) .addComponent(self.RThat)) .addGroup(layout3.createSequentialGroup() ) ) ) layout3.setVerticalGroup(layout3.createSequentialGroup() .addGroup(layout3.createSequentialGroup() .addGroup(layout3.createParallelGroup() .addComponent(bM_Categories) .addComponent(self.iStart)) .addGroup(layout3.createParallelGroup() .addComponent(bcCat) .addComponent(self.RThis) .addComponent(self.RThat)) .addGroup(layout3.createParallelGroup() .addGroup(layout3.createParallelGroup() .addComponent(optioncCategories) .addComponent(self.cCurly) .addComponent(self.cSemiC) ) ) ) ) ############################################################# # ConfimIT Layout: 2 groups one Horizontal and one Vertical layout4.setHorizontalGroup(layout4.createSequentialGroup() .addGroup(layout4.createParallelGroup() .addGroup(layout4.createSequentialGroup() .addComponent(bClinks) .addComponent(self.PID) ) .addGroup(layout4.createSequentialGroup() .addComponent(bClinksNA) .addComponent(bClinksCA) ) .addGroup(layout4.createSequentialGroup() .addComponent(baddDIVt) .addComponent(self.Width) ) )) layout4.setVerticalGroup(layout4.createSequentialGroup() .addGroup(layout4.createSequentialGroup() .addGroup(layout4.createParallelGroup() .addComponent(bClinks) .addComponent(self.PID)) .addGroup(layout4.createParallelGroup() .addComponent(bClinksNA) .addComponent(bClinksCA) ) .addGroup(layout4.createParallelGroup() .addComponent(baddDIVt) .addComponent(self.Width) ) )) #layout2.linkSize(SwingConstants.HORIZONTAL, [self.cCurly,bM_Categories]) #layout.linkSize(SwingConstants.HORIZONTAL, [ok, bCopyToInput, close, bM_Categories]) #layout3.linkSize(SwingConstants.HORIZONTAL, [self.RThis,self.RThat,bRemoveNBSP_L,bRemoveNBSP_R,bM_Categories,bSandReplace,bcCat]) ############################################################# ############################################################# # Aplication Settings self.pack() #self.setPreferredSize(Dimension(1000, 1000)) self.setTitle("Workhelper") self.setSize(800, 500) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
def appendText(self, message, user=None): '''This function takes care of appending any new messages to the content area ''' message_label=JTextArea(message,2,3, font=self.label_2_font) # If this is a message from the grab text function, create a new label, assign it's colours if user!=None: message_label.setBackground(Color(240,240,240)) message_label.setForeground(Color(129,129,129)) # Otherwise set the format for receive function (no user passed in) else: message_label.setBackground(Color(215,215,215)) message_label.setForeground(Color(40,153,153)) # Format and style options for the new message labels message_label.setEditable(False) message_label.setLineWrap(True) message_label.setWrapStyleWord(True) message_label.setBorder(BorderFactory.createLineBorder( Color(247,246,242),4)) # Sets the positioning of messages self.main_content.setCaretPosition(self.main_content.getDocument().getLength()) doc = self.main_content.getStyledDocument() attr=SimpleAttributeSet() self.main_content.insertComponent(message_label) # Essential for jtextarea to be able to stack message doc.insertString( self.main_content.getDocument().getLength(),'\n ', attr) # Not sure if needed self.main_content.repaint() ### This is a late edit so it isn't included in the documentation. Basically trying to dynamically update the number ### of users label at runtime. Works for incrementing the value but not decrementing it. print(message) # Only split the message if there are enough values to split (greeting messages differ in format to chat messages) try: user, text=message.split(' : ') except: return #print('Split values are %s %s'%(user, text)) user=str(user.strip()) #print(self.no_users) #print(user+' : '+text) # If the user already in the list, pass if user in self.no_users: if text == ('User %s amach sa teach !'%user): self.no_users.remove(user) print('User % removed'%user) else: #print('User %s not in list'%user) if str(user) == 'You': #print('User is equal to "You"') return self.no_users.append(user) print('User appended') self.number_users=len(self.no_users) #print('Length of user list is '+str(self.number_users)) self.user_label2=JLabel(" Users online : %s "%str(len(self.no_users)),JLabel.RIGHT, font=self.label_2_font) #print('Label created') #print('Attempt to replace label') self.client_layout.replace(self.user_label, self.user_label2) self.user_label = self.user_label2 self.user_label.repaint() self.user_label.revalidate() print('Label updated')
def initVulnerabilityTab(self): # ## init vulnerability tab # nameLabel = JLabel("Vulnerability Name:") nameLabel.setBounds(10, 10, 140, 30) self.addButton = JButton("Add",actionPerformed=self.addVuln) self.addButton.setBounds(10, 500, 100, 30) rmVulnButton = JButton("Remove",actionPerformed=self.rmVuln) rmVulnButton.setBounds(465, 500, 100, 30) mitigationLabel = JLabel("Mitigation:") mitigationLabel.setBounds(10, 290, 150, 30) addSSBtn = JButton("Add SS",actionPerformed=self.addSS) addSSBtn.setBounds(750, 40, 110, 30) deleteSSBtn = JButton("Remove SS",actionPerformed=self.removeSS) deleteSSBtn.setBounds(750, 75, 110, 30) piclistLabel = JLabel("Images list:") piclistLabel.setBounds(580, 10, 140, 30) self.screenshotsList = DefaultListModel() self.ssList = JList(self.screenshotsList) self.ssList.setBounds(580, 40, 150, 250) self.ssList.addListSelectionListener(ssChangedHandler(self)) self.ssList.setBorder(BorderFactory.createLineBorder(Color.GRAY)) previewPicLabel = JLabel("Selected image preview: (click to open in image viewer)") previewPicLabel.setBounds(580, 290, 500, 30) copyImgMenu = JMenuItem("Copy") copyImgMenu.addActionListener(copyImg(self)) self.imgMenu = JPopupMenu("Popup") self.imgMenu.add(copyImgMenu) self.firstPic = JLabel() self.firstPic.setBorder(BorderFactory.createLineBorder(Color.GRAY)) self.firstPic.setBounds(580, 320, 550, 400) self.firstPic.addMouseListener(imageClicked(self)) self.vulnName = JTextField("") self.vulnName.getDocument().addDocumentListener(vulnTextChanged(self)) self.vulnName.setBounds(140, 10, 422, 30) sevirities = ["Unclassified", "Critical","High","Medium","Low"] self.threatLevel = JComboBox(sevirities); self.threatLevel.setBounds(140, 45, 140, 30) colors = ["Color:", "Green", "Red"] self.colorCombo = JComboBox(colors); self.colorCombo.setBounds(465, 45, 100, 30) self.colorCombo severityLabel = JLabel("Threat Level:") severityLabel.setBounds(10, 45, 100, 30) descriptionLabel = JLabel("Description:") descriptionLabel.setBounds(10, 80, 100, 30) self.descriptionString = JTextArea("", 5, 30) self.descriptionString.setWrapStyleWord(True); self.descriptionString.setLineWrap(True) self.descriptionString.setBounds(10, 110, 555, 175) descriptionStringScroll = JScrollPane(self.descriptionString) descriptionStringScroll.setBounds(10, 110, 555, 175) descriptionStringScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED) self.mitigationStr = JTextArea("", 5, 30) self.mitigationStr.setWrapStyleWord(True); self.mitigationStr.setLineWrap(True) self.mitigationStr.setBounds(10, 320, 555, 175) mitigationStrScroll = JScrollPane(self.mitigationStr) mitigationStrScroll.setBounds(10, 320, 555, 175) mitigationStrScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED) self.pnl = JPanel() self.pnl.setBounds(0, 0, 1000, 1000); self.pnl.setLayout(None); self.pnl.add(addSSBtn) self.pnl.add(piclistLabel) self.pnl.add(nameLabel) self.pnl.add(deleteSSBtn) self.pnl.add(rmVulnButton) self.pnl.add(severityLabel) self.pnl.add(mitigationLabel) self.pnl.add(descriptionLabel) self.pnl.add(previewPicLabel) self.pnl.add(mitigationStrScroll) self.pnl.add(descriptionStringScroll) self.pnl.add(self.ssList) self.pnl.add(self.firstPic) self.pnl.add(self.addButton) self.pnl.add(self.vulnName) self.pnl.add(self.threatLevel) self.pnl.add(self.colorCombo)
def __init__(self, table=None): self.jScrollPane1 = JScrollPane() self.jTable1 = JTable() self.jPanel1 = JPanel() self.labelName = JLabel() self.textName = JTextField() self.labelSeverity = JLabel() self.textSeverity = JTextField() self.labelHost = JLabel() self.labelPath = JLabel() self.textHost = JTextField() self.textPath = JTextField() self.tabIssue = JTabbedPane() self.panelDescription = JPanel() self.panelRequest = JPanel() self.panelResponse = JPanel() self.panelRemediation = JPanel() # setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE) self.jTable1 = table # wrap the table in a scrollpane self.jScrollPane1.setViewportView(self.jTable1) # top panel containing the table from java.awt import Color self.jPanel1.setBorder(BorderFactory.createLineBorder(Color(0, 0, 0))) # create the labels and textfields self.labelName.text = "Issue Type/Name" self.textName.text = "Issue Name/Type" self.textName.editable = False self.textName.setBackground(Color.LIGHT_GRAY) self.labelSeverity.text = "Severity" self.textSeverity.text = "" self.textSeverity.editable = False self.textSeverity.setBackground(Color.LIGHT_GRAY) self.labelHost.text = "Host" self.textHost.text = "Issue Host" self.textHost.editable = False self.textHost.setBackground(Color.LIGHT_GRAY) self.labelPath.text = "Path" self.textPath.text = "Issue Path" self.textPath.editable = False self.textPath.setBackground(Color.LIGHT_GRAY) from java.lang import Short # description panel panelDescriptionLayout = GroupLayout(self.panelDescription) self.panelDescription.setLayout(panelDescriptionLayout) panelDescriptionLayout.setHorizontalGroup( panelDescriptionLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelDescriptionLayout.setVerticalGroup( panelDescriptionLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Description", self.panelDescription) # request tab panelRequestLayout = GroupLayout(self.panelRequest) self.panelRequest.setLayout(panelRequestLayout) panelRequestLayout.setHorizontalGroup( panelRequestLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelRequestLayout.setVerticalGroup( panelRequestLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Request", self.panelRequest) # response tab panelResponseLayout = GroupLayout(self.panelResponse) self.panelResponse.setLayout(panelResponseLayout) panelResponseLayout.setHorizontalGroup( panelResponseLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelResponseLayout.setVerticalGroup( panelResponseLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Response", self.panelResponse) # remediation tab panelRemediationLayout = GroupLayout(self.panelRemediation) self.panelRemediation.setLayout(panelRemediationLayout) panelRemediationLayout.setHorizontalGroup( panelRemediationLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 948, Short.MAX_VALUE)) panelRemediationLayout.setVerticalGroup( panelRemediationLayout.createParallelGroup( GroupLayout.Alignment.LEADING).addGap(0, 287, Short.MAX_VALUE)) self.tabIssue.addTab("Remediation", self.panelRemediation) # jpanel1? jPanel1Layout = GroupLayout(self.jPanel1) self.jPanel1.setLayout(jPanel1Layout) jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addContainerGap( ).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.TRAILING).addComponent( self.labelHost).addComponent( self.labelSeverity).addComponent( self.labelName) ).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.LEADING). addComponent(self.textName).addGroup( jPanel1Layout.createSequentialGroup().addComponent( self.textSeverity, GroupLayout.PREFERRED_SIZE, 98, GroupLayout.PREFERRED_SIZE).addGap( 0, 0, Short.MAX_VALUE)). addGroup( jPanel1Layout.createSequentialGroup().addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, 330, GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18). addComponent(self.labelPath).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(self.textPath)))).addComponent( self.tabIssue)).addContainerGap())) jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(GroupLayout.Alignment.LEADING). addGroup(jPanel1Layout.createSequentialGroup().addContainerGap( ).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelName).addComponent( self.textName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelSeverity).addComponent( self.textSeverity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) ).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup( jPanel1Layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelHost).addComponent( self.labelPath).addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.textPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)). addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addComponent( self.tabIssue).addContainerGap())) # create the main panel self.panel = JPanel() layout = GroupLayout(self.panel) self.panel.setLayout(layout) layout.setAutoCreateGaps(True) layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addContainerGap().addGroup( layout.createParallelGroup( GroupLayout.Alignment.LEADING).addComponent( self.jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent( self.jScrollPane1)).addContainerGap())) layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addContainerGap().addComponent( self.jScrollPane1, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE).addGap( 18, 18, 18).addComponent(self.jPanel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addContainerGap()))
def wrongEntry(self): self.textfield.setBorder(BorderFactory.createLineBorder(Color.RED, 1))
def launchGui(self, caller): self._stdout = PrintWriter(self._callbacks.getStdout(), True) self._stdout.println('Launching gui') callMessage = caller.getSelectedMessages() self.msg1 = callMessage[0] #setup frame self.frame = JFrame('Create Issue', windowClosing=self.closeUI) Border = BorderFactory.createLineBorder(Color.BLACK) #create split panel to add issue panel and template panel self.splitPane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT) self.frame.add(self.splitPane) #panel setup and add to splitPane self.issuePanel = JPanel(GridLayout(0,2)) self.splitPane.setLeftComponent(self.issuePanel) #setup issue name text fields to add to panel self.issueNameField = JTextField('',15) self.issueNameLabel = JLabel("IssueName:", SwingConstants.CENTER) self.issuePanel.add(self.issueNameLabel) self.issuePanel.add(self.issueNameField) #add issue detail text area self.issueDetailField = JTextArea() self.issueDetailField.editable = True self.issueDetailField.wrapStyleWord = True self.issueDetailField.lineWrap = True self.issueDetailField.alignmentX = Component.LEFT_ALIGNMENT self.issueDetailField.size = (200, 20) self.issueDetailField.setBorder(Border) self.idfSp = JScrollPane() self.idfSp.getViewport().setView((self.issueDetailField)) self.issuePanel.add(JLabel("Issue Detail:", SwingConstants.CENTER)) self.issuePanel.add(self.idfSp) self.issueBackgroundField= JTextArea() self.issueBackgroundField.editable = True self.issueBackgroundField.wrapStyleWord = True self.issueBackgroundField.lineWrap = True self.issueBackgroundField.alignmentX = Component.LEFT_ALIGNMENT self.issueBackgroundField.size = (200, 20) self.issueBackgroundField.setBorder(Border) self.ibfSp = JScrollPane() self.ibfSp.getViewport().setView((self.issueBackgroundField)) self.issuePanel.add(JLabel("Issue Background:", SwingConstants.CENTER)) self.issuePanel.add(self.ibfSp) #add remediation detail text area self.remediationDetailField = JTextArea() self.remediationDetailField.editable = True self.remediationDetailField.wrapStyleWord = True self.remediationDetailField.lineWrap = True self.remediationDetailField.alignmentX = Component.LEFT_ALIGNMENT self.remediationDetailField.size = (200, 20) self.remediationDetailField.setBorder(Border) self.rdfSp = JScrollPane() self.rdfSp.getViewport().setView((self.remediationDetailField)) self.issuePanel.add(JLabel("Remediation Detail:", SwingConstants.CENTER)) self.issuePanel.add(self.rdfSp) self.remediationBackgroundField= JTextArea() self.remediationBackgroundField.editable = True self.remediationBackgroundField.wrapStyleWord = True self.remediationBackgroundField.lineWrap = True self.remediationBackgroundField.alignmentX = Component.LEFT_ALIGNMENT self.remediationBackgroundField.size = (200, 20) self.remediationBackgroundField.setBorder(Border) self.rbfSp = JScrollPane() self.rbfSp.getViewport().setView((self.remediationBackgroundField)) self.issuePanel.add(JLabel("Remediation Background:", SwingConstants.CENTER)) self.issuePanel.add(self.rbfSp) #add radio buttons for severity self.radioBtnSevHigh = JRadioButton('High', actionPerformed=None) self.radioBtnSevMedium = JRadioButton('Medium', actionPerformed=None) self.radioBtnSevLow = JRadioButton('Low', actionPerformed=None) severityButtonGroup = ButtonGroup() severityButtonGroup.add(self.radioBtnSevHigh) severityButtonGroup.add(self.radioBtnSevMedium) severityButtonGroup.add(self.radioBtnSevLow) self.radioBtnSevHigh.setSelected(True) self.issuePanel.add(JLabel("Severity:", SwingConstants.CENTER)) self.issuePanel.add(self.radioBtnSevHigh) self.issuePanel.add(self.radioBtnSevMedium) self.issuePanel.add(self.radioBtnSevLow) self.reqPattern = JTextField('',15) self.issuePanel.add(JLabel("Mark Pattern in Request:", SwingConstants.CENTER)) self.issuePanel.add(self.reqPattern) self.resPattern = JTextField('',15) self.issuePanel.add(JLabel("Mark Pattern in Response:", SwingConstants.CENTER)) self.issuePanel.add(self.resPattern) #add a button self.issueButton = JButton('Add!', actionPerformed=lambda x, m=self.msg1: self.logScanIssue(m)) self.issuePanel.add(self.issueButton) #template panel setup self.templatePanel = JPanel(GridLayout(1,2)) self.splitPane.setRightComponent(self.templatePanel) #add a list of templates self.templatePanel.add(JLabel("Select from Templates", SwingConstants.CENTER)) self.templateData = tuple(self.tmpl.keys()) self.templateList = JList(self.templateData) self.templateScrollPane = JScrollPane() #self.templateScrollPane.setPreferredSize(Dimension(100,125)) self.templateScrollPane.getViewport().setView((self.templateList)) self.templatePanel.add(self.templateScrollPane) self.templateButton = JButton('Apply', actionPerformed=self.applyTemplate) self.templatePanel.add(self.templateButton) #pack up the frame and display it self.frame.pack() self.show()
def registerExtenderCallbacks(self, callbacks): self.out = callbacks.getStdout() self.callbacks = callbacks self.helpers = callbacks.getHelpers() callbacks.setExtensionName("WhatsApp Decoder") self.banner = JLabel("WHATSAPP DECRYPTION AND ENCRYPTION EXTENSION BY DIKLA BARDA, ROMAN ZAIKIN", SwingConstants.CENTER) self.banner.setFont(Font("Serif", Font.PLAIN, 17)) self.banner.setBorder(BorderFactory.createLineBorder(Color.BLACK)) self.statusConn = JLabel("CONNECTION STATUS: ") self.statusConnField = JLabel("NOT CONNECTED") self.statusAct = JLabel("ACTION STATUS: ") self.statusActField = JLabel("OK") self.ref = JLabel("Ref object: ") self.refField = JTextField("123", 80) self.refField.setToolTipText("Copy the Ref from burpsuit WebSocket, make sure that the parameter 'secret' is there and you copy only the 'ref' without the connection and other data, if not logout from your whatsapp web and login again.") self.privateKey = JLabel("Private Key:") self.privateKeyField = JTextField("123", 80) self.privateKeyField.setToolTipText("Copy the private key list from your whatsapp web according to our blog post ") self.publicKey = JLabel("Public Key: ") self.publicKeyField = JTextField("123", 80) self.publicKeyField.setToolTipText("Copy the public key list from your whatsapp web according to our blog post") self.statusPanel1 = JPanel() self.statusPanel1.add(self.statusConn) self.statusPanel1.add(self.statusConnField) self.statusPanel2 = JPanel() self.statusPanel2.add(self.statusAct) self.statusPanel2.add(self.statusActField) self.privateKeyPanel = JPanel() self.privateKeyPanel.add(self.privateKey) self.privateKeyPanel.add(self.privateKeyField) self.publicKeyPanel = JPanel() self.publicKeyPanel.add(self.publicKey) self.publicKeyPanel.add(self.publicKeyField) self.refPanel = JPanel() self.refPanel.add(self.ref) self.refPanel.add(self.refField) self.messageField = JTextArea("", 5, 90) self.messageField.setLineWrap(True) self.messageField.setToolTipText("If you putting in the incoming traffic you can copy it from burp suit, the outgoing is the list from aesCbcEncrypt") self.whatsAppMessagesPanel = JPanel() self.whatsAppMessagesPanel.add(self.messageField) self.btnSave = JButton("Connect", actionPerformed=self.saveConfig) self.btnRestore = JButton("Clear", actionPerformed=self.clearConfig) self.grpConfig = JPanel() self.grpConfig.add(self.btnSave) self.grpConfig.add(self.btnRestore) self.btnIncoming = JButton("Incoming", actionPerformed=self.performAction) self.btnOutgoing = JButton("Outgoing", actionPerformed=self.performAction) self.btnEncrypt = JButton("Encrypt", actionPerformed=self.performAction) self.btnEncrypt.setEnabled(False) # Can't send data without a direction self.btnDecrypt = JButton("Decrypt", actionPerformed=self.performAction) self.btnDecrypt.setEnabled(False) # Can't send data without a direction self.btnCrypt = JPanel() self.btnCrypt.add(self.btnIncoming) self.btnCrypt.add(self.btnEncrypt) self.btnCrypt.add(self.btnDecrypt) self.btnCrypt.add(self.btnOutgoing) self.tab = JPanel() layout = GridBagLayout() self.tab.setLayout(layout) c = GridBagConstraints() c.ipadx = 0 c.ipady = 0 c.fill = GridBagConstraints.BOTH #c.weightx = 0 # gap between the x items #c.weighty = 0 # gap between the y items c.anchor = GridBagConstraints.NORTHWEST c.gridx = 0 c.gridy = 0 self.tab.add(self.banner, c) c.gridx = 0 c.gridy = 1 self.tab.add(self.refPanel, c) c.gridx = 0 c.gridy = 2 self.tab.add(self.privateKeyPanel, c) c.gridx = 0 c.gridy = 3 self.tab.add(self.publicKeyPanel, c) c.gridx = 0 c.gridy = 4 c.anchor = GridBagConstraints.CENTER self.tab.add(self.grpConfig, c) c.gridx = 0 c.gridy = 5 self.tab.add(self.whatsAppMessagesPanel, c) c.gridx = 0 c.gridy = 6 self.tab.add(self.btnCrypt, c) c.gridx = 0 c.gridy = 7 self.tab.add(self.statusPanel1, c) c.gridx = 0 c.gridy = 8 self.tab.add(self.statusPanel2, c) # restore config self.restoreConfig() callbacks.addSuiteTab(self)
stripped_filename = strip_end(old_filename,"_icons") stripped_filename = strip_end(stripped_filename,"_run") start_file = filepath + "/" + stripped_filename + filetype icons_file = filepath + "/" + stripped_filename + "_icons" + filetype run_file = filepath + "/" + stripped_filename + "_run" + filetype label_panel_location.text = start_file #row13b2.text = icons_file row11b2.text = run_file #os.rename(r'filepath/old_filename.file type',r'file path/NEW file name.file type') row0 = JPanel() row0.setLayout(BoxLayout(row0, BoxLayout.X_AXIS)) txt = JTextField(140) txt.setMaximumSize( txt.getPreferredSize() ); txt.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createLineBorder(Color.red), txt.getBorder())); label_panel_location = JLabel() btnpanelLocation = JButton("Set Panel Location", actionPerformed = btnpanelLocation_action) row0.add(Box.createVerticalGlue()) row0.add(Box.createRigidArea(Dimension(20, 0))) row0.add(btnpanelLocation) row0.add(Box.createRigidArea(Dimension(20, 0))) row0.add(label_panel_location) row0.add(Box.createRigidArea(Dimension(20, 0))) row12 = JPanel() row12.setLayout(BoxLayout(row12, BoxLayout.X_AXIS)) row12b1 = JLabel("Dispatcher System: Modifies panels to produce a running system") row12b1.add( Box.createHorizontalGlue() ); row12b1.setAlignmentX( row12b1.LEFT_ALIGNMENT )