mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-09 06:39:33 +00:00
Corrected handling of always calc hashes flag
This commit is contained in:
parent
8b243e8215
commit
509684cebc
@ -77,7 +77,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
private List<HashDb> knownBadHashSets = new ArrayList<>();
|
private List<HashDb> knownBadHashSets = new ArrayList<>();
|
||||||
private Set<String> hashSetNames = new HashSet<>();
|
private Set<String> hashSetNames = new HashSet<>();
|
||||||
private Set<String> hashSetPaths = new HashSet<>();
|
private Set<String> hashSetPaths = new HashSet<>();
|
||||||
private boolean alwaysCalculateHashes = false;
|
private boolean alwaysCalculateHashes = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the singleton instance of this class.
|
* Gets the singleton instance of this class.
|
||||||
@ -566,7 +566,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, " element ");
|
Logger.getLogger(HashDbManager.class.getName()).log(Level.WARNING, " element ");
|
||||||
alwaysCalculateHashes = false;
|
alwaysCalculateHashes = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.sleuthkit.autopsy.hashdatabase;
|
package org.sleuthkit.autopsy.hashdatabase;
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
@ -35,7 +36,8 @@ import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
|||||||
/**
|
/**
|
||||||
* Instances of this class provide a simplified UI for managing the hash sets configuration.
|
* Instances of this class provide a simplified UI for managing the hash sets configuration.
|
||||||
*/
|
*/
|
||||||
public class HashDbSimpleConfigPanel extends javax.swing.JPanel {
|
public class HashDbSimpleConfigPanel extends javax.swing.JPanel {
|
||||||
|
|
||||||
private HashDatabasesTableModel knownTableModel;
|
private HashDatabasesTableModel knownTableModel;
|
||||||
private HashDatabasesTableModel knownBadTableModel;
|
private HashDatabasesTableModel knownBadTableModel;
|
||||||
|
|
||||||
@ -49,6 +51,7 @@ public class HashDbSimpleConfigPanel extends javax.swing.JPanel {
|
|||||||
private void customizeComponents() {
|
private void customizeComponents() {
|
||||||
customizeHashDbsTable(jScrollPane1, knownHashTable, knownTableModel);
|
customizeHashDbsTable(jScrollPane1, knownHashTable, knownTableModel);
|
||||||
customizeHashDbsTable(jScrollPane2, knownBadHashTable, knownBadTableModel);
|
customizeHashDbsTable(jScrollPane2, knownBadHashTable, knownBadTableModel);
|
||||||
|
alwaysCalcHashesCheckbox.setSelected(HashDbManager.getInstance().getAlwaysCalculateHashes());
|
||||||
|
|
||||||
// Add a listener to the always calculate hashes checkbox component.
|
// Add a listener to the always calculate hashes checkbox component.
|
||||||
// The listener passes the user's selection on to the hash database manager.
|
// The listener passes the user's selection on to the hash database manager.
|
||||||
@ -81,42 +84,14 @@ public class HashDbSimpleConfigPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void load() {
|
void load() {
|
||||||
knownTableModel.refresh();
|
knownTableModel.load();
|
||||||
knownBadTableModel.refresh();
|
knownBadTableModel.load();
|
||||||
refreshAlwaysCalcHashesCheckbox();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void save() {
|
void save() {
|
||||||
HashDbManager.getInstance().save();
|
HashDbManager.getInstance().save();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshAlwaysCalcHashesCheckbox() {
|
|
||||||
boolean noHashDbsConfiguredForIngest = true;
|
|
||||||
for (HashDb hashDb : HashDbManager.getInstance().getAllHashSets()) {
|
|
||||||
try {
|
|
||||||
if (hashDb.getSearchDuringIngest()== true && hashDb.hasLookupIndex()) {
|
|
||||||
noHashDbsConfiguredForIngest = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (TskCoreException ex) {
|
|
||||||
Logger.getLogger(HashDbSimpleConfigPanel.class.getName()).log(Level.SEVERE, "Error getting info for " + hashDb.getHashSetName() + " hash database", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are no hash databases configured for use during file ingest,
|
|
||||||
// default to always calculating hashes of the files.
|
|
||||||
if (noHashDbsConfiguredForIngest) {
|
|
||||||
alwaysCalcHashesCheckbox.setEnabled(true);
|
|
||||||
alwaysCalcHashesCheckbox.setSelected(true);
|
|
||||||
HashDbManager.getInstance().setAlwaysCalculateHashes(true);
|
|
||||||
} else {
|
|
||||||
alwaysCalcHashesCheckbox.setEnabled(false);
|
|
||||||
alwaysCalcHashesCheckbox.setSelected(false);
|
|
||||||
HashDbManager.getInstance().setAlwaysCalculateHashes(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class HashDatabasesTableModel extends AbstractTableModel {
|
private class HashDatabasesTableModel extends AbstractTableModel {
|
||||||
private final HashDbManager.HashDb.KnownFilesType hashDatabasesType;
|
private final HashDbManager.HashDb.KnownFilesType hashDatabasesType;
|
||||||
private List<HashDb> hashDatabases;
|
private List<HashDb> hashDatabases;
|
||||||
@ -135,7 +110,7 @@ public class HashDbSimpleConfigPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refresh() {
|
private void load() {
|
||||||
getHashDatabases();
|
getHashDatabases();
|
||||||
fireTableDataChanged();
|
fireTableDataChanged();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user