def run(self): frame = JFrame('SecConfigReport_09', size=(500, 300), locationRelativeTo=None, componentResized=self.frameResized, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) data = [] text = AdminTask.generateSecConfigReport() #----------------------------------------------------------------------- # The RegExp was added to replace multiple blanks with a single one #----------------------------------------------------------------------- for line in text.splitlines()[2:]: data.append([ re.sub(' +', ' ', info.strip()) for info in line[:-2].split(';') ]) self.table = table = JTable( reportTableModel( data, ';;;'.split(';'), ), selectionMode=ListSelectionModel.SINGLE_SELECTION) table.setDefaultRenderer(String, reportRenderer()) self.setColumnWidths(table) scroller = JScrollPane(table) scroller.getViewport().addChangeListener(rowFinder(table)) frame.add(scroller) frame.pack() frame.setVisible(1) frame.setMinimumSize(frame.getSize())
def __init__(self): # Panel for Measurements self.setLayout(BorderLayout()) # PAGE_START ''' show group/dataset names in the list (component/variable) names ''' self.cbfilemeasOut = JComboBox([]) bfilemeasOut= JButton('Measurements', actionPerformed= self.loadMeasOut) p3= JPanel() p3.setLayout(GridLayout(1,2)) p3.add(self.cbfilemeasOut) p3.add(bfilemeasOut) self.add(p3, BorderLayout.PAGE_START) # LINE_START root = DefaultMutableTreeNode('VarMeasurements') self.tree = JTree(root) scrollPane = JScrollPane() # add a scrollbar to the viewport scrollPane.setPreferredSize(Dimension(230,320)) scrollPane.getViewport().setView((self.tree)) p4 = JPanel() p4.add(scrollPane) self.add(p4, BorderLayout.LINE_START) # CENTER ''' represent a signal with matplot lib in textarea places ''' graficMeas= JTextArea() self.add(graficMeas, BorderLayout.CENTER)
def make_tree(self): print('make_tree') root = DefaultMutableTreeNode(self.exper.name) sb = br.SimilarityBuilder() for hseg in self.exper.hsegs(): all_file_dict = hseg.file_dict() all_file_dict.update(hseg.cell_file_dict()) all_file_dict.update(hseg.bin_file_dict()) sb.add_group(hseg.name, all_file_dict) simprofile, comparisons = sb.simprofile_comparison() sim_str = '' for val in simprofile: sim_str += str(val) + '\n' tp = JTextArea(sim_str) stp = JScrollPane() stp.getViewport().setView(tp) # # stp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); # stp.setPreferredSize(Dimension(250, 250)); # tp.setPreferredSize(Dimension(250, 250)) stp_panel = JPanel(BorderLayout()) stp_panel.add(tp, BorderLayout.CENTER) # self.add(stp_panel, 'grow') for hseg in self.exper.hsegs(): hseg_node = DefaultMutableTreeNode(hseg.name) root.add(hseg_node) if len(comparisons[hseg.name]) > 0: for definer, file_names in comparisons[hseg.name].items(): for file_name in file_names: node_str = definer + ': ' + file_name hseg_node.add(DefaultMutableTreeNode(node_str)) # for file_suf in hseg.file_dict() : # hseg_node.add(DefaultMutableTreeNode(file_suf)) self.tree = JTree(root) scrollPane = JScrollPane() scrollPane.getViewport().setView((self.tree)) # scrollPan # scrollPane.setPreferredSize(Dimension(300,250)) tree_panel = JPanel(BorderLayout()) tree_panel.add(scrollPane, BorderLayout.CENTER) combo_panel = JPanel(GridLayout(0, 2, 10, 10)) # combo_panel.setLayout(BoxLayout(combo_panel, BoxLayout.X_AXIS)) combo_panel.add(stp_panel) #, BorderLayout.LINE_START) combo_panel.add(tree_panel) #, BorderLayout.LINE_END) self.panel.add(combo_panel) # self.add(scrollPane, 'grow') self.revalidate()
def make_chf_panel(self): """ chf --> common hseg files """ chf_panel = JPanel() chf_panel.setLayout(MigLayout('insets 0')) chf_files_label = JLabel('Hemisegment cells') chf_files_text = JTextArea( BobGui.archetype_to_str( self.exper.hseg_cell_files_cab().archetype)) chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(chf_files_text, 'grow, wrap') chf_files_label = JLabel('Hemisegment binary image files') chf_files_text = JTextArea( BobGui.archetype_to_str(self.exper.hseg_bin_files_cab().archetype)) chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(chf_files_text, 'grow, wrap') chf_files_label = JLabel('Intensity Image Files') # chf_files_text = JTextArea(BobGui.archetype_to_str(self.exper.hseg_intens_im_files_cab().archetype)) # print(self.exper.hseg_intens_im_files_cab().archetype) # chf_panel.add(chf_files_label, 'growx, wrap') # chf_panel.add(chf_files_text, 'grow, wrap') self.intens_im_boxes = [] intens_im_panel = JPanel() intens_im_panel.setLayout(MigLayout('insets 0')) for poss_im_file in self.exper.hseg_intens_im_files_cab().archetype: self.intens_im_boxes.append(JCheckBox(poss_im_file)) intens_im_panel.add(self.intens_im_boxes[-1], 'wrap') chf_panel.add(chf_files_label, 'growx, wrap') chf_panel.add(intens_im_panel, 'grow, wrap') mdf_create_button = JButton( 'Create meta_data file from default outline') # mdf_create_button = JButton('<html>Create meta_data file<br>from default outline</html>') mdf_create_button.addActionListener( ActionListenerFactory(self, self.mdf_create_al)) mdf_open_button = JButton('Open existing meta_data file') mdf_open_button.addActionListener( ActionListenerFactory(self, self.mdf_open_al)) # meta_data_file_buttton = JButton('Open/Create meta_data file') # meta_data_file_buttton.addActionListener(ActionListenerFactory(self, self.meta_data_al)) # chf_panel.add(meta_data_file_buttton) chf_panel.add(mdf_create_button, 'wrap') chf_panel.add(mdf_open_button, 'wrap') chf_scroll_pane = JScrollPane() chf_scroll_pane.getViewport().setView(chf_panel) return chf_scroll_pane
class IMDbUISettingsPanel(IngestModuleIngestJobSettingsPanel): def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() self.area.setText("message, call, user, chat") self.local_settings.setSetting('tableList', self.area.getText()) def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setSetting('Flag', 'true') self.local_settings.setSetting('tableList', self.area.getText()) else: self.local_settings.setSetting('Flag', 'false') def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Искать таблицы?".decode('UTF-8'), actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel( "Введите названия интересуемых таблиц".decode('UTF-8')) self.label2 = JLabel( "через запятую, после чего установите флажок".decode('UTF-8')) self.label3 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.panel1.add(self.label3) self.add(self.panel1) self.local_settings.setSetting('Flag', 'false') self.area = JTextArea(5, 25) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) self.add(self.pane) def customizeComponents(self): self.checkbox.setSelected( self.local_settings.getSetting('Flag') == 'true') self.area.setText(self.local_settings.getSetting('tableList')) def getSettings(self): return self.local_settings
def friendsList(self, username): self.window = swing.JFrame(username) self.window.layout = awt.BorderLayout() statusPanel = swing.JPanel() statusPanel.layout = awt.GridLayout(4,1) # Set status placeholder UI statusPanel.border = swing.BorderFactory.createTitledBorder("Status") buttonGroup = swing.ButtonGroup() radioButton = swing.JRadioButton("Away", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) radioButton = swing.JRadioButton("Here", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) #Wizard of Oz incoming chat request radioButton = swing.JButton("Page Boss", actionPerformed=self.callBoss) buttonGroup.add(radioButton) statusPanel.add(radioButton) statusPanel.add(self.status) #statusPanel.add(swing.JButton("Update Status", actionPerformed=self.updateStatus)) #Buddy list panel = swing.JPanel() panel.layout = awt.BorderLayout() panel.border = swing.BorderFactory.createTitledBorder("Friends Online") ##TODO: fix threading so that friends load before the window print self.friendsData self.friendsData.append('guest') print '2' self.list = swing.JList(self.friendsData) panel.add("Center", swing.JScrollPane(self.list)) launchChatButton = swing.JButton("Launch chat?", actionPerformed=self.launchChatOut) panel.add("South", launchChatButton) self.window.windowClosing = self.goodbye pane = JScrollPane() pane.getViewport().add(self.list) panel.add(pane) self.window.add("North", statusPanel) self.window.add("South", panel) self.window.pack() self.window.visible = True return self.window
def friendsList(self, username): self.window = swing.JFrame(username) self.window.layout = awt.BorderLayout() statusPanel = swing.JPanel() statusPanel.layout = awt.GridLayout(4, 1) # Set status placeholder UI statusPanel.border = swing.BorderFactory.createTitledBorder("Status") buttonGroup = swing.ButtonGroup() radioButton = swing.JRadioButton("Away", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) radioButton = swing.JRadioButton("Here", actionPerformed=self.radioCallback) buttonGroup.add(radioButton) statusPanel.add(radioButton) #Wizard of Oz incoming chat request radioButton = swing.JButton("Page Boss", actionPerformed=self.callBoss) buttonGroup.add(radioButton) statusPanel.add(radioButton) statusPanel.add(self.status) #statusPanel.add(swing.JButton("Update Status", actionPerformed=self.updateStatus)) #Buddy list panel = swing.JPanel() panel.layout = awt.BorderLayout() panel.border = swing.BorderFactory.createTitledBorder("Friends Online") ##TODO: fix threading so that friends load before the window print self.friendsData self.friendsData.append('guest') print '2' self.list = swing.JList(self.friendsData) panel.add("Center", swing.JScrollPane(self.list)) launchChatButton = swing.JButton("Launch chat?", actionPerformed=self.launchChatOut) panel.add("South", launchChatButton) self.window.windowClosing = self.goodbye pane = JScrollPane() pane.getViewport().add(self.list) panel.add(pane) self.window.add("North", statusPanel) self.window.add("South", panel) self.window.pack() self.window.visible = True return self.window
class PerceptualHashSettingsPanel(IngestModuleIngestJobSettingsPanel): # TODO: Update this for your UI def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # TODO: Update this for your UI def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setSetting('Flag', 'true') self.local_settings.setSetting('pHash', self.area.getText()) else: self.local_settings.setSetting('Flag', 'false') # TODO: Update this for your UI def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Check to activate/deactivate pHashToCheck", actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel("Input your phash value for checking: ") self.label2 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.add(self.panel1) self.area = JTextArea(5, 25) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) self.add(self.pane) # TODO: Update this for your UI def customizeComponents(self): self.checkbox.setSelected( self.local_settings.getSetting('Flag') == 'true') self.area.setText(self.local_settings.getSetting('pHash')) # Return the settings used def getSettings(self): return self.local_settings
def make_tree(self): root = DefaultMutableTreeNode(self.exper.name) for hseg in self.exper.hsegs(): hseg_node = DefaultMutableTreeNode(hseg.name) root.add(hseg_node) for file_suf in hseg.file_dict(): hseg_node.add(DefaultMutableTreeNode(file_suf)) self.tree = JTree(root) scrollPane = JScrollPane() scrollPane.getViewport().setView((self.tree)) # scrollPane.setPreferredSize(Dimension(300,250)) tree_panel = JPanel() tree_panel.add(scrollPane) box_layout = BoxLayout(self.panel, BoxLayout.Y_AXIS) self.panel.setLayout(box_layout) self.panel.add(tree_panel) self.revalidate()
def initUI(self): self.panel = JPanel() self.panel.setLayout(GridLayout(5, 2)) labelURL = JLabel('Introduzca las URL que desee analizar:') chkboxSync = JCheckBox('Sincronizacion de cookies') textfieldURL = JTextField(15) chkboxResp = JCheckBox('Restauracion de cookies') labelFichero = JLabel( 'O si lo prefiere, seleccione un fichero .txt que las contenga:') label6 = JLabel(' ') self.area = JTextArea() pane = JScrollPane() pane.getViewport().add(self.area) buttonFichero = JButton("Seleccionar fichero", actionPerformed=self.open) buttonEjecutar = JButton("Ejecutar", actionPerformed=self.ejecutar) label10 = JLabel(' ') self.panel.add(labelURL) self.panel.add(chkboxSync) self.panel.add(textfieldURL) self.panel.add(chkboxResp) self.panel.add(labelFichero) self.panel.add(label6) self.panel.add(pane) self.panel.add(buttonFichero) self.panel.add(buttonEjecutar) self.panel.add(label10) self.add(self.panel) self.setTitle( "HERRAMIENTA PARA LA DETECCION DE TECNICAS DE SEGUIMIENTO DE USUARIOS EN LA WEB" ) self.setSize(950, 450) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
def initUI(self): global outputTextField self.panel = JPanel() self.panel.setLayout(BorderLayout()) toolbar = JToolBar() openb = JButton("Choose input file", actionPerformed=self.onClick) outputLabel = JLabel(" Enter output file name: ") outputTextField = JTextField("hl7OutputReport.txt", 5) print outputTextField.getText() toolbar.add(openb) toolbar.add(outputLabel) toolbar.add(outputTextField) self.area = JTextArea() self.area.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.area.setText("Select your HL7 ORU messages text file to be converted to tab-delimited flat \nfile with select HL7 fields.\n") self.area.append("You can enter the path + file name for your output file or it will default to the current \nfile name in the text field above in your current working directory.") pane = JScrollPane() pane.getViewport().add(self.area) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.panel.add(pane) self.add(self.panel) self.add(toolbar, BorderLayout.NORTH) self.setTitle("HL7 ORU Results Reporter") self.setSize(600, 300) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True) return outputTextField.getText()
def __init__(self, dir=None, label=None): if not dir: dir = os.getcwd() if not label: label = "FileTree" dir = File(dir) self._dir = dir self.this = JPanel() self.this.setLayout(BorderLayout()) # Add a label self.this.add(BorderLayout.PAGE_START, JLabel(label)) # Make a tree list with all the nodes, and make it a JTree tree = JTree(self._add_nodes(None, dir)) tree.setRootVisible(False) self._tree = tree # Lastly, put the JTree into a JScrollPane. scrollpane = JScrollPane() scrollpane.getViewport().add(tree) self.this.add(BorderLayout.CENTER, scrollpane)
def initComponents(self): self.panel = JPanel() self.panel.setLayout(BorderLayout()) toolbar = JToolBar() openb = JButton("Select", actionPerformed=self.onClick) toolbar.add(openb) self.area = JTextArea() self.area.setBorder(BorderFactory.createEmptyBorder(10, 100, 10, 100)) pane = JScrollPane() pane.getViewport().add(self.area) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.panel.add(pane) self.add(self.panel) self.add(toolbar)
def initComponents(self): dataModel = DefaultTableModel(self.regTableData, self.regCols) self.regTable = JTable(dataModel) scrollPaneReg = JScrollPane() scrollPaneReg.getViewport().setView((self.regTable)) self.regTab.add(scrollPaneReg) # self.logTabbedPane.addTab('Registred',self.regTab) self.logTabbedPane.insertTab("Registred", None, self.regTab, None, 0) dataModel = DefaultTableModel(self.parkTableData, self.parkCols) self.parkTable = JTable(dataModel) scrollPanePark = JScrollPane() scrollPanePark.getViewport().setView((self.parkTable)) self.parkedTab.add(scrollPanePark) # self.logTabbedPane.addTab('Parked',self.parkedTab) self.logTabbedPane.insertTab("Parked", None, self.parkedTab, None, 1) dataModel = DefaultTableModel(self.bypassTableData, self.bypassCol) self.bypassTable = JTable(dataModel) scrollPaneBypass = JScrollPane() scrollPaneBypass.getViewport().setView((self.bypassTable)) self.bypassTab.add(scrollPaneBypass) # self.logTabbedPane.addTab('Bypassed',self.bypassTab) self.logTabbedPane.insertTab("Bypassed", None, self.bypassTab, None, 2) self.add(self.logTabbedPane, BorderLayout.CENTER) innerBorder = BorderFactory.createTitledBorder('View Logs ') outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5) self.setBorder( BorderFactory.createCompoundBorder(outerBorder, innerBorder))
def __init__(self): frame = JFrame("Jython JTable Example") frame.setSize(500, 250) frame.setLayout(BorderLayout()) self.tableData = [ ['Mouse 1', eventNames[0], eventScriptType[0]], ['Mouse 2', eventNames[1], eventScriptType[1]], ['Mouse 3', eventNames[2], eventScriptType[2]], ['Mouse 1 Shift', eventNames[3], eventScriptType[3]], ['Mouse 2 Shift', eventNames[4], eventScriptType[4]], ['Mouse 3 Shift', eventNames[5], eventScriptType[5]], ['Mouse 1 Control', eventNames[6], eventScriptType[6]], ['Mouse 2 Control', eventNames[7], eventScriptType[7]], ['Mouse 3 Control', eventNames[8], eventScriptType[8]], ] colNames = ('Script/Event', 'Name', 'Type') dataModel = DefaultTableModel(self.tableData, colNames) self.table = JTable(dataModel) scrollPane = JScrollPane() scrollPane.setPreferredSize(Dimension(400, 200)) scrollPane.getViewport().setView((self.table)) panel = JPanel() panel.add(scrollPane) frame.add(panel, BorderLayout.CENTER) self.label = JLabel('Hello from Jython') frame.add(self.label, BorderLayout.NORTH) button = JButton('Save Settings', actionPerformed=self.setText) frame.add(button, BorderLayout.SOUTH) exitButton = JButton('Exit', actionPerformed=self.myExit) frame.add(exitButton, BorderLayout.EAST) frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) frame.setVisible(True)
def __init__(self): frame = JFrame("Jython JTable Example") frame.setSize(500, 250) frame.setLayout(BorderLayout()) self.tableData = [ ['Mouse 1', eventNames[0], eventScriptType[0]], ['Mouse 2', eventNames[1] , eventScriptType[1]], ['Mouse 3', eventNames[2], eventScriptType[2]], ['Mouse 1 Shift', eventNames[3], eventScriptType[3]], ['Mouse 2 Shift',eventNames[4], eventScriptType[4]], ['Mouse 3 Shift',eventNames[5], eventScriptType[5]], ['Mouse 1 Control',eventNames[6], eventScriptType[6]], ['Mouse 2 Control',eventNames[7], eventScriptType[7]], ['Mouse 3 Control',eventNames[8], eventScriptType[8]], ] colNames = ('Script/Event','Name','Type') dataModel = DefaultTableModel(self.tableData, colNames) self.table = JTable(dataModel) scrollPane = JScrollPane() scrollPane.setPreferredSize(Dimension(400,200)) scrollPane.getViewport().setView((self.table)) panel = JPanel() panel.add(scrollPane) frame.add(panel, BorderLayout.CENTER) self.label = JLabel('Hello from Jython') frame.add(self.label, BorderLayout.NORTH) button = JButton('Save Settings',actionPerformed=self.setText) frame.add(button, BorderLayout.SOUTH) exitButton = JButton('Exit',actionPerformed=self.myExit) frame.add(exitButton, BorderLayout.EAST) frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE) frame.setVisible(True)
def registerExtenderCallbacks(self, callbacks): print '------------------------------Welcome to the Burp Suite Wordlist Creator----------------------------------' print 'Right click HTML or JSON responses in the Target tab to gather all unique words gathered from the response' # print '##########################################################################################################' self._callbacks = callbacks self._helpers = callbacks.getHelpers() self.context = None self.hosts = set() #Define extension properties callbacks.setExtensionName("Custom Wordlist") callbacks.registerContextMenuFactory(self) #wordlist file self.wordlist = [] #Setup space for save dialogue to sit in. self.panel = JPanel() self.panel.setLayout(BorderLayout()) self.area = JTextArea() self.area.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) pane = JScrollPane() pane.getViewport().add(self.area) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) self.panel.add(pane) self.add(self.panel) self.setTitle("File chooser") self.setSize(300, 250) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) #this is just providing a place where the save box can sit in, no need for it to be visible on start self.setVisible(False) return
def make_hseg_tree_panel(self): root = DefaultMutableTreeNode(self.exper.name) for hseg in self.exper.hsegs(): hseg_node = DefaultMutableTreeNode(hseg.name) root.add(hseg_node) hseg_at_deviations = self.exper.hseg_all_files_cab( ).archetype_deviations if len(hseg_at_deviations[hseg.name]) > 0: for definer, file_names in hseg_at_deviations[ hseg.name].items(): for file_name in file_names: node_str = definer + ': ' + file_name temp = DefaultMutableTreeNode(node_str) hseg_node.add(temp) hseg_tree = JTree(root) hseg_tree.setCellRenderer(BobPyTreeCellRenderer()) hseg_scroll_pane = JScrollPane() hseg_scroll_pane.getViewport().setView((hseg_tree)) return hseg_scroll_pane
def make_hseg_tree_panel(self): root = DefaultMutableTreeNode(self.exper.name) for hseg in self.exper.hsegs(): hseg_node = DefaultMutableTreeNode(hseg.name) root.add(hseg_node) hseg_at_deviations = self.exper.hseg_files_cab( ).archetype_deviations if len(hseg_at_deviations[hseg.name]) > 0: for definer, file_names in hseg_at_deviations[ hseg.name].items(): for file_name in file_names: node_str = definer + ': ' + file_name temp = DefaultMutableTreeNode(node_str) hseg_node.add(temp) hseg_tree = JTree(root) hseg_tree.setCellRenderer(BobPyTreeCellRenderer()) hseg_scroll_pane = JScrollPane() hseg_scroll_pane.getViewport().setView((hseg_tree)) hseg_panel = JPanel(MigLayout('insets 0')) hseg_panel.add(hseg_scroll_pane, 'grow, span, push, wrap') run_button = JButton('Run') run_button.addActionListener(ActionListenerFactory(self, self.run_al)) rerun_button = JButton('Rerun') rerun_button.addActionListener( ActionListenerFactory(self, self.rerun_al)) hseg_panel.add(run_button) hseg_panel.add(rerun_button) return hseg_panel
class BurpExtender(IBurpExtender, IContextMenuFactory, ITab, ComponentListener, ActionListener, MouseAdapter): # contains the messages to show in the messages table _table_data = [] # contains the messages to translate _messages = [] # used to keep track when to refresh the table _reload_table = False _sql_file = None def registerExtenderCallbacks(self, callbacks): self._panel = JPanel() self._panel.setLayout(BorderLayout()) #self._panel.setSize(400,400) # sourrounding try\except because Burp is not giving enough info try: # creating all the UI elements # create the split pane self._split_pane_horizontal = JSplitPane( JSplitPane.HORIZONTAL_SPLIT) self._split_panel_vertical = JSplitPane(JSplitPane.VERTICAL_SPLIT) # create panels self._panel_top = JPanel() self._panel_top.setLayout(BorderLayout()) self._panel_bottom = JPanel() self._panel_bottom.setLayout(BorderLayout()) self._panel_right = JPanel() self._panel_right.setLayout(BorderLayout()) self._panel_request = JPanel() self._panel_request.setLayout(BorderLayout()) self._panel_response = JPanel() self._panel_response.setLayout(BorderLayout()) # create the tabbed pane used to show request\response self._tabbed_pane = JTabbedPane(JTabbedPane.TOP) # create the tabbed pane used to show aslan++\concretization file self._tabbed_pane_editor = JTabbedPane(JTabbedPane.TOP) # create the bottom command for selecting the SQL file and # generating the model self._button_generate = JButton( 'Generate!', actionPerformed=self._generate_model) self._button_save = JButton('Save', actionPerformed=self._save_model) self._button_select_sql = JButton( 'Select SQL', actionPerformed=self._select_sql_file) self._text_field_sql_file = JTextField(20) self._panel_bottom_commands = JPanel() layout = GroupLayout(self._panel_bottom_commands) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) seq_layout = layout.createSequentialGroup() seq_layout.addComponent(self._text_field_sql_file) seq_layout.addComponent(self._button_select_sql) seq_layout.addComponent(self._button_generate) seq_layout.addComponent(self._button_save) layout.setHorizontalGroup(seq_layout) # create the message editors that will be used to show request and response self._message_editor_request = callbacks.createMessageEditor( None, True) self._message_editor_response = callbacks.createMessageEditor( None, True) # create the table that will be used to show the messages selected for # the translation self._columns_names = ('Host', 'Method', 'URL') dataModel = NonEditableModel(self._table_data, self._columns_names) self._table = JTable(dataModel) self._scrollPane = JScrollPane() self._scrollPane.getViewport().setView((self._table)) popmenu = JPopupMenu() delete_item = JMenuItem("Delete") delete_item.addActionListener(self) popmenu.add(delete_item) self._table.setComponentPopupMenu(popmenu) self._table.addMouseListener(self) # add all the elements self._panel_request.add( self._message_editor_request.getComponent()) self._panel_response.add( self._message_editor_response.getComponent()) self._tabbed_pane.addTab("Request", self._panel_request) self._tabbed_pane.addTab("Response", self._panel_response) self._panel_top.add(self._scrollPane, BorderLayout.CENTER) self._panel_bottom.add(self._tabbed_pane, BorderLayout.CENTER) scroll = JScrollPane(self._panel_bottom) self._panel_right.add(self._tabbed_pane_editor, BorderLayout.CENTER) self._panel_right.add(self._panel_bottom_commands, BorderLayout.PAGE_END) self._split_panel_vertical.setTopComponent(self._panel_top) self._split_panel_vertical.setBottomComponent(scroll) self._split_pane_horizontal.setLeftComponent( self._split_panel_vertical) self._split_pane_horizontal.setRightComponent(self._panel_right) self._panel.addComponentListener(self) self._panel.add(self._split_pane_horizontal) self._callbacks = callbacks callbacks.setExtensionName("WAFEx") callbacks.addSuiteTab(self) callbacks.registerContextMenuFactory(self) except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print(exc_type, fname, exc_tb.tb_lineno) def getTabCaption(self): return "WAFEx" def getUiComponent(self): try: Platform.runLater(EditorTabUI(self)) return self._panel except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print(exc_type, fname, exc_tb.tb_lineno) def componentShown(self, e): self._split_pane_horizontal.setDividerLocation(0.25) # populate the table with the selected requests\response try: if self._reload_table: print("reload") self._table_data = [ ] # empty _table_data (not too cool but quick) for c in self._messages: msg = c[0] http_request = converter._byte_array_to_string( msg.getRequest()) request_parser = HttpParser() request_parser.execute(http_request, len(http_request)) host = msg.getHttpService().getHost() page = request_parser.get_url() method = request_parser.get_method() tmp = [host, method, page] self._table_data += [tmp] self._table.getModel().setDataVector(self._table_data, self._columns_names) self._reload_table = False except Exception as e: print(e) def componentHidden(self, e): return def componentMoved(self, e): return def componentResized(self, e): self._split_pane_horizontal.setDividerLocation(0.25) def createMenuItems(self, invocation): ret = [] try: if (invocation.getInvocationContext() == invocation.CONTEXT_TARGET_SITE_MAP_TABLE): menu = JMenuItem("Send to WAFEx") messages = invocation.getSelectedMessages() def listener(e): """ Generates a new WAFEx model. """ #self._generateWAFExModel(messages) self._addToGeneration(messages) menu.addActionListener(listener) ret.append(menu) except Exception as e: print(e) return ret def mouseClicked(self, e): """ Positions the Aslan++ editor to the selected request position. """ try: index = self._table.getSelectedRow() c = self._messages[index] print(len(c)) message = c[0] tag = c[1] self._message_editor_request.setMessage(message.getRequest(), True) self._message_editor_response.setMessage(message.getResponse(), False) if tag != None: document = self._jfxp_aslanpp._editor.getText() start, end = self._search_tag_position(tag, document) self._jfxp_aslanpp._editor.moveTo(start) self._jfxp_aslanpp._editor.selectRange(start, end) self._jfxp_aslanpp._editor.requestFollowCaret() self._jfxp_aslanpp._editor.requestFocus() except Exception as e: print(e) def actionPerformed(self, e): """ Performs the delete action. """ try: index = self._table.getSelectedRow() del self._table_data[index] del self._messages[index] self._table.getModel().setDataVector(self._table_data, self._columns_names) except Exception as e: print(e) def _search_tag_position(self, tag, text): """ Searches for a particular tag in a given text and return its position. """ pattern = self._search_pattern.format(tag) for m in re.finditer(pattern, text): return m.start(), m.end() def _save_model(self, e): """ Saves the current Aslan++ model and concretization file. """ try: chooseFile = JFileChooser() filter_ = FileNameExtensionFilter("txt files", ["txt"]) chooseFile.addChoosableFileFilter(filter_) ret = chooseFile.showDialog(self._panel, "Choose file") if ret == JFileChooser.APPROVE_OPTION: self._model_name = chooseFile.getSelectedFile().getPath() with open("{}.aslan++".format(self._model_name), "w") as f: skeleton = self._jfxp_aslanpp._editor.getText() skeleton = skeleton.replace("@filename", basename(self._model_name)) f.write(skeleton) print("model created") with open("{}.txt".format(self._model_name), "w") as f: f.write(self._jfxp_concretization._editor.getText()) except Exception as e: print(e) def _select_sql_file(self, e): """ Shows a JFileChooser dialog to select the SQL file to use for creating the model. """ try: chooseFile = JFileChooser() filter_ = FileNameExtensionFilter("txt files", ["txt"]) chooseFile.addChoosableFileFilter(filter_) ret = chooseFile.showDialog(self._panel, "Choose file") if ret == JFileChooser.APPROVE_OPTION: self._sql_file = chooseFile.getSelectedFile().getPath() else: self._sql_file = None self._text_field_sql_file.setText("" + self._sql_file) except Exception as e: print(e) def _addToGeneration(self, messages): for msg in messages: self._messages += [[msg, None]] self._reload_table = True def _generate_model(self, e): if len(self._messages) <= 0: frame = JFrame("Error") JOptionPane.showMessageDialog(frame, "No messages!", "Error", JOptionPane.ERROR_MESSAGE) return if self._sql_file == None: frame = JFrame("Error") replay = JOptionPane.showConfirmDialog( frame, "No SQL file selected!\nDo you want to continue?", "Info", JOptionPane.YES_NO_OPTION) if replay == JOptionPane.NO_OPTION: return # create a new AslanppModel model = AslanppModel() # save _sql_file model._sql_file = self._sql_file for c in self._messages: # from byte to char Request and Response # for some reason b can be a negative value causing a crash # so I put a check to ensure b is in the right range msg = c[0] if msg.getRequest() == None or msg.getResponse() == None: # do not convert empty messages continue http_request = "".join( chr(b) for b in msg.getRequest() if b >= 0 and b <= 256) http_response = "".join( chr(b) for b in msg.getResponse() if b >= 0 and b <= 256) protocol = msg.getHttpService().getProtocol() # save the tag number generate by _parseHttpRequestResponse in the _messages array c[1] = converter._parseHttpRequestResponse(model, http_request, http_response, protocol) # generate the ASLan++ code self._model, self._concrete = converter._generateWAFExModel(model) Platform.runLater( UpdateEditor(self._jfxp_aslanpp._editor, self._jfxp_concretization._editor, self._model, self._concrete))
def __init__(self): super(WorkHelper, self).__init__() self.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard() #self.initUI() #def initUI(self): #panel = JPanel() #self.getContentPane().add(panel) ############################################################# # Layout layout = GroupLayout(self.getContentPane()) self.getContentPane().setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) ############################################################# ############################################################# # Scroll Area Input + Output Larea1 = JLabel("InputArea:") Larea2 = JLabel("OutputArea:") Sarea1 = JScrollPane() Sarea2 = JScrollPane() self.area1 = JTextArea() self.area1.setToolTipText("Input Area") self.area1.setEditable(True) self.area1.setBorder(BorderFactory.createLineBorder(Color.gray)) Sarea1.setPreferredSize(Dimension(300,100)) Sarea1.getViewport().setView((self.area1)) self.area2 = JTextArea() self.area2.setToolTipText("Output Area") self.area2.setEditable(False) self.area2.setBorder(BorderFactory.createLineBorder(Color.gray)) Sarea2.setPreferredSize(Dimension(300,100)) Sarea2.getViewport().setView((self.area2)) ############################################################# ############################################################# # Buttons self.cCurly = JCheckBox("Curly"); self.cCurly.setToolTipText("When 'Checked' Curly Brackets will surround the Categories") self.cCurly.setSelected(1) self.cCtClipB = JCheckBox("Auto-Copy"); self.cCtClipB.setToolTipText("When 'Checked' after the Categories are created they will added to the clipboard") self.cCtClipB.setSelected(1) self.cSemiC = JCheckBox("SemiColumn"); self.cSemiC.setToolTipText("When 'Checked' after the Categories are created at the end will be a semicolomn") self.cSemiC.setSelected(1) bRemoveNBSP_L = JButton("Clean LText", actionPerformed=self.bRemoveNBSP_L) bRemoveNBSP_L.setToolTipText("Removes Spaces, Tabs from the start of every text line from the input Area") bRemoveNBSP_R = JButton("Clean RText", actionPerformed=self.bRemoveNBSP_R) bRemoveNBSP_R.setToolTipText("Removes Spaces, Tabs from the end of every text line from the input Area") bCopyToInput = JButton("Copy to Input", actionPerformed=self.bCopyToInput) bCopyToInput.setToolTipText("Copy the text from the Output Area to the Input Area for further Operations") bClear = JButton("Clear", actionPerformed=self.bClear) bClear.setToolTipText("Clears the text form both Input and Output text Areas") self.iStart = JTextField(maximumSize=Dimension(40,25)) self.iStart.setToolTipText("The Start Index for the Making of the Categories") self.RThis = JTextField() self.RThis = JTextField(maximumSize=Dimension(120,25)) self.RThis.setToolTipText("Text to be replaced or The Starting C_Index") self.RThat = JTextField() self.RThat = JTextField(maximumSize=Dimension(120,25)) self.RThat.setToolTipText("Text to be placed or The Finish C_Index") bSandReplace = JButton("Replace Text", actionPerformed=self.bSandReplace) bSandReplace.setToolTipText("Replace the text from This with Thext from That in the Text from the Input Area and displays it in the Output Area") bcCat = JButton("CreatCateg", actionPerformed=self.bcCat) bcCat.setToolTipText("Create a categorical form starting C_Index to finish C_Index; Use the above text boxes to define the indexes") bC_S = JButton("Create _Series", actionPerformed=self.bC_S) bC_S.setToolTipText("Create a series form starting C_Index to finish C_Index; Use the above text boxes to define the indexes; It will create a series for every row in the Input Area") bM_Categories = JButton("Categories", actionPerformed=self.mCategories) bM_Categories.setToolTipText("Make Categories using the lines from the Input Area") #bM_Categories = JButton(maximumSize=Dimension(40,25)) # de incercat daca merge cu ; sa grupezi in [dsa] elementele ############################################################# ############################################################# # Aplication Layout 2 groups one Horizontal and one Vertical layout.setHorizontalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(Larea1) .addComponent(Sarea1) .addComponent(Sarea2) .addComponent(bCopyToInput) .addComponent(Larea2)) .addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addComponent(bM_Categories) .addComponent(self.iStart)) .addGroup(layout.createSequentialGroup() .addComponent(self.cCurly) .addComponent(self.cSemiC) .addComponent(self.cCtClipB)) .addGroup(layout.createSequentialGroup() .addComponent(bRemoveNBSP_L) .addComponent(bRemoveNBSP_R)) .addGroup(layout.createSequentialGroup() .addComponent(self.RThis) .addComponent(self.RThat)) .addGroup(layout.createSequentialGroup() .addComponent(bSandReplace) .addComponent(bcCat)) .addGroup(layout.createSequentialGroup() .addComponent(bC_S)) .addComponent(bClear)) ) layout.setVerticalGroup(layout.createSequentialGroup() .addComponent(Larea1) .addGroup(layout.createParallelGroup() .addComponent(Sarea1) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(bM_Categories) .addComponent(self.iStart)) .addGroup(layout.createParallelGroup() .addComponent(self.cCurly) .addComponent(self.cSemiC) .addComponent(self.cCtClipB)) .addGroup(layout.createParallelGroup() .addComponent(bRemoveNBSP_L) .addComponent(bRemoveNBSP_R)) .addGroup(layout.createParallelGroup() .addComponent(self.RThis) .addComponent(self.RThat)) .addGroup(layout.createParallelGroup() .addComponent(bSandReplace) .addComponent(bcCat)) .addGroup(layout.createParallelGroup() .addComponent(bC_S)) ) ) .addGroup(layout.createParallelGroup() .addComponent(bCopyToInput) .addComponent(bClear)) .addComponent(Larea2) .addGroup(layout.createParallelGroup() .addComponent(Sarea2)) ) #layout.linkSize(SwingConstants.HORIZONTAL, [ok, bCopyToInput, close, bM_Categories]) layout.linkSize(SwingConstants.HORIZONTAL, [self.RThis,self.RThat,bRemoveNBSP_L,bRemoveNBSP_R,bCopyToInput,bM_Categories,bSandReplace,bcCat,bC_S]) #layout.linkSize(SwingConstants.HORIZONTAL, [self.cCurly,bM_Categories]) ############################################################# ############################################################# # Aplication Settings self.pack() #self.setPreferredSize(Dimension(1000, 1000)) self.setTitle("Workhelper") self.setSize(800, 500) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
def __init__(self): super(WorkHelper, self).__init__() self.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard() ############################################################# # Layout: layout = GroupLayout(self.getContentPane()) self.getContentPane().setLayout(layout) layout.setAutoCreateGaps(True) layout.setAutoCreateContainerGaps(True) ############################################################# ############################################################# # Frame Area: Larea1 = JLabel("InputArea:") Sarea1 = JScrollPane() self.area1 = JTextArea() self.area1.setToolTipText("Input Area") self.area1.setEditable(True) self.area1.setBorder(BorderFactory.createLineBorder(Color.gray)) Sarea1.setPreferredSize(Dimension(300,100)) Sarea1.getViewport().setView((self.area1)) bClear = JButton("Clear", actionPerformed=self.bClear) bClear.setToolTipText("Clears the text form both Input and Output text Areas") bCopyToInput = JButton("Copy to Input", actionPerformed=self.bCopyToInput) bCopyToInput.setToolTipText("Copy the text from the Output Area to the Input Area for further Operations") self.cCtClipB = JCheckBox("Auto-Copy"); self.cCtClipB.setToolTipText("When 'Checked' after the Categories are created they will added to the clipboard") self.cCtClipB.setSelected(1) Larea2 = JLabel("OutputArea:") Sarea2 = JScrollPane() self.area2 = JTextArea() self.area2.setToolTipText("Output Area") self.area2.setEditable(False) self.area2.setBorder(BorderFactory.createLineBorder(Color.gray)) Sarea2.setPreferredSize(Dimension(300,100)) Sarea2.getViewport().setView((self.area2)) ############################################################# # Tabbed Area: tabPane = JTabbedPane(JTabbedPane.TOP) self.getContentPane().add(tabPane) ##################################################### # Text Edit pane panel_TEdit = JPanel() layout2 = GroupLayout(panel_TEdit) layout2.setAutoCreateGaps(True) layout2.setAutoCreateContainerGaps(True) panel_TEdit.setLayout(layout2) bRemoveNBSP_L = JButton("Clean LText", actionPerformed=self.bRemoveNBSP_L) bRemoveNBSP_L.setToolTipText("Removes Spaces, Tabs from the start of every text line from the input Area") bRemoveNBSP_R = JButton("Clean RText", actionPerformed=self.bRemoveNBSP_R) bRemoveNBSP_R.setToolTipText("Removes Spaces, Tabs from the end of every text line from the input Area") self.ReplaceThis = JTextField() self.ReplaceThis = JTextField(maximumSize=Dimension(120,25)) self.ReplaceThis.setToolTipText("Text to be replaced") self.ReplaceThat = JTextField() self.ReplaceThat = JTextField(maximumSize=Dimension(120,25)) self.ReplaceThat.setToolTipText("Text to be placed") bSandReplace = JButton("Replace Text", actionPerformed=self.bSandReplace) bSandReplace.setToolTipText("Replace the text from This with Text from That in the Text from the Input Area and displays it in the Output Area") bRemNumbers = JButton("Rem Numbers", actionPerformed=self.RemNumbers) bRemNumbers.setToolTipText("Removes numbers from the start of every line") ##################################################### # Dimension pane panel_Dimensions = JPanel() layout3 = GroupLayout(panel_Dimensions) layout3.setAutoCreateGaps(True) layout3.setAutoCreateContainerGaps(True) panel_Dimensions.setLayout(layout3) self.cCurly = JCheckBox("Curly"); self.cCurly.setToolTipText("When 'Checked' Curly Brackets will surround the Categories") self.cCurly.setSelected(1) self.cSemiC = JCheckBox("SemiColumn"); self.cSemiC.setToolTipText("When 'Checked' after the Categories are created at the end will be a semicolomn") self.cSemiC.setSelected(1) self.iStart = JTextField(maximumSize=Dimension(40,25)) self.iStart.setToolTipText("The Start Index for the Making of the Categories") self.RThis = JTextField() self.RThis = JTextField(maximumSize=Dimension(120,25)) self.RThis.setToolTipText("The Starting Index used in creating the Categorical") self.RThat = JTextField() self.RThat = JTextField(maximumSize=Dimension(120,25)) self.RThat.setToolTipText("The Finish Index used in creating the Categorical") optioncCategories = JLabel("Options:") bcCat = JButton("CreatCateg", actionPerformed=self.bcCat) bcCat.setToolTipText("Create a categorical form starting C_Index to finish C_Index; Use the text boxes to define the indexes") bM_Categories = JButton("Categories", actionPerformed=self.mCategories) bM_Categories.setToolTipText("Make Categories using the lines from the Input Area. Use it to define Categorical questions.") ##################################################### # ConfirmIt pane panel_ConfirmIt = JPanel() layout4 = GroupLayout(panel_ConfirmIt) layout4.setAutoCreateGaps(True) layout4.setAutoCreateContainerGaps(True) panel_ConfirmIt.setLayout(layout4) self.PID = JTextField() self.PID = JTextField(maximumSize=Dimension(120,25)) self.PID.setToolTipText("The PID number used for creating links with PID and ids from every line of the Input Area") bClinks = JButton("Create Links", actionPerformed=self.bClinks) bClinks.setToolTipText("Create links for a project using PID and ID, ID`s are read from every line of the Input Area") bClinksNA = JButton("Create Links NA ", actionPerformed=self.bClinksNA) bClinksNA.setToolTipText("Create links for a project using PID and ID`s from the standard sample test for US") bClinksCA = JButton("Create Links CA", actionPerformed=self.bClinksCA) bClinksCA.setToolTipText("Create links for a project using PID and ID`s from the standard sample test for CA") self.Width = JTextField() self.Width = JTextField(maximumSize=Dimension(120,25)) self.Width.setToolTipText("The Width used in creating the DIV html tag, note the dimension used is in px") baddDIVt = JButton("Add DIV tag", actionPerformed=self.baddDIVt) baddDIVt.setToolTipText("Create a DIV tag for every line in the Input Area") ##################################################### # Statistics pane panel_Statistics = JPanel() layout5 = GroupLayout(panel_Statistics) layout5.setAutoCreateGaps(True) layout5.setAutoCreateContainerGaps(True) panel_Statistics.setLayout(layout5) ##################################################### # TimeTraking pane panel_TimeTraking = JPanel() layout6 = GroupLayout(panel_TimeTraking) layout6.setAutoCreateGaps(True) layout6.setAutoCreateContainerGaps(True) panel_TimeTraking.setLayout(layout6) ##################################################### # Tabbed Area Tabs tabPane.addTab("Text Edit", panel_TEdit) tabPane.addTab("Dimensions", panel_Dimensions) tabPane.addTab("ConfirmIt", panel_ConfirmIt) tabPane.addTab("Statistics", panel_Statistics) tabPane.addTab("TimeTraking", panel_TimeTraking) ############################################################# ############################################################# # Aplication Layouts: 2 groups one Horizontal and one Vertical ############################################################# # Frame Layout: 2 groups one Horizontal and one Vertical layout.setHorizontalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addComponent(Larea1) .addComponent(Sarea1) .addComponent(Sarea2) .addGroup(layout.createSequentialGroup() .addComponent(bCopyToInput) .addComponent(bClear) .addComponent(self.cCtClipB)) .addComponent(Larea2)) .addGroup(layout.createParallelGroup() .addComponent(tabPane)) ) layout.setVerticalGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup() .addGroup(layout.createSequentialGroup() .addComponent(Larea1) .addComponent(Sarea1) .addGroup(layout.createParallelGroup() .addComponent(bCopyToInput) .addComponent(bClear) .addComponent(self.cCtClipB) ) .addComponent(Larea2) .addComponent(Sarea2)) .addGroup(layout.createSequentialGroup() .addComponent(tabPane)) ) ) ############################################################# # TEdit Layout: 2 groups one Horizontal and one Vertical layout2.setHorizontalGroup(layout2.createSequentialGroup() .addGroup(layout2.createParallelGroup() .addGroup(layout2.createSequentialGroup() .addComponent(bRemNumbers) .addComponent(bRemoveNBSP_L) .addComponent(bRemoveNBSP_R)) .addGroup(layout2.createSequentialGroup() .addComponent(bSandReplace) .addComponent(self.ReplaceThis) .addComponent(self.ReplaceThat)) )) layout2.setVerticalGroup(layout2.createSequentialGroup() .addGroup(layout2.createParallelGroup() .addComponent(bRemNumbers) .addComponent(bRemoveNBSP_L) .addComponent(bRemoveNBSP_R)) .addGroup(layout2.createParallelGroup() .addComponent(bSandReplace) .addComponent(self.ReplaceThis) .addComponent(self.ReplaceThat)) ) ############################################################# # Dimensions Layout: 2 groups one Horizontal and one Vertical layout3.setHorizontalGroup(layout3.createSequentialGroup() .addGroup(layout3.createParallelGroup() .addGroup(layout3.createSequentialGroup() .addComponent(bM_Categories) .addComponent(self.iStart)) .addGroup(layout3.createSequentialGroup() .addComponent(optioncCategories) .addComponent(self.cCurly) .addComponent(self.cSemiC) ) .addGroup(layout3.createSequentialGroup() .addComponent(bcCat) .addComponent(self.RThis) .addComponent(self.RThat)) .addGroup(layout3.createSequentialGroup() ) ) ) layout3.setVerticalGroup(layout3.createSequentialGroup() .addGroup(layout3.createSequentialGroup() .addGroup(layout3.createParallelGroup() .addComponent(bM_Categories) .addComponent(self.iStart)) .addGroup(layout3.createParallelGroup() .addComponent(bcCat) .addComponent(self.RThis) .addComponent(self.RThat)) .addGroup(layout3.createParallelGroup() .addGroup(layout3.createParallelGroup() .addComponent(optioncCategories) .addComponent(self.cCurly) .addComponent(self.cSemiC) ) ) ) ) ############################################################# # ConfimIT Layout: 2 groups one Horizontal and one Vertical layout4.setHorizontalGroup(layout4.createSequentialGroup() .addGroup(layout4.createParallelGroup() .addGroup(layout4.createSequentialGroup() .addComponent(bClinks) .addComponent(self.PID) ) .addGroup(layout4.createSequentialGroup() .addComponent(bClinksNA) .addComponent(bClinksCA) ) .addGroup(layout4.createSequentialGroup() .addComponent(baddDIVt) .addComponent(self.Width) ) )) layout4.setVerticalGroup(layout4.createSequentialGroup() .addGroup(layout4.createSequentialGroup() .addGroup(layout4.createParallelGroup() .addComponent(bClinks) .addComponent(self.PID)) .addGroup(layout4.createParallelGroup() .addComponent(bClinksNA) .addComponent(bClinksCA) ) .addGroup(layout4.createParallelGroup() .addComponent(baddDIVt) .addComponent(self.Width) ) )) #layout2.linkSize(SwingConstants.HORIZONTAL, [self.cCurly,bM_Categories]) #layout.linkSize(SwingConstants.HORIZONTAL, [ok, bCopyToInput, close, bM_Categories]) #layout3.linkSize(SwingConstants.HORIZONTAL, [self.RThis,self.RThat,bRemoveNBSP_L,bRemoveNBSP_R,bM_Categories,bSandReplace,bcCat]) ############################################################# ############################################################# # Aplication Settings self.pack() #self.setPreferredSize(Dimension(1000, 1000)) self.setTitle("Workhelper") self.setSize(800, 500) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
class Process_EVTX1WithUISettingsPanel(IngestModuleIngestJobSettingsPanel): # Note, we can't use a self.settings instance variable. # Rather, self.local_settings is used. # https://wiki.python.org/jython/UserGuide#javabean-properties # Jython Introspector generates a property - 'settings' on the basis # of getSettings() defined in this class. Since only getter function # is present, it creates a read-only 'settings' property. This auto- # generated read-only property overshadows the instance-variable - # 'settings' # We get passed in a previous version of the settings so that we can # prepopulate the UI # TODO: Update this for your UI def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # TODO: Update this for your UI def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setFlag(True) else: self.local_settings.setFlag(False) if self.checkbox1.isSelected(): self.local_settings.setFlag1(True) else: self.local_settings.setFlag1(False) if self.checkbox2.isSelected(): self.local_settings.setFlag2(True) else: self.local_settings.setFlag2(False) if self.checkbox3.isSelected(): self.local_settings.setFlag3(True) else: self.local_settings.setFlag3(False) if self.checkbox4.isSelected(): self.local_settings.setFlag4(True) self.local_settings.setArea(self.area.getText()) else: self.local_settings.setFlag4(False) def keyPressed(self, event): self.local_settings.setArea(self.area.getText()) # TODO: Update this for your UI def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("All Logs", actionPerformed=self.checkBoxEvent) self.checkbox1 = JCheckBox("Application.Evtx", actionPerformed=self.checkBoxEvent) self.checkbox2 = JCheckBox("Security.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox3 = JCheckBox("System.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox( "Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.panel1.add(self.checkbox) self.panel1.add(self.checkbox1) self.panel1.add(self.checkbox2) self.panel1.add(self.checkbox3) self.panel1.add(self.checkbox4) self.add(self.panel1) self.area = JTextArea(5, 25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane) # TODO: Update this for your UI def customizeComponents(self): self.checkbox.setSelected(self.local_settings.getFlag()) self.checkbox1.setSelected(self.local_settings.getFlag1()) self.checkbox2.setSelected(self.local_settings.getFlag2()) self.checkbox3.setSelected(self.local_settings.getFlag3()) self.checkbox4.setSelected(self.local_settings.getFlag4()) # Return the settings used def getSettings(self): return self.local_settings
class JBrukerSubmit: colHeads = ('block/sample #', 'Holder', 'Name', 'Experiment', 'Solvent', 'Group', 'Member', 'Sample Name') if platform.node() == 'DM-CHEM-200': basedir = r"W:\downloads\Eric\jython" elif platform.node() == 'ERIC-PC': basedir = r"C:\Users\ERIC\Dropbox\projects\programming\2020\python\autoNMRinput" else: # running from Bruker spectrometers basedir = "/data/downloads/Eric" def listSubmit(self, event): """Submit highlighted to csv file to automation folder of spectrometer """ # Ask for starting carousel position and submit experimets to topspin # obtain file name of CSV file selected = self.list.selectedIndex csvName = self.data[selected] # if no selected file and table is empty just return if self.label.text == "Selected File": return # Create check dialog before submitting data to automation self.dataTableModel.dataVector # submitString = "submit " + csvName + " starting at carousel position " + self.carouselStartingPosition.text submitString = "submit " + csvName + " starting at carousel position " + str( (self.dataTableModel.dataVector)[0][1]) result = JOptionPane.showConfirmDialog(self.frame, submitString) # if submission confirmed if result == 0: # submit csv file to automation ret = readcsv243A.submitNMRexpts([ self.dataTableModel.dataVector, csvName, self.carouselStartingPosition.text ]) # if successful or not update status string if ret == 0: self.statusLabel.text = "File " + csvName + " Submitted to TOPSPIN Starting at Carousel Position " + str( (self.dataTableModel.dataVector)[0][1]) self.panelStatusLabel.setBackground(Color.GREEN) elif ret == 1: self.statusLabel.text = "Carousel Position not a number" self.panelStatusLabel.setBackground(Color.RED) elif ret == 2: self.statusLabel.text = "Incompatible experiment chosen for spectrometer" self.panelStatusLabel.setBackground(Color.RED) elif ret == 3: self.statusLabel.text = "A holder starting position is not between 1 and 60 inclusive" self.panelStatusLabel.setBackground(Color.RED) elif ret == 4: self.statusLabel.text = "Too many samples for starting position chosen" self.panelStatusLabel.setBackground(Color.RED) # if an error occured display error message also in a warning dialog too. if ret in [1, 2, 3, 4]: JOptionPane.showMessageDialog(self.frame, self.statusLabel.text) def listSelect(self, event): """When a new csv file is selected from the list read in the file and display its contents in the table. Unordered csv files will be ordered based on the block/sample number. A holder column will be added to the CSV data based on the carousel starting position. """ # Process the events from the list box and update the label # get the index from the list and then the filename selected = self.list.selectedIndex if selected >= 0: # update file label and set background colour to normal csvName = self.data[selected] self.label.text = csvName self.panelLabel.setBackground(self.standardBackgroundColor) # reset status label self.statusLabel.text = "Status" self.panelStatusLabel.setBackground(self.standardBackgroundColor) # # update table by reading in csv file # read in csv file and store as a list of dictionaries # one dictionary for each line fn = csvName self.expt_list = [] f = open(os.path.join(JBrukerSubmit.basedir, fn), 'r') reader = csv.DictReader(f) for row in reader: self.expt_list.append(row) f.close() # get carousel starting position, if the value cannot be converted # to an integer reset it to 1 and reset the GUI to 1 try: self.cnumber = int(self.carouselStartingPosition.text) except: self.cnumber = 1 self.self.carouselStartingPosition.text = "1" # get the csv data into a list of lists form ready for displaying self.tableData = returnJTableData(self.expt_list, self.cnumber) # display csv table in table view colNames = JBrukerSubmit.colHeads # transfer the data over to the table model self.dataTableModel.setDataVector(self.tableData, colNames) # display the table in the GUI self.scrollPaneTable.getViewport().setView((self.table)) # check to see if experiments will run on the spectometer ok, pulseSequence = checkExperimentsWillRun(self.expt_list) if not ok: # display warning dialog warningText = pulseSequence + " cannot be run on this spectrometer" JOptionPane.showMessageDialog(self.frame, warningText) def returnCSVlist(self, hiddenFiles): """ read in csv files ommitting any that are created after auto submission and return as list of strings. Miss out any that have been hidden""" csvlist = [ f for f in os.listdir(JBrukerSubmit.basedir) if (f.endswith(".csv")) and (f[-6] not in ['A', 'B', 'N']) ] csvlist = [f for f in csvlist if f not in self.hiddenFiles] return csvlist def listUpdate(self, event): """ when update button clicked renew csv list """ self.data = self.returnCSVlist(self.hiddenFiles) self.list.setListData(self.data) def checkCarouselNumber(self, event): """ check that carousel field is an integer change background to white if okay, red if not.""" self.cnumber = self.carouselStartingPosition.text try: self.cnumber = int(self.cnumber) self.carouselStartingPosition.background = Color.WHITE self.listSelect(event) except: self.carouselStartingPosition.background = Color.RED def tableMouseClicked(self, event): """Prior to editing the user will click the holder number cell more often than not. This function saves the cell row and column and the value in the cell prior to editing.""" tble = event.getSource() self.rw = tble.getSelectedRow() self.cl = tble.getSelectedColumn() self.oldHolderValue = tble.getValueAt(self.rw, self.cl) # print "table mouse clicked", self.rw, self.cl def tableChangedCB(self, event): """Function is called when a cell is being edited. After the user presses return the data is updated. Should only work if Holder column is being edited""" print "Table Changed" tble = event.getSource() if (event.keyChar == "\n") and (self.cl != 1): tble.setValueAt(self.oldHolderValue, self.rw, self.cl) elif (event.keyChar == "\n") and (self.cl == 1): print "RETURN" vlue = tble.getValueAt(self.rw, self.cl) print "row", self.rw, "col", self.cl, "value", vlue # # check to see if new holder number is used by another sample # get block number of sample changed blckNumber = tble.getValueAt(self.rw, 0) # # get values in table holderAlreadyOccupied = False tableValues = self.dataTableModel.dataVector for i, rw in enumerate(tableValues): print i if (int(rw[1]) == int(vlue)) and (int(blckNumber) != int(rw[0])): tble.setValueAt(int(self.oldHolderValue), self.rw, 1) holderAlreadyOccupied = True warningText = "Holder " + str( vlue) + " already used for sample " + str(rw[0]) JOptionPane.showMessageDialog(self.frame, warningText) break # # check to see if any other rows with same sample number need to be updated if not holderAlreadyOccupied: for i, rw in enumerate(tableValues): if int(blckNumber) == int(rw[0]): tble.setValueAt(int(vlue), i, 1) # def tableKeyPressedCB(self, event): # print "tableKeyPressedCB" # tble = event.getSource() # if event.keyChar == "\n": # print "RETURN" # vlue = tble.getValueAt(self.rw, self.cl) # print "row", self.rw, "col", self.cl, "value", vlue # elif (event.keyChar).isdigit(): # print "event.keyChar", event.keyChar # self.rw = tble.getSelectedRow() # self.cl = tble.getSelectedColumn() def listShowAllFiles(self, event): fp = open("hiddenFiles.txt", 'w') fp.write('zzz\n') fp.close() self.hiddenFiles = ['zzz'] self.listUpdate(event) def listHideFile(self, event): # find highlighted csv file name selected = self.list.selectedIndex csvName = self.data[selected] # add csv file name to hidden csv files list self.hiddenFiles.append(csvName) # update label above table view self.label.text = "Selected File" self.panelLabel.setBackground(self.standardBackgroundColor) # display csv table in table view # set table to blanks self.tableData = [] for i in range(18): self.tableData.append([ "", ] * len(JBrukerSubmit.colHeads)) self.dataTableModel.setDataVector(self.tableData, JBrukerSubmit.colHeads) self.listUpdate(event) # save hiddenFiles file fp = open("hiddenFiles.txt", 'w') for f in self.hiddenFiles: fp.write(f + '\n') fp.close() 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)
class BurpExtender(IBurpExtender, ITab, IHttpListener, IMessageEditorController, AbstractTableModel, IContextMenuFactory, IHttpRequestResponseWithMarkers, ITextEditor): def registerExtenderCallbacks(self, callbacks): self._callbacks = callbacks #Initialize callbacks to be used later self._helpers = callbacks.getHelpers() callbacks.setExtensionName("Trishul") self._log = ArrayList() #_log used to store our outputs for a URL, which is retrieved later by the tool self._lock = Lock() #Lock is used for locking threads while updating logs in order such that no multiple updates happen at once self.intercept = 0 self.FOUND = "Found" self.CHECK = "Possible! Check Manually" self.NOT_FOUND = "Not Found" #Static Values for output #Initialize GUI self.issuesTab() self.advisoryReqResp() self.configTab() self.tabsInit() self.definecallbacks() print("Thank You for Installing Trishul") return # #Initialize Issues Tab displaying the JTree # def issuesTab(self): self.root = DefaultMutableTreeNode('Issues') frame = JFrame("Issues Tree") self.tree = JTree(self.root) self.rowSelected = '' self.tree.addMouseListener(mouseclick(self)) self.issuepanel = JScrollPane() self.issuepanel.setPreferredSize(Dimension(300,450)) self.issuepanel.getViewport().setView((self.tree)) frame.add(self.issuepanel,BorderLayout.CENTER) # #Adding Issues to Issues TreePath # def addIssues(self, branch, branchData=None): if branchData == None: branch.add(DefaultMutableTreeNode('No valid data')) else: for item in branchData: branch.add(DefaultMutableTreeNode(item)) # #Initialize the Config Tab to modify tool settings # def configTab(self): Config = JLabel("Config") self.startButton = JToggleButton("Intercept Off", actionPerformed=self.startOrStop) self.startButton.setBounds(40, 30, 200, 30) self.autoScroll = JCheckBox("Auto Scroll") self.autoScroll.setBounds(40, 80, 200, 30) self.xsscheck = JCheckBox("Detect XSS") self.xsscheck.setSelected(True) self.xsscheck.setBounds(40, 110, 200, 30) self.sqlicheck = JCheckBox("Detect SQLi") self.sqlicheck.setSelected(True) self.sqlicheck.setBounds(40, 140, 200, 30) self.ssticheck = JCheckBox("Detect SSTI") self.ssticheck.setSelected(True) self.ssticheck.setBounds(40, 170, 200, 30) self.blindxss = JCheckBox("Blind XSS") self.blindxss.setBounds(40, 200, 200, 30) self.BlindXSSText = JTextArea("", 5, 30) scrollbxssText = JScrollPane(self.BlindXSSText) scrollbxssText.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED) scrollbxssText.setBounds(40, 250, 400, 110) self.configtab = JPanel() self.configtab.setLayout(None) self.configtab.setBounds(0, 0, 300, 300) self.configtab.add(Config) self.configtab.add(self.startButton) self.configtab.add(self.autoScroll) self.configtab.add(self.xsscheck) self.configtab.add(self.sqlicheck) self.configtab.add(self.ssticheck) self.configtab.add(self.blindxss) self.configtab.add(scrollbxssText) # #Turn Intercept from Proxy on or off # def startOrStop(self, event): if self.startButton.getText() == "Intercept Off": self.startButton.setText("Intercept On") self.startButton.setSelected(True) self.intercept = 1 else: self.startButton.setText("Intercept Off") self.startButton.setSelected(False) self.intercept = 0 # #Intialize the Advisory, Request and Response Tabs # def advisoryReqResp(self): self.textfield = JEditorPane("text/html", "") self.kit = HTMLEditorKit() self.textfield.setEditorKit(self.kit) self.doc = self.textfield.getDocument() self.textfield.setEditable(0) self.advisorypanel = JScrollPane() self.advisorypanel.getVerticalScrollBar() self.advisorypanel.setPreferredSize(Dimension(300,450)) self.advisorypanel.getViewport().setView((self.textfield)) self.selectedreq = [] self._requestViewer = self._callbacks.createMessageEditor(self, False) self._responseViewer = self._callbacks.createMessageEditor(self, False) self._texteditor = self._callbacks.createTextEditor() self._texteditor.setEditable(False) # #Initialize Trishul Tabs # def tabsInit(self): self.logTable = Table(self) tableWidth = self.logTable.getPreferredSize().width self.logTable.getColumn("#").setPreferredWidth(Math.round(tableWidth / 50 * 0.1)) self.logTable.getColumn("Method").setPreferredWidth(Math.round(tableWidth / 50 * 3)) self.logTable.getColumn("URL").setPreferredWidth(Math.round(tableWidth / 50 * 40)) self.logTable.getColumn("Parameters").setPreferredWidth(Math.round(tableWidth / 50 * 1)) self.logTable.getColumn("XSS").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self.logTable.getColumn("SQLi").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self.logTable.getColumn("SSTI").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self.logTable.getColumn("Request Time").setPreferredWidth(Math.round(tableWidth / 50 * 4)) self.tableSorter = TableRowSorter(self) self.logTable.setRowSorter(self.tableSorter) self._bottomsplit = JSplitPane(JSplitPane.HORIZONTAL_SPLIT) self._bottomsplit.setDividerLocation(500) self.issuetab = JTabbedPane() self.issuetab.addTab("Config",self.configtab) self.issuetab.addTab("Issues",self.issuepanel) self._bottomsplit.setLeftComponent(self.issuetab) self.tabs = JTabbedPane() self.tabs.addTab("Advisory",self.advisorypanel) self.tabs.addTab("Request", self._requestViewer.getComponent()) self.tabs.addTab("Response", self._responseViewer.getComponent()) self.tabs.addTab("Highlighted Response", self._texteditor.getComponent()) self._bottomsplit.setRightComponent(self.tabs) self._splitpane = JSplitPane(JSplitPane.VERTICAL_SPLIT) self._splitpane.setDividerLocation(450) self._splitpane.setResizeWeight(1) self.scrollPane = JScrollPane(self.logTable) self._splitpane.setLeftComponent(self.scrollPane) self.scrollPane.getVerticalScrollBar().addAdjustmentListener(autoScrollListener(self)) self._splitpane.setRightComponent(self._bottomsplit) # #Initialize burp callbacks # def definecallbacks(self): self._callbacks.registerHttpListener(self) self._callbacks.customizeUiComponent(self._splitpane) self._callbacks.customizeUiComponent(self.logTable) self._callbacks.customizeUiComponent(self.scrollPane) self._callbacks.customizeUiComponent(self._bottomsplit) self._callbacks.registerContextMenuFactory(self) self._callbacks.addSuiteTab(self) # #Menu Item to send Request to Trishul # def createMenuItems(self, invocation): responses = invocation.getSelectedMessages() if responses > 0: ret = LinkedList() requestMenuItem = JMenuItem("Send request to Trishul") for response in responses: requestMenuItem.addActionListener(handleMenuItems(self,response, "request")) ret.add(requestMenuItem) return ret return None # #Highlighting Response # def markHttpMessage( self, requestResponse, responseMarkString ): responseMarkers = None if responseMarkString: response = requestResponse.getResponse() responseMarkBytes = self._helpers.stringToBytes( responseMarkString ) start = self._helpers.indexOf( response, responseMarkBytes, False, 0, len( response ) ) if -1 < start: responseMarkers = [ array( 'i',[ start, start + len( responseMarkBytes ) ] ) ] requestHighlights = [array( 'i',[ 0, 5 ] )] return self._callbacks.applyMarkers( requestResponse, requestHighlights, responseMarkers ) def getTabCaption(self): return "Trishul" def getUiComponent(self): return self._splitpane # #Table Model to display URL's and results based on the log size # def getRowCount(self): try: return self._log.size() except: return 0 def getColumnCount(self): return 8 def getColumnName(self, columnIndex): data = ['#','Method', 'URL', 'Parameters', 'XSS', 'SQLi', "SSTI", "Request Time"] try: return data[columnIndex] except IndexError: return "" def getColumnClass(self, columnIndex): data = [Integer, String, String, Integer, String, String, String, String] try: return data[columnIndex] except IndexError: return "" #Get Data stored in log and display in the respective columns def getValueAt(self, rowIndex, columnIndex): logEntry = self._log.get(rowIndex) if columnIndex == 0: return rowIndex+1 if columnIndex == 1: return logEntry._method if columnIndex == 2: return logEntry._url.toString() if columnIndex == 3: return len(logEntry._parameter) if columnIndex == 4: return logEntry._XSSStatus if columnIndex == 5: return logEntry._SQLiStatus if columnIndex == 6: return logEntry._SSTIStatus if columnIndex == 7: return logEntry._req_time return "" def getHttpService(self): return self._currentlyDisplayedItem.getHttpService() def getRequest(self): return self._currentlyDisplayedItem.getRequest() def getResponse(self): return self._currentlyDisplayedItem.getResponse() #For Intercepted requests perform tests in scope def processHttpMessage(self, toolFlag, messageIsRequest, messageInf): if self.intercept == 1: if toolFlag == self._callbacks.TOOL_PROXY: if not messageIsRequest: requestInfo = self._helpers.analyzeRequest(messageInf) requeststr = requestInfo.getUrl() parameters = requestInfo.getParameters() param_new = [p for p in parameters if p.getType() != 2] if len(param_new) != 0: if self._callbacks.isInScope(URL(str(requeststr))): start_new_thread(self.sendRequestToTrishul,(messageInf,)) return # #Main processing of Trishul # def sendRequestToTrishul(self,messageInfo): request = messageInfo.getRequest() req_time = datetime.datetime.today() requestURL = self._helpers.analyzeRequest(messageInfo).getUrl() messageInfo = self._callbacks.makeHttpRequest(self._helpers.buildHttpService(str(requestURL.getHost()), int(requestURL.getPort()), requestURL.getProtocol() == "https"), request) resp_time = datetime.datetime.today() time_taken = (resp_time - req_time).total_seconds() response = messageInfo.getResponse() #initialozations of default value SQLiimp = self.NOT_FOUND SSTIimp = self.NOT_FOUND XSSimp = self.NOT_FOUND Comp_req = messageInfo requestInfo = self._helpers.analyzeRequest(messageInfo) self.content_resp = self._helpers.analyzeResponse(response) requestURL = requestInfo.getUrl() parameters = requestInfo.getParameters() requeststring = self._helpers.bytesToString(request) headers = requestInfo.getHeaders() #Used to obtain GET, POST and JSON parameters from burp api param_new = [p for p in parameters if p.getType() == 0 or p.getType() == 1 or p.getType() == 6] i = 0 xssflag=0 sqliflag=0 sstiflag=0 resultxss = [] resultsqli = [] resultssti = [] xssreqresp = [] sqlireqresp = [] sstireqresp = [] ssti_description = [] sqli_description = [] xss_description = [] for i in range(len(param_new)): name = param_new[i].getName() ptype = param_new[i].getType() param_value = param_new[i].getValue() #check XSS if ticked if self.xsscheck.isSelected(): score = 0 flag1 = 0 XSSimp = self.NOT_FOUND payload_array = ["<", ">", "\\\\'asd", "\\\\\"asd", "\\", "'\""] json_payload_array = ["<", ">", "\\\\'asd", "\\\"asd", "\\", "\'\\\""] payload_all = "" json_payload = "" rand_str = "testtest" for payload in payload_array: payload_all = payload_all+rand_str+payload payload_all = URLEncoder.encode(payload_all, "UTF-8") for payload in json_payload_array: json_payload = json_payload+rand_str+payload json_payload = URLEncoder.encode(json_payload, "UTF-8") if ptype == 0 or ptype == 1: new_paramters_value = self._helpers.buildParameter(name, payload_all, ptype) updated_request = self._helpers.updateParameter(request, new_paramters_value) else: jsonreq = re.search(r"\s([{\[].*?[}\]])$", requeststring).group(1) new = jsonreq.split(name+"\":",1)[1] if new.startswith('\"'): newjsonreq = jsonreq.replace(name+"\":\""+param_value,name+"\":\""+json_payload) else: newjsonreq = jsonreq.replace(name+"\":"+param_value,name+"\":\""+json_payload+"\"") updated_request = self._helpers.buildHttpMessage(headers, newjsonreq) attack = self.makeRequest(Comp_req, updated_request) response = attack.getResponse() response_str = self._helpers.bytesToString(response) xssreqresp.append(attack) if_found_payload = "" non_encoded_symbols = "" for check_payload in payload_array: if_found_payload = rand_str+check_payload if if_found_payload in response_str: non_encoded_symbols = non_encoded_symbols+"<br>"+check_payload.replace('<', '<') score = score+1 flag1 = 1 if score > 2: XSSimp = self.CHECK if score > 3: XSSimp = self.FOUND xssflag = self.checkBetterScore(score,xssflag) if non_encoded_symbols == " \\\\'asd": XSSimp = self.NOT_FOUND if non_encoded_symbols != '': xss_description.append("The Payload <b>" + payload_all.replace('<', '<') + "</b> was passed in the request for the paramater <b>" + self._helpers.urlDecode(name) + "</b>. Some Tags were observed in the output unfiltered. A payload can be generated with the observed tags.<br>Symbols not encoded for parameter <b>" + name + "</b>: " + non_encoded_symbols) else: xss_description.append("") else: XSSimp = "Disabled" resultxss.append(XSSimp) if self.sqlicheck.isSelected(): SQLiimp = self.NOT_FOUND score = 0 value = "%27and%28select%2afrom%28select%28sleep%285%29%29%29a%29--" orig_time = datetime.datetime.today() if ptype == 0 or ptype == 1: new_paramters_value = self._helpers.buildParameter(name, value, ptype) updated_request = self._helpers.updateParameter(request, new_paramters_value) else: jsonreq = re.search(r"\s([{\[].*?[}\]])$", requeststring).group(1) new = jsonreq.split(name+"\":",1)[1] if new.startswith('\"'): newjsonreq = jsonreq.replace(name+"\":\""+param_value,name+"\":\""+value) else: newjsonreq = jsonreq.replace(name+"\":"+param_value,name+"\":\""+value+"\"") updated_request = self._helpers.buildHttpMessage(headers, newjsonreq) attack1 = self.makeRequest(Comp_req, updated_request) response1 = attack1.getResponse() new_time = datetime.datetime.today() response_str1 = self._helpers.bytesToString(response1) sqlireqresp.append(attack1) diff = (new_time - orig_time).total_seconds() if (diff - time_taken) > 3: score = 4 self.error_array = ["check the manual that corresponds to your", "You have an error", "syntax error", "SQL syntax", "SQL statement", "ERROR:", "Error:", "MySQL","Warning:","mysql_fetch_array()"] found_text = "" for error in self.error_array: if error in response_str1: found_text = found_text + error score = score + 1 if score > 1: SQLiimp = self.CHECK if score > 2: SQLiimp = self.FOUND sqliflag = self.checkBetterScore(score,sqliflag) if found_text != '': sqli_description.append("The payload <b>"+self._helpers.urlDecode(value)+"</b> was passed in the request for parameter <b>"+self._helpers.urlDecode(name)+"</b>. Some errors were generated in the response which confirms that there is an Error based SQLi. Please check the request and response for this parameter") elif (diff - time_taken) > 3: sqli_description.append("The payload <b>"+self._helpers.urlDecode(value)+"</b> was passed in the request for parameter <b>"+self._helpers.urlDecode(name)+"</b>. The response was in a delay of <b>"+str(diff)+"</b> seconds as compared to original <b>"+str(time_taken)+"</b> seconds. This indicates that there is a time based SQLi. Please check the request and response for this parameter") else: sqli_description.append("") else: SQLiimp = "Disabled" resultsqli.append(SQLiimp) if self.ssticheck.isSelected(): score = 0 SSTIimp = self.NOT_FOUND payload_array = ["${123*456}", "<%=123*567%>", "{{123*678}}"] json_payload_array = ["$\{123*456\}", "<%=123*567%>", "\{\{123*678\}\}"] payload_all = "" rand_str = "jjjjjjj" json_payload = "" for payload in payload_array: payload_all = payload_all+rand_str+payload for payload in json_payload_array: json_payload = json_payload+rand_str+payload payload_all = URLEncoder.encode(payload_all, "UTF-8") json_payload = URLEncoder.encode(json_payload, "UTF-8") if ptype == 0 or ptype == 1: new_paramters_value = self._helpers.buildParameter(name, payload_all, ptype) updated_request = self._helpers.updateParameter(request, new_paramters_value) else: jsonreq = re.search(r"\s([{\[].*?[}\]])$", requeststring).group(1) new = jsonreq.split(name+"\":",1)[1] if new.startswith('\"'): newjsonreq = jsonreq.replace(name+"\":\""+param_value,name+"\":\""+json_payload) else: newjsonreq = jsonreq.replace(name+"\":"+param_value,name+"\":\""+json_payload+"\"") updated_request = self._helpers.buildHttpMessage(headers, newjsonreq) attack = self.makeRequest(Comp_req, updated_request) response = attack.getResponse() response_str = self._helpers.bytesToString(response) self.expected_output = ["56088","69741","83394","3885","777777777777777"] for output in self.expected_output: if_found_payload = rand_str+output if if_found_payload in response_str: if output == self.expected_output[0]: sstireqresp.append(attack) ssti_description.append("Parameter <b>" + self._helpers.urlDecode(name) + "</b> is using <b>Java</b> Template<br>The value <b>" + payload_new + "</b> was passed which gave result as <b>56088</b>") score = 2 if output == self.expected_output[1]: sstireqresp.append(attack) ssti_description.append("Parameter <b>" + self._helpers.urlDecode(name) + "</b> is using <b>Ruby</b> Template<br>The value <b>" + payload_new + "</b> was passed which gave result as <b>69741</b>") score = 2 if output == self.expected_output[2]: payload_new = "{{5*'777'}}" json_payload_ssti = "\{\{5*'777'\}\}" payload = URLEncoder.encode("{{5*'777'}}", "UTF-8") json_ssti = URLEncoder.encode("\{\{5*'777'\}\}", "UTF-8") if ptype == 0 or ptype == 1: new_paramters = self._helpers.buildParameter(name, payload, ptype) ssti_updated_request = self._helpers.updateParameter(request, new_paramters) else: jsonreq = re.search(r"\s([{\[].*?[}\]])$", requeststring).group(1) new = jsonreq.split(name+"\":",1)[1] if new.startswith('\"'): newjsonreq = jsonreq.replace(name+"\":\""+param_value,name+"\":\""+json_ssti) else: newjsonreq = jsonreq.replace(name+"\":"+param_value,name+"\":\""+json_ssti+"\"") ssti_updated_request = self._helpers.buildHttpMessage(headers, newjsonreq) self.ssti_attack = self.makeRequest(Comp_req, ssti_updated_request) ssti_response = self.ssti_attack.getResponse() ssti_response_str = self._helpers.bytesToString(ssti_response) if self.expected_output[3] in ssti_response_str: sstireqresp.append(self.ssti_attack) ssti_description.append("Parameter <b>" + self._helpers.urlDecode(name) + "</b> is using <b>Twig</b> Template<br>The value <b>" + payload_new + "</b> was passed which gave result as <b>3885</b>") score = 2 elif self.expected_output[4] in ssti_response_str: sstireqresp.append(self.ssti_attack) self.responseMarkString = "777777777777777" ssti_description.append("Parameter <b>" + self._helpers.urlDecode(name) + "</b> is using <b>Jinja2</b> Template<br>The value <b>" + payload_new + "</b> was passed which gave result as <b>777777777777777</b>") score = 2 if score > 0: SSTIimp = self.CHECK if score > 1: SSTIimp = self.FOUND sstiflag = self.checkBetterScore(score,sstiflag) else: SSTIimp = "Disabled" resultssti.append(SSTIimp) if self.blindxss.isSelected(): blindxss_value = self.BlindXSSText.getText() if ptype == 0 or ptype == 1: new_paramters_value = self._helpers.buildParameter(name, blindxss_value, ptype) updated_request = self._helpers.updateParameter(request, new_paramters_value) else: jsonreq = re.search(r"\s([{\[].*?[}\]])$", requeststring).group(1) new = jsonreq.split(name+"\":",1)[1] if new.startswith('\"'): newjsonreq = jsonreq.replace(name+"\":\""+param_value,name+"\":\""+blindxss_value) else: newjsonreq = jsonreq.replace(name+"\":"+param_value,name+"\":\""+blindxss_value+"\"") updated_request = self._helpers.buildHttpMessage(headers, newjsonreq) attack = self.makeRequest(Comp_req, updated_request) if XSSimp != "Disabled": if xssflag > 3: XSSimp = self.FOUND elif xssflag > 2: XSSimp = self.CHECK else: XSSimp = self.NOT_FOUND if SSTIimp != "Disabled": if sstiflag > 1: SSTIimp = self.FOUND elif sstiflag > 0: SSTIimp = self.CHECK else: SSTIimp = self.NOT_FOUND if SQLiimp != "Disabled": if sqliflag > 3: SQLiimp = self.FOUND elif sqliflag > 2: SQLiimp = self.CHECK else: SQLiimp = self.NOT_FOUND self.addToLog(messageInfo, XSSimp, SQLiimp, SSTIimp, param_new, resultxss, resultsqli, resultssti, xssreqresp, sqlireqresp, sstireqresp , xss_description, sqli_description, ssti_description, req_time.strftime('%H:%M:%S %m/%d/%y')) # #Function used to check if the score originally and mentioned is better # def checkBetterScore(self, score, ogscore): if score > ogscore: ogscore = score return ogscore def makeRequest(self, messageInfo, message): request = messageInfo.getRequest() requestURL = self._helpers.analyzeRequest(messageInfo).getUrl() return self._callbacks.makeHttpRequest(self._helpers.buildHttpService(str(requestURL.getHost()), int(requestURL.getPort()), requestURL.getProtocol() == "https"), message) def addToLog(self, messageInfo, XSSimp, SQLiimp, SSTIimp, parameters, resultxss, resultsqli, resultssti, xssreqresp, sqlireqresp, sstireqresp, xss_description, sqli_description, ssti_description, req_time): requestInfo = self._helpers.analyzeRequest(messageInfo) method = requestInfo.getMethod() self._lock.acquire() row = self._log.size() self._log.add(LogEntry(self._callbacks.saveBuffersToTempFiles(messageInfo), requestInfo.getUrl(),method,XSSimp,SQLiimp,SSTIimp,req_time, parameters,resultxss, resultsqli, resultssti, xssreqresp, sqlireqresp, sstireqresp, xss_description, sqli_description, ssti_description)) # same requests not include again. SwingUtilities.invokeLater(UpdateTableEDT(self,"insert",row,row)) self._lock.release()
class BurpExtender(IBurpExtender, ITab, IScannerCheck, IScannerInsertionPoint, IContextMenuFactory): # definitions EXTENSION_NAME="IssueCreator" tmpl = dict() tmpl['XSS'] = dict() tmpl['XSS']['name'] = 'Cross-Site Scripting (reflected)' tmpl['XSS']['idetail'] = 'It is possible to inject arbitrary JavaScript into the application\'s response' tmpl['XSS']['ibackground'] = '''Reflected cross-site scripting vulnerabilities arise when data is copied from a request and echoed into the application's immediate response in an unsafe way. An attacker can use the vulnerability to construct a request which, if issued by another application user, will cause JavaScript code supplied by the attacker to execute within the user's browser in the context of that user's session with the application. The attacker-supplied code can perform a wide variety of actions, such as stealing the victim's session token or login credentials, performing arbitrary actions on the victim's behalf, and logging their keystrokes. Users can be induced to issue the attacker's crafted request in various ways. For example, the attacker can send a victim a link containing a malicious URL in an email or instant message. They can submit the link to popular web sites that allow content authoring, for example in blog comments. And they can create an innocuous looking web site which causes anyone viewing it to make arbitrary cross-domain requests to the vulnerable application (using either the GET or the POST method). The security impact of cross-site scripting vulnerabilities is dependent upon the nature of the vulnerable application, the kinds of data and functionality which it contains, and the other applications which belong to the same domain and organization. If the application is used only to display non-sensitive public content, with no authentication or access control functionality, then a cross-site scripting flaw may be considered low risk. However, if the same application resides on a domain which can access cookies for other more security-critical applications, then the vulnerability could be used to attack those other applications, and so may be considered high risk. Similarly, if the organization which owns the application is a likely target for phishing attacks, then the vulnerability could be leveraged to lend credibility to such attacks, by injecting Trojan functionality into the vulnerable application, and exploiting users' trust in the organization in order to capture credentials for other applications which it owns. In many kinds of application, such as those providing online banking functionality, cross-site scripting should always be considered high risk. ''' tmpl['XSS']['rdetail'] = ''''Input should be validated as strictly as possible on arrival, given the kind of content which it is expected to contain. For example, personal names should consist of alphabetical and a small range of typographical characters, and be relatively short; a year of birth should consist of exactly four numerals; email addresses should match a well-defined regular expression. Input which fails the validation should be rejected, not sanitized. User input should be HTML-encoded at any point where it is copied into application responses. All HTML metacharacters, including < > " ' and =, should be replaced with the corresponding HTML entities (< > etc). In cases where the application's functionality allows users to author content using a restricted subset of HTML tags and attributes (for example, blog comments which allow limited formatting and linking), it is necessary to parse the supplied HTML to validate that it does not use any dangerous syntax; this is a non-trivial task. ''' tmpl['XSS']['rbackground'] = 'do not trust user input!' tmpl['SQLi'] = dict() tmpl['SQLi']['name'] = 'SQL Injection' tmpl['SQLi']['idetail'] = 'Input parameter appears to be vulnerable to SQL injection attacks.' tmpl['SQLi']['ibackground'] = '''SQL injection vulnerabilities arise when user-controllable data is incorporated into database SQL queries in an unsafe manner. An attacker can supply crafted input to break out of the data context in which their input appears and interfere with the structure of the surrounding query. Various attacks can be delivered via SQL injection, including reading or modifying critical application data, interfering with application logic, escalating privileges within the database and executing operating system commands. ''' tmpl['SQLi']['rdetail'] = '''The most effective way to prevent SQL injection attacks is to use parameterized queries (also known as prepared statements) for all database access. This method uses two steps to incorporate potentially tainted data into SQL queries: first, the application specifies the structure of the query, leaving placeholders for each item of user input; second, the application specifies the contents of each placeholder. Because the structure of the query has already defined in the first step, it is not possible for malformed data in the second step to interfere with the query structure. You should review the documentation for your database and application platform to determine the appropriate APIs which you can use to perform parameterized queries. It is strongly recommended that you parameterize every variable data item that is incorporated into database queries, even if it is not obviously tainted, to prevent oversights occurring and avoid vulnerabilities being introduced by changes elsewhere within the code base of the application. ''' tmpl['SQLi']['rbackground'] = 'SQL Injection background' tmpl['Insecure-Cookie'] = dict() tmpl['Insecure-Cookie']['name'] = 'Cookie Was Set Without Secure Flag' tmpl['Insecure-Cookie']['idetail'] = 'Application has set a secure cookie without the secure attribute' tmpl['Insecure-Cookie']['ibackground'] = 'Client will send this cookie over the clear via http. This could be eavesdropped on.' tmpl['Insecure-Cookie']['rdetail'] = 'The application should set all cookies that are session related or sensitive in nature with the secure attribute.' tmpl['Insecure-Cookie']['rbackground'] = '...' tmpl['Your-Item'] = dict() tmpl['Your-Item']['name'] = 'My issue name' tmpl['Your-Item']['idetail'] = 'My issue detail' tmpl['Your-Item']['ibackground'] = 'the issue background here' tmpl['Your-Item']['rdetail'] = '''the remediation detail. i'll put this in triple quotes. because. ''' tmpl['Your-Item']['rbackground'] = 'this is remediation background information for my issue' def registerExtenderCallbacks(self, callbacks): # keep a reference to our callbacks object self._callbacks = callbacks # obtain an extension helpers object self._helpers = callbacks.getHelpers() # define stdout writer self._stdout = PrintWriter(callbacks.getStdout(), True) self._stdout.println(self.EXTENSION_NAME + ' by @luxcupitor') self._stdout.println('================================') self._stdout.println('') self._stdout.println('TIP: right click on items in proxy or repeater tab') self._stdout.println('and select "Add as Issue to Scanner".') self._stdout.println('') # set our extension name callbacks.setExtensionName(self.EXTENSION_NAME) # setup a context menu for the proxy tab. needs createMenuItems callbacks.registerContextMenuFactory(self) return def createMenuItems(self, caller): '''caller is the burpsuite context that invoked the menu''' menu = [] #Proxy tab is context 6/repeater request is 0/repeater response is 3 idx = caller.getInvocationContext() if idx == 6 or idx == 0 or idx == 3: menu.append(JMenuItem("Add as Issue to Scanner", None, actionPerformed=lambda x, c=caller: self.launchGui(c))) return menu if menu else None def getMatches(self, response, match): '''This finds our pattern match in the request/response and returns an int array''' start = 0 count = 0 matches = [array('i')] while start < len(response): start=self._helpers.indexOf(response, match, True, start, len(response)) if start == -1: break try: matches[count] except: matches.append(array('i')) matches[count].append(start) matches[count].append(start+len(match)) start += len(match) count += 1 return matches def logScanIssue(self, baseRequestResponse): '''This is redundant (mostly) of the doPassiveScan function''' reqPATTERN=self.reqPattern.text resPATTERN=self.resPattern.text ISSUE_NAME=self.issueNameField.text ISSUE_DETAIL=self.issueDetailField.text ISSUE_BACKGROUND=self.issueBackgroundField.text REMEDIATION_BACKGROUND=self.remediationBackgroundField.text REMEDIATION_DETAIL=self.remediationDetailField.text if self.radioBtnSevHigh.isSelected(): SEVERITY="High" elif self.radioBtnSevMedium.isSelected(): SEVERITY="Medium" else: SEVERITY="Low" CONFIDENCE="Certain" self._stdout = PrintWriter(self._callbacks.getStdout(), True) self._stdout.println('logScanIssue has been called') self._stdout.println('[-] ISSUE_NAME: ' + ISSUE_NAME) self._stdout.println('[-] ISSUE_DETAIL: ' + ISSUE_DETAIL) self._stdout.println('[-] ISSUE_BACKGROUND: ' + ISSUE_BACKGROUND) self._stdout.println('[-] REMEDIATION_DETAIL: ' + REMEDIATION_DETAIL) self._stdout.println('[-] REMEDIATION_BACKGROUND: ' + REMEDIATION_BACKGROUND) self._stdout.println('[-] SEVERITY: ' + SEVERITY) self._stdout.println('[-] CONFIDENCE: ' + CONFIDENCE) match = False if reqPATTERN == "": reqmatch = None else: reqmatch = self.getMatches(baseRequestResponse.getRequest(), reqPATTERN) match = True if resPATTERN == "": resmatch = None else: resmatch = self.getMatches(baseRequestResponse.getResponse(), resPATTERN) match = True if match: httpmsgs = [self._callbacks.applyMarkers(baseRequestResponse,reqmatch,resmatch)] issue=ScanIssue(baseRequestResponse.getHttpService(), self._helpers.analyzeRequest(baseRequestResponse).getUrl(), httpmsgs, ISSUE_NAME, ISSUE_DETAIL, SEVERITY, CONFIDENCE, ISSUE_BACKGROUND, REMEDIATION_DETAIL, REMEDIATION_BACKGROUND) self._callbacks.addScanIssue(issue) self.closeUI(None) return def launchGui(self, caller): self._stdout = PrintWriter(self._callbacks.getStdout(), True) self._stdout.println('Launching gui') callMessage = caller.getSelectedMessages() self.msg1 = callMessage[0] #setup frame self.frame = JFrame('Create Issue', windowClosing=self.closeUI) Border = BorderFactory.createLineBorder(Color.BLACK) #create split panel to add issue panel and template panel self.splitPane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT) self.frame.add(self.splitPane) #panel setup and add to splitPane self.issuePanel = JPanel(GridLayout(0,2)) self.splitPane.setLeftComponent(self.issuePanel) #setup issue name text fields to add to panel self.issueNameField = JTextField('',15) self.issueNameLabel = JLabel("IssueName:", SwingConstants.CENTER) self.issuePanel.add(self.issueNameLabel) self.issuePanel.add(self.issueNameField) #add issue detail text area self.issueDetailField = JTextArea() self.issueDetailField.editable = True self.issueDetailField.wrapStyleWord = True self.issueDetailField.lineWrap = True self.issueDetailField.alignmentX = Component.LEFT_ALIGNMENT self.issueDetailField.size = (200, 20) self.issueDetailField.setBorder(Border) self.idfSp = JScrollPane() self.idfSp.getViewport().setView((self.issueDetailField)) self.issuePanel.add(JLabel("Issue Detail:", SwingConstants.CENTER)) self.issuePanel.add(self.idfSp) self.issueBackgroundField= JTextArea() self.issueBackgroundField.editable = True self.issueBackgroundField.wrapStyleWord = True self.issueBackgroundField.lineWrap = True self.issueBackgroundField.alignmentX = Component.LEFT_ALIGNMENT self.issueBackgroundField.size = (200, 20) self.issueBackgroundField.setBorder(Border) self.ibfSp = JScrollPane() self.ibfSp.getViewport().setView((self.issueBackgroundField)) self.issuePanel.add(JLabel("Issue Background:", SwingConstants.CENTER)) self.issuePanel.add(self.ibfSp) #add remediation detail text area self.remediationDetailField = JTextArea() self.remediationDetailField.editable = True self.remediationDetailField.wrapStyleWord = True self.remediationDetailField.lineWrap = True self.remediationDetailField.alignmentX = Component.LEFT_ALIGNMENT self.remediationDetailField.size = (200, 20) self.remediationDetailField.setBorder(Border) self.rdfSp = JScrollPane() self.rdfSp.getViewport().setView((self.remediationDetailField)) self.issuePanel.add(JLabel("Remediation Detail:", SwingConstants.CENTER)) self.issuePanel.add(self.rdfSp) self.remediationBackgroundField= JTextArea() self.remediationBackgroundField.editable = True self.remediationBackgroundField.wrapStyleWord = True self.remediationBackgroundField.lineWrap = True self.remediationBackgroundField.alignmentX = Component.LEFT_ALIGNMENT self.remediationBackgroundField.size = (200, 20) self.remediationBackgroundField.setBorder(Border) self.rbfSp = JScrollPane() self.rbfSp.getViewport().setView((self.remediationBackgroundField)) self.issuePanel.add(JLabel("Remediation Background:", SwingConstants.CENTER)) self.issuePanel.add(self.rbfSp) #add radio buttons for severity self.radioBtnSevHigh = JRadioButton('High', actionPerformed=None) self.radioBtnSevMedium = JRadioButton('Medium', actionPerformed=None) self.radioBtnSevLow = JRadioButton('Low', actionPerformed=None) severityButtonGroup = ButtonGroup() severityButtonGroup.add(self.radioBtnSevHigh) severityButtonGroup.add(self.radioBtnSevMedium) severityButtonGroup.add(self.radioBtnSevLow) self.radioBtnSevHigh.setSelected(True) self.issuePanel.add(JLabel("Severity:", SwingConstants.CENTER)) self.issuePanel.add(self.radioBtnSevHigh) self.issuePanel.add(self.radioBtnSevMedium) self.issuePanel.add(self.radioBtnSevLow) self.reqPattern = JTextField('',15) self.issuePanel.add(JLabel("Mark Pattern in Request:", SwingConstants.CENTER)) self.issuePanel.add(self.reqPattern) self.resPattern = JTextField('',15) self.issuePanel.add(JLabel("Mark Pattern in Response:", SwingConstants.CENTER)) self.issuePanel.add(self.resPattern) #add a button self.issueButton = JButton('Add!', actionPerformed=lambda x, m=self.msg1: self.logScanIssue(m)) self.issuePanel.add(self.issueButton) #template panel setup self.templatePanel = JPanel(GridLayout(1,2)) self.splitPane.setRightComponent(self.templatePanel) #add a list of templates self.templatePanel.add(JLabel("Select from Templates", SwingConstants.CENTER)) self.templateData = tuple(self.tmpl.keys()) self.templateList = JList(self.templateData) self.templateScrollPane = JScrollPane() #self.templateScrollPane.setPreferredSize(Dimension(100,125)) self.templateScrollPane.getViewport().setView((self.templateList)) self.templatePanel.add(self.templateScrollPane) self.templateButton = JButton('Apply', actionPerformed=self.applyTemplate) self.templatePanel.add(self.templateButton) #pack up the frame and display it self.frame.pack() self.show() def applyTemplate(self, event): selected = self.templateList.selectedIndex if selected >= 0: self.issueNameField.text = self.tmpl[self.templateData[selected]]['name'] self.issueDetailField.text = self.tmpl[self.templateData[selected]]['idetail'] self.issueBackgroundField.text = self.tmpl[self.templateData[selected]]['ibackground'] self.remediationDetailField.text = self.tmpl[self.templateData[selected]]['rdetail'] self.remediationBackgroundField.text = self.tmpl[self.templateData[selected]]['rbackground'] def show(self): self.frame.visible = True def closeUI(self, event): self.frame.setVisible(False) self.frame.dispose()
class Process_EVTX1WithUISettingsPanel(IngestModuleIngestJobSettingsPanel): # Note, we can't use a self.settings instance variable. # Rather, self.local_settings is used. # https://wiki.python.org/jython/UserGuide#javabean-properties # Jython Introspector generates a property - 'settings' on the basis # of getSettings() defined in this class. Since only getter function # is present, it creates a read-only 'settings' property. This auto- # generated read-only property overshadows the instance-variable - # 'settings' # We get passed in a previous version of the settings so that we can # prepopulate the UI # TODO: Update this for your UI def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # TODO: Update this for your UI def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setSetting('All', 'true') else: self.local_settings.setSetting('All', 'false') if self.checkbox4.isSelected(): self.local_settings.setSetting('Other', 'true') self.local_settings.setSetting('Eventids', self.area.getText()) # self.local_settings.setFlag(False) # self.checkbox.setSelected(self.local_settings.getFlag()) else: self.local_settings.setSetting('Other', 'false') def keyPressed(self, event): self.local_settings.setArea('Eventids', self.area.getText()) # TODO: Update this for your UI def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Create Content View of Unique Event Id's", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox( "Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.text1 = JLabel( "*** Only run this once otherwise it adds it to the data again.") self.text2 = JLabel(" ") self.text3 = JLabel( "*** Format is a comma delimited text ie: 8001, 8002") self.panel1.add(self.checkbox) self.panel1.add(self.text1) self.panel1.add(self.text2) self.panel1.add(self.checkbox4) self.panel1.add(self.text3) self.add(self.panel1) self.area = JTextArea(5, 25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane) # TODO: Update this for your UI def customizeComponents(self): self.checkbox.setSelected( self.local_settings.getSetting('All') == 'true') self.checkbox4.setSelected( self.local_settings.getSetting('Other') == 'true') self.area.setText(self.local_settings.getSetting('Eventids')) # Return the settings used def getSettings(self): return self.local_settings
class GUI_PSQLiteUISettingsPanel(IngestModuleIngestJobSettingsPanel): # Note, we can't use a self.settings instance variable. # Rather, self.local_settings is used. # https://wiki.python.org/jython/UserGuide#javabean-properties # Jython Introspector generates a property - 'settings' on the basis # of getSettings() defined in this class. Since only getter function # is present, it creates a read-only 'settings' property. This auto- # generated read-only property overshadows the instance-variable - # 'settings' # We get passed in a previous version of the settings so that we can # prepopulate the UI # TODO: Update this for your UI def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # TODO: Update this for your UI def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setSetting('Flag', 'true') self.local_settings.setSetting('plists', self.area.getText()); else: self.local_settings.setSetting('Flag', 'false') # TODO: Update this for your UI def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Check to activate/deactivate TextArea", actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel("Input in SQLite DB's in area below,") self.label2 = JLabel("seperate values by commas.") self.label3 = JLabel("then check the box above.") self.label4 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.panel1.add(self.label3) self.panel1.add(self.label4) self.add(self.panel1) self.area = JTextArea(5,25) #self.area.getDocument().addDocumentListener(self.area) #self.area.addKeyListener(listener) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self.area) #self.add(self.area) self.add(self.pane) # TODO: Update this for your UI def customizeComponents(self): self.checkbox.setSelected(self.local_settings.getSetting('Flag') == 'true') self.area.setText(self.local_settings.getSetting('plists')) # Return the settings used def getSettings(self): return self.local_settings
class GUI_PSQLiteUISettingsPanel(IngestModuleIngestJobSettingsPanel): # Note, we can't use a self.settings instance variable. # Rather, self.local_settings is used. # https://wiki.python.org/jython/UserGuide#javabean-properties # Jython Introspector generates a property - 'settings' on the basis # of getSettings() defined in this class. Since only getter function # is present, it creates a read-only 'settings' property. This auto- # generated read-only property overshadows the instance-variable - # 'settings' # We get passed in a previous version of the settings so that we can # prepopulate the UI # TODO: Update this for your UI def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # TODO: Update this for your UI def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setFlag(True) self.local_settings.setArea(self.area.getText()) else: self.local_settings.setFlag(False) # TODO: Update this for your UI def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Check to activate/deactivate TextArea", actionPerformed=self.checkBoxEvent) self.label0 = JLabel(" ") self.label1 = JLabel("Input in SQLite DB's in area below,") self.label2 = JLabel("seperate values by commas.") self.label3 = JLabel("then check the box above.") self.label4 = JLabel(" ") self.panel1.add(self.checkbox) self.panel1.add(self.label0) self.panel1.add(self.label1) self.panel1.add(self.label2) self.panel1.add(self.label3) self.panel1.add(self.label4) self.add(self.panel1) self.area = JTextArea(5, 25) #self.area.getDocument().addDocumentListener(self.area) #self.area.addKeyListener(listener) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self.area) #self.add(self.area) self.add(self.pane) # TODO: Update this for your UI def customizeComponents(self): self.checkbox.setSelected(self.local_settings.getFlag()) # Return the settings used def getSettings(self): return self.local_settings
class Process_EVTX1WithUISettingsPanel(IngestModuleIngestJobSettingsPanel): # Note, we can't use a self.settings instance variable. # Rather, self.local_settings is used. # https://wiki.python.org/jython/UserGuide#javabean-properties # Jython Introspector generates a property - 'settings' on the basis # of getSettings() defined in this class. Since only getter function # is present, it creates a read-only 'settings' property. This auto- # generated read-only property overshadows the instance-variable - # 'settings' # We get passed in a previous version of the settings so that we can # prepopulate the UI # TODO: Update this for your UI def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # TODO: Update this for your UI def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setSetting('All', 'true') else: self.local_settings.setSetting('All', 'false') if self.checkbox4.isSelected(): self.local_settings.setSetting('Other', 'true') self.local_settings.setSetting('Eventids', self.area.getText()); # self.local_settings.setFlag(False) # self.checkbox.setSelected(self.local_settings.getFlag()) else: self.local_settings.setSetting('Other', 'false') def keyPressed(self, event): self.local_settings.setArea('Eventids', self.area.getText()) # TODO: Update this for your UI def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) #self.setLayout(GridLayout(0,1)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.panel1 = JPanel() self.panel1.setLayout(BoxLayout(self.panel1, BoxLayout.Y_AXIS)) self.panel1.setAlignmentY(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("Create Content View of Unique Event Id's", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox("Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) self.text1 = JLabel("*** Only run this once otherwise it adds it to the data again.") self.text2 = JLabel(" ") self.text3 = JLabel("*** Format is a comma delimited text ie: 8001, 8002") self.panel1.add(self.checkbox) self.panel1.add(self.text1) self.panel1.add(self.text2) self.panel1.add(self.checkbox4) self.panel1.add(self.text3) self.add(self.panel1) self.area = JTextArea(5,25) #self.area.addKeyListener(self) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.pane = JScrollPane() self.pane.getViewport().add(self.area) #self.pane.addKeyListener(self) #self.add(self.area) self.add(self.pane) # TODO: Update this for your UI def customizeComponents(self): self.checkbox.setSelected(self.local_settings.getSetting('All') == 'true') self.checkbox4.setSelected(self.local_settings.getSetting('Other') == 'true') self.area.setText(self.local_settings.getSetting('Eventids')) # Return the settings used def getSettings(self): return self.local_settings
class Process_EVTX1WithUISettingsPanel(IngestModuleIngestJobSettingsPanel): # Note, we can't use a self.settings instance variable. # Rather, self.local_settings is used. # https://wiki.python.org/jython/UserGuide#javabean-properties # Jython Introspector generates a property - 'settings' on the basis # of getSettings() defined in this class. Since only getter function # is present, it creates a read-only 'settings' property. This auto- # generated read-only property overshadows the instance-variable - # 'settings' # We get passed in a previous version of the settings so that we can # prepopulate the UI # TODO: Update this for your UI def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # TODO: Update this for your UI def checkBoxEvent(self, event): if self.checkbox.isSelected(): self.local_settings.setSetting('All', 'true') else: self.local_settings.setSetting('All', 'false') if self.checkbox1.isSelected(): self.local_settings.setSetting('Application', 'true') else: self.local_settings.setSetting('Application', 'false') if self.checkbox2.isSelected(): self.local_settings.setSetting('Security', 'true') else: self.local_settings.setSetting('Security', 'false') if self.checkbox3.isSelected(): self.local_settings.setSetting('System', 'true') else: self.local_settings.setSetting('System', 'false') if self.checkbox4.isSelected(): self.local_settings.setSetting('Other', 'true') self.area.setEnabled(True) else: self.local_settings.setSetting('Other', 'false') self.area.setEnabled(False) if self.filterCheckbox.isSelected(): self.local_settings.setSetting('Filter', 'true') self.filterField.setEnabled(True) self.filterSelector.setEnabled(True) self.filterInput.setEnabled(True) else: self.local_settings.setSetting('Filter', 'false') self.filterField.setEnabled(False) self.filterSelector.setEnabled(False) self.filterInput.setEnabled(False) if self.sortCheckbox.isSelected(): self.local_settings.setSetting('SortDesc', 'true') else: self.local_settings.setSetting('SortDesc', 'false') def keyPressed(self, event): self.local_settings.setSetting('EventLogs', self.area.getText()) # TODO: Update this for your UI def initComponents(self): self.setLayout(BoxLayout(self, BoxLayout.Y_AXIS)) self.setAlignmentX(JComponent.LEFT_ALIGNMENT) self.checkbox = JCheckBox("All Logs", actionPerformed=self.checkBoxEvent) self.checkbox1 = JCheckBox("Application.Evtx", actionPerformed=self.checkBoxEvent) self.checkbox2 = JCheckBox("Security.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox3 = JCheckBox("System.EVTX", actionPerformed=self.checkBoxEvent) self.checkbox4 = JCheckBox( "Other - Input in text area below then check this box", actionPerformed=self.checkBoxEvent) # Scrollable text area for additional log names self.area = JTextArea(3, 10) self.area.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)) self.area.setEnabled(False) self.pane = JScrollPane() self.pane.getViewport().add(self.area) self.add(self.checkbox) self.add(self.checkbox1) self.add(self.checkbox2) self.add(self.checkbox3) self.add(self.checkbox4) self.add(self.pane) self.add(JSeparator()) self.add(JSeparator()) self.filterCheckbox = JCheckBox("Filter", actionPerformed=self.checkBoxEvent) self.filterCheckbox.setLayout( BoxLayout(self.filterCheckbox, BoxLayout.X_AXIS)) self.add(self.filterCheckbox) self.filterPanel = JPanel() self.filterPanel.setLayout( BoxLayout(self.filterPanel, BoxLayout.X_AXIS)) self.filterField = JComboBox([ "Computer Name", "Event Identifier", "Event Level", "Source Name", "Event Detail" ]) self.filterField.setEnabled(False) self.filterField.setMaximumSize(self.filterField.getPreferredSize()) self.filterSelector = JComboBox( ["equals", "not equals", "contains", "starts with", "ends with"]) self.filterSelector.setEnabled(False) self.filterSelector.setMaximumSize( self.filterSelector.getPreferredSize()) self.filterInput = JTextField() self.filterInput.setEnabled(False) self.filterInput.setMaximumSize( Dimension(512, self.filterInput.getPreferredSize().height)) self.filterPanel.add(self.filterField) self.filterPanel.add(self.filterSelector) self.filterPanel.add(self.filterInput) self.add(self.filterPanel) self.sortCheckbox = JCheckBox("Sort Event Counts Descending", actionPerformed=self.checkBoxEvent) self.add(self.sortCheckbox) # TODO: Update this for your UI def customizeComponents(self): self.checkbox.setSelected( self.local_settings.getSetting('All') == 'true') self.checkbox1.setSelected( self.local_settings.getSetting('Application') == 'true') self.checkbox2.setSelected( self.local_settings.getSetting('Security') == 'true') self.checkbox3.setSelected( self.local_settings.getSetting('System') == 'true') self.checkbox4.setSelected( self.local_settings.getSetting('Other') == 'true') self.area.setText(self.local_settings.getSetting('EventLogs')) # Return the settings used def getSettings(self): self.local_settings.setSetting('EventLogs', self.area.getText()) self.local_settings.setSetting('FilterField', self.filterField.getSelectedItem()) self.local_settings.setSetting('FilterMode', self.filterSelector.getSelectedItem()) self.local_settings.setSetting('FilterInput', self.filterInput.getText()) return self.local_settings
def initUI(self): self.panel = JPanel() self.panel.setLayout(GridLayout(6, 3)) self.panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)) labelVacio1 = JLabel(' ') labelVacio2 = JLabel(' ') labelVacio3 = JLabel(' ') labelVacio4 = JLabel(' ') labelVacio5 = JLabel(' ') labelVacio6 = JLabel(' ') labelVacio7 = JLabel(' ') labelVacio8 = JLabel(' ') labelVacio9 = JLabel(' ') labelVacio10 = JLabel(' ') labelVacio11 = JLabel(' ') labelVacio12 = JLabel(' ') labelVacio13 = JLabel(' ') labelVacio14 = JLabel(' ') labelVacio15 = JLabel(' ') labelVacio16 = JLabel(' ') labelURL = JLabel(' Introduzca las URL que desee analizar:') chkboxSync = JCheckBox('Sincronizacion de cookies') self.textfieldURL = JTextField(15) chkboxResp = JCheckBox('Restauracion de cookies') labelFichero = JLabel(' O seleccione un fichero que las contenga:') self.area = JTextArea() pane = JScrollPane() pane.getViewport().add(self.area) panelFichero = JPanel() panelFichero.setLayout(None) buttonFichero = JButton("Seleccionar fichero", actionPerformed=self.open) buttonFichero.setBounds(10, 0, 200, 25) panelFichero.add(buttonFichero) buttonEjecutar = JButton("Ejecutar", actionPerformed=self.ejecutar) buttonEjecutar.setFont(Font("Tahoma", Font.BOLD, 24)) self.panel.add(labelURL) self.panel.add(labelVacio4) self.panel.add(chkboxSync) self.panel.add(self.textfieldURL) self.panel.add(labelVacio6) self.panel.add(chkboxResp) self.panel.add(labelFichero) self.panel.add(labelVacio9) self.panel.add(labelVacio10) self.panel.add(pane) self.panel.add(panelFichero) #self.panel.add(buttonFichero) self.panel.add(labelVacio11) self.panel.add(labelVacio12) self.panel.add(labelVacio13) self.panel.add(labelVacio14) self.panel.add(labelVacio15) self.panel.add(buttonEjecutar) self.panel.add(labelVacio16) self.add(self.panel) self.setTitle( "HERRAMIENTA PARA LA DETECCION DE TECNICAS DE SEGUIMIENTO DE USUARIOS EN LA WEB" ) self.setSize(1000, 450) self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setLocationRelativeTo(None) self.setVisible(True)
# jDescription.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); jDescription.setEditable(0) def exitme(event): frame.dispose() jB2 = JButton("Exit", actionPerformed=exitme) lowerPanel.add(jB2); topPanel.setLayout(BorderLayout()); # comments jScrollPane1 = JScrollPane(); jScrollPane1.getViewport().add( jDescription ); topPanel.add(jScrollPane1,BorderLayout.CENTER); jDescription.setLineWrap(1); jDescription.setWrapStyleWord(1); jDescription.setCaretColor(Color.red); frame.add( topPanel, BorderLayout.CENTER ); frame.add( lowerPanel, BorderLayout.SOUTH ); bounds = view.getBounds() ww = bounds.width hh= bounds.height xx = bounds.x yy = bounds.y