def display_error(self, error): self.JprogramList.setListData(tuple()) self.splitPane.setRightComponent(JLabel("Error : {}".format(error)))
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout(self.gbPanel0) self.Label_1 = JLabel("Protocol:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Label_1, self.gbcPanel0) self.panel0.add(self.Label_1) self.Protocol_TF = JTextField(20, focusLost=self.setProtocol) self.Protocol_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Protocol_TF, self.gbcPanel0) self.panel0.add(self.Protocol_TF) self.Blank_1 = JLabel(" ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_1, self.gbcPanel0) self.panel0.add(self.Blank_1) self.Label_2 = JLabel("Cuckoo IP Address") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Label_2, self.gbcPanel0) self.panel0.add(self.Label_2) self.IP_Address_TF = JTextField(20, focusLost=self.setIPAddress) self.IP_Address_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.IP_Address_TF, self.gbcPanel0) self.panel0.add(self.IP_Address_TF) self.Blank_2 = JLabel(" ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_2, self.gbcPanel0) self.panel0.add(self.Blank_2) self.Label_3 = JLabel("Port Number") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Label_3, self.gbcPanel0) self.panel0.add(self.Label_3) self.Port_Number_TF = JTextField(20, focusLost=self.setPortNumber) self.Port_Number_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Port_Number_TF, self.gbcPanel0) self.panel0.add(self.Port_Number_TF) self.Blank_3 = JLabel(" ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_3, self.gbcPanel0) self.panel0.add(self.Blank_3) self.Blank_5 = JLabel("Tag to Choose: ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_5, self.gbcPanel0) self.panel0.add(self.Blank_5) self.find_tags() self.List_Box_LB = JList(self.tag_list, valueChanged=self.onchange_lb) self.List_Box_LB.setVisibleRowCount(3) self.scpList_Box_LB = JScrollPane(self.List_Box_LB) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.scpList_Box_LB, self.gbcPanel0) self.panel0.add(self.scpList_Box_LB) self.Blank_6 = JLabel(" ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_6, self.gbcPanel0) self.panel0.add(self.Blank_6) self.Submit_File_CB = JCheckBox("Submit a File", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Submit_File_CB, self.gbcPanel0) self.panel0.add(self.Submit_File_CB) # self.Submit_URL_CB = JCheckBox("Submit a URL", actionPerformed=self.checkBoxEvent) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 23 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Submit_URL_CB, self.gbcPanel0 ) # self.panel0.add( self.Submit_URL_CB ) self.Check_Server_Status_BTN = JButton( "Check Server Status", actionPerformed=self.Check_Server) self.Check_Server_Status_BTN.setEnabled(True) self.rbgPanel0.add(self.Check_Server_Status_BTN) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Check_Server_Status_BTN, self.gbcPanel0) self.panel0.add(self.Check_Server_Status_BTN) self.Error_Message = JLabel("") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Error_Message, self.gbcPanel0) self.panel0.add(self.Error_Message) self.add(self.panel0)
def setColumnWidths(self, table): #----------------------------------------------------------------------- # Set up some variables to access the table properties and data #----------------------------------------------------------------------- tcm = table.getColumnModel() # Table Column Model model = table.getModel() # Used to access the table data margin = tcm.getColumnMargin() # gap between columns #----------------------------------------------------------------------- # For each column, determine the maximum width required #----------------------------------------------------------------------- rows = model.getRowCount() # How many rows exist? cols = tcm.getColumnCount() # How many columns exist? labels = [JLabel(font=plainFont), JLabel(font=boldFont)] print ' Now Min Pre Max' print '---------------+---+---+---+---' metrics = [fmPlain, fmBold] tWidth = 0 # Table width section = 0 # Boolean: current row is a section? sections = 0 # Number of setion rows for i in range(cols): # Note: i == column index col = tcm.getColumn(i) idx = col.getModelIndex() #------------------------------------------------------------------- # Find the maximum width required for the data values in this column # Note: Use the column adjustments to compute the best width #------------------------------------------------------------------- cWidth = 0 # Initial column width for row in range(rows): v0 = model.getValueAt(row, 0) if v0.startswith('_'): section = 1 sections += 1 else: section = 0 comp = labels[section] fm = metrics[section] # FontMetric r = table.getCellRenderer(row, i) v = model.getValueAt(row, idx) if v.startswith('_'): v = v[1:] comp.setText(v) cWidth = max(cWidth, comp.getPreferredSize().width) if cWidth > 0: col.setMinWidth(128 + margin) col.setPreferredWidth(128 + margin) # col.setPreferredWidth( cWidth + margin ) col.setMaxWidth(cWidth + margin) # print 'Col: %d width: %d' % ( i, cWidth ) print 'Col: %d widths |%3d|%3d|%3d|%d' % ( i, col.getWidth(), col.getMinWidth(), col.getPreferredWidth(), col.getMaxWidth()) #------------------------------------------------------------------- # Add current column (preferred) width to the total table width #------------------------------------------------------------------- tWidth += col.getPreferredWidth() print '---------------+---+---+---+---' h0 = table.getRowHeight() # print 'rowHeight:', h0 sections /= cols # print '#Sections:', sections # for row in range( rows ) : # lines = 1 # for c in range( cols ) : # col = tcm.getColumn( c ) # pre = col.getPreferredWidth() # val = model.getValueAt( row, c ) # if not c : # fm = metrics[ val.startswith( '_' ) ] # lines = max( lines, int( round( fm.stringWidth( val ) / pre ) + 2 ) ) # print '%3d : %2d' % ( row, lines ) # table.setRowHeight( row, lines * h0 ) #----------------------------------------------------------------------- # Set the preferred viewport size so we don't (initially) see scrollbars #----------------------------------------------------------------------- table.setPreferredScrollableViewportSize( Dimension(tWidth, sections * table.getRowHeight()))
def build_gui(self): """Construct GUI elements.""" Mpanel = JPanel() # Mpanel.setLayout(GridLayout(0, 3)) Mpanel.setLayout(BoxLayout(Mpanel, BoxLayout.X_AXIS)) panel = JPanel() panel.setLayout(None) Mpanel.add(Box.createVerticalGlue()) Mpanel.add(panel) Mpanel.add(Box.createVerticalGlue()) img = os.path.abspath("gat_logo_sticky.png") logo = JLabel(ImageIcon(img)) logo.setBounds(150, 40, 165, 49) save_btn = JButton('Salvar', actionPerformed=self.save_config) save_btn.setBounds(100, 240, 75, 30) save_btn.setPreferredSize(Dimension(75, 30)) limpar_btn = JButton('Limpar ID Projeto', actionPerformed=self.clsProjectId) limpar_btn.setBounds(250, 240, 150, 30) limpar_btn.setPreferredSize(Dimension(150, 30)) label_h = JLabel('API Url:') label_h.setHorizontalAlignment(SwingConstants.RIGHT) label_h.setBounds(0, 120, 95, 30) label_h.setPreferredSize(Dimension(100, 30)) self.host_api = JTextField(50) self.host_api.setBounds(100, 120, 300, 30) self.host_api.setPreferredSize(Dimension(250, 30)) label_a = JLabel('API Token:') label_a.setHorizontalAlignment(SwingConstants.RIGHT) label_a.setBounds(0, 160, 95, 30) label_a.setPreferredSize(Dimension(100, 30)) self.api_token = JTextField(50) self.api_token.setBounds(100, 160, 300, 30) self.api_token.setPreferredSize(Dimension(250, 30)) label_p = JLabel('Project ID:') label_p.setHorizontalAlignment(SwingConstants.RIGHT) label_p.setBounds(0, 200, 95, 30) label_p.setPreferredSize(Dimension(100, 30)) self.project_id = JTextField(50) self.project_id.setForeground(Color.orange) self.project_id.setBackground(Color.gray) self.project_id.setBounds(100, 200, 300, 30) self.project_id.setPreferredSize(Dimension(250, 30)) self.project_id.editable = False panel.add(logo) panel.add(label_h) panel.add(self.host_api) panel.add(label_a) panel.add(self.api_token) panel.add(label_p) panel.add(self.project_id) panel.add(limpar_btn) panel.add(save_btn) return Mpanel
def registerExtenderCallbacks(self, callbacks): self.callbacks = callbacks self.helpers = callbacks.getHelpers() callbacks.setExtensionName("Missing Scanner Checks") self.out = callbacks.getStdout() # define all checkboxes self.cbPassiveChecks = self.defineCheckBox("Passive Scanner Checks") self.cbDOMXSS = self.defineCheckBox("DOM XSS", False) self.cbDOMXSSSources = self.defineCheckBox("Sources", False) self.cbDOMXSSSinks = self.defineCheckBox("Sinks") self.cbDOMXSSjQuerySinks = self.defineCheckBox("jQuery Sinks", False) self.grpDOMXSSSettings = JPanel() self.grpDOMXSSSettings.add(self.cbDOMXSSSources) self.grpDOMXSSSettings.add(self.cbDOMXSSSinks) self.grpDOMXSSSettings.add(self.cbDOMXSSjQuerySinks) self.cbSTS = self.defineCheckBox("Strict Transport Security") self.lblSTSMin = JLabel("Minimum acceptable max-age") self.inSTSMin = JTextField( str(STSMinimum), 9, actionPerformed=self.setSTSMinimum ) # TODO: actionPerformed only fires on enter key - focus lost would be better self.inSTSMin.setToolTipText( "Enter the minimum max-age value which is considered as acceptable. Press return to change setting!" ) self.grpSTSSettings = JPanel() self.grpSTSSettings.add(self.lblSTSMin) self.grpSTSSettings.add(self.inSTSMin) self.cbXCTO = self.defineCheckBox("Content Sniffing") self.cbXXP = self.defineCheckBox( "Client-side XSS Filter Configuration") self.cbRedirToHTTPS = self.defineCheckBox( "Redirection from HTTP to HTTPS") self.btnSave = JButton("Set as default", actionPerformed=self.saveConfig) self.btnRestore = JButton("Restore", actionPerformed=self.restoreConfig) self.grpConfig = JPanel() self.grpConfig.add(self.btnSave) self.grpConfig.add(self.btnRestore) self.restoreConfig() # definition of config tab self.tab = JPanel() layout = GroupLayout(self.tab) self.tab.setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) layout.setHorizontalGroup(layout.createSequentialGroup().addGroup( layout.createParallelGroup().addComponent(self.cbPassiveChecks) ).addGroup(layout.createParallelGroup().addComponent( self.cbDOMXSS).addComponent(self.cbSTS).addComponent( self.cbXCTO).addComponent(self.cbXXP).addComponent( self.cbRedirToHTTPS)).addGroup( layout.createParallelGroup().addComponent( self.grpDOMXSSSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.grpSTSSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.grpConfig, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))) layout.setVerticalGroup(layout.createSequentialGroup().addGroup( layout.createParallelGroup().addComponent( self.cbPassiveChecks).addComponent(self.cbDOMXSS).addComponent( self.grpDOMXSSSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)).addGroup( layout.createParallelGroup().addComponent( self.cbSTS).addComponent( self.grpSTSSettings, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)).addComponent( self.cbXCTO).addComponent( self.cbXXP).addComponent( self.cbRedirToHTTPS).addComponent( self.grpConfig, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)) self.domXSSSourcesRE = re.compile( "(location\s*[\[.])|([.\[]\s*[\"']?\s*(arguments|dialogArguments|innerHTML|write(ln)?|open(Dialog)?|showModalDialog|cookie|URL|documentURI|baseURI|referrer|name|opener|parent|top|content|self|frames)\W)|(localStorage|sessionStorage|Database)" ) # NOTE: done some optimizations here, original RE caused too much noise # - added leading dot in the first part - original recognized "<a href=..." etc. # - removed "value" in first part self.domXSSSinksRE = re.compile( "(\.(src|href|data|location|code|action)\s*[\"'\]]*\s*\+?\s*=)|((replace|assign|navigate|getResponseHeader|open(Dialog)?|showModalDialog|eval|evaluate|execCommand|execScript|setTimeout|setInterval)\s*[\"'\]]*\s*\()" ) self.domXSSjQuerySinksRE = re.compile( "after\(|\.append\(|\.before\(|\.html\(|\.prepend\(|\.replaceWith\(|\.wrap\(|\.wrapAll\(|\$\(|\.globalEval\(|\.add\(|jQUery\(|\$\(|\.parseHTML\(" ) self.headerSTSRE = re.compile( "^Strict-Transport-Security:.*?max-age=\"?(\d+)\"?", re.I) # TODO: multiple max-age directives cause confusion! self.headerXCTORE = re.compile( "^X-Content-Type-Options:\s*nosniff\s*$", re.I) self.headerXXP = re.compile( "^X-XSS-Protection:\s*(\d)(?:\s*;\s*mode\s*=\s*\"?(block)\"?)?", re.I) self.headerLocationHTTPS = re.compile( "^(?:Content-)?Location:\s*(https://.*)$", re.I) callbacks.registerScannerCheck(self) callbacks.addSuiteTab(self)
def getUiComponent(self): aws_access_key_id = self.callbacks.loadExtensionSetting("aws_access_key_id") aws_secret_accesskey = self.callbacks.loadExtensionSetting("aws_secret_access_key") if aws_access_key_id: self.aws_access_key_id = aws_access_key_id if aws_secret_accesskey: self.aws_secret_accesskey = aws_secret_accesskey self.panel = JPanel() self.main = JPanel() self.main.setLayout(BoxLayout(self.main, BoxLayout.Y_AXIS)) self.access_key_panel = JPanel() self.main.add(self.access_key_panel) self.access_key_panel.setLayout(BoxLayout(self.access_key_panel, BoxLayout.X_AXIS)) self.access_key_panel.add(JLabel('Access Key: ')) self.access_key = JTextField(self.aws_access_key_id,25) self.access_key_panel.add(self.access_key) self.secret_key_panel = JPanel() self.main.add(self.secret_key_panel) self.secret_key_panel.setLayout(BoxLayout(self.secret_key_panel, BoxLayout.X_AXIS)) self.secret_key_panel.add(JLabel('Secret Key: ')) self.secret_key = JPasswordField(self.aws_secret_accesskey,25) self.secret_key_panel.add(self.secret_key) self.target_host_panel = JPanel() self.main.add(self.target_host_panel) self.target_host_panel.setLayout(BoxLayout(self.target_host_panel, BoxLayout.X_AXIS)) self.target_host_panel.add(JLabel('Target host: ')) self.target_host = JTextField('example.com', 25) self.target_host_panel.add(self.target_host) self.buttons_panel = JPanel() self.main.add(self.buttons_panel) self.buttons_panel.setLayout(BoxLayout(self.buttons_panel, BoxLayout.X_AXIS)) self.save_button = JButton('Save Keys', actionPerformed = self.saveKeys) self.buttons_panel.add(self.save_button) self.enable_button = JButton('Enable', actionPerformed = self.enableGateway) self.buttons_panel.add(self.enable_button) self.disable_button = JButton('Disable', actionPerformed = self.disableGateway) self.buttons_panel.add(self.disable_button) self.disable_button.setEnabled(False) self.protocol_panel = JPanel() self.main.add(self.protocol_panel) self.protocol_panel.setLayout(BoxLayout(self.protocol_panel, BoxLayout.Y_AXIS)) self.protocol_panel.add(JLabel("Target Protocol:")) self.https_button = JRadioButton("HTTPS",True) self.http_button = JRadioButton("HTTP",False) self.protocol_panel.add(self.http_button) self.protocol_panel.add(self.https_button) buttongroup = ButtonGroup() buttongroup.add(self.https_button) buttongroup.add(self.http_button) self.regions_title = JPanel() self.main.add(self.regions_title) self.regions_title.add(JLabel("Regions to launch API Gateways in:")) self.regions_panel = JPanel() self.main.add(self.regions_panel) glayout = GridLayout(4,3) self.regions_panel.setLayout(glayout) for region in AVAIL_REGIONS: cur_region = region.replace('-','_') cur_region = cur_region+'_status' setattr(self,cur_region,JCheckBox(region,True)) attr = getattr(self,cur_region) self.regions_panel.add(attr) self.status = JPanel() self.main.add(self.status) self.status.setLayout(BoxLayout(self.status, BoxLayout.X_AXIS)) self.status_indicator = JLabel(DISABLED,JLabel.CENTER) self.status_indicator.putClientProperty("html.disable", None) self.status.add(self.status_indicator) self.panel.add(self.main) return self.panel
def _initializeGui(self, callbacks): tab = JPanel() jLabel1 = JLabel("Original Hash:") jLabel2 = JLabel("Original message:") jLabel3 = JLabel("Message to append:") jLabel5 = JLabel("Max key length:") jTextField1 = JTextField("") jTextField2 = JTextField("") jTextField3 = JTextField("") jTextField4 = JTextField("128") jLabel4 = JLabel("Hashing functions") jCheckBox1 = JCheckBox("MD4") jCheckBox2 = JCheckBox("MD5") jCheckBox3 = JCheckBox("SHA1") jCheckBox4 = JCheckBox("SHA256") jCheckBox5 = JCheckBox("SHA512") jCheckBox1.setEnabled(False) jCheckBox2.setEnabled(False) jCheckBox3.setEnabled(False) jCheckBox4.setEnabled(False) jCheckBox5.setEnabled(False) jScrollPane1 = JScrollPane() jTable1 = JTable() jButton1 = JButton("Generate", actionPerformed=self.generate_attack) jButton1.setEnabled(False) jButton2 = JButton("Copy messages", actionPerformed=self.copy_messages) jButton3 = JButton("Copy hashes", actionPerformed=self.copy_hashes) self._tab = tab self._textfields = { "original_hash": jTextField1, "original_msg": jTextField2, "append_msg": jTextField3, "max_key_len": jTextField4, } self._checkboxes = { md4: jCheckBox1, md5: jCheckBox2, sha1: jCheckBox3, sha256: jCheckBox4, sha512: jCheckBox5, } self._table = jTable1 self._extensions = {} self._hashes, self._messages = [], [] # Hash field change event jTextField1.getDocument().addDocumentListener( HashChangeListener(self._checkboxes, self._textfields['original_hash'], jButton1)) # Table columns jTable1.setModel( DefaultTableModel([], ["#", "Type", "New Message", "Hash"])) jScrollPane1.setViewportView(jTable1) # Table column width jTable1.getColumnModel().getColumn(0).setMaxWidth(50) jTable1.getColumnModel().getColumn(1).setMaxWidth(60) layout = GroupLayout(tab) tab.setLayout(layout) layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addGap(24, 24, 24).addGroup( layout.createParallelGroup( GroupLayout.Alignment.TRAILING).addComponent(jLabel5). addComponent(jLabel1).addComponent(jLabel2). addComponent(jLabel3)).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addGroup( layout.createParallelGroup( GroupLayout.Alignment.LEADING).addComponent( jTextField3, GroupLayout.DEFAULT_SIZE, 425, 32767).addComponent(jTextField2). addComponent(jTextField1).addGroup( layout.createSequentialGroup().addComponent( jTextField4, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE).addGap( 0, 0, 32767))).addGap(30, 30, 30). addGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING). addGroup(layout.createSequentialGroup( ).addComponent(jCheckBox1).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(jCheckBox2).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(jCheckBox3).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(jCheckBox4).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addComponent( jCheckBox5)).addComponent(jLabel4).addGroup( layout.createSequentialGroup().addComponent( jButton1).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(jButton3).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent(jButton2))).addGap( 167, 167, 167)).addComponent(jScrollPane1)) layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup( layout.createSequentialGroup().addGap(26, 26, 26).addGroup( layout.createParallelGroup(GroupLayout.Alignment.BASELINE). addComponent(jLabel1).addComponent( jTextField1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel4)). addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addGroup( layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( jTextField2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE). addComponent(jLabel2).addGroup( layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( jCheckBox2).addComponent(jCheckBox3). addComponent(jCheckBox1).addComponent(jCheckBox4). addComponent(jCheckBox5))).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED). addGroup( layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( jTextField3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jLabel3) ).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addGroup( layout.createParallelGroup( GroupLayout.Alignment.BASELINE). addComponent(jLabel5).addComponent( jTextField4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent(jButton2). addComponent(jButton3).addComponent(jButton1)).addGap( 13, 13, 13).addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 971, 32767))) callbacks.customizeUiComponent(tab) callbacks.addSuiteTab(self)
def __init__(self, arg_dict): super(CumulusUI, self).__init__() # Load argument from the command line self.start_time = arg_dict['start_time'] self.end_time = arg_dict['end_time'] self.dss_path = arg_dict['dss_path'] self.cwms_home = arg_dict['cwms_home'] self.config = arg_dict['config'] # Get the DSS Path if one was saved in the "cumulus.config" file if os.path.isfile(self.config): with open(os.path.join(APPDATA, "cumulus.config")) as f: self.dss_path = f.read() # Get the basins and products, load JSON, create lists for JList, and create dictionaries self.basin_download = json.loads(self.http_get(url_basins)) self.jlist_basins = ["{}:{}".format(b['office_symbol'], b['name']) for b in self.basin_download] self.basin_meta = dict(zip(self.jlist_basins, self.basin_download)) self.jlist_basins.sort() self.product_download = json.loads(self.http_get(url_products)) self.jlist_products = ["{}".format(p['name'].replace("_", " ").title()) for p in self.product_download] self.product_meta = dict(zip(self.jlist_products, self.product_download)) self.jlist_products.sort() btn_submit = JButton() lbl_start_date = JLabel() lbl_end_date = JLabel() self.txt_select_file = JTextField() btn_select_file = JButton() lbl_origin = JLabel() lbl_extent = JLabel() lbl_select_file = JLabel() self.txt_start_time = JTextField() self.txt_end_time = JTextField() jScrollPane1 = JScrollPane() self.lst_product = JList() self.lst_product = JList(self.jlist_products, valueChanged = self.choose_product) jScrollPane2 = JScrollPane() self.lst_watershed = JList() self.lst_watershed = JList(self.jlist_basins, valueChanged = self.choose_watershed) self.cwms_dssname = JCheckBox() self.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) self.setTitle("Cumulus CAVI UI") self.setLocation(Point(10, 10)) self.setLocationByPlatform(True) self.setName("CumulusCaviUi") self.setResizable(False) btn_submit.setFont(Font("Tahoma", 0, 18)) btn_submit.setText("Submit") btn_submit.actionPerformed = self.submit lbl_start_date.setText("Start Date/Time") lbl_end_date.setText("End Date/Time") self.txt_select_file.setToolTipText("FQPN to output file (.dss)") btn_select_file.setText("...") btn_select_file.setToolTipText("Select File...") btn_select_file.actionPerformed = self.select_file lbl_origin.setText("Minimum (x,y):") lbl_extent.setText("Maximum (x,y):") lbl_select_file.setText("Output File Location") self.txt_start_time.setToolTipText("Start Time") self.txt_end_time.setToolTipText("End Time") self.lst_product.setBorder(BorderFactory.createTitledBorder(None, "Available Products", TitledBorder.CENTER, TitledBorder.TOP, Font("Tahoma", 0, 14))) self.lst_product.setFont(Font("Tahoma", 0, 14)) jScrollPane1.setViewportView(self.lst_product) self.lst_product.getAccessibleContext().setAccessibleName("Available Products") self.lst_product.getAccessibleContext().setAccessibleParent(jScrollPane2) self.lst_watershed.setBorder(BorderFactory.createTitledBorder(None, "Available Watersheds", TitledBorder.CENTER, TitledBorder.TOP, Font("Tahoma", 0, 14))) self.lst_watershed.setFont(Font("Tahoma", 0, 14)) self.lst_watershed.setSelectionMode(ListSelectionModel.SINGLE_SELECTION) jScrollPane2.setViewportView(self.lst_watershed) self.cwms_dssname.setText("CWMS DSS filename") self.cwms_dssname.setToolTipText("Parameter.yyyy.mm.dss") self.cwms_dssname.setVisible(False) layout = GroupLayout(self.getContentPane()); self.getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, False) .addComponent(lbl_select_file) .addComponent(jScrollPane1) .addComponent(jScrollPane2) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(btn_submit) .addComponent(self.txt_select_file, GroupLayout.PREFERRED_SIZE, 377, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(btn_select_file)) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(lbl_start_date) .addComponent(self.txt_start_time, GroupLayout.PREFERRED_SIZE, 170, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(self.txt_end_time, GroupLayout.PREFERRED_SIZE, 170, GroupLayout.PREFERRED_SIZE) .addComponent(lbl_end_date)))) .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ) layout.setVerticalGroup( layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(lbl_start_date) .addComponent(lbl_end_date)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(self.txt_start_time, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(self.txt_end_time, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jScrollPane2, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 201, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, Short.MAX_VALUE) .addComponent(lbl_select_file) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(self.txt_select_file, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btn_select_file)) .addGap(18, 18, 18) .addComponent(btn_submit) .addContainerGap()) ) self.txt_select_file.setText(self.dss_path) self.txt_start_time.setText(self.start_time) self.txt_end_time.setText(self.end_time) self.pack() self.setLocationRelativeTo(None)
def __init__(self): # Setup controls - buttons first self.playButton.preferredSize = self.refreshButton.preferredSize self.playButton.actionCommand = self.PLAY self.playButton.actionPerformed = self.whenButtonClicked self.pauseButton.preferredSize = self.refreshButton.preferredSize self.pauseButton.actionCommand = self.PAUSE self.pauseButton.actionPerformed = self.whenButtonClicked self.stopButton.preferredSize = self.refreshButton.preferredSize self.stopButton.actionCommand = self.STOP self.stopButton.actionPerformed = self.whenButtonClicked self.refreshButton.actionCommand = self.REFRESH self.refreshButton.actionPerformed = self.whenButtonClicked # Now combobox and text field self.sourceCombo.itemStateChanged = self.whenSourceChanged self.updateSourcesList() self.rangeSpinner.stateChanged = self.whenRangeChanged # Now sliders ticksMajor = int(self.posMinMax / 4) ticksMinor = int(ticksMajor / 5) labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Left")) labels.put(0, JLabel("Centre")) labels.put(self.posMinMax, JLabel("Right")) self.positionXSlider.labelTable = labels self.positionXSlider.minimum = -self.posMinMax self.positionXSlider.maximum = self.posMinMax self.positionXSlider.majorTickSpacing = ticksMajor self.positionXSlider.minorTickSpacing = ticksMinor self.positionXSlider.paintTicks = True self.positionXSlider.paintLabels = True self.positionXSlider.snapToTicks = True self.positionXSlider.value = 0 self.positionXSlider.stateChanged = self.whenSliderXChanged labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Behind")) labels.put(0, JLabel("Centre")) labels.put(self.posMinMax, JLabel("In-front")) self.positionYSlider.labelTable = labels self.positionYSlider.minimum = -self.posMinMax self.positionYSlider.maximum = self.posMinMax self.positionYSlider.majorTickSpacing = ticksMajor self.positionYSlider.minorTickSpacing = ticksMinor self.positionYSlider.paintTicks = True self.positionYSlider.paintLabels = True self.positionYSlider.snapToTicks = True self.positionYSlider.value = 0 self.positionYSlider.orientation = JSlider.VERTICAL self.positionYSlider.stateChanged = self.whenSliderYChanged labels = Hashtable(3) labels.put(-self.posMinMax, JLabel("Below")) labels.put(0, JLabel("Centre")) labels.put(self.posMinMax, JLabel("Above")) self.positionZSlider.labelTable = labels self.positionZSlider.minimum = -self.posMinMax self.positionZSlider.maximum = self.posMinMax self.positionZSlider.majorTickSpacing = ticksMajor self.positionZSlider.minorTickSpacing = ticksMinor self.positionZSlider.paintTicks = True self.positionZSlider.paintLabels = True self.positionZSlider.snapToTicks = True self.positionZSlider.value = 0 self.positionZSlider.orientation = JSlider.VERTICAL self.positionZSlider.stateChanged = self.whenSliderZChanged # Setup frame self.title = "Simple JMRI Audio Player" self.contentPane.layout = BoxLayout(self.contentPane, BoxLayout.Y_AXIS) # Add controls to frame - combo & buttons first p = JPanel(FlowLayout(FlowLayout.LEADING)) p.add(self.sourceCombo) p.add(self.refreshButton) p.add(self.playButton) p.add(self.pauseButton) p.add(self.stopButton) #p.add(JLabel("Range")) #p.add(self.rangeSpinner) self.add(p) self.add(Box.createVerticalGlue()) # Now sliders p = JPanel(FlowLayout(FlowLayout.LEADING)) label = JLabel("Y Position") label.UI = VerticalLabelUI() # Default behaviour is anti-clockwise p.add(label) p.add(self.positionYSlider) p2 = JPanel() p2.layout = BoxLayout(p2, BoxLayout.Y_AXIS) p3 = JPanel() p3.add(JLabel("Range")) p3.add(self.rangeSpinner) p2.add(p3) #p2.add(Box.createVerticalGlue()) p3 = JPanel() p3.layout = BoxLayout(p3, BoxLayout.Y_AXIS) label = JLabel("X Position") label.alignmentX = JLabel.CENTER_ALIGNMENT p3.add(label) p3.add(self.positionXSlider) p2.add(p3) p.add(p2) label = JLabel("Z Position") label.UI = VerticalLabelUI() p.add(label) p.add(self.positionZSlider) self.add(p) # Finally pack and show self.pack() self.show()
def makePane(self): #----------------------------------------------------------------------- # Panel Header #----------------------------------------------------------------------- panel = JPanel(FlowLayout()) panel.add( JLabel('<html><h2>ConfirmDialog options:</h2>', JLabel.CENTER)) #----------------------------------------------------------------------- # ConfirmDialog argument values #----------------------------------------------------------------------- choices = JPanel( border=BorderFactory.createEmptyBorder( 20, # top 20, # left 5, # bottom 20 # right ), ) choices.setLayout(BoxLayout(choices, BoxLayout.PAGE_AXIS)) #----------------------------------------------------------------------- # Required: Message to be displayed #----------------------------------------------------------------------- picks = JPanel(GridLayout(0, 2)) picks.add( JLabel('<html><font color="red">Message:</font>', JLabel.RIGHT)) self.message = picks.add(JTextField(10)) #----------------------------------------------------------------------- # Optional: Dialog box title #----------------------------------------------------------------------- picks.add(JLabel('Title:', JLabel.RIGHT)) self.title = picks.add(JTextField(10)) #----------------------------------------------------------------------- # Optional: Option Type #----------------------------------------------------------------------- picks.add(JLabel('optionType:', JLabel.RIGHT)) JOP = JOptionPane # Make the next few lines shorter optionTypes = [('Yes or No', JOP.YES_NO_OPTION), ('Yes, No, or Cancel', JOP.YES_NO_CANCEL_OPTION), ('OK or Cancel', JOP.OK_CANCEL_OPTION)] optionList, self.optionDict = [], {} for name, value in optionTypes: optionList.append(name) self.optionDict[name] = value self.optType = picks.add(JComboBox(optionList)) picks.add(self.optType) #----------------------------------------------------------------------- # Optional: Message Type #----------------------------------------------------------------------- picks.add(JLabel('messageType:', JLabel.RIGHT)) messageTypes = [('Unspecified', None), ('Plain', JOptionPane.PLAIN_MESSAGE), ('Error', JOptionPane.ERROR_MESSAGE), ('Informational', JOptionPane.INFORMATION_MESSAGE), ('Warning', JOptionPane.WARNING_MESSAGE), ('Question', JOptionPane.QUESTION_MESSAGE)] msgList, self.msgDict = [], {} for name, value in messageTypes: msgList.append(name) self.msgDict[name] = value self.msgType = picks.add(JComboBox(msgList)) picks.add(self.msgType) choices.add(picks) panel.add(choices) panel.add( JButton('Display Dialog Box', actionPerformed=self.showDialog)) return panel
def __init__(self, callbacks, issue=defaultIssue, title="", modality=""): """Constructor, populates the dialog.""" # set the title self.setTitle(title) # store the issue self.issue = issue from javax.swing import JFrame self.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE) if modality is not "": from java.awt.Dialog import ModalityType modality = modality.lower() # application blocks us from clicking anything else in Burp if modality == "application": self.setModalityType(ModalityType.APPLICATION_MODAL) if modality == "document": self.setModalityType(ModalityType.DOCUMENT_MODAL) if modality == "modeless": self.setModalityType(ModalityType.DOCUMENT_MODAL) if modality == "toolkit": self.setModalityType(ModalityType.DOCUMENT_MODAL) # assert isinstance(callbacks, IBurpExtenderCallbacks) # starting converted code from NetBeans self.labelPath = JLabel("Path") self.labelSeverity = JLabel("Severity") 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 = callbacks.createMessageEditor(None, True) self.panelResponse = callbacks.createMessageEditor(None, True) self.textName = JTextField() self.textHost = JTextField() self.textPath = JTextField() self.labelHost = JLabel("Host") self.labelName = JLabel("Name") # buttons self.buttonSave = JButton("Save", actionPerformed=self.saveButtonAction) self.buttonCancel = JButton("Cancel", actionPerformed=self.cancelButtonAction) self.buttonReset = JButton("Reset", actionPerformed=self.resetButtonAction) # description and remediation textareas from java.awt import Dimension self.textAreaDescription.setPreferredSize(Dimension(400, 500)) self.textAreaDescription.setLineWrap(True) self.textAreaDescription.setWrapStyleWord(True) self.textAreaRemediation.setLineWrap(True) self.textAreaRemediation.setWrapStyleWord(True) self.tabIssue.addTab("Description", self.jsPaneDescription) self.tabIssue.addTab("Remediation", self.jsPaneRemediation) # request and response tabs # 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()) # template self.labelTemplate = JLabel("Template") self.comboTemplate = JComboBox() # TODO: Populate this from outside using a config file from the # constructor? or perhaps the extension config self.comboSeverity = JComboBox( ["Critical", "High", "Medium", "Low", "Info"]) self.comboSeverity.setSelectedIndex(-1) # add componentlistener dlgListener = DialogListener(self) self.addComponentListener(dlgListener) if issue is None: issue = self.defaultIssue # load the issue into the edit dialog. self.loadPanel(issue) # "here be dragons" GUI code layout = GroupLayout(self.getContentPane()) self.getContentPane().setLayout(layout) layout.setHorizontalGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER).addGroup( layout.createSequentialGroup().addGroup( layout.createParallelGroup(GroupLayout.Alignment.CENTER). addGroup(layout.createSequentialGroup().addContainerGap( ).addGroup(layout.createParallelGroup().addGroup( layout.createSequentialGroup().addGroup( layout.createParallelGroup().addComponent( self.labelTemplate).addComponent( self.labelHost). addComponent(self.labelName)).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED). addGroup(layout.createParallelGroup().addGroup( layout.createSequentialGroup().addComponent( self.comboTemplate) ).addGroup(layout.createSequentialGroup().addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, 212, GroupLayout.PREFERRED_SIZE).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED ).addComponent(self.labelPath).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED ).addComponent( self.textPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, 800 )).addGroup( GroupLayout.Alignment.TRAILING, layout.createSequentialGroup(). addComponent(self.textName).addPreferredGap( LayoutStyle.ComponentPlacement.UNRELATED). addComponent( self.labelSeverity).addPreferredGap( LayoutStyle.ComponentPlacement. UNRELATED).addComponent( self.comboSeverity, GroupLayout.PREFERRED_SIZE, 182, GroupLayout.PREFERRED_SIZE))) ).addComponent(self.tabIssue))).addGroup( layout.createSequentialGroup().addComponent( self.buttonSave, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.buttonReset, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.buttonCancel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout. PREFERRED_SIZE))).addContainerGap())) # link size of buttons together from javax.swing import SwingConstants layout.linkSize(SwingConstants.HORIZONTAL, [self.buttonCancel, self.buttonSave, self.buttonReset]) layout.setVerticalGroup(layout.createParallelGroup().addGroup( GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addGroup( layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.labelName).addComponent( self.textName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.labelSeverity).addComponent( self.comboSeverity, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)). addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup( layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.textHost, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.labelPath).addComponent(self.textPath). addComponent(self.labelHost)).addGroup( layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent( self.comboTemplate, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addComponent( self.labelTemplate)).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED). addComponent(self.tabIssue).addPreferredGap( LayoutStyle.ComponentPlacement.RELATED).addGroup( layout.createParallelGroup().addComponent( self.buttonSave).addComponent( self.buttonReset).addComponent( self.buttonCancel)).addContainerGap())) # end of converted code from NetBeans # set the template label and combobox to invisible self.labelTemplate.setVisible(False) self.comboTemplate.setVisible(False)
mainForm.dispose() informationForm.informasiPane.setVisible(True) def aboutButton(event): from myGUI import aboutForm mainForm.dispose() aboutForm.aboutForm.setVisible(True) #form and panel construction mainForm = JFrame("Halaman Utama", size=(987,610), ) myPanel = JPanel() myPanel.setOpaque(True) myPanel.setBackground(Color.WHITE) myPanel.setLayout(None) message = JLabel("<html><center>Teknik Pemecahan Kunci Algoritma ElGamal <br>Dengan Metode Index Calculus<html>", JLabel.CENTER) message.setSize(987, 144) message.setFont(myFont) #message.setAlignmentX(433) message.setAlignmentY(34) mainForm.setContentPane(myPanel) #mainForm.setSize(310, 125) mainForm.locationByPlatform=True mainForm.visible=True #buttons creation button1 = JButton("Naive User", actionPerformed=naiveButton) button1.setSize(233,145)
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout(self.gbPanel0) self.Error_Message = JLabel("") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Error_Message, self.gbcPanel0) self.panel0.add(self.Error_Message) # self.Label_1 = JLabel("MacFSEvents To Include:") # self.Label_1.setEnabled(True) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 1 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) # self.panel0.add( self.Label_1 ) # self.Blank_1 = JLabel( " ") # self.Blank_1.setEnabled(True) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 5 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) # self.panel0.add( self.Blank_1 ) # self.Plugin_list = ('FolderEvent','Mount','Unmount','EndOfTransaction','LastHardLinkRemoved','HardLink', \ # 'SymbolicLink','FileEvent','PermissionChange','ExtendedAttrModified','ExtendedAttrRemoved', \ # 'DocumentRevisioning','Created','Removed','InodeMetaMod','Renamed','Modified', \ # 'Exchange','FinderInfoMod','FolderCreated') # self.Plugin_LB = JList( self.Plugin_list, valueChanged=self.onchange_plugins_lb) # self.Plugin_LB.setVisibleRowCount( 7 ) # self.scpPlugin_LB = JScrollPane( self.Plugin_LB ) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 7 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 1 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.scpPlugin_LB, self.gbcPanel0 ) # self.panel0.add( self.scpPlugin_LB ) self.Blank_4 = JLabel(" ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_4, self.gbcPanel0) self.panel0.add(self.Blank_4) # self.Label_3 = JLabel( "Message:") # self.Label_3.setEnabled(True) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 29 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) # self.panel0.add( self.Label_3 ) self.add(self.panel0)
def __initLayout__(self): self._levelComboBox = JComboBox() levelComboBoxSize = Dimension(300, 30) self._levelComboBox.setPreferredSize(levelComboBoxSize) self._levelComboBox.setMaximumSize(levelComboBoxSize) for level in range(0, 6): self._levelComboBox.addItem(str(level)) self._techRenderedCheckBox = JCheckBox('Rendered', True) self._techTimebasedCheckBox = JCheckBox('Time-based', True) self._plugin_groups = {} for plugin in plugins: parent = plugin.__base__.__name__ if not self._plugin_groups.has_key(parent): self._plugin_groups[parent] = [] self._plugin_groups[parent].append(plugin) self._pluginCheckBoxes = [] for pluginGroup in self._plugin_groups.values(): for plugin in pluginGroup: self._pluginCheckBoxes.append(PluginCheckBox(plugin)) self._positionReplaceCheckBox = JCheckBox('Replace', True) self._positionAppendCheckBox = JCheckBox('Append', False) displayItems = ({ 'label': 'Level', 'components': (self._levelComboBox, ), 'description': 'Level of code context escape to perform (1-5, Default:0).' }, { 'label': 'Techniques', 'components': ( self._techRenderedCheckBox, self._techTimebasedCheckBox, ), 'description': 'Techniques R(endered) T(ime-based blind). Default: RT.' }, { 'label': 'Template Engines', 'components': self._pluginCheckBoxes, 'description': 'Force back-end template engine to this value(s).' }, { 'label': 'Payload position', 'components': ( self._positionReplaceCheckBox, self._positionAppendCheckBox, ), 'description': 'Scan payload position. This feature only appears in BurpExtension.' }) layout = GroupLayout(self) self.setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) labelWidth = 200 hgroup = layout.createParallelGroup(GroupLayout.Alignment.LEADING) vgroup = layout.createSequentialGroup() for displayItem in displayItems: label = JLabel(displayItem.get('label')) label.setToolTipText(displayItem.get('description')) _hgroup = layout.createSequentialGroup().addComponent( label, labelWidth, labelWidth, labelWidth) _vgroup = layout.createParallelGroup( GroupLayout.Alignment.BASELINE).addComponent(label) for component in displayItem.get('components'): _hgroup.addComponent(component) _vgroup.addComponent(component) hgroup.addGroup(_hgroup) vgroup.addGroup(_vgroup) layout.setHorizontalGroup(hgroup) layout.setVerticalGroup(vgroup)
def __init__(self, callbacks, parent): # Initialze self stuff self._callbacks = callbacks self.config = {} self.ext_stats = {} self.url_reqs = [] self.parse_files = False self.tab = JPanel(GridBagLayout()) self.view_port_text = JTextArea("===SpyDir===") self.delim = JTextField(30) self.ext_white_list = JTextField(30) # I'm not sure if these fields are necessary still # why not just use Burp func to handle this? # leaving them in case I need it for the HTTP handler later # self.cookies = JTextField(30) # self.headers = JTextField(30) self.url = JTextField(30) self.parent_window = parent self.plugins = {} self.loaded_p_list = set() self.loaded_plugins = False self.config['Plugin Folder'] = None self.double_click = False self.source_input = "" self.print_stats = True self.curr_conf = JLabel() self.window = JFrame("Select plugins", preferredSize=(200, 250), windowClosing=self.p_close) self.window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE) self.window.setVisible(False) # Initialize local stuff tab_constraints = GridBagConstraints() status_field = JScrollPane(self.view_port_text) # Configure view port self.view_port_text.setEditable(False) labels = self.build_ui() # Add things to rows tab_constraints.anchor = GridBagConstraints.FIRST_LINE_END tab_constraints.gridx = 1 tab_constraints.gridy = 0 tab_constraints.fill = GridBagConstraints.HORIZONTAL self.tab.add(JButton( "Resize screen", actionPerformed=self.resize), tab_constraints) tab_constraints.gridx = 0 tab_constraints.gridy = 1 tab_constraints.anchor = GridBagConstraints.FIRST_LINE_START self.tab.add(labels, tab_constraints) tab_constraints.gridx = 1 tab_constraints.gridy = 1 tab_constraints.fill = GridBagConstraints.BOTH tab_constraints.weightx = 1.0 tab_constraints.weighty = 1.0 tab_constraints.anchor = GridBagConstraints.FIRST_LINE_END self.tab.add(status_field, tab_constraints) try: self._callbacks.customizeUiComponent(self.tab) except Exception: pass
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 c.weighty = 0.0 note_status = JLabel("") gb.setConstraints(note_status, c) all.add(note_status) # 2nd-to-last Bottom right button for editing the note text in the middle-right text area c.gridx = 2 c.gridy = 2 c.weightx = 0.0 c.anchor = GridBagConstraints.NORTHEAST edit_note = JButton("Edit note") edit_note.setEnabled(False) gb.setConstraints(edit_note, c) all.add(edit_note) # Bottom right button for requesting that the text note in the text area be saved to the CSV file c.gridx = 3
def build_ui(self): """Builds the configuration screen""" labels = JPanel(GridLayout(21, 1)) checkbox = JCheckBox("Attempt to parse files for URL patterns?", False, actionPerformed=self.set_parse) stats_box = JCheckBox("Show stats?", True, actionPerformed=self.set_show_stats) # The two year old in me is laughing heartily plug_butt = JButton("Specify plugins location", actionPerformed=self.set_plugin_loc) load_plug_butt = JButton("Select plugins", actionPerformed=self.p_build_ui) parse_butt = JButton("Parse directory", actionPerformed=self.parse) clear_butt = JButton("Clear text", actionPerformed=self.clear) spider_butt = JButton("Send to Spider", actionPerformed=self.scan) save_butt = JButton("Save config", actionPerformed=self.save) rest_butt = JButton("Restore config", actionPerformed=self.restore) source_butt = JButton("Input Source File/Directory", actionPerformed=self.get_source_input) # Build grid labels.add(source_butt) labels.add(self.curr_conf) labels.add(JLabel("String Delimiter:")) labels.add(self.delim) labels.add(JLabel("Extension Whitelist:")) labels.add(self.ext_white_list) labels.add(JLabel("URL:")) labels.add(self.url) # Leaving these here for now. # labels.add(JLabel("Cookies:")) # labels.add(self.cookies) # labels.add(JLabel("HTTP Headers:")) # labels.add(self.headers) labels.add(checkbox) labels.add(stats_box) labels.add(plug_butt) labels.add(parse_butt) labels.add(JButton("Show all endpoints", actionPerformed=self.print_endpoints)) labels.add(clear_butt) labels.add(spider_butt) labels.add(JLabel("")) labels.add(save_butt) labels.add(rest_butt) labels.add(load_plug_butt) # Tool tips! self.delim.setToolTipText("Use to manipulate the final URL. " "See About tab for example.") self.ext_white_list.setToolTipText("Define a comma delimited list of" " file extensions to parse. Use *" " to parse all files.") self.url.setToolTipText("Enter the target URL") checkbox.setToolTipText("Parse files line by line using plugins" " to enumerate language/framework specific" " endpoints") parse_butt.setToolTipText("Attempt to enumerate application endpoints") clear_butt.setToolTipText("Clear status window and the parse results") spider_butt.setToolTipText("Process discovered endpoints") save_butt.setToolTipText("Saves the current config settings") rest_butt.setToolTipText("<html>Restores previous config settings:" "<br/>-Input Directory<br/>-String Delim" "<br/>-Ext WL<br/>-URL<br/>-Plugins") source_butt.setToolTipText("Select the application's " "source directory or file to parse") return labels
def about(self, e): JOptionPane.showMessageDialog( self.frame, JLabel(self.aboutTask.getResult(), font=MONOFONT), 'About', JOptionPane.PLAIN_MESSAGE)
def __init__(self): self.rw = 0 # table row self.cl = 0 # table column # load hidden files list self.hiddenFiles = ["zzz"] if os.path.exists("hiddenFiles.txt"): fp = open("hiddenFiles.txt", "r") self.hiddenFiles = fp.readlines() fp.close() self.hiddenFiles = [f.strip() for f in self.hiddenFiles] print self.hiddenFiles # These lines setup the basic frame, size and layout # the setDefaultCloseOperation so that only the window closes and not TOPSPIN self.frame = JFrame("Submit NMR Experimets") self.frame.setSize(1200, 440) self.frame.setLayout(BorderLayout()) self.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) # set up the list and the contents of the list # the python tuple get converted to a Java vector self.data = self.returnCSVlist(self.hiddenFiles) self.list = JList(self.data, valueChanged=self.listSelect) self.spane = JScrollPane() self.spane.setPreferredSize(Dimension(145, 150)) self.spane.getViewport().setView((self.list)) panel = JPanel() panel.add(self.spane) # define buttons bpanel = JPanel() btnS = JButton('Submit File', actionPerformed=self.listSubmit) btnU = JButton('Update List', actionPerformed=self.listUpdate) btnHideFile = JButton('Hide File', actionPerformed=self.listHideFile) btnShowAllFiles = JButton('Show All Files', actionPerformed=self.listShowAllFiles) # label displaying CSV file selected self.label = JLabel('Selected File', JLabel.CENTER) # label to display warnings and confirm expriments submitted self.statusLabel = JLabel('Status', JLabel.CENTER) # Create table to display csv file self.tableData = [] for r in range(18): self.tableData.append([ "", ] * len(JBrukerSubmit.colHeads)) colNames = JBrukerSubmit.colHeads self.dataTableModel = DefaultTableModel(self.tableData, colNames) self.table = JTable(self.dataTableModel, keyTyped=self.tableChangedCB, mouseClicked=self.tableMouseClicked) # set all columns to uneditable except Holder column # print dir(self.table) # self.table.getColumn(0).setEditable(False) # self.table.getColumn(2).setEditable(False) # self.table.getColumn(3).setEditable(False) # self.table.getColumn(4).setEditable(False) # self.table.getColumn(5).setEditable(False) # self.table.getColumn(6).setEditable(False) # self.table = JTable(self.dataTableModel, # keyPressed=self.tableKeyPressedCB) self.scrollPaneTable = JScrollPane() self.scrollPaneTable.setPreferredSize(Dimension(900, 300)) self.scrollPaneTable.getViewport().setView((self.table)) panelTable = JPanel() panelTable.add(self.scrollPaneTable) # create text field to get carousel starting position self.carouselLabel = JLabel("Carousel Position", JLabel.CENTER) self.carouselStartingPosition = JTextField( '1', 13, keyPressed=self.checkCarouselNumber) # add widgets to do with manupulating csv list in FlowLayout Mode panelList = JPanel() panelList.setLayout(FlowLayout()) panelList.setPreferredSize(Dimension(170, 200)) # set preferred size of buttons btnU.setPreferredSize(Dimension(140, 20)) btnS.setPreferredSize(Dimension(140, 20)) btnHideFile.setPreferredSize(Dimension(140, 20)) btnShowAllFiles.setPreferredSize(Dimension(140, 20)) self.carouselLabel.setPreferredSize(Dimension(140, 20)) self.carouselStartingPosition.setPreferredSize(Dimension(170, 20)) panelList.add(btnU) panelList.add(panel) panelList.add(btnHideFile) panelList.add(btnShowAllFiles) panelList.add(JSeparator(JSeparator.HORIZONTAL), BorderLayout.LINE_START) panelList.add(self.carouselLabel) panelList.add(self.carouselStartingPosition) panelList.add(btnS) self.panelLabel = JPanel() self.panelLabel.add(self.label) self.standardBackgroundColor = self.panelLabel.getBackground() # put status label in a panel so that background color can be changed self.panelStatusLabel = JPanel() self.panelStatusLabel.add(self.statusLabel) # add widgets to frame self.frame.add(self.panelLabel, BorderLayout.NORTH) self.frame.add(panelList, BorderLayout.WEST) self.frame.add(panelTable, BorderLayout.CENTER) self.frame.add(self.panelStatusLabel, BorderLayout.SOUTH) self.frame.setVisible(True)
def teacherLogined(teObj): # teacherObject is object of teacher global panel global table global heading global frame frame = JFrame("Teacher Page ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) panel = JPanel() panel.setSize(500, 580) panel.setLocation(0, 20) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.WHITE) heading = JLabel() heading.setBounds(210, 10, 200, 30) table = JTable() table.setBounds(0, 50, 500, 470) sp = JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) bar = JMenuBar() profile = JMenu("Profile") showProfile = JMenuItem("Show Profile", actionPerformed=clickShowProfile) changePassword = JMenuItem("Change Password", actionPerformed=clickChangePassword) showStudents = JMenuItem("Show students", actionPerformed=clickShowStudents) profile.add(showProfile) profile.add(changePassword) profile.add(showStudents) bar.add(profile) attendence = JMenu("Attendence") showAllAttendence = JMenuItem("Show All Attendence", actionPerformed=clickAllAttendence) showAttendenceInMonth = JMenuItem("show attendence in month", actionPerformed=clickAttendenceInMonth) attendence.add(showAllAttendence) attendence.add(showAttendenceInMonth) bar.add(attendence) studentAttendence = JMenu("Student Attendence") takeStudentAttendence = JMenuItem( "Take Student Attendence", actionPerformed=clickTakeStudentAttendence) showStudentAttendenceInMonth = JMenuItem( "show all student attendence in month", actionPerformed=clickShowAllStudentAttendenceInMonth) showStudentAttendenceStatisticsInMonth = JMenuItem( "show student attendence statistics in month", actionPerformed=clickShowStudentAttendenceStatisticsInMonth) showSpecificStudentAttendenceInMonth = JMenuItem( "show specific student attendence in month", actionPerformed=clickShowSpecificStudentAttendenceInMonth) studentAttendence.add(takeStudentAttendence) studentAttendence.add(showStudentAttendenceInMonth) studentAttendence.add(showSpecificStudentAttendenceInMonth) studentAttendence.add(showStudentAttendenceStatisticsInMonth) bar.add(studentAttendence) logout = JMenuItem("logout", actionPerformed=clickLogout) bar.add(logout) panel.add(table) frame.setJMenuBar(bar) frame.add(panel) frame.setVisible(True)
def actionTarget(self, event): print("*" * 80) self.fileId = [] requestResponses = self.invocation.getSelectedMessages() chosts, ihosts = self.countHostIssues(requestResponses) if self.project <= 1: panelinput = JPanel() panelinput.add(JLabel("Projeto ID: ")) projectq = JTextField(20) panelinput.add(projectq) result = JOptionPane.showOptionDialog( None, panelinput, "Qual projeto enviar Issues?", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, None, ["OK", "Sem projeto"], "OK") if result == -1: print("[-] Cancelado envio!") return if result == JOptionPane.OK_OPTION: self.project_id.setText(projectq.getText()) self.projectId = str(projectq.getText()) if not re.match('([0-9a-f]{24})', self.projectId): self.projectId = None mess = "Projeto Id formato inválido".decode("utf8") JOptionPane.showMessageDialog(None, mess, "Error", JOptionPane.ERROR_MESSAGE) return mess = "Sessão atual".decode("utf8") ever = JOptionPane.showOptionDialog( None, "Solicitar Id de Projeto novamente?", mess, JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, None, ["Nunca", "Sim"], "Sim") # let user select parameters for new session if ever == JOptionPane.OK_OPTION: self.project = 2 else: self.project = 1 for reqResp in requestResponses: url = reqResp.getHttpService() requestIssues = self._callbacks.getScanIssues(str(url)) listIssues = [] if requestIssues: if len(requestIssues) > 0: for i in requestIssues: scanissue = i if scanissue.getIssueName() not in ['']: sep = "<br><hr><br>" issue = {} issue['Tool_Type'] = "BURP" IssueType = scanissue.getIssueType() IssueName = scanissue.getIssueName() IssueCrit = scanissue.getSeverity() IssueConf = scanissue.getConfidence() protocol = scanissue.getHttpService().getProtocol() host = scanissue.getHttpService().getHost() IssuePath = i.getUrl().getPath() IssueDesc = scanissue.getIssueDetail() IssueDescBk = scanissue.getIssueBackground() IssueRecom = scanissue.getRemediationDetail() IssueRecomBk = scanissue.getRemediationBackground() if IssueType: issue['IssueType'] = scanissue.getIssueType() else: issue['IssueType'] = 0000 if IssueName: issue['DetailsFinding_Title'] = IssueName issue['Recomenation_Title'] = IssueName else: issue['DetailsFinding_Title'] = "No Issue name" issue['Recomenation_Title'] = "No Issue name" if "False positive" in IssueCrit: sTag = "False positive" IssueCrit = "" elif "Information" in IssueCrit: IssueCrit = "Informative" sTag = "" else: sTag = "" if IssueCrit: issue['Severity'] = IssueCrit else: issue['Severity'] = "Informative" issue['Web_Application_URI'] = "{}://{}".format( protocol, host) if IssuePath: issue['Web_Application_Path'] = IssuePath else: issue['Web_Application_Path'] = "/" if IssueConf: issue['fTag'] = IssueConf else: issue['fTag'] = " " issue['sTag'] = sTag if IssueDescBk is not None: issue['Description'] = IssueDescBk.replace( "\n", "") else: issue['Description'] = "" if IssueDesc is not None: issue['Description'] += "{}{}".format( sep, IssueDesc.replace("\n", "")) if IssueRecomBk is not None: issue['Recommendation'] = IssueRecomBk.replace( "\n", "") else: issue['Recommendation'] = IssueName if IssueRecom is not None: issue['Recommendation'] += "{}{}".format( sep, IssueRecom.replace("\n", "")) listIssues.append(issue) self.generateReportGat(listIssues) # iniciar threads print("[+] Thread(s) Iniciada(s)...") if self.project: print("[+] Enviando Issues para o Project Id: {}".format( self.projectId)) print("[+] Enviando {} host(s), total de {} Issue(s),\n".format( chosts, ihosts)) self.launchThread(self.sendIssues)
def showStackOverlayWindow(self): all = JPanel() all.setLayout(MigLayout()) self.imageIDs = WindowManager.getIDList() self.imageNames = [] if self.imageIDs is None: IJ.error( "No open images", "Stack Overlay requires at least one image to be already open." ) return for i in self.imageIDs: self.imageNames.append(WindowManager.getImage(i).getTitle()) self.baseImageBox = JComboBox(self.imageNames) baseImageBoxLabel = JLabel("Base image") self.baseImageBox.setSelectedIndex(0) all.add(baseImageBoxLabel) all.add(self.baseImageBox, "wrap") self.overlayImageBox = JComboBox(self.imageNames) overlayImageBoxLabel = JLabel("Overlay image") if len(self.imageNames) > 1: self.overlayImageBox.setSelectedIndex(1) all.add(overlayImageBoxLabel) all.add(self.overlayImageBox, "wrap") all.add(JSeparator(SwingConstants.HORIZONTAL), "span, wrap") overlayStyleFrame = JPanel() overlayStyleFrame.setLayout(MigLayout()) overlayStyleFrame.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Overlay Style"), BorderFactory.createEmptyBorder(5, 5, 5, 5))) colorLabel = JLabel("Overlay color") self.overlayColorPreviewLabel = JLabel(" ") self.overlayColorPreviewLabel.setBorder( BorderFactory.createEmptyBorder(0, 0, 1, 0)) self.overlayColorPreviewLabel.setOpaque(True) self.overlayColorPreviewLabel.setBackground(Color.red) self.overlayColor = Color.red colorPicker = JColorChooser() colorPicker.setPreviewPanel(self.overlayColorPreviewLabel) colorButton = JButton("Select color...", actionPerformed=self.showColorChooser) opacityLabel = JLabel("Overlay opacity (%)") opacitySpinnerModel = SpinnerNumberModel(100, 0, 100, 1) self.opacitySpinner = JSpinner(opacitySpinnerModel) overlayStyleFrame.add(colorLabel) overlayStyleFrame.add(self.overlayColorPreviewLabel) overlayStyleFrame.add(colorButton, "wrap") overlayStyleFrame.add(opacityLabel) overlayStyleFrame.add(self.opacitySpinner, "wrap") all.add(overlayStyleFrame, "span, wrap") self.virtualStackCheckbox = JCheckBox("Use Virtual Stack", True) all.add(self.virtualStackCheckbox, "span, wrap") # TODO: add non-thermonuclear cancel button functionality overlayCancelButton = JButton("Cancel", actionPerformed=self.onQuit) overlayStartButton = JButton("Overlay images", actionPerformed=self.overlayImages) all.add(overlayCancelButton, "gapleft push") all.add(overlayStartButton, "gapleft push") self.frame = JFrame("Stack Overlay") self.frame.getContentPane().add(JScrollPane(all)) self.frame.pack() self.frame.setLocationRelativeTo(None) self.frame.setVisible(True)
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 registerExtenderCallbacks(self, callbacks): self.callbacks = callbacks self.helpers = callbacks.getHelpers() callbacks.setExtensionName("Session Authentication Tool") self.out = callbacks.getStdout() # definition of suite tab self.tab = JPanel(GridBagLayout()) self.tabledata = MappingTableModel(callbacks) self.table = JTable(self.tabledata) #self.table.getColumnModel().getColumn(0).setPreferredWidth(50); #self.table.getColumnModel().getColumn(1).setPreferredWidth(100); self.tablecont = JScrollPane(self.table) c = GridBagConstraints() c.fill = GridBagConstraints.HORIZONTAL c.anchor = GridBagConstraints.FIRST_LINE_START c.gridx = 0 c.gridy = 0 c.gridheight = 6 c.weightx = 0.3 c.weighty = 0.5 self.tab.add(self.tablecont, c) c = GridBagConstraints() c.weightx = 0.1 c.anchor = GridBagConstraints.FIRST_LINE_START c.gridx = 1 c.gridy = 0 label_id = JLabel("Identifier:") self.tab.add(label_id, c) self.input_id = JTextField(20) self.input_id.setToolTipText( "Enter the identifier which is used by the application to identifiy a particular test user account, e.g. a numerical user id or a user name." ) c.gridy = 1 self.tab.add(self.input_id, c) c.gridy = 2 label_content = JLabel("Content:") self.tab.add(label_content, c) self.input_content = JTextField(20, actionPerformed=self.btn_add_id) self.input_content.setToolTipText( "Enter some content which is displayed in responses of the application and shows that the current session belongs to a particular user, e.g. the full name of the user." ) c.gridy = 3 self.tab.add(self.input_content, c) self.btn_add = JButton("Add/Edit Identity", actionPerformed=self.btn_add_id) c.gridy = 4 self.tab.add(self.btn_add, c) self.btn_del = JButton("Delete Identity", actionPerformed=self.btn_del_id) c.gridy = 5 self.tab.add(self.btn_del, c) callbacks.customizeUiComponent(self.tab) callbacks.customizeUiComponent(self.table) callbacks.customizeUiComponent(self.tablecont) callbacks.customizeUiComponent(self.btn_add) callbacks.customizeUiComponent(self.btn_del) callbacks.customizeUiComponent(label_id) callbacks.customizeUiComponent(self.input_id) callbacks.addSuiteTab(self) callbacks.registerScannerCheck(self) callbacks.registerIntruderPayloadGeneratorFactory(self) callbacks.registerContextMenuFactory(self)
def __init__(self, isTemporal): self.isTemporal = isTemporal JPanel() self.setLayout(GridLayout(6,2)) self.add(JLabel('Total data')) self.add(JLabel('')) self.add(JLabel('# Pops' if not isTemporal else "# Gens")) self.totalPops = JLabel('0', SwingConstants.RIGHT) self.add(self.totalPops) self.add(JLabel('# Loci')) self.totalLoci = JLabel('0', SwingConstants.RIGHT) self.add(self.totalLoci) self.add(JLabel('Selected')) self.add(JLabel('')) self.add(JLabel('# Pops' if not isTemporal else "# Gens")) self.selPops = JLabel('0', SwingConstants.RIGHT) self.add(self.selPops) self.add(JLabel('# Loci')) self.selLoci = JLabel('0', SwingConstants.RIGHT) self.add(self.selLoci)
def registerExtenderCallbacks(self, callbacks): print("[*] Loading Jaeles beta v0.1") # keep a reference to our callbacks object self._callbacks = callbacks # obtain an extension helpers object self._helpers = callbacks.getHelpers() # set our extension name callbacks.setExtensionName("Jaeles") # main split pane self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT) # table of log entries # logTable = Table(self) # scrollPane = JScrollPane(logTable) # _toppane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT) _mainpane = JSplitPane(JSplitPane.VERTICAL_SPLIT) _mainpane.setResizeWeight(0.5) # _mainpane = JPanel() _toppane = JPanel() # top pane self.banner = JLabel( "Jaeles - The Swiss Army knife for automated Web Application Testing. " ) self.banner.setBounds(50, 30, 200, 400) self.banner2 = JLabel( "Official Documentation: https://jaeles-project.github.io/") self.banner2.setBounds(100, 50, 200, 400) _toppane.add(self.banner) _toppane.add(self.banner2) # _botpane = JPanel() _botpane = JSplitPane(JSplitPane.VERTICAL_SPLIT) # bot pane self.HostLabel = JLabel("Jaeles Endpoint: ") self.HostLabel.setBounds(100, 150, 200, 400) self.Jaeles_endpoint = 'http://127.0.0.1:5000/api/parse' self.jwt = 'Jaeles token_here' # just prevent plugin error when you doesn't have server running try: self.initial() jwt, endpoint = self.get_config() if endpoint: self.Jaeles_endpoint = endpoint if jwt: self.jwt = jwt except: pass endpoint_pane = JPanel() # end point to submit request self.EndpointText = JTextArea(self.Jaeles_endpoint, 3, 100) self.jwtLabel = JLabel("Jaeles JWT token: ") self.jwtLabel.setBounds(100, 300, 250, 450) self.jwtText = JTextArea(self.jwt, 3, 100, lineWrap=True) buttons = JPanel() self.buttonLabel = JLabel("Actions: ") self.buttonLabel.setBounds(150, 200, 200, 400) self._saveButton = JButton("Save", actionPerformed=self.saveToken) self._loadButton = JButton("Test Connection", actionPerformed=self.butClick) self._reloadButton = JButton("Reload", actionPerformed=self.butClick) oob_control = JPanel() self.oobLabel = JLabel("OOB: ") self.oobLabel.setBounds(150, 200, 200, 400) self._saveoob = JButton("Save OOB", actionPerformed=self.saveToken) self._pollingBox = JCheckBox("Polling") self._pollingBox.setBounds(290, 25, 300, 30) oob_control.add(self.oobLabel) oob_control.add(self._saveoob) oob_control.add(self._pollingBox) # _botpane.add(self.banner) # endpoint_pane.add(self.blankLabel) endpoint_pane.add(self.HostLabel) endpoint_pane.add(self.EndpointText) endpoint_pane.add(self.jwtLabel) endpoint_pane.add(self.jwtText) buttons.add(self.buttonLabel) buttons.add(self._saveButton) buttons.add(self._loadButton) buttons.add(self._reloadButton) _botpane.setLeftComponent(oob_control) _botpane.setLeftComponent(endpoint_pane) _botpane.setRightComponent(buttons) _botpane.setResizeWeight(0.7) # set _mainpane.setLeftComponent(_toppane) _mainpane.setRightComponent(_botpane) self._splitpane.setLeftComponent(_mainpane) ########### # tabs with request/response viewers tabs = JTabbedPane() self.log_area = JTextArea("", 5, 30) # self._requestViewer = callbacks.createMessageEditor(self, False) tabs.addTab("Log", self.log_area) # tabs.addTab("Config", self._requestViewer.getComponent()) self._splitpane.setRightComponent(tabs) self._splitpane.setResizeWeight(0.5) callbacks.customizeUiComponent(self._splitpane) callbacks.customizeUiComponent(tabs) callbacks.registerContextMenuFactory(self) # add the custom tab to Burp's UI callbacks.addSuiteTab(self) # register ourselves as an HTTP listener # callbacks.registerHttpListener(self) self.print_log("Jaeles Loaded ...") return
from javax.swing import JLabel from javax.swing import JFrame from javax.swing import JTable from javax.swing import JScrollPane from javax.swing import ListSelectionModel from javax.swing.table import DefaultTableCellRenderer from javax.swing.table import DefaultTableModel #------------------------------------------------------------------------------- # Define some global font related variables #------------------------------------------------------------------------------- plainFont = Font('Dialog', Font.PLAIN, 12) boldFont = Font('Dialog', Font.BOLD, 12) fmPlain = JLabel().getFontMetrics(plainFont) fmBold = JLabel().getFontMetrics(boldFont) #------------------------------------------------------------------------------- # Name: reportTableModel # Role: Define table data characteristics #------------------------------------------------------------------------------- class reportTableModel(DefaultTableModel): #--------------------------------------------------------------------------- # Name: __init__() # Role: Class constructor # Note: Save the initial data for easy highlight removal #--------------------------------------------------------------------------- def __init__(self, data, headings):
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout(self.gbPanel0) self.LabelA = JLabel("S3 Bucket:") self.LabelA.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.LabelA, self.gbcPanel0) self.panel0.add(self.LabelA) self.Bucket_TF = JTextField(20) self.Bucket_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Bucket_TF, self.gbcPanel0) self.panel0.add(self.Bucket_TF) self.Blank_1 = JLabel(" ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 4 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_1, self.gbcPanel0) self.panel0.add(self.Blank_1) self.LabelB = JLabel("AWS Access Key:") self.LabelB.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.LabelB, self.gbcPanel0) self.panel0.add(self.LabelB) self.Access_Key_TF = JTextField(20) self.Access_Key_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Access_Key_TF, self.gbcPanel0) self.panel0.add(self.Access_Key_TF) self.Blank_2 = JLabel(" ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 8 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_2, self.gbcPanel0) self.panel0.add(self.Blank_2) self.LabelC = JLabel("AWS Secret Key:") self.LabelC.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.LabelC, self.gbcPanel0) self.panel0.add(self.LabelC) self.Secret_Key_TF = JTextField(20) self.Secret_Key_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Secret_Key_TF, self.gbcPanel0) self.panel0.add(self.Secret_Key_TF) self.Blank_3 = JLabel(" ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 12 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_3, self.gbcPanel0) self.panel0.add(self.Blank_3) self.LabelD = JLabel("AWS Region:") self.LabelD.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.LabelD, self.gbcPanel0) self.panel0.add(self.LabelD) self.Region_TF = JTextField(20) self.Region_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Region_TF, self.gbcPanel0) self.panel0.add(self.Region_TF) self.Blank_4 = JLabel(" ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 16 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Blank_4, self.gbcPanel0) self.panel0.add(self.Blank_4) self.Save_Settings_BTN = JButton("Save Settings", actionPerformed=self.SaveSettings) self.Save_Settings_BTN.setEnabled(True) self.rbgPanel0.add(self.Save_Settings_BTN) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Save_Settings_BTN, self.gbcPanel0) self.panel0.add(self.Save_Settings_BTN) self.Label_1 = JLabel("Error Message:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 18 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Label_1, self.gbcPanel0) self.panel0.add(self.Label_1) self.Error_Message = JLabel("") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints(self.Error_Message, self.gbcPanel0) self.panel0.add(self.Error_Message) self.add(self.panel0)
def addStudent(courseName, courseFee, v): global tfStudentName global tfStudentPhone global tfStudentEmail global taStudentAddress global tfCourseName global tfCourseFee global cbStudentAssignTeacher global frame frame = JFrame("Add Student ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 600) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("ADD STUDENT") heading.setBounds(200, 30, 150, 40) lbCourseName = JLabel(" Course name") lbCourseFee = JLabel(" Course Fee") lbStudentName = JLabel("Student name ") lbStudentPhone = JLabel("Phone") lbStudentEmail = JLabel("Email Id") lbStudentAddress = JLabel("Address") lbStudentAssignTeacher = JLabel("Student Assign teacher ") tfCourseName = JTextField(courseName) tfCourseFee = JTextField(str(courseFee)) tfStudentName = JTextField() tfStudentPhone = JTextField() tfStudentEmail = JTextField() taStudentAddress = JTextArea() cbStudentAssignTeacher = JComboBox(v) tfCourseName.setEditable(False) tfCourseFee.setEditable(False) lbCourseName.setBounds(70, 100, 130, 30) lbCourseFee.setBounds(70, 150, 130, 30) lbStudentName.setBounds(70, 200, 130, 30) lbStudentPhone.setBounds(70, 250, 130, 30) lbStudentEmail.setBounds(70, 300, 130, 30) lbStudentAddress.setBounds(70, 350, 130, 80) lbStudentAssignTeacher.setBounds(70, 450, 130, 30) tfCourseName.setBounds(220, 100, 130, 30) tfCourseFee.setBounds(220, 150, 130, 30) tfStudentName.setBounds(220, 200, 130, 30) tfStudentPhone.setBounds(220, 250, 130, 30) tfStudentEmail.setBounds(220, 300, 130, 30) taStudentAddress.setBounds(220, 350, 130, 80) cbStudentAssignTeacher.setBounds(220, 450, 130, 30) btnEnter = JButton("ADD", actionPerformed=clickAddStudent) btnEnter.setBounds(350, 510, 100, 40) btnCancel = JButton("Cancel", actionPerformed=clickbtnCancelForm) btnCancel.setBounds(50, 510, 100, 40) panel.add(heading) panel.add(lbCourseName) panel.add(lbCourseFee) panel.add(lbStudentName) panel.add(lbStudentPhone) panel.add(lbStudentEmail) panel.add(lbStudentAddress) panel.add(lbStudentAssignTeacher) panel.add(tfCourseName) panel.add(tfCourseFee) panel.add(tfStudentName) panel.add(tfStudentPhone) panel.add(tfStudentEmail) panel.add(taStudentAddress) panel.add(cbStudentAssignTeacher) panel.add(btnEnter) panel.add(btnCancel) frame.add(panel)
update_progress) # To update the progress bar task.execute() rm.runCommand(imp, "Show All without labels") f3_txt1.setText("0") def update_progress(event): # Invoked when task's progress property changes. if event.propertyName == "progress": progressBar.value = event.newValue # Browse original image lbl1 = JLabel("Path to original image") lbl1.setBounds(40, 20, 200, 20) f2_btn_original = JButton("Browse", actionPerformed=f2_clic_browse1) f2_btn_original.setBounds(170, 20, 100, 20) f2_txt1 = JTextField(10) f2_txt1.setBounds(280, 20, 120, 20) # Browse label image lbl2 = JLabel("Path to label image") lbl2.setBounds(40, 50, 200, 20) f2_btn_label = JButton("Browse", actionPerformed=f2_clic_browse2) f2_btn_label.setBounds(170, 50, 100, 20) f2_txt2 = JTextField(10) f2_txt2.setBounds(280, 50, 120, 20) # Button Previous