mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 07:56:16 +00:00
Hash DB ingest config: fix setting syncing in widgets, simplify NSRL widget
This commit is contained in:
parent
fba30dde20
commit
3ad3e64952
@ -8,7 +8,6 @@ HashDbSimplePanel.notableValLabel.text=-
|
||||
HashDbMgmtPanel.addNotableButton.text=Add Known Bad Database
|
||||
HashDbMgmtPanel.removeNotableButton.text=Remove Selected
|
||||
HashDbSimplePanel.jLabel1.text=Select known bad databases to use during ingest:
|
||||
HashDbSimplePanel.jLabel2.text=NSRL Database:
|
||||
HashDbMgmtPanel.nsrlNameLabel.text=Not Configured
|
||||
HashDbMgmtPanel.setNSRLButton.text=Change
|
||||
HashDbMgmtPanel.jLabel1.text=Known Bad Database(s):
|
||||
@ -55,3 +54,5 @@ HashDbSearchPanel.errorField.text=Error: Not all files have been hashed.
|
||||
HashDbSearchPanel.saveBox.text=Remember Hashes
|
||||
HashDbSearchPanel.cancelButton.text=Cancel
|
||||
HashDbSimplePanel.calcHashesButton.text=Calculate hashes even if no hash database is selected
|
||||
HashDbSimplePanel.nsrlDbLabel.text=NSRL Database:
|
||||
HashDbSimplePanel.nsrlDbLabelVal.text=-
|
||||
|
@ -17,13 +17,18 @@
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="1" pref="0" max="32767" attributes="1"/>
|
||||
<Component id="jScrollPane2" alignment="0" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="calcHashesButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="nsrlDbLabel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="nsrlDbLabelVal" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
@ -32,14 +37,15 @@
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane2" min="-2" pref="20" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="nsrlDbLabel" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="nsrlDbLabelVal" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="19" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="25" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane1" min="-2" pref="68" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="calcHashesButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
@ -79,38 +85,13 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Component class="javax.swing.JLabel" name="nsrlDbLabel">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/hashdatabase/Bundle.properties" key="HashDbSimplePanel.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/hashdatabase/Bundle.properties" key="HashDbSimplePanel.nsrlDbLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="jTable1">
|
||||
<Properties>
|
||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="f0" green="f0" red="f0" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="showHorizontalLines" type="boolean" value="false"/>
|
||||
<Property name="showVerticalLines" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JCheckBox" name="calcHashesButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
@ -118,5 +99,12 @@
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="nsrlDbLabelVal">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/hashdatabase/Bundle.properties" key="HashDbSimplePanel.nsrlDbLabelVal.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -26,6 +26,7 @@ package org.sleuthkit.autopsy.hashdatabase;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
@ -39,14 +40,12 @@ public class HashDbSimplePanel extends javax.swing.JPanel {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(HashDbSimplePanel.class.getName());
|
||||
private HashTableModel knownBadTableModel;
|
||||
private NSRLTableModel nsrlTableModel;
|
||||
private HashDb nsrl;
|
||||
private static boolean ingestRunning = false;
|
||||
|
||||
/** Creates new form HashDbSimplePanel */
|
||||
public HashDbSimplePanel() {
|
||||
knownBadTableModel = new HashTableModel();
|
||||
nsrlTableModel = new NSRLTableModel();
|
||||
initComponents();
|
||||
customizeComponents();
|
||||
}
|
||||
@ -55,9 +54,24 @@ public class HashDbSimplePanel extends javax.swing.JPanel {
|
||||
ingestRunning = running;
|
||||
}
|
||||
|
||||
private void customizeComponents() {
|
||||
private void reloadCalc() {
|
||||
final HashDbXML xmlHandle = HashDbXML.getCurrent();
|
||||
if(xmlHandle.getNSRLSet()==null && xmlHandle.getKnownBadSets().isEmpty()) {
|
||||
|
||||
final boolean nsrlUsed = xmlHandle.getNSRLSet()!=null && xmlHandle.getNSRLSet().getUseForIngest()== true;
|
||||
final List<HashDb> knowns = xmlHandle.getKnownBadSets();
|
||||
final boolean knownExists = !knowns.isEmpty();
|
||||
boolean knownUsed = false;
|
||||
if (knownExists) {
|
||||
for (HashDb known : knowns) {
|
||||
if (known.getUseForIngest() == true) {
|
||||
knownUsed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(! nsrlUsed
|
||||
&& ! knownUsed ) {
|
||||
calcHashesButton.setEnabled(true);
|
||||
calcHashesButton.setSelected(true);
|
||||
xmlHandle.setCalculate(true);
|
||||
@ -66,6 +80,10 @@ public class HashDbSimplePanel extends javax.swing.JPanel {
|
||||
calcHashesButton.setSelected(false);
|
||||
xmlHandle.setCalculate(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void customizeComponents() {
|
||||
final HashDbXML xmlHandle = HashDbXML.getCurrent();
|
||||
calcHashesButton.addActionListener( new ActionListener() {
|
||||
|
||||
@Override
|
||||
@ -80,26 +98,18 @@ public class HashDbSimplePanel extends javax.swing.JPanel {
|
||||
});
|
||||
|
||||
notableHashTable.setModel(knownBadTableModel);
|
||||
jTable1.setModel(nsrlTableModel);
|
||||
|
||||
notableHashTable.setTableHeader(null);
|
||||
jTable1.setTableHeader(null);
|
||||
notableHashTable.setRowSelectionAllowed(false);
|
||||
jTable1.setRowSelectionAllowed(false);
|
||||
//customize column witdhs
|
||||
final int width1 = jScrollPane1.getPreferredSize().width;
|
||||
final int width2 = jScrollPane2.getPreferredSize().width;
|
||||
TableColumn column1 = null;
|
||||
TableColumn column2 = null;
|
||||
for (int i = 0; i < notableHashTable.getColumnCount(); i++) {
|
||||
column1 = notableHashTable.getColumnModel().getColumn(i);
|
||||
column2 = jTable1.getColumnModel().getColumn(i);
|
||||
if (i == 0) {
|
||||
column1.setPreferredWidth(((int) (width1 * 0.15)));
|
||||
column2.setPreferredWidth(((int) (width2 * 0.15)));
|
||||
} else {
|
||||
column1.setPreferredWidth(((int) (width1 * 0.84)));
|
||||
column2.setPreferredWidth(((int) (width2 * 0.84)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,10 +128,9 @@ public class HashDbSimplePanel extends javax.swing.JPanel {
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
notableHashTable = new javax.swing.JTable();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
jTable1 = new javax.swing.JTable();
|
||||
nsrlDbLabel = new javax.swing.JLabel();
|
||||
calcHashesButton = new javax.swing.JCheckBox();
|
||||
nsrlDbLabelVal = new javax.swing.JLabel();
|
||||
|
||||
jScrollPane1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
||||
@ -132,42 +141,40 @@ public class HashDbSimplePanel extends javax.swing.JPanel {
|
||||
|
||||
jLabel1.setText(org.openide.util.NbBundle.getMessage(HashDbSimplePanel.class, "HashDbSimplePanel.jLabel1.text")); // NOI18N
|
||||
|
||||
jLabel2.setText(org.openide.util.NbBundle.getMessage(HashDbSimplePanel.class, "HashDbSimplePanel.jLabel2.text")); // NOI18N
|
||||
|
||||
jScrollPane2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
||||
jTable1.setBackground(new java.awt.Color(240, 240, 240));
|
||||
jTable1.setShowHorizontalLines(false);
|
||||
jTable1.setShowVerticalLines(false);
|
||||
jScrollPane2.setViewportView(jTable1);
|
||||
nsrlDbLabel.setText(org.openide.util.NbBundle.getMessage(HashDbSimplePanel.class, "HashDbSimplePanel.nsrlDbLabel.text")); // NOI18N
|
||||
|
||||
calcHashesButton.setText(org.openide.util.NbBundle.getMessage(HashDbSimplePanel.class, "HashDbSimplePanel.calcHashesButton.text")); // NOI18N
|
||||
|
||||
nsrlDbLabelVal.setText(org.openide.util.NbBundle.getMessage(HashDbSimplePanel.class, "HashDbSimplePanel.nsrlDbLabelVal.text")); // NOI18N
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(calcHashesButton))
|
||||
.addComponent(calcHashesButton)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
|
||||
.addComponent(nsrlDbLabel)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(nsrlDbLabelVal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(nsrlDbLabel)
|
||||
.addComponent(nsrlDbLabelVal))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(calcHashesButton)
|
||||
.addContainerGap())
|
||||
);
|
||||
@ -176,48 +183,28 @@ public class HashDbSimplePanel extends javax.swing.JPanel {
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JCheckBox calcHashesButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JTable jTable1;
|
||||
private javax.swing.JTable notableHashTable;
|
||||
private javax.swing.JLabel nsrlDbLabel;
|
||||
private javax.swing.JLabel nsrlDbLabelVal;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
private void reloadSets() {
|
||||
nsrl = HashDbXML.getCurrent().getNSRLSet();
|
||||
nsrlTableModel.resync();
|
||||
|
||||
if (nsrl == null || nsrl.getUseForIngest() == false) {
|
||||
nsrlDbLabelVal.setText("Not Configured");
|
||||
}
|
||||
else {
|
||||
nsrlDbLabelVal.setText("Configured");
|
||||
}
|
||||
|
||||
reloadCalc();
|
||||
|
||||
knownBadTableModel.resync();
|
||||
}
|
||||
|
||||
private class NSRLTableModel extends AbstractTableModel {
|
||||
|
||||
private void resync() {
|
||||
fireTableDataChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
if (columnIndex == 0) {
|
||||
return "";
|
||||
} else {
|
||||
if(nsrl == null) {
|
||||
return "Not Configured";
|
||||
} else {
|
||||
return nsrl.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class HashTableModel extends AbstractTableModel {
|
||||
|
||||
@ -270,6 +257,7 @@ public class HashDbSimplePanel extends javax.swing.JPanel {
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(HashDbSimplePanel.this, "Databases must be indexed before they can be used for ingest");
|
||||
}
|
||||
reloadSets();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user