From 3c76d5006c96818392a76caf2f61e37bf30fc9b8 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 16 Nov 2020 16:18:25 -0500 Subject: [PATCH 1/2] Added file list refresh button --- .../autopsy/modules/yara/ui/Bundle.properties | 1 + .../modules/yara/ui/Bundle.properties-MERGED | 1 + .../modules/yara/ui/RuleSetDetailsPanel.form | 24 ++++++++++- .../modules/yara/ui/RuleSetDetailsPanel.java | 43 ++++++++++++++++--- 4 files changed, 62 insertions(+), 7 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/yara/ui/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/yara/ui/Bundle.properties index 2ac49a5463..22f969f628 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/yara/ui/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/yara/ui/Bundle.properties @@ -12,3 +12,4 @@ YaraIngestSettingsPanel.border.title=Select YARA rule sets to enable during inge YaraIngestSettingsPanel.allFilesButton.text=All Files YaraIngestSettingsPanel.allFilesButton.toolTipText= YaraIngestSettingsPanel.executableFilesButton.text=Only Executable Files +RuleSetDetailsPanel.refreshButton.text=Refresh File List diff --git a/Core/src/org/sleuthkit/autopsy/modules/yara/ui/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/modules/yara/ui/Bundle.properties-MERGED index 3fad865f43..f152cf959b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/yara/ui/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/modules/yara/ui/Bundle.properties-MERGED @@ -14,6 +14,7 @@ YaraIngestSettingsPanel.border.title=Select YARA rule sets to enable during inge YaraIngestSettingsPanel.allFilesButton.text=All Files YaraIngestSettingsPanel.allFilesButton.toolTipText= YaraIngestSettingsPanel.executableFilesButton.text=Only Executable Files +RuleSetDetailsPanel.refreshButton.text=Refresh File List # {0} - rule set name YaraRuleSetOptionPanel_badName_msg=Rule set name {0} already exists.\nRule set names must be unique. YaraRuleSetOptionPanel_badName_title=Create Rule Set diff --git a/Core/src/org/sleuthkit/autopsy/modules/yara/ui/RuleSetDetailsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/yara/ui/RuleSetDetailsPanel.form index 2f1c87a69f..955199108a 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/yara/ui/RuleSetDetailsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/yara/ui/RuleSetDetailsPanel.form @@ -81,11 +81,33 @@ - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/yara/ui/RuleSetDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/yara/ui/RuleSetDetailsPanel.java index 8c284a190e..7e3e506948 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/yara/ui/RuleSetDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/yara/ui/RuleSetDetailsPanel.java @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.modules.yara.ui; import java.awt.Component; import java.awt.Desktop; +import java.awt.Graphics; import java.io.File; import java.io.IOException; import java.util.List; @@ -56,7 +57,8 @@ public class RuleSetDetailsPanel extends javax.swing.JPanel { fileList.setModel(fileListModel); fileList.setCellRenderer(new FileRenderer()); openFolderButton.setEnabled(false); - + scrollPane.setViewportView(fileList); + } /** @@ -71,15 +73,17 @@ public class RuleSetDetailsPanel extends javax.swing.JPanel { if (ruleSet != null) { List files = currentRuleSet.getRuleFiles(); - - for (File file : files) { - fileListModel.addElement(file); + + if(files != null) { + for (File file : files) { + fileListModel.addElement(file); + } } } openFolderButton.setEnabled(ruleSet != null); } - + /** * Simple ListCellRenderer for the file list. */ @@ -116,6 +120,7 @@ public class RuleSetDetailsPanel extends javax.swing.JPanel { openFolderButton = new javax.swing.JButton(); openLabel = new javax.swing.JLabel(); scrollPane = new javax.swing.JScrollPane(); + javax.swing.JButton refreshButton = new javax.swing.JButton(); setLayout(new java.awt.GridBagLayout()); @@ -159,12 +164,25 @@ public class RuleSetDetailsPanel extends javax.swing.JPanel { gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 4; - gridBagConstraints.gridwidth = 2; + gridBagConstraints.gridwidth = 3; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0); add(scrollPane, gridBagConstraints); + + refreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/arrow-circle-double-135.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(refreshButton, org.openide.util.NbBundle.getMessage(RuleSetDetailsPanel.class, "RuleSetDetailsPanel.refreshButton.text")); // NOI18N + refreshButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + refreshButtonActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 5; + gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHEAST; + add(refreshButton, gridBagConstraints); }// //GEN-END:initComponents @Messages({ @@ -188,6 +206,19 @@ public class RuleSetDetailsPanel extends javax.swing.JPanel { } }//GEN-LAST:event_openFolderButtonActionPerformed + private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed + if (currentRuleSet != null) { + fileListModel.clear(); + List files = currentRuleSet.getRuleFiles(); + + if(files != null) { + for (File file : files) { + fileListModel.addElement(file); + } + } + } + }//GEN-LAST:event_refreshButtonActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton openFolderButton; From cc18e88ab4beef64de6aead536e32974508e04de Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Fri, 20 Nov 2020 10:38:09 -0500 Subject: [PATCH 2/2] Review changes --- Core/build.xml | 2 +- .../modules/yara/YaraIngestHelper.java | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Core/build.xml b/Core/build.xml index 811ff30772..a9807f490b 100644 --- a/Core/build.xml +++ b/Core/build.xml @@ -98,7 +98,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/yara/YaraIngestHelper.java b/Core/src/org/sleuthkit/autopsy/modules/yara/YaraIngestHelper.java index 20f1b7d67f..4b71a62351 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/yara/YaraIngestHelper.java +++ b/Core/src/org/sleuthkit/autopsy/modules/yara/YaraIngestHelper.java @@ -1,7 +1,20 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.modules.yara;