def __init__(self, parent): self._parent = parent self.setTitle("Select Parameters/Headers for new Session") print "IN DIALOG!Q!!" self.table = JTable() columns = ["Use", "Type", "Name", "Value"] data = [] headers = self._parent._extender.headers parameters = self._parent._extender.parameters for header in headers[1:]: name, val = header.split(": ") data.append([self.should_use(name), "Header", name, val]) for param in parameters: data.append([self.should_use(param.getName()), Parameter.type_mapping[param.getType()], param.getName(), param.getValue()]) class CheckBoxTableModel(DefaultTableModel): def getColumnClass(self, x): if x == 0: return Boolean else: return String data_model = CheckBoxTableModel(data, columns) self.table.setModel(data_model) self.table.getColumnModel().getColumn(0).setMaxWidth(30) self.table.getColumnModel().getColumn(1).setMaxWidth(50) gridBagLayout = GridBagLayout() gridBagLayout.columnWidths = [ 0, 0, 0] gridBagLayout.rowHeights = [0, 0, 0] gridBagLayout.columnWeights = [0.0, 0.0, 0.0] gridBagLayout.rowWeights = [0.0, 1.0, 0.0] self.setLayout(gridBagLayout) self.getContentPane().add(JLabel("Select Parameters/Headers for new session:"), _new_grid_bag(0, 0, 3)) self.getContentPane().add(JScrollPane(self.table), _new_grid_bag(0, 1, 3)) self.getContentPane().add(JButton("Save", actionPerformed=self.save), _new_grid_bag(1, 2)) self.pack() self.setVisible(True)
def __init__(self, extender, controller, editable): self._extender = extender self._panel = JPanel() # main panel # type combobox for tables self._types = Parameter.type_mapping.values() + ["- Remove Row -"] self._actions = ["replace", "insert", "delete"] # define the GridBagLayout ( 4x4 ) gridBagLayout = GridBagLayout() gridBagLayout.columnWidths = [ 0, 0, 0, 0] gridBagLayout.rowHeights = [0, 0, 0, 0] gridBagLayout.columnWeights = [1.0, 0.0, 0.0, 0.0] gridBagLayout.rowWeights = [0.0, 1.0, 5.0, 0.0] self._panel.setLayout(gridBagLayout) # JComboBox for Session selection self._session_selector = JComboBox(extender.sm.sessions, itemStateChanged=self.changeSession) self._session_selector_model = self._session_selector.getModel() gbc_session_selector = _new_grid_bag(0, 0) self._panel.add(self._session_selector, gbc_session_selector) # "Delete Session" Button del_session = JButton("Delete Session", actionPerformed=self.deleteSession) gbc_del_session = _new_grid_bag(1, 0) self._panel.add(del_session, gbc_del_session) # "New Session" Button new_session = JButton("New Session", actionPerformed=self.new_session) gbc_new_session = _new_grid_bag(2, 0) self._panel.add(new_session, gbc_new_session) # Table containing modified parameters self.modification_table = JTable() self.update_table() gbc_modification_table = _new_grid_bag(0, 1, 3) self._panel.add(JScrollPane(self.modification_table), gbc_modification_table) self.modification_table.setPreferredScrollableViewportSize(self.modification_table.getPreferredSize()); self.modification_table.setFillsViewportHeight(True) # HTTP message editor self._editor = self._extender.callbacks.createTextEditor() gbc_messageEditor = _new_grid_bag(0, 2, 3) self._panel.add(self._editor.getComponent(), gbc_messageEditor)
def __init__(self): self.myParent = None self.setBounds(self.getDefaultFrameBounds()) self.setLayout(GridBagLayout()) self.table = self.__initTable() self.__initDropDownBox(self.table) #self.__initRadioCaseCmd() ui.dock(self)
def __setupLayout(self): self.setLayout(GridBagLayout()) constr = GridBagConstraints() constr.weighty = 1 constr.weightx = 1 constr.gridx = 0 constr.gridy = 1 constr.fill = GridBagConstraints.BOTH return constr
def __init__(self, callbacks): self._callbacks = callbacks self.tab = JPanel(GridBagLayout()) about_constraints = GridBagConstraints() about_author = (("<html><center><h2>SpyDir</h2><b>Version:</b> " "%s<br/>Created by: <em>Ryan Reid</em>" " (@_aur3lius)<br/>https://github.com/aur3lius-dev/" "SpyDir</center><br/>") % VERSION) about_spydir = """<em><center> SpyDir is an extension that assists in the enumeration of application<br/> endpoints via an input directory containing the application's<br/> source code. It provides an option to process files as endpoints,<br/> think: ASP, PHP, HTML, or parse files to attempt to enumerate<br/> endpoints via plugins, think: MVC. Users may opt to send the<br/> discovered endpoints directly to the Burp Spider. </center></em><br/> This tool is in <b>Alpha</b>! <b>Please</b> provide feedback on the GitHub page!<br/><br/>""" getting_started = """<b>Getting started:</b><br/> <ul> <li>Add a local source repository</li> <li>Add the target URL</li> <li>Use the String delimiter to construct the appropriate directory path (if necessary)</li> <li>Alternatively, parse each file by selecting plugins and checking the checkbox</li> <li>Explicitly define the file extensions to process</li> <li>Parse the directory</li> <li>Verify output is correct <b>before</b> sending to spider</li> <li>Send requests to the Burp Spider</li> </ul> """ advanced_info = r"""<html><b>String Delimiter</b><br/> String Delimiter allows us to append the necessary section of the folder structure.<br/> Suppose the target application is hosted at the following URL: https://localhost:8080. <br/>The target code base is stored in: 'C:\Source\TestApp'. <br/>Within the TestApp folder there is a subfolder, 'views', with static .html files.<br/> In this case the String Delimiter will need to equal 'TestApp'. <br/>With the expectation that the tool will produce an example URL will such as:<br/>https://localhost:8080/views/view1.html.<br/> <b>Note:</b> String Delimiter is ignored if parsing files using plugins! </html>""" about_constraints.anchor = GridBagConstraints.FIRST_LINE_START about_constraints.weightx = 1.0 about_constraints.weighty = 1.0 self.tab.add(JLabel("%s\n%s\n%s\n%s" % (about_author, about_spydir, getting_started, advanced_info)), about_constraints)
def __init__(self): self.running = True menuBar = JMenuBar() menu = JMenu("File") menu.add(OpenAction(self)) menu.add(CloseAction(self)) menu.addSeparator() menu.add(QuitAction(self)) self.addWindowListener(ProfelisWindowAdapter(self)) menuBar.add(menu) self.setJMenuBar(menuBar) self.contentPane = JPanel() self.contentPane.layout = GridBagLayout() constraints = GridBagConstraints() self.blastLocation = JTextField( System.getProperty("user.home") + "/blast") self.databaseLocation = JTextField( System.getProperty("user.home") + "/blast/db") self.projects = JTabbedPane() constraints.gridx, constraints.gridy = 0, 0 constraints.gridwidth, constraints.gridheight = 1, 1 constraints.fill = GridBagConstraints.NONE constraints.weightx, constraints.weighty = 0, 0 self.contentPane.add(JLabel("Blast Location"), constraints) constraints.gridx, constraints.gridy = 1, 0 constraints.fill = GridBagConstraints.HORIZONTAL constraints.weightx, constraints.weighty = 1, 0 self.contentPane.add(self.blastLocation, constraints) constraints.gridx, constraints.gridy = 2, 0 constraints.fill = GridBagConstraints.NONE constraints.weightx, constraints.weighty = 0, 0 self.contentPane.add(JButton(BlastAction(self)), constraints) constraints.gridx, constraints.gridy = 3, 0 constraints.fill = GridBagConstraints.NONE constraints.weightx, constraints.weighty = 0, 0 self.contentPane.add(JLabel("Database Location"), constraints) constraints.gridx, constraints.gridy = 4, 0 constraints.fill = GridBagConstraints.HORIZONTAL constraints.weightx, constraints.weighty = 1, 0 self.contentPane.add(self.databaseLocation, constraints) constraints.gridx, constraints.gridy = 5, 0 constraints.fill = GridBagConstraints.NONE constraints.weightx, constraints.weighty = 0, 0 self.contentPane.add(JButton(DatabaseAction(self)), constraints) constraints.gridx, constraints.gridy = 0, 1 constraints.gridwidth, constraints.gridheight = 6, 1 constraints.fill = GridBagConstraints.BOTH constraints.weightx, constraints.weighty = 1, 1 self.contentPane.add(self.projects, constraints)
def makeUI(model): # Components: table = JTable(model) jsp = JScrollPane(table) regex_label = JLabel("Search: ") regex_field = JTextField(20) base_path_label = JLabel("Base path:") base_path_field = JTextField(50) if base_path is not None: base_path_field.setText(base_path) # Panel for all components all = JPanel() all.setBorder(EmptyBorder(20, 20, 20, 20)) layout, c = GridBagLayout(), GC() all.setLayout(layout) # First row: label and regex text field add(all, regex_label, gridx=0, gridy=0) # with default constraints add(all, regex_field, gridx=1, gridy=0, fill=GC.HORIZONTAL, weightx=1.0) # Second row: the table add(all, jsp, gridx=0, gridy=1, fill=GC.BOTH, gridwidth=2, weightx=1.0, weighty=1.0) # full weights so it stretches when resizing # Third row: the base path add(all, base_path_label, gridx=0, gridy=2) add(all, base_path_field, gridx=1, gridy=2, fill=GC.HORIZONTAL, weightx=1.0) # Window frame frame = JFrame("File paths") frame.getContentPane().add(all) #frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) frame.addWindowListener(Closing()) frame.pack() frame.setVisible(True) # Listeners regex_field.addKeyListener(EnterListener(table)) table.addMouseListener(RowClickListener(base_path_field)) al = ArrowListener(table, regex_field) table.addKeyListener(al) regex_field.addKeyListener(al) # Instead of a KeyListener, use the input vs action map table.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter") table.getActionMap().put("enter", OpenImageFromTableCell()) # return model, table, regex_field, frame
def __init__(self): JPanel.__init__(self) self.setLayout(GridBagLayout()) self.setBorder(TitledBorder("Channel")) # some helper constants REL = GridBagConstraints.RELATIVE REM = GridBagConstraints.REMAINDER HORIZ = GridBagConstraints.HORIZONTAL NW = GridBagConstraints.NORTHWEST CENTER = GridBagConstraints.CENTER # --- title label = JLabel("Title:") self.constrain(label, REL, REL, REL, 1, HORIZ, CENTER, 1.0, 1.0, 2, 2, 2, 2) self.field_title = JTextField() self.field_title.setEditable(0) self.constrain(self.field_title, REL, REL, REM, 1, HORIZ, CENTER, 1.0, 1.0, 2, 2, 2, 2) # --- description label = JLabel("Description:") self.constrain(label, REL, REL, REL, 1, HORIZ, NW, 1.0, 1.0, 2, 2, 2, 2) self.field_descr = JTextArea(3, 40) self.field_descr.setEditable(0) # wrap long lines self.field_descr.setLineWrap(1) # allow only full words to be wrapped self.field_descr.setWrapStyleWord(1) # ensure that the border look is the same self.field_descr.setBorder(self.field_title.getBorder()) self.constrain(self.field_descr, REL, REL, REM, 1, HORIZ, NW, 1.0, 1.0, 2, 2, 2, 2) # --- location label = JLabel("Location:") self.constrain(label, REL, REL, REL, 1, HORIZ, NW, 1.0, 1.0, 2, 2, 2, 2) self.field_location = JTextField() self.constrain(self.field_location, REL, REL, REM, REL, HORIZ, NW, 1.0, 1.0, 2, 2, 2, 2) # --- last update label = JLabel("Last Update:") self.constrain(label, REL, REL, REL, REM, HORIZ, NW, 1.0, 1.0, 2, 2, 2, 2) self.field_lastupdate = JTextField() self.field_lastupdate.setEditable(0) self.constrain(self.field_lastupdate, REL, REL, REM, REM, HORIZ, NW, 1.0, 1.0, 2, 2, 2, 2)
def build_general_panel(self): ''' Create the panel that'll go in the General tab. This should contain options for choosing which server to use for validation as well as default working dir. ''' panel = JPanel(GridBagLayout()) constraints = GridBagConstraints() constraints.insets = Insets(10, 10, 10, 10) panel = self.build_working_dir_panel(constraints, panel) panel = self.build_servers_panel(constraints, panel) return panel
def initComponents(self): self.setLayout(GridBagLayout()) gc = GridBagConstraints() gc.weightx = 1 gc.weighty = 1 # First Row gc.gridy = 0 gc.weightx = 1 gc.weighty = 0.1 gc.gridx = 0 gc.fill = GridBagConstraints.NONE gc.anchor = GridBagConstraints.LINE_END gc.insets = Insets(0, 0, 0, 5) self.add(self.usernameLabel, gc) gc.gridx = 1 gc.anchor = GridBagConstraints.LINE_START gc.insets = Insets(0, 0, 0, 0) self.add(self.usernameField, gc) # Second Row gc.gridy += 1 gc.weightx = 1 gc.weighty = 0.1 gc.gridx = 0 gc.anchor = GridBagConstraints.LINE_END gc.insets = Insets(0, 0, 0, 5) self.add(self.superPassLabel, gc) gc.gridx = 1 gc.anchor = GridBagConstraints.LINE_START gc.insets = Insets(0, 0, 0, 0) self.add(self.superPassField, gc) #Next Row gc.gridy += 1 gc.weightx = 1 gc.weighty = 2.0 gc.gridx = 1 gc.anchor = GridBagConstraints.FIRST_LINE_START self.add(self.deleteAdminBtn, gc) innerBorder = BorderFactory.createTitledBorder('Delete Admin') outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5) self.setBorder( BorderFactory.createCompoundBorder(outerBorder, innerBorder))
def __initTable(self): ''' construct the test case table ''' self.model = TestCaseModel(self.testcases) self.table = TestCaseTable(self.model, self.testcases) self.scrollpane = JScrollPane(self.table) self.setLayout(GridBagLayout()) self.constr = GridBagConstraints() self.constr.weighty = 1 self.constr.weightx = 1 self.constr.gridx = 0 self.constr.gridy = 1 self.constr.fill = GridBagConstraints.BOTH self.add(self.scrollpane,self.constr)
def __init__(self): # Make the frame and set its properties self.frame = JFrame( "File Translator", defaultCloseOperation=WindowConstants.EXIT_ON_CLOSE, layout=GridBagLayout()) self.frame.setSize(1200, 800) # Make a GridBagLayout for this frame gridbag = GridBagLayout() constraints = GridBagConstraints() constraints.fill = GridBagConstraints.CENTER # Make sure to have a panel to hold everything self.loginPanel = JPanel(GridLayout(0, 2)) self.frame.add(self.loginPanel) gridbag.setConstraints(self.loginPanel, constraints) self.loginPanel.setLayout(gridbag) # Entry for the path self.usernameField = JTextField('', 30) self.loginPanel.add(JLabel("username:"******"password:")) self.loginPanel.add(self.textField) # Make a button to enter the information self.loginButton = JButton('Enter', actionPerformed=enter_button) self.loginPanel.add(self.loginButton) self.frame.add(self.loginPanel) # Make everything visible and make sure it starts at centre of screen self.frame.pack() self.frame.setLocationRelativeTo(None) self.frame.setVisible(True)
def _constructAboutPanel(self, insets): aboutPanel = JPanel(GridBagLayout()) with open("about.html") as file: aboutBody = file.read() aboutLabel = JLabel(aboutBody.format(extension_name=EXTENSION_NAME)) aboutLabelConstraints = GridBagConstraints() aboutLabelConstraints.weightx = 1 aboutLabelConstraints.weighty = 1 aboutLabelConstraints.insets = insets aboutLabelConstraints.fill = GridBagConstraints.HORIZONTAL aboutLabelConstraints.anchor = GridBagConstraints.PAGE_START aboutPanel.add(aboutLabel, aboutLabelConstraints) return aboutPanel
def compose_ui(self, components): panel = JPanel() panel.setLayout(GridBagLayout()) constraints= GridBagConstraints() constraints.fill = GridBagConstraints.HORIZONTAL constraints.insets = Insets(2, 1, 2, 1) for i in components: for j in components[i]: constraints.gridy, constraints.gridx = i, j constraints.gridwidth = components[i][j]['width'] if type(components[i][j]) == dict and 'width' in components[i][j] else 1 constraints.gridheight = components[i][j]['height'] if type(components[i][j]) == dict and 'height' in components[i][j] else 1 item = components[i][j]['item'] if type(components[i][j]) == dict and 'item' in components[i][j] else components[i][j] panel.add(item, constraints) return panel
def build_appearance_panel(self): ''' Create the panel that'll go in the General tab. This should contain options for choosing which server to use for validation as well as default working dir. ''' panel = JPanel(GridBagLayout()) constraints = self.add_constraints(GridBagConstraints(), insets=Insets(10, 10, 10, 10)) self.build_console_font_panel(constraints, panel) self.build_console_font_color_panel(constraints, panel) self.build_console_background_color_panel(constraints, panel) self.build_edit_area_font_panel(constraints, panel) return panel
def addComponents(self, container): container.setLayout(GridBagLayout()) names = '1,2,3 being the third number'.split(',') for col in range(len(names)): c = GridBagConstraints() c.gridx = col # gridx is the grid column c.gridy = col # gridy is the grid row # container.add(JButton(names[col]), c) c = GridBagConstraints() c.gridx = 1 c.gridy = 3 # put this one on the next row c.ipady = 32 # make this one taller container.add(JButton('Four shalt thou not count'), c)
def __init__(self, title=None, padding=50): super(DualForm, self).__init__() self._fields = OrderedDict() self.setLayout(GridBagLayout()) etched_border = createEtchedBorder(1) if title is not None: title_border = createTitledBorder(etched_border, title) title_border.setTitlePosition(2) title_border.setTitleJustification(2) self.setBorder(title_border) else: self.setBorder(etched_border) self.setAlignmentX(JPanel.LEFT_ALIGNMENT)
def initializeDisplay(self, queries, swing): """ queries: A list of the fasts files to be processed. swing: If true then updates about progress will be displayed in a swing window, otherwise they will be written to stdout. Initializes the interface for telling the user about progress in the pipeline. Queries is used to count the number of queries the pipeline will process and to size the swing display(if it is used) so that text isn't cutoff at the edge of the window. The swing display is setup if swing is true. """ self.numJobs = len(queries) if swing: self.frame = JFrame("Neofelis") self.frame.addWindowListener(PipelineWindowAdapter(self)) contentPane = JPanel(GridBagLayout()) self.frame.setContentPane(contentPane) self.globalLabel = JLabel(max(queries, key=len)) self.globalProgress = JProgressBar(0, self.numJobs) self.currentLabel = JLabel(max(self.messages, key=len)) self.currentProgress = JProgressBar(0, len(self.messages)) self.doneButton = JButton(DoneAction(self.frame)) self.doneButton.setEnabled(False) constraints = GridBagConstraints() constraints.gridx, constraints.gridy = 0, 0 constraints.gridwidth, constraints.gridheight = 1, 1 constraints.weightx = 1 constraints.fill = GridBagConstraints.HORIZONTAL contentPane.add(self.globalLabel, constraints) constraints.gridy = 1 contentPane.add(self.globalProgress, constraints) constraints.gridy = 2 contentPane.add(self.currentLabel, constraints) constraints.gridy = 3 contentPane.add(self.currentProgress, constraints) constraints.gridy = 4 constraints.weightx = 0 constraints.fill = GridBagConstraints.NONE constraints.anchor = GridBagConstraints.LINE_END contentPane.add(self.doneButton, constraints) self.frame.pack() self.frame.setResizable(False) self.globalLabel.setText(" ") self.currentLabel.setText(" ") self.frame.setLocationRelativeTo(None) self.frame.setVisible(True)
def __init__(self, parent): self._parent = parent self.setTitle("Select Parameters/Headers for new Session") print "IN DIALOG!Q!!" self.table = JTable() columns = ["Use", "Type", "Name", "Value"] data = [] headers = self._parent._extender.headers parameters = self._parent._extender.parameters for header in headers[1:]: name, val = header.split(": ") data.append([self.should_use(name), "Header", name, val]) for param in parameters: data.append([ self.should_use(param.getName()), Parameter.type_mapping[param.getType()], param.getName(), param.getValue() ]) class CheckBoxTableModel(DefaultTableModel): def getColumnClass(self, x): if x == 0: return Boolean else: return String data_model = CheckBoxTableModel(data, columns) self.table.setModel(data_model) self.table.getColumnModel().getColumn(0).setMaxWidth(30) self.table.getColumnModel().getColumn(1).setMaxWidth(50) gridBagLayout = GridBagLayout() gridBagLayout.columnWidths = [0, 0, 0] gridBagLayout.rowHeights = [0, 0, 0] gridBagLayout.columnWeights = [0.0, 0.0, 0.0] gridBagLayout.rowWeights = [0.0, 1.0, 0.0] self.setLayout(gridBagLayout) self.getContentPane().add( JLabel("Select Parameters/Headers for new session:"), _new_grid_bag(0, 0, 3)) self.getContentPane().add(JScrollPane(self.table), _new_grid_bag(0, 1, 3)) self.getContentPane().add(JButton("Save", actionPerformed=self.save), _new_grid_bag(1, 2)) self.pack() self.setVisible(True)
def __initTable(self): ''' Construct the smell information table and add it ''' self.model = SmellIdentiKitModel() self.table = SmellIdentiKitTable(self.model, self.metricDict) self.listener = SelectionListener(self.table) self.table.getSelectionModel().addListSelectionListener(self.listener) self.table.getColumnModel().getSelectionModel().addListSelectionListener(self.listener) self.scrollpane = JScrollPane(self.table) self.setLayout(GridBagLayout()) self.constr = GridBagConstraints() self.constr.fill = GridBagConstraints.BOTH self.constr.weighty = 1 self.constr.weightx = 1 self.constr.gridx = 0 self.constr.gridy = 1 self.add(self.scrollpane,self.constr)
def tagLoad(self): # 创建窗口 开始 self.tabs = JTabbedPane() self.scan_type_settings = JPanel(GridBagLayout()) c = GridBagConstraints() # 界面选项卡加载 self.tag_1(c) self.tag_2(c) # 添加选项卡 self.tabs.addTab(u'扫描类型设置', self.scan_type_settings) self._callbacks.customizeUiComponent(self.tabs) self._callbacks.addSuiteTab(self)
def create_gui(): global dropdown, current_file frame = JFrame('', defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE, size = (400, 150)); frame.setBounds(350,350,400,150); container_panel = JPanel(GridBagLayout()); c = GridBagConstraints(); dropdown = JComboBox(list(img_paths.keys())); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 0.5; c.gridwidth = 3; container_panel.add(dropdown, c); add_file_button = JButton('<html>Add Image/File</html>', actionPerformed=select_file); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 3; c.gridy = 0; c.weightx = 0.5; c.gridwidth = 1; container_panel.add(add_file_button, c); process_file_button = JButton('<html>Process Selected Image</html>', actionPerformed=process_current_img); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 1; c.weightx = 0.5; c.gridwidth = 2; container_panel.add(process_file_button, c); process_all_button = JButton('<html>Process Entire Stack</html>', actionPerformed=process_stack); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 2; c.gridy = 1; c.weightx = 0.5; c.gridwidth = 2; container_panel.add(process_all_button, c); current_file = dropdown.getSelectedItem(); frame.add(container_panel); frame.visible = True;
def addComponents( self, container ) : container.setLayout( GridBagLayout() ) c = GridBagConstraints() # Start with the default constraints print '\n default constraints:' print ' gridx:', c.gridx print ' gridy:', c.gridx print ' gridwidth:', c.gridwidth print 'gridheight:', c.gridheight print ' weightx:', c.weightx print ' weighty:', c.weighty print ' anchor:', c.anchor print ' fill:', c.fill print ' insets:', c.insets print ' ipadx:', c.ipadx print ' ipady:', c.ipady for name in '1,2,3 being the third number'.split( ',' ) : container.add( JButton( name ) )
def __init__(self, extender, controller, editable): self._extender = extender self._panel = JPanel() # main panel # type combobox for tables self._types = Parameter.type_mapping.values() + ["- Remove Row -"] self._actions = ["replace", "insert", "delete"] # define the GridBagLayout ( 4x4 ) gridBagLayout = GridBagLayout() gridBagLayout.columnWidths = [0, 0, 0, 0] gridBagLayout.rowHeights = [0, 0, 0, 0] gridBagLayout.columnWeights = [1.0, 0.0, 0.0, 0.0] gridBagLayout.rowWeights = [0.0, 1.0, 5.0, 0.0] self._panel.setLayout(gridBagLayout) # JComboBox for Session selection self._session_selector = JComboBox(extender.sm.sessions, itemStateChanged=self.changeSession) self._session_selector_model = self._session_selector.getModel() gbc_session_selector = _new_grid_bag(0, 0) self._panel.add(self._session_selector, gbc_session_selector) # "Delete Session" Button del_session = JButton("Delete Session", actionPerformed=self.deleteSession) gbc_del_session = _new_grid_bag(1, 0) self._panel.add(del_session, gbc_del_session) # "New Session" Button new_session = JButton("New Session", actionPerformed=self.new_session) gbc_new_session = _new_grid_bag(2, 0) self._panel.add(new_session, gbc_new_session) # Table containing modified parameters self.modification_table = JTable() self.update_table() gbc_modification_table = _new_grid_bag(0, 1, 3) self._panel.add(JScrollPane(self.modification_table), gbc_modification_table) self.modification_table.setPreferredScrollableViewportSize( self.modification_table.getPreferredSize()) self.modification_table.setFillsViewportHeight(True) # HTTP message editor self._editor = self._extender.callbacks.createTextEditor() gbc_messageEditor = _new_grid_bag(0, 2, 3) self._panel.add(self._editor.getComponent(), gbc_messageEditor)
def _constructResultsPanel(self, insets): resultsPanel = JPanel(GridBagLayout()) self._progressBar = JProgressBar() self._progressBar.setStringPainted(True) self._progressBar.setMinimum(0) progressBarContraints = GridBagConstraints() progressBarContraints.gridx = 0 progressBarContraints.gridy = 0 progressBarContraints.fill = GridBagConstraints.HORIZONTAL resultsPanel.add(self._progressBar, progressBarContraints) self._resultsTableModel = ResultsTableModel(COLUMNS, 0) resultsTable = JTable(self._resultsTableModel) resultsTable.setAutoCreateRowSorter(True) cellRenderer = ColoredTableCellRenderer() for index in [5, 6, 7, 8, 9]: column = resultsTable.columnModel.getColumn(index) column.cellRenderer = cellRenderer resultsTable.getColumnModel().getColumn(0).setPreferredWidth(99999999) resultsTable.getColumnModel().getColumn(1).setMinWidth(160) resultsTable.getColumnModel().getColumn(2).setMinWidth(100) resultsTable.getColumnModel().getColumn(3).setMinWidth(80) resultsTable.getColumnModel().getColumn(4).setMinWidth(80) resultsTable.getColumnModel().getColumn(5).setMinWidth(110) resultsTable.getColumnModel().getColumn(6).setMinWidth(110) resultsTable.getColumnModel().getColumn(7).setMinWidth(90) resultsTable.getColumnModel().getColumn(8).setMinWidth(110) resultsTable.getColumnModel().getColumn(9).setMinWidth(110) resultsTable.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS) resultsScrollPane = JScrollPane(resultsTable) resultsScrollPaneConstraints = GridBagConstraints() resultsScrollPaneConstraints.gridx = 0 resultsScrollPaneConstraints.gridy = 1 resultsScrollPaneConstraints.weightx = 1 resultsScrollPaneConstraints.weighty = 1 resultsScrollPaneConstraints.fill = GridBagConstraints.BOTH resultsPanel.add(resultsScrollPane, resultsScrollPaneConstraints) return resultsPanel
def __init__(self, view, sys): JDialog.__init__(self, view, jEdit.getProperty("jython.pathhandler.title")) self.sys = sys content = self.contentPane content.layout = BorderLayout() upperPanel = JPanel(BorderLayout()) leftPanel = JPanel(BorderLayout(), border = \ BorderFactory.createTitledBorder(jEdit.getProperty("jython.pathhandler.pathborder"))) self.model = DefaultListModel() for s in sys.path: self.model.addElement(s) self.pathlist = JList( self.model, selectionMode=ListSelectionModel.SINGLE_SELECTION) leftPanel.add(JScrollPane(self.pathlist)) rightPanel = JPanel(GridBagLayout()) constraints = GridBagConstraints() constraints.insets = Insets(5, 5, 5, 5) constraints.gridy = GridBagConstraints.RELATIVE constraints.gridx = 0 buttons = [("Plus.png", "New...", self.new), \ ("ButtonProperties.png", "Edit...", self.edit), ("Minus.png", "Remove", self.remove), \ ("ArrowU.png", "Move Up", self.up), \ ("ArrowD.png", "Move down", self.down)] for (i, t, a) in buttons: rightPanel.add(JButton(icon = GUIUtilities.loadIcon(i), \ toolTipText=t, actionPerformed=a), constraints) upperPanel.add(leftPanel, BorderLayout.CENTER) upperPanel.add(rightPanel, BorderLayout.EAST) content.add(upperPanel, BorderLayout.CENTER) lowerPanel = JPanel(FlowLayout(FlowLayout.RIGHT)) self.saveAsk = JCheckBox(jEdit.getProperty("options.jython.saveJythonPathTitle"), \ selected = jEdit.getBooleanProperty("options.jython.saveJythonPath"), actionPerformed = self.saveAsk) ok = JButton("Ok", actionPerformed=self.__ok) lowerPanel.add(self.saveAsk) lowerPanel.add(ok) self.rootPane.defaultButton = ok lowerPanel.add(JButton("Cancel", actionPerformed=self.__cancel)) content.add(lowerPanel, BorderLayout.SOUTH)
def __init__(self): self.setLayout(GridBagLayout()) shrinkX = JButton("shrinkX") shrinkX.actionPerformed = lambda event: rescaleLayout(0.5, 1) constr = GridBagConstraints() constr.gridx = 0 constr.gridy = 0 self.add(shrinkX, constr) growX = JButton("growX") growX.actionPerformed = lambda event: rescaleLayout(1.5, 1) constr = GridBagConstraints() constr.gridx = 2 constr.gridy = 0 self.add(growX, constr) shrinkY = JButton("shrinkY") shrinkY.actionPerformed = lambda event: rescaleLayout(1, 0.5) constr = GridBagConstraints() constr.gridx = 0 constr.gridy = 2 self.add(shrinkY, constr) growY = JButton("growY") growY.actionPerformed = lambda event: rescaleLayout(1, 1.5) constr = GridBagConstraints() constr.gridx = 2 constr.gridy = 2 self.add(growY, constr) centerB = JButton("center") centerB.actionPerformed = lambda event: center() constr = GridBagConstraints() constr.gridx = 1 constr.gridy = 1 self.add(centerB, constr) ui.dock(self)
def initComponents(self): self.setLayout(GridBagLayout()) gc = GridBagConstraints() gc.weightx = 1 gc.weighty = 1 # First Row gc.gridy = 0 gc.weightx = 1 gc.weighty = 0.1 gc.gridx = 0 gc.fill = GridBagConstraints.NONE gc.anchor = GridBagConstraints.LINE_END gc.insets = Insets(0, 0, 0, 5) self.add(self.vehicleLabel, gc) gc.gridx = 1 gc.anchor = GridBagConstraints.LINE_START gc.insets = Insets(0, 0, 0, 0) self.add(self.vehicleField, gc) #Next Row gc.gridy += 1 gc.weightx = 1 gc.weighty = 2.0 gc.gridx = 1 gc.anchor = GridBagConstraints.FIRST_LINE_START self.add(self.bypassBtn, gc) innerBorder = BorderFactory.createTitledBorder('Emergency Bypass') outerBorder = BorderFactory.createEmptyBorder(5, 5, 5, 5) self.setBorder( BorderFactory.createCompoundBorder(outerBorder, innerBorder))
def initComponents(self): self.setLayout(GridBagLayout()) gbc = GridBagConstraints() gbc.anchor = GridBagConstraints.NORTHWEST gbc.gridx = 0 gbc.gridy = 0 descriptionLabel = JLabel("FEA - BitCoin Validation module") self.add(descriptionLabel, gbc) tlHitlist = JLabel("Base list of hashes to analyze: ") gbc.gridy = 1 self.add(tlHitlist, gbc) self.tbHitlist = JTextField("testlist", 20) self.tbHitlist.addActionListener(self.tbHitlistActionPerformed) gbc.gridx = 1 self.add(self.tbHitlist, gbc) gbc.gridx = 0 self.cbBlockchainCheck = JCheckBox( "Query Blockchain.info", actionPerformed=self.cbBlockchainCheckActionPerformed) self.cbBlockchainCheck.setSelected(True) gbc.gridy = 2 self.add(self.cbBlockchainCheck, gbc) tlBCMaxHits = JLabel( "Timeout (in seconds) between calls to Blockchain.info: ") gbc.gridy = 3 self.add(tlBCMaxHits, gbc) self.tbMaxBCHits = JTextField("5", 5) self.tbMaxBCHits.addActionListener(self.tbMaxBCHitsActionPerformed) gbc.gridx = 1 self.add(self.tbMaxBCHits, gbc)
def __init__(self, program): self.setLayout(GridBagLayout()) self.setBorder(make_title_border("User-Agent", padding=5)) btn = JButton("Add to settings") ua_text = JTextField(program.user_agent) self.add( ua_text, make_constraints(weightx=4, fill=GridBagConstraints.HORIZONTAL)) self.add(btn, make_constraints(weightx=1)) self.setMaximumSize( Dimension(9999999, self.getPreferredSize().height + 10)) def add_to_options(event): prefix = "Generated by YWH-addon" config = json.loads( context.callbacks.saveConfigAsJson( "proxy.match_replace_rules")) # remove other YWH addon rules match_replace_rules = filter( lambda rule: not rule["comment"].startswith(prefix), config["proxy"]["match_replace_rules"], ) new_rule = { "is_simple_match": False, "enabled": True, "rule_type": "request_header", "string_match": "^User-Agent: (.*)$", "string_replace": "User-Agent: $1 {}".format(program.user_agent), "comment": "{} for {}".format(prefix, program.slug), } match_replace_rules.append(new_rule) config["proxy"]["match_replace_rules"] = match_replace_rules context.callbacks.loadConfigFromJson(json.dumps(config)) btn.addActionListener(CallbackActionListener(add_to_options))
def arrange_plots(regplot, plotm, plotd): """ arranges the plots in a certain order, regplot and plotm in first row next to each other plotd in second row """ from javax.swing import JPanel, JFrame from java.awt import GridBagLayout, GridBagConstraints mainPanel = JPanel() mainPanel.setLayout(GridBagLayout()) c = GridBagConstraints() c.fill = c.BOTH c.weightx, c.weighty = 0.5, 1 c.gridx, c.gridy, c.gridwidth, c.gridheight = 0, 0, 10, 4 c.weightx, c.weighty = 0.5, 1 c.gridx, c.gridy, c.gridwidth, c.gridheight = 0, 0, 10, 4 mainPanel.add(regplot) c.gridx, c.gridy, c.gridwidth, c.gridheight = 0, 0, 10, 4 c.weightx, c.weighty = 1, 1 mainPanel.add(plotm, c) c.gridx, c.gridy, c.gridwidth, c.gridheight = 0, 4, 10, 6 mainPanel.add(plotd, c) return mainPanel
def actionPerformed(self, e): bugs_tab = self.tabbed_panes[self.key].getComponentAt(1) tab_count = str(bugs_tab.getTabCount()) request_tab = self.view.set_request_tab_pane(self.request_response) response_tab = self.view.set_response_tab_pane(self.request_response) bugs_tabbed_pane = self.view.set_bugs_tabbed_pane( request_tab, response_tab) bugs_tab.add(tab_count, bugs_tabbed_pane) index = bugs_tab.indexOfTab(tab_count) panel_tab = JPanel(GridBagLayout()) panel_tab.setOpaque(False) label_title = JLabel(tab_count) button_close = JButton("x") button_close.setBorder(None) panel_tab.add(label_title) panel_tab.add(button_close) bugs_tab.setTabComponentAt(index, panel_tab) button_close.addActionListener(CloseTab(bugs_tab))
class CuckooSettingsWithUISettingsPanel(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.tag_list = [] self.initComponents() self.customizeComponents() self.path_to_cuckoo_exe = os.path.join(os.path.dirname(os.path.abspath(__file__)), "cuckoo_api.exe") # Check the checkboxs to see what actions need to be taken def checkBoxEvent(self, event): if self.Submit_File_CB.isSelected(): self.local_settings.setSetting('Submit_File', 'true') self.local_settings.setSetting('Submit_URL', 'false') else: self.local_settings.setSetting('Submit_File', 'false') def onchange_lb(self, event): self.local_settings.cleartag_list() list_selected = self.List_Box_LB.getSelectedValuesList() self.local_settings.setSetting('tag_list', str(list_selected)) def find_tags(self): sql_statement = "SELECT distinct(display_name) u_tag_name FROM content_tags INNER JOIN tag_names ON " + \ " content_tags.tag_name_id = tag_names.tag_name_id;" skCase = Case.getCurrentCase().getSleuthkitCase() dbquery = skCase.executeQuery(sql_statement) resultSet = dbquery.getResultSet() while resultSet.next(): self.tag_list.append(resultSet.getString("u_tag_name")) dbquery.close() # Check to see if the Cuckoo server is available and you can talk to it def Check_Server(self, e): pipe = Popen([self.path_to_cuckoo_exe, self.Protocol_TF.getText(),self.IP_Address_TF.getText(), self.Port_Number_TF.getText(), "cuckoo_status" ], stdout=PIPE, stderr=PIPE) out_text = pipe.communicate()[0] self.Error_Message.setText("Cuckoo Status is " + out_text) #self.log(Level.INFO, "Cuckoo Status is ==> " + out_text) def setIPAddress(self, event): self.local_settings.setSetting('IP_Address', self.IP_Address_TF.getText()) def setProtocol(self, event): self.local_settings.setSetting('Protocol', self.Protocol_TF.getText()) def setPortNumber(self, event): self.local_settings.setSetting('Port_Number', self.Port_Number_TF.getText()) # Create the initial data fields/layout in the UI def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Label_1 = JLabel("Protocol:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Protocol_TF = JTextField(20, focusLost=self.setProtocol) self.Protocol_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Protocol_TF, self.gbcPanel0 ) self.panel0.add( self.Protocol_TF ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Label_2 = JLabel("Cuckoo IP Address") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.IP_Address_TF = JTextField(20, focusLost=self.setIPAddress) self.IP_Address_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.IP_Address_TF, self.gbcPanel0 ) self.panel0.add( self.IP_Address_TF ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Label_3 = JLabel("Port Number") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.Port_Number_TF = JTextField(20, focusLost=self.setPortNumber) self.Port_Number_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Port_Number_TF, self.gbcPanel0 ) self.panel0.add( self.Port_Number_TF ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Blank_5 = JLabel( "Tag to Choose: ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_5, self.gbcPanel0 ) self.panel0.add( self.Blank_5 ) self.find_tags() self.List_Box_LB = JList( self.tag_list, valueChanged=self.onchange_lb) self.List_Box_LB.setVisibleRowCount( 3 ) self.scpList_Box_LB = JScrollPane( self.List_Box_LB ) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.scpList_Box_LB, self.gbcPanel0 ) self.panel0.add( self.scpList_Box_LB ) self.Blank_6 = JLabel( " ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_6, self.gbcPanel0 ) self.panel0.add( self.Blank_6 ) self.Submit_File_CB = JCheckBox("Submit a File", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Submit_File_CB, self.gbcPanel0 ) self.panel0.add( self.Submit_File_CB ) # self.Submit_URL_CB = JCheckBox("Submit a URL", actionPerformed=self.checkBoxEvent) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 23 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Submit_URL_CB, self.gbcPanel0 ) # self.panel0.add( self.Submit_URL_CB ) self.Check_Server_Status_BTN = JButton( "Check Server Status", actionPerformed=self.Check_Server) self.Check_Server_Status_BTN.setEnabled(True) self.rbgPanel0.add( self.Check_Server_Status_BTN ) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Check_Server_Status_BTN, self.gbcPanel0 ) self.panel0.add( self.Check_Server_Status_BTN ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0) # Custom load any data field and initialize the values def customizeComponents(self): #self.Exclude_File_Sources_CB.setSelected(self.local_settings.getExclude_File_Sources()) #self.Run_Cuckoo_CB.setSelected(self.local_settings.getSetting('Submit_File') == 'true') #self.Import_Cuckoo_CB.setSelected(self.local_settings.getImport_Cuckoo()) self.Port_Number_TF.setText(self.local_settings.getSetting('Port_Number')) self.IP_Address_TF.setText(self.local_settings.getSetting('IP_Address')) self.Protocol_TF.setText(self.local_settings.getSetting('Protocol')) # Return the settings used def getSettings(self): return self.local_settings
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Label_1 = JLabel("Protocol:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Protocol_TF = JTextField(20, focusLost=self.setProtocol) self.Protocol_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Protocol_TF, self.gbcPanel0 ) self.panel0.add( self.Protocol_TF ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Label_2 = JLabel("Cuckoo IP Address") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.IP_Address_TF = JTextField(20, focusLost=self.setIPAddress) self.IP_Address_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.IP_Address_TF, self.gbcPanel0 ) self.panel0.add( self.IP_Address_TF ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Label_3 = JLabel("Port Number") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.Port_Number_TF = JTextField(20, focusLost=self.setPortNumber) self.Port_Number_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Port_Number_TF, self.gbcPanel0 ) self.panel0.add( self.Port_Number_TF ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Blank_5 = JLabel( "Tag to Choose: ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_5, self.gbcPanel0 ) self.panel0.add( self.Blank_5 ) self.find_tags() self.List_Box_LB = JList( self.tag_list, valueChanged=self.onchange_lb) self.List_Box_LB.setVisibleRowCount( 3 ) self.scpList_Box_LB = JScrollPane( self.List_Box_LB ) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.scpList_Box_LB, self.gbcPanel0 ) self.panel0.add( self.scpList_Box_LB ) self.Blank_6 = JLabel( " ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_6, self.gbcPanel0 ) self.panel0.add( self.Blank_6 ) self.Submit_File_CB = JCheckBox("Submit a File", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Submit_File_CB, self.gbcPanel0 ) self.panel0.add( self.Submit_File_CB ) # self.Submit_URL_CB = JCheckBox("Submit a URL", actionPerformed=self.checkBoxEvent) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 23 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Submit_URL_CB, self.gbcPanel0 ) # self.panel0.add( self.Submit_URL_CB ) self.Check_Server_Status_BTN = JButton( "Check Server Status", actionPerformed=self.Check_Server) self.Check_Server_Status_BTN.setEnabled(True) self.rbgPanel0.add( self.Check_Server_Status_BTN ) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Check_Server_Status_BTN, self.gbcPanel0 ) self.panel0.add( self.Check_Server_Status_BTN ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0)
class GUI_Test_SQLSettingsWithUISettingsPanel(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() # Check the checkboxs to see what actions need to be taken def checkBoxEvent(self, event): if self.Exec_Program_CB.isSelected(): self.local_settings.setSetting('Exec_Prog_Flag', 'true') self.Program_Executable_TF.setEnabled(True) self.Find_Program_Exec_BTN.setEnabled(True) else: self.local_settings.setSetting('Exec_Prog_Flag', 'false') self.Program_Executable_TF.setText("") self.Program_Executable_TF.setEnabled(False) self.Find_Program_Exec_BTN.setEnabled(False) # Check to see if there are any entries that need to be populated from the database. def check_Database_entries(self): head, tail = os.path.split(os.path.abspath(__file__)) settings_db = os.path.join(head, "GUI_Settings.db3") try: Class.forName("org.sqlite.JDBC").newInstance() dbConn = DriverManager.getConnection("jdbc:sqlite:%s" % settings_db) except SQLException as e: self.Error_Message.setText("Error Opening Settings DB!") try: stmt = dbConn.createStatement() SQL_Statement = 'Select Setting_Name, Setting_Value from settings;' resultSet = stmt.executeQuery(SQL_Statement) while resultSet.next(): if resultSet.getString("Setting_Name") == "Program_Exec_Name": self.Program_Executable_TF.setText(resultSet.getString("Setting_Value")) self.local_settings.setSetting('ExecFile', resultSet.getString("Setting_Value")) self.local_settings.setSetting('Exec_Prog_Flag', 'true') self.Exec_Program_CB.setSelected(True) self.Program_Executable_TF.setEnabled(True) self.Find_Program_Exec_BTN.setEnabled(True) self.Error_Message.setText("Settings Read successfully!") except SQLException as e: self.Error_Message.setText("Error Reading Settings Database") stmt.close() dbConn.close() # Save entries from the GUI to the database. def SaveSettings(self, e): head, tail = os.path.split(os.path.abspath(__file__)) settings_db = os.path.join(head, "GUI_Settings.db3") try: Class.forName("org.sqlite.JDBC").newInstance() dbConn = DriverManager.getConnection("jdbc:sqlite:%s" % settings_db) except SQLException as e: self.Error_Message.setText("Error Opening Settings") try: stmt = dbConn.createStatement() SQL_Statement = 'Insert into settings (Setting_Name, Setting_Value) values ("Program_Exec_Name", "' + \ self.Program_Executable_TF.getText() + '");' resultSet = stmt.executeQuery(SQL_Statement) self.Error_Message.setText("Settings Saved") except SQLException as e: self.Error_Message.setText("Error Inserting Settings " + str(e)) stmt.close() dbConn.close() # When button to find file is clicked then open dialog to find the file and return it. def onClick(self, e): chooseFile = JFileChooser() filter = FileNameExtensionFilter("SQLite", ["sqlite"]) chooseFile.addChoosableFileFilter(filter) ret = chooseFile.showDialog(self.panel0, "Select SQLite") if ret == JFileChooser.APPROVE_OPTION: file = chooseFile.getSelectedFile() Canonical_file = file.getCanonicalPath() #text = self.readPath(file) self.local_settings.setSetting('ExecFile', Canonical_file) self.Program_Executable_TF.setText(Canonical_file) # Create the initial data fields/layout in the UI def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Exec_Program_CB = JCheckBox("Execute Program", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Exec_Program_CB, self.gbcPanel0 ) self.panel0.add( self.Exec_Program_CB ) self.Program_Executable_TF = JTextField(20) self.Program_Executable_TF.setEnabled(False) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Exec", actionPerformed=self.onClick) self.Find_Program_Exec_BTN.setEnabled(False) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Save_Settings_BTN = JButton( "Save Settings", actionPerformed=self.SaveSettings) self.Save_Settings_BTN.setEnabled(True) self.rbgPanel0.add( self.Save_Settings_BTN ) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Save_Settings_BTN, self.gbcPanel0 ) self.panel0.add( self.Save_Settings_BTN ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Label_1 = JLabel( "Error Message:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0) # Custom load any data field and initialize the values def customizeComponents(self): self.Exec_Program_CB.setSelected(self.local_settings.getSetting('Exec_Prog_Flag') == 'true') self.check_Database_entries() # Return the settings used def getSettings(self): return self.local_settings
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.All_Artifacts_CB = JCheckBox("Remove All Custom Artifacts", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.All_Artifacts_CB, self.gbcPanel0 ) self.panel0.add( self.All_Artifacts_CB ) self.All_Attributes_CB = JCheckBox("Remove All Custom Attributes", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.All_Attributes_CB, self.gbcPanel0 ) self.panel0.add( self.All_Attributes_CB ) self.Blank_0 = JLabel( " ") self.Blank_0.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_0, self.gbcPanel0 ) self.panel0.add( self.Blank_0 ) self.Label_0 = JLabel( "Remove selected Artifacts") self.Label_0.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_0, self.gbcPanel0 ) self.panel0.add( self.Label_0 ) self.Blank_0 = JLabel( " ") self.Blank_0.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_0, self.gbcPanel0 ) self.panel0.add( self.Blank_0 ) self.get_artifacts() self.List_Box_LB = JList( self.artifact_list, valueChanged=self.onchange_lb) self.List_Box_LB.setVisibleRowCount( 3 ) self.scpList_Box_LB = JScrollPane( self.List_Box_LB ) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.scpList_Box_LB, self.gbcPanel0 ) self.panel0.add( self.scpList_Box_LB ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Label_1 = JLabel( "Message:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Error_Message = JLabel( "For developer purposes only, it may fubar your case") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0)
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Label_1 = JLabel("Plaso Executable Directory") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Program_Executable_TF = JTextField(20, focusLost=self.setPlasoDirectory) self.Program_Executable_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Dir", actionPerformed=self.Find_Plaso_Dir) self.Find_Program_Exec_BTN.setEnabled(True) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Label_1 = JLabel("Plaso Storage File") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Plaso_Storage_File_TF = JTextField(20, focusLost=self.setPlasoStorageFile) self.Plaso_Storage_File_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Plaso_Storage_File_TF, self.gbcPanel0 ) self.panel0.add( self.Plaso_Storage_File_TF ) self.Find_Storage_BTN = JButton( "Find Storage File", actionPerformed=self.Find_Plaso_File) self.Find_Storage_BTN.setEnabled(True) self.rbgPanel0.add( self.Find_Storage_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Storage_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Storage_BTN ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Exclude_File_Sources_CB = JCheckBox( "Exclude File Source", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Exclude_File_Sources_CB, self.gbcPanel0 ) self.panel0.add( self.Exclude_File_Sources_CB ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Label_3 = JLabel( "Message:") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 23 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0)
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Exec_Program_CB = JCheckBox("Execute Program", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Exec_Program_CB, self.gbcPanel0 ) self.panel0.add( self.Exec_Program_CB ) self.Program_Executable_TF = JTextField(20) self.Program_Executable_TF.setEnabled(False) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Exec", actionPerformed=self.onClick) self.Find_Program_Exec_BTN.setEnabled(False) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Imp_File_CB = JCheckBox( "Import File", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Imp_File_CB, self.gbcPanel0 ) self.panel0.add( self.Imp_File_CB ) self.File_Imp_TF = JTextField(20) self.File_Imp_TF.setEnabled(False) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.File_Imp_TF, self.gbcPanel0 ) self.panel0.add( self.File_Imp_TF ) self.Find_Imp_File_BTN = JButton( "Find File", actionPerformed=self.onClick) self.Find_Imp_File_BTN.setEnabled(False) self.rbgPanel0.add( self.Find_Imp_File_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Imp_File_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Imp_File_BTN ) self.Check_Box_CB = JCheckBox( "Check Box 1", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Check_Box_CB, self.gbcPanel0 ) self.panel0.add( self.Check_Box_CB ) self.dataComboBox_CB = ("Chocolate", "Ice Cream", "Apple Pie") self.ComboBox_CB = JComboBox( self.dataComboBox_CB) self.ComboBox_CB.itemStateChanged = self.onchange_cb self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.ComboBox_CB, self.gbcPanel0 ) self.panel0.add( self.ComboBox_CB ) self.dataList_Box_LB = ("Chocolate", "Ice Cream", "Apple Pie", "Pudding", "Candy" ) self.List_Box_LB = JList( self.dataList_Box_LB, valueChanged=self.onchange_lb) #self.List_Box_LB.itemStateChanged = self.onchange_lb self.List_Box_LB.setVisibleRowCount( 3 ) self.scpList_Box_LB = JScrollPane( self.List_Box_LB ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.scpList_Box_LB, self.gbcPanel0 ) self.panel0.add( self.scpList_Box_LB ) # self.Radio_Button_RB = JRadioButton( "Radio Button" ) # self.rbgPanel0.add( self.Radio_Button_RB ) # self.gbcPanel0.gridx = 7 # self.gbcPanel0.gridy = 17 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Radio_Button_RB, self.gbcPanel0 ) # self.panel0.add( self.Radio_Button_RB ) # self.Label_1 = JLabel( "Error Message:") # self.Label_1.setEnabled(True) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 19 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) # self.panel0.add( self.Label_1 ) # self.Error_Message = JLabel( "") # self.Error_Message.setEnabled(True) # self.gbcPanel0.gridx = 6 # self.gbcPanel0.gridy = 19 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) # self.panel0.add( self.Error_Message ) self.add(self.panel0)
class GUI_TestWithUISettingsPanel(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.Exec_Program_CB.isSelected(): self.local_settings.setSetting('Exec_Prog_Flag', 'true') self.Program_Executable_TF.setEnabled(True) self.Find_Program_Exec_BTN.setEnabled(True) else: self.local_settings.setSetting('Exec_Prog_Flag', 'false') self.Program_Executable_TF.setText("") self.Program_Executable_TF.setEnabled(False) self.Find_Program_Exec_BTN.setEnabled(False) if self.Imp_File_CB.isSelected(): self.local_settings.setSetting('Imp_File_Flag', 'true') self.File_Imp_TF.setEnabled(True) self.Find_Imp_File_BTN.setEnabled(True) else: self.local_settings.setSetting('Imp_File_Flag', 'false') self.File_Imp_TF.setText("") self.local_settings.setSetting('File_Imp_TF', "") self.File_Imp_TF.setEnabled(False) self.Find_Imp_File_BTN.setEnabled(False) def keyPressed(self, event): self.local_settings.setSetting('Area', self.area.getText()) def onchange_cb(self, event): self.local_settings.setSetting('ComboBox', event.item) #self.Error_Message.setText(event.item) def onchange_lb(self, event): self.local_settings.setSetting('ListBox', "") list_selected = self.List_Box_LB.getSelectedValuesList() self.local_settings.setSetting('ListBox', str(list_selected)) # if (len(list_selected) > 0): # self.Error_Message.setText(str(list_selected)) # else: # self.Error_Message.setText("") def onClick(self, e): chooseFile = JFileChooser() filter = FileNameExtensionFilter("SQLite", ["sqlite"]) chooseFile.addChoosableFileFilter(filter) ret = chooseFile.showDialog(self.panel0, "Select SQLite") if ret == JFileChooser.APPROVE_OPTION: file = chooseFile.getSelectedFile() Canonical_file = file.getCanonicalPath() #text = self.readPath(file) if self.File_Imp_TF.isEnabled(): self.File_Imp_TF.setText(Canonical_file) self.local_settings.setSetting('File_Imp_TF', Canonical_file) else: self.local_settings.setSetting('ExecFile', Canonical_file) self.Program_Executable_TF.setText(Canonical_file) # TODO: Update this for your UI def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Exec_Program_CB = JCheckBox("Execute Program", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Exec_Program_CB, self.gbcPanel0 ) self.panel0.add( self.Exec_Program_CB ) self.Program_Executable_TF = JTextField(20) self.Program_Executable_TF.setEnabled(False) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Exec", actionPerformed=self.onClick) self.Find_Program_Exec_BTN.setEnabled(False) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Imp_File_CB = JCheckBox( "Import File", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Imp_File_CB, self.gbcPanel0 ) self.panel0.add( self.Imp_File_CB ) self.File_Imp_TF = JTextField(20) self.File_Imp_TF.setEnabled(False) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.File_Imp_TF, self.gbcPanel0 ) self.panel0.add( self.File_Imp_TF ) self.Find_Imp_File_BTN = JButton( "Find File", actionPerformed=self.onClick) self.Find_Imp_File_BTN.setEnabled(False) self.rbgPanel0.add( self.Find_Imp_File_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Imp_File_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Imp_File_BTN ) self.Check_Box_CB = JCheckBox( "Check Box 1", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Check_Box_CB, self.gbcPanel0 ) self.panel0.add( self.Check_Box_CB ) self.dataComboBox_CB = ("Chocolate", "Ice Cream", "Apple Pie") self.ComboBox_CB = JComboBox( self.dataComboBox_CB) self.ComboBox_CB.itemStateChanged = self.onchange_cb self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.ComboBox_CB, self.gbcPanel0 ) self.panel0.add( self.ComboBox_CB ) self.dataList_Box_LB = ("Chocolate", "Ice Cream", "Apple Pie", "Pudding", "Candy" ) self.List_Box_LB = JList( self.dataList_Box_LB, valueChanged=self.onchange_lb) #self.List_Box_LB.itemStateChanged = self.onchange_lb self.List_Box_LB.setVisibleRowCount( 3 ) self.scpList_Box_LB = JScrollPane( self.List_Box_LB ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.scpList_Box_LB, self.gbcPanel0 ) self.panel0.add( self.scpList_Box_LB ) # self.Radio_Button_RB = JRadioButton( "Radio Button" ) # self.rbgPanel0.add( self.Radio_Button_RB ) # self.gbcPanel0.gridx = 7 # self.gbcPanel0.gridy = 17 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Radio_Button_RB, self.gbcPanel0 ) # self.panel0.add( self.Radio_Button_RB ) # self.Label_1 = JLabel( "Error Message:") # self.Label_1.setEnabled(True) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 19 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) # self.panel0.add( self.Label_1 ) # self.Error_Message = JLabel( "") # self.Error_Message.setEnabled(True) # self.gbcPanel0.gridx = 6 # self.gbcPanel0.gridy = 19 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) # self.panel0.add( self.Error_Message ) self.add(self.panel0) # TODO: Update this for your UI def customizeComponents(self): self.Exec_Program_CB.setSelected(self.local_settings.getSetting('Exec_Prog_Flag') == 'true') self.Imp_File_CB.setSelected(self.local_settings.getSetting('Imp_File_Flag') == 'true') self.Check_Box_CB.setSelected(self.local_settings.getSetting('Check_Box_1') == 'true') # Return the settings used def getSettings(self): return self.local_settings
class TimesketchSettingsWithUISettingsPanel(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 def __init__(self, settings): self.local_settings = settings self.tag_list = [] self.initComponents() self.customizeComponents() self.path_to_Timesketch_exe = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Timesketch_api.exe") # Check to see if the Timesketch server is available and you can talk to it def Check_Server(self, e): pipe = Popen([self.path_to_Timesketch_exe, self.Protocol_TF.getText(),self.IP_Address_TF.getText(), self.Port_Number_TF.getText(), "Timesketch_status" ], stdout=PIPE, stderr=PIPE) out_text = pipe.communicate()[0] self.Error_Message.setText("Timesketch Status is " + out_text) #self.log(Level.INFO, "Timesketch Status is ==> " + out_text) def setIPAddress(self, event): self.local_settings.setSetting('ipAddress', self.IP_Address_TF.getText()) def setPortNumber(self, event): self.local_settings.setSetting('portNumber', self.Port_Number_TF.getText()) def setUserName(self, event): self.local_settings.setSetting('userName', self.userName_TF.getText()) def setPassword(self, event): self.local_settings.setSetting('password', self.password_TF.getText()) def setsketchName(self, event): self.local_settings.setSetting('sketchName', self.sketchName_TF.getText()) def setsketchDescription(self, event): self.local_settings.setSetting('sketchDescription', self.sketchDescription_TF.getText()) # Create the initial data fields/layout in the UI def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Label_2 = JLabel("Timesketch IP Address") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.IP_Address_TF = JTextField(20, focusLost=self.setIPAddress) self.IP_Address_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.IP_Address_TF, self.gbcPanel0 ) self.panel0.add( self.IP_Address_TF ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Label_3 = JLabel("Port Number") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.Port_Number_TF = JTextField(20, focusLost=self.setPortNumber) self.Port_Number_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Port_Number_TF, self.gbcPanel0 ) self.panel0.add( self.Port_Number_TF ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Label_4 = JLabel("User Name") self.Label_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_4, self.gbcPanel0 ) self.panel0.add( self.Label_4 ) self.userName_TF = JTextField(20, focusLost=self.setUserName) self.userName_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.userName_TF, self.gbcPanel0 ) self.panel0.add( self.userName_TF ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Label_5 = JLabel("Password") self.Label_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_5, self.gbcPanel0 ) self.panel0.add( self.Label_5 ) self.password_TF = JPasswordField(20, focusLost=self.setPassword) # self.password_TF = JTextField(20) self.password_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.password_TF, self.gbcPanel0 ) self.panel0.add( self.password_TF ) self.Blank_5 = JLabel( " ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_5, self.gbcPanel0 ) self.panel0.add( self.Blank_5 ) self.Label_6 = JLabel("Sketch Name") self.Label_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_6, self.gbcPanel0 ) self.panel0.add( self.Label_6 ) self.sketchName_TF = JTextField(20, focusLost=self.setsketchName) self.sketchName_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.sketchName_TF, self.gbcPanel0 ) self.panel0.add( self.sketchName_TF ) self.Blank_6 = JLabel( " ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 23 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_6, self.gbcPanel0 ) self.panel0.add( self.Blank_6 ) self.Label_7 = JLabel("Sketch Description") self.Label_7.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_7, self.gbcPanel0 ) self.panel0.add( self.Label_7 ) self.sketchDescription_TF = JTextField(20, focusLost=self.setsketchDescription) self.sketchDescription_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.sketchDescription_TF, self.gbcPanel0 ) self.panel0.add( self.sketchDescription_TF ) self.Blank_7 = JLabel( " ") self.Blank_7.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 27 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_7, self.gbcPanel0 ) self.panel0.add( self.Blank_7 ) # self.Check_Server_Status_BTN = JButton( "Check Server Status", actionPerformed=self.Check_Server) # self.Check_Server_Status_BTN.setEnabled(True) # self.rbgPanel0.add( self.Save_Settings_BTN ) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 29 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Check_Server_Status_BTN, self.gbcPanel0 ) # self.panel0.add( self.Check_Server_Status_BTN ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0) # Custom load any data field and initialize the values def customizeComponents(self): #self.Exclude_File_Sources_CB.setSelected(self.local_settings.getExclude_File_Sources()) #self.Run_Timesketch_CB.setSelected(self.local_settings.getRun_Timesketch()) #self.Import_Timesketch_CB.setSelected(self.local_settings.getImport_Timesketch()) #self.check_Database_entries() self.IP_Address_TF.setText(self.local_settings.getSetting('ipAddress')) self.Port_Number_TF.setText(self.local_settings.getSetting('portNumber')) self.userName_TF.setText(self.local_settings.getSetting('userName')) self.password_TF.setText(self.local_settings.getSetting('password')) self.sketchName_TF.setText(Case.getCurrentCase().getNumber()) self.sketchDescription_TF.setText(Case.getCurrentCase().getName()) self.local_settings.setSetting('sketchName', self.sketchName_TF.getText()) self.local_settings.setSetting('sketchDescription', self.sketchDescription_TF.getText()) # Return the settings used def getSettings(self): return self.local_settings
class VolatilitySettingsWithUISettingsPanel(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 _logger = Logger.getLogger(VolatilityIngestModuleFactory.moduleName) def log(self, level, msg): self._logger.logp(level, self.__class__.__name__, inspect.stack()[1][3], msg) def __init__(self, settings): self.local_settings = settings self.initComponents() self.customizeComponents() # Check the checkboxs to see what actions need to be taken def checkBoxEvent(self, event): if self.Exclude_File_Sources_CB.isSelected(): self.local_settings.setSetting('Exclude_File_Sources', 'true') else: self.local_settings.setSetting('Exclude_File_Sources', 'false') def get_plugins(self): head, tail = os.path.split(os.path.abspath(__file__)) settings_db = os.path.join(head, "GUI_Settings.db3") try: Class.forName("org.sqlite.JDBC").newInstance() dbConn = DriverManager.getConnection("jdbc:sqlite:%s" % settings_db) self.Error_Message.setText("Database opened") except SQLException as e: self.Error_Message.setText("Error Opening Settings DB!") try: stmt = dbConn.createStatement() SQL_Statement = "select plugin_name from plugins where volatility_version = '" + self.Version_CB.getSelectedItem() + "';" resultSet = stmt.executeQuery(SQL_Statement) plugin_list = [] while resultSet.next(): plugin_list.append(resultSet.getString("plugin_name")) stmt.close() dbConn.close() return plugin_list except SQLException as e: self.Error_Message.setText("Error Reading plugins") stmt.close() dbConn.close() return "Error" def get_profiles(self): head, tail = os.path.split(os.path.abspath(__file__)) settings_db = os.path.join(head, "GUI_Settings.db3") try: Class.forName("org.sqlite.JDBC").newInstance() dbConn = DriverManager.getConnection("jdbc:sqlite:%s" % settings_db) self.Error_Message.setText("Database opened") except SQLException as e: self.Error_Message.setText("Error Opening Settings DB!") try: stmt = dbConn.createStatement() SQL_Statement = "select profile_name from profiles where volatility_version = '" + self.Version_CB.getSelectedItem() + "';" resultSet = stmt.executeQuery(SQL_Statement) profile_list = [] while resultSet.next(): profile_list.append(resultSet.getString("profile_name")) stmt.close() dbConn.close() return profile_list except SQLException as e: self.Error_Message.setText("Error Reading plugins") stmt.close() dbConn.close() return "Error" # When button to find file is clicked then open dialog to find the file and return it. def Find_Dir(self, e): chooseFile = JFileChooser() filter = FileNameExtensionFilter("All", ["*.*"]) chooseFile.addChoosableFileFilter(filter) #chooseFile.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) ret = chooseFile.showDialog(self.panel0, "Find Volatility Directory") if ret == JFileChooser.APPROVE_OPTION: file = chooseFile.getSelectedFile() Canonical_file = file.getCanonicalPath() #text = self.readPath(file) self.local_settings.setSetting('Volatility_Directory', Canonical_file) self.Program_Executable_TF.setText(Canonical_file) def keyPressed(self, event): self.local_settings.setSetting('AdditionalParms', self.Additional_Parms_TF.getText()) #self.Error_Message.setText(self.Additional_Parms_TF.getText()) def onchange_version(self, event): self.local_settings.setSetting('Version', event.item) plugin_list = self.get_plugins() profile_list = self.get_profiles() self.Profile_CB.removeAllItems() self.Plugin_LB.clearSelection() self.Plugin_LB.setListData(plugin_list) for profile in profile_list: self.Profile_CB.addItem(profile) #self.Profile_CB.addItems(profile) self.panel0.repaint() def onchange_plugins_lb(self, event): self.local_settings.setSetting('PluginListBox' , '') list_selected = self.Plugin_LB.getSelectedValuesList() self.local_settings.setSetting('PluginListBox', str(list_selected)) def onchange_profile_cb(self, event): self.local_settings.setSetting('Profile', event.item) # Create the initial data fields/layout in the UI def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.Label_1 = JLabel("Volatility Executable Directory") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Program_Executable_TF = JTextField(10) self.Program_Executable_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Dir", actionPerformed=self.Find_Dir) self.Find_Program_Exec_BTN.setEnabled(True) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Version_Label_1 = JLabel( "Version:") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Version_Label_1, self.gbcPanel0 ) self.panel0.add( self.Version_Label_1 ) self.Version_List = ("2.5", "2.6") self.Version_CB = JComboBox( self.Version_List) self.Version_CB.itemStateChanged = self.onchange_version self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Version_CB, self.gbcPanel0 ) self.panel0.add( self.Version_CB ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Plugin_Label_1 = JLabel( "Plugins:") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Plugin_Label_1, self.gbcPanel0 ) self.panel0.add( self.Plugin_Label_1 ) self.Plugin_list = self.get_plugins() self.Plugin_LB = JList( self.Plugin_list, valueChanged=self.onchange_plugins_lb) self.Plugin_LB.setVisibleRowCount( 3 ) self.scpPlugin_LB = JScrollPane( self.Plugin_LB ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.scpPlugin_LB, self.gbcPanel0 ) self.panel0.add( self.scpPlugin_LB ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Profile_Label_1 = JLabel( "Profile:") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Profile_Label_1, self.gbcPanel0 ) self.panel0.add( self.Profile_Label_1 ) self.Profile_List = self.get_profiles() self.Profile_CB = JComboBox( self.Profile_List) self.Profile_CB.itemStateChanged = self.onchange_profile_cb self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Profile_CB, self.gbcPanel0 ) self.panel0.add( self.Profile_CB ) self.Blank_5 = JLabel( " ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_5, self.gbcPanel0 ) self.panel0.add( self.Blank_5 ) self.Label_2 = JLabel("Additional Parameters To Run With:") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 23 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.Additional_Parms_TF = JTextField(10,focusLost=self.keyPressed) #self.Additional_Parms_TF.getDocument().addDocumentListener() self.Additional_Parms_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Additional_Parms_TF, self.gbcPanel0 ) self.panel0.add( self.Additional_Parms_TF ) self.Blank_6 = JLabel( " ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 27 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_6, self.gbcPanel0 ) self.panel0.add( self.Blank_6 ) self.Label_3 = JLabel( "Message:") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 29 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.add(self.panel0) # Custom load any data field and initialize the values def customizeComponents(self): self.Program_Executable_TF.setText(self.local_settings.getSetting('Volatility_Directory')) #pass # Return the settings used def getSettings(self): return self.local_settings
def __init__(self, extender=None, *rows): self.extender = extender self.table = table = JTable(ParameterProcessingRulesTableModel(*rows)) table.setPreferredScrollableViewportSize(Dimension(500, 70)) table.setRowSorter(TableRowSorter(table.getModel())) table.setFillsViewportHeight(True) gridBagLayout = GridBagLayout() gridBagLayout.columnWidths = [0, 0, 25, 0 ] gridBagLayout.rowHeights = [0, 0, 0, 0] gridBagLayout.columnWeights = [0.0, 1.0, 1.0, Double.MIN_VALUE] gridBagLayout.rowWeights = [0.0, 0.0, 0.0, Double.MIN_VALUE] self.setLayout(gridBagLayout) addButton = JButton("Add") addButton.addActionListener(AddRemoveParameterListener(table)) addButtonConstraints = GridBagConstraints() addButtonConstraints.fill = GridBagConstraints.HORIZONTAL addButtonConstraints.insets = Insets(0, 0, 5, 5) addButtonConstraints.gridx = 0 addButtonConstraints.gridy = 0 self.add(addButton, addButtonConstraints) removeButton = JButton("Remove") removeButton.addActionListener(AddRemoveParameterListener(table)) removeButtonConstraints = GridBagConstraints() removeButtonConstraints.fill = GridBagConstraints.HORIZONTAL removeButtonConstraints.insets = Insets(0, 0, 5, 5) removeButtonConstraints.gridx = 0 removeButtonConstraints.gridy = 1 self.add(removeButton, removeButtonConstraints) upButton = JButton("Up") upButton.addActionListener(AddRemoveParameterListener(table)) upButtonConstraints = GridBagConstraints() upButtonConstraints.fill = GridBagConstraints.HORIZONTAL upButtonConstraints.insets = Insets(0, 0, 5, 5) upButtonConstraints.gridx = 0 upButtonConstraints.gridy = 2 self.add(upButton, upButtonConstraints) downButton = JButton("Down") downButton.addActionListener(AddRemoveParameterListener(table)) downButtonConstraints = GridBagConstraints() downButtonConstraints.fill = GridBagConstraints.HORIZONTAL downButtonConstraints.anchor = GridBagConstraints.NORTH downButtonConstraints.insets = Insets(0, 0, 5, 5) downButtonConstraints.gridx = 0 downButtonConstraints.gridy = 3 self.add(downButton, downButtonConstraints) scrollPane = JScrollPane(table) scrollPaneConstraints = GridBagConstraints() scrollPaneConstraints.gridwidth = 2 scrollPaneConstraints.gridheight = 5 scrollPaneConstraints.insets = Insets(0, 0, 5, 5) scrollPaneConstraints.anchor = GridBagConstraints.NORTHWEST scrollPaneConstraints.gridx = 1 scrollPaneConstraints.gridy = 0 self.add(scrollPane, scrollPaneConstraints) self.initParameterColumn(table) self.initColumnSizes(table)
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Exec_Program_CB = JCheckBox("Execute Program", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Exec_Program_CB, self.gbcPanel0 ) self.panel0.add( self.Exec_Program_CB ) self.Program_Executable_TF = JTextField(20) self.Program_Executable_TF.setEnabled(False) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Exec", actionPerformed=self.onClick) self.Find_Program_Exec_BTN.setEnabled(False) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Save_Settings_BTN = JButton( "Save Settings", actionPerformed=self.SaveSettings) self.Save_Settings_BTN.setEnabled(True) self.rbgPanel0.add( self.Save_Settings_BTN ) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Save_Settings_BTN, self.gbcPanel0 ) self.panel0.add( self.Save_Settings_BTN ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Label_1 = JLabel( "Error Message:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0)
class VolatilitySettingsWithUISettingsPanel(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() # When button to find file is clicked then open dialog to find the file and return it. def Find_Dir(self, e): chooseFile = JFileChooser() filter = FileNameExtensionFilter("All", ["*.*"]) chooseFile.addChoosableFileFilter(filter) #chooseFile.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY) ret = chooseFile.showDialog(self.panel0, "Find Volatility Directory") if ret == JFileChooser.APPROVE_OPTION: file = chooseFile.getSelectedFile() Canonical_file = file.getCanonicalPath() #text = self.readPath(file) self.local_settings.setSetting('Volatility_Directory', Canonical_file) self.Program_Executable_TF.setText(Canonical_file) def keyPressed(self, event): self.local_settings.setProcessIDs(self.Process_Ids_To_Dump_TF.getText()) #self.Error_Message.setText(self.Process_Ids_To_Dump_TF.getText()) def checkBoxEvent(self, event): if self.Check_Box.isSelected(): self.local_settings.setSetting('Flag', 'true') else: self.local_settings.setSetting('Flag', 'False') # Create the initial data fields/layout in the UI def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.Label_1 = JLabel("Volatility Executable Directory") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Program_Executable_TF = JTextField(10) self.Program_Executable_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Dir", actionPerformed=self.Find_Dir) self.Find_Program_Exec_BTN.setEnabled(True) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Check_Box = JCheckBox("Extract and Create Memory Image from Hiberfile", actionPerformed=self.checkBoxEvent) self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Check_Box, self.gbcPanel0 ) self.panel0.add( self.Check_Box ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Label_3 = JLabel( "Message:") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.add(self.panel0) # Custom load any data field and initialize the values def customizeComponents(self): self.Check_Box.setSelected(self.local_settings.getSetting('Flag') == 'true') self.Program_Executable_TF.setText(self.local_settings.getSetting('Volatility_Directory')) #pass # Return the settings used def getSettings(self): return self.local_settings
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Label_2 = JLabel("Timesketch IP Address") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.IP_Address_TF = JTextField(20, focusLost=self.setIPAddress) self.IP_Address_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.IP_Address_TF, self.gbcPanel0 ) self.panel0.add( self.IP_Address_TF ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Label_3 = JLabel("Port Number") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.Port_Number_TF = JTextField(20, focusLost=self.setPortNumber) self.Port_Number_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Port_Number_TF, self.gbcPanel0 ) self.panel0.add( self.Port_Number_TF ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Label_4 = JLabel("User Name") self.Label_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_4, self.gbcPanel0 ) self.panel0.add( self.Label_4 ) self.userName_TF = JTextField(20, focusLost=self.setUserName) self.userName_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.userName_TF, self.gbcPanel0 ) self.panel0.add( self.userName_TF ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Label_5 = JLabel("Password") self.Label_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_5, self.gbcPanel0 ) self.panel0.add( self.Label_5 ) self.password_TF = JPasswordField(20, focusLost=self.setPassword) # self.password_TF = JTextField(20) self.password_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.password_TF, self.gbcPanel0 ) self.panel0.add( self.password_TF ) self.Blank_5 = JLabel( " ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_5, self.gbcPanel0 ) self.panel0.add( self.Blank_5 ) self.Label_6 = JLabel("Sketch Name") self.Label_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_6, self.gbcPanel0 ) self.panel0.add( self.Label_6 ) self.sketchName_TF = JTextField(20, focusLost=self.setsketchName) self.sketchName_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.sketchName_TF, self.gbcPanel0 ) self.panel0.add( self.sketchName_TF ) self.Blank_6 = JLabel( " ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 23 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_6, self.gbcPanel0 ) self.panel0.add( self.Blank_6 ) self.Label_7 = JLabel("Sketch Description") self.Label_7.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_7, self.gbcPanel0 ) self.panel0.add( self.Label_7 ) self.sketchDescription_TF = JTextField(20, focusLost=self.setsketchDescription) self.sketchDescription_TF.setEnabled(True) self.gbcPanel0.gridx = 4 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.sketchDescription_TF, self.gbcPanel0 ) self.panel0.add( self.sketchDescription_TF ) self.Blank_7 = JLabel( " ") self.Blank_7.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 27 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_7, self.gbcPanel0 ) self.panel0.add( self.Blank_7 ) # self.Check_Server_Status_BTN = JButton( "Check Server Status", actionPerformed=self.Check_Server) # self.Check_Server_Status_BTN.setEnabled(True) # self.rbgPanel0.add( self.Save_Settings_BTN ) # self.gbcPanel0.gridx = 2 # self.gbcPanel0.gridy = 29 # self.gbcPanel0.gridwidth = 1 # self.gbcPanel0.gridheight = 1 # self.gbcPanel0.fill = GridBagConstraints.BOTH # self.gbcPanel0.weightx = 1 # self.gbcPanel0.weighty = 0 # self.gbcPanel0.anchor = GridBagConstraints.NORTH # self.gbPanel0.setConstraints( self.Check_Server_Status_BTN, self.gbcPanel0 ) # self.panel0.add( self.Check_Server_Status_BTN ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0)
class Remove_ArtifactsWithUISettingsPanel(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.artifact_list = [] self.initComponents() self.customizeComponents() # Check to see if there are any entries that need to be populated from the database. def checkBoxEvent(self, event): if self.All_Artifacts_CB.isSelected(): self.local_settings.setSetting('allArtifacts', 'true') self.List_Box_LB.setEnabled(False) else: self.local_settings.setSetting('allArtifacts', 'false') self.List_Box_LB.setEnabled(True) if self.All_Attributes_CB.isSelected(): self.local_settings.setSetting('allAttributes', 'true') self.List_Box_LB.setEnabled(False) else: self.local_settings.setSetting('allAttributes', 'false') self.List_Box_LB.setEnabled(True) def onchange_lb(self, event): self.local_settings.setSetting('listSelected', '') list_selected = self.List_Box_LB.getSelectedValuesList() self.local_settings.setSetting('listSelected', list_selected) def get_artifacts(self): sql_statement = "select distinct(type_name) 'type_name' from blackboard_artifacts a, blackboard_artifact_types b " + \ " where a.artifact_type_id = b.artifact_type_id;" skCase = Case.getCurrentCase().getSleuthkitCase() dbquery = skCase.executeQuery(sql_statement) resultSet = dbquery.getResultSet() while resultSet.next(): self.artifact_list.append(resultSet.getString("type_name")) dbquery.close() # Create the initial data fields/layout in the UI def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.All_Artifacts_CB = JCheckBox("Remove All Custom Artifacts", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.All_Artifacts_CB, self.gbcPanel0 ) self.panel0.add( self.All_Artifacts_CB ) self.All_Attributes_CB = JCheckBox("Remove All Custom Attributes", actionPerformed=self.checkBoxEvent) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.All_Attributes_CB, self.gbcPanel0 ) self.panel0.add( self.All_Attributes_CB ) self.Blank_0 = JLabel( " ") self.Blank_0.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_0, self.gbcPanel0 ) self.panel0.add( self.Blank_0 ) self.Label_0 = JLabel( "Remove selected Artifacts") self.Label_0.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_0, self.gbcPanel0 ) self.panel0.add( self.Label_0 ) self.Blank_0 = JLabel( " ") self.Blank_0.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_0, self.gbcPanel0 ) self.panel0.add( self.Blank_0 ) self.get_artifacts() self.List_Box_LB = JList( self.artifact_list, valueChanged=self.onchange_lb) self.List_Box_LB.setVisibleRowCount( 3 ) self.scpList_Box_LB = JScrollPane( self.List_Box_LB ) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.scpList_Box_LB, self.gbcPanel0 ) self.panel0.add( self.scpList_Box_LB ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Label_1 = JLabel( "Message:") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Blank_2 = JLabel( " ") self.Blank_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_2, self.gbcPanel0 ) self.panel0.add( self.Blank_2 ) self.Error_Message = JLabel( "For developer purposes only, it may fubar your case") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.add(self.panel0) # Custom load any data field and initialize the values def customizeComponents(self): self.All_Artifacts_CB.setSelected(self.local_settings.getSetting('allArtifacts') == 'true') self.All_Attributes_CB.setSelected(self.local_settings.getSetting('allAttributes') == 'true') # Return the settings used def getSettings(self): return self.local_settings
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 31 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.Label_1 = JLabel("Volatility Executable Directory") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Program_Executable_TF = JTextField(10) self.Program_Executable_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Dir", actionPerformed=self.Find_Dir) self.Find_Program_Exec_BTN.setEnabled(True) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Version_Label_1 = JLabel( "Version:") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Version_Label_1, self.gbcPanel0 ) self.panel0.add( self.Version_Label_1 ) self.Version_List = ("2.5", "2.6") self.Version_CB = JComboBox( self.Version_List) self.Version_CB.itemStateChanged = self.onchange_version self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Version_CB, self.gbcPanel0 ) self.panel0.add( self.Version_CB ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Plugin_Label_1 = JLabel( "Plugins:") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Plugin_Label_1, self.gbcPanel0 ) self.panel0.add( self.Plugin_Label_1 ) self.Plugin_list = self.get_plugins() self.Plugin_LB = JList( self.Plugin_list, valueChanged=self.onchange_plugins_lb) self.Plugin_LB.setVisibleRowCount( 3 ) self.scpPlugin_LB = JScrollPane( self.Plugin_LB ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.scpPlugin_LB, self.gbcPanel0 ) self.panel0.add( self.scpPlugin_LB ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 17 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Profile_Label_1 = JLabel( "Profile:") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Profile_Label_1, self.gbcPanel0 ) self.panel0.add( self.Profile_Label_1 ) self.Profile_List = self.get_profiles() self.Profile_CB = JComboBox( self.Profile_List) self.Profile_CB.itemStateChanged = self.onchange_profile_cb self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 19 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 1 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Profile_CB, self.gbcPanel0 ) self.panel0.add( self.Profile_CB ) self.Blank_5 = JLabel( " ") self.Blank_5.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 21 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_5, self.gbcPanel0 ) self.panel0.add( self.Blank_5 ) self.Label_2 = JLabel("Additional Parameters To Run With:") self.Label_2.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 23 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_2, self.gbcPanel0 ) self.panel0.add( self.Label_2 ) self.Additional_Parms_TF = JTextField(10,focusLost=self.keyPressed) #self.Additional_Parms_TF.getDocument().addDocumentListener() self.Additional_Parms_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 25 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Additional_Parms_TF, self.gbcPanel0 ) self.panel0.add( self.Additional_Parms_TF ) self.Blank_6 = JLabel( " ") self.Blank_6.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 27 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_6, self.gbcPanel0 ) self.panel0.add( self.Blank_6 ) self.Label_3 = JLabel( "Message:") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 29 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.add(self.panel0)
def initComponents(self): self.panel0 = JPanel() self.rbgPanel0 = ButtonGroup() self.gbPanel0 = GridBagLayout() self.gbcPanel0 = GridBagConstraints() self.panel0.setLayout( self.gbPanel0 ) self.Error_Message = JLabel( "") self.Error_Message.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 15 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Error_Message, self.gbcPanel0 ) self.panel0.add( self.Error_Message ) self.Label_1 = JLabel("Volatility Executable Directory") self.Label_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 1 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_1, self.gbcPanel0 ) self.panel0.add( self.Label_1 ) self.Program_Executable_TF = JTextField(10) self.Program_Executable_TF.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Program_Executable_TF, self.gbcPanel0 ) self.panel0.add( self.Program_Executable_TF ) self.Find_Program_Exec_BTN = JButton( "Find Dir", actionPerformed=self.Find_Dir) self.Find_Program_Exec_BTN.setEnabled(True) self.rbgPanel0.add( self.Find_Program_Exec_BTN ) self.gbcPanel0.gridx = 6 self.gbcPanel0.gridy = 3 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Find_Program_Exec_BTN, self.gbcPanel0 ) self.panel0.add( self.Find_Program_Exec_BTN ) self.Blank_1 = JLabel( " ") self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 5 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_1, self.gbcPanel0 ) self.panel0.add( self.Blank_1 ) self.Blank_3 = JLabel( " ") self.Blank_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 7 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_3, self.gbcPanel0 ) self.panel0.add( self.Blank_3 ) self.Check_Box = JCheckBox("Extract and Create Memory Image from Hiberfile", actionPerformed=self.checkBoxEvent) self.Blank_1.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 9 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Check_Box, self.gbcPanel0 ) self.panel0.add( self.Check_Box ) self.Blank_4 = JLabel( " ") self.Blank_4.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 11 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Blank_4, self.gbcPanel0 ) self.panel0.add( self.Blank_4 ) self.Label_3 = JLabel( "Message:") self.Label_3.setEnabled(True) self.gbcPanel0.gridx = 2 self.gbcPanel0.gridy = 13 self.gbcPanel0.gridwidth = 1 self.gbcPanel0.gridheight = 1 self.gbcPanel0.fill = GridBagConstraints.BOTH self.gbcPanel0.weightx = 1 self.gbcPanel0.weighty = 0 self.gbcPanel0.anchor = GridBagConstraints.NORTH self.gbPanel0.setConstraints( self.Label_3, self.gbcPanel0 ) self.panel0.add( self.Label_3 ) self.add(self.panel0)