mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-18 18:47:43 +00:00
Merge branch 'develop' of github.com:sleuthkit/autopsy into develop
This commit is contained in:
commit
dfb33d44fa
@ -50,7 +50,6 @@ public final class HashDbConfigPanel extends javax.swing.JPanel implements Optio
|
||||
private static final String NO_SELECTION_TEXT = "No database selected";
|
||||
private static final String ERROR_GETTING_PATH_TEXT = "Error occurred getting path";
|
||||
private static final String ERROR_GETTING_INDEX_STATUS_TEXT = "Error occurred getting status";
|
||||
private static final String LEGACY_INDEX_FILE_EXTENSION = "-md5.idx";
|
||||
private HashDbManager hashSetManager = HashDbManager.getInstance();
|
||||
private HashSetTableModel hashSetTableModel = new HashSetTableModel();
|
||||
|
||||
@ -161,13 +160,10 @@ public final class HashDbConfigPanel extends javax.swing.JPanel implements Optio
|
||||
hashDbIndexStatusLabel.setForeground(Color.black);
|
||||
indexButton.setEnabled(false);
|
||||
}
|
||||
else if (db.hasLookupIndex()) {
|
||||
else if (db.hasIndex()) {
|
||||
if (db.hasIndexOnly()) {
|
||||
hashDbIndexStatusLabel.setText("Index only");
|
||||
}
|
||||
else if (db.getIndexPath().endsWith(LEGACY_INDEX_FILE_EXTENSION)) {
|
||||
hashDbIndexStatusLabel.setText("Indexed (old format)");
|
||||
}
|
||||
else {
|
||||
hashDbIndexStatusLabel.setText("Indexed");
|
||||
}
|
||||
@ -242,7 +238,7 @@ public final class HashDbConfigPanel extends javax.swing.JPanel implements Optio
|
||||
List<HashDb> unindexed = new ArrayList<>();
|
||||
for (HashDb hashSet : hashSetManager.getAllHashSets()) {
|
||||
try {
|
||||
if (!hashSet.hasLookupIndex()) {
|
||||
if (!hashSet.hasIndex()) {
|
||||
unindexed.add(hashSet);
|
||||
}
|
||||
}
|
||||
@ -376,7 +372,7 @@ public final class HashDbConfigPanel extends javax.swing.JPanel implements Optio
|
||||
|
||||
private boolean indexExists(int rowIndex){
|
||||
try {
|
||||
return hashSets.get(rowIndex).hasLookupIndex();
|
||||
return hashSets.get(rowIndex).hasIndex();
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(HashSetTableModel.class.getName()).log(Level.SEVERE, "Error getting index info for hash database", ex);
|
||||
|
@ -43,6 +43,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.datamodel.TskData;
|
||||
import org.sleuthkit.datamodel.TskException;
|
||||
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
||||
import org.sleuthkit.datamodel.HashInfo;
|
||||
|
||||
public class HashDbIngestModule extends IngestModuleAbstractFile {
|
||||
private static HashDbIngestModule instance = null;
|
||||
@ -164,7 +165,7 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
|
||||
for (HashDb db : hashDbs) {
|
||||
if (db.getSearchDuringIngest()) {
|
||||
try {
|
||||
if (db.hasLookupIndex()) {
|
||||
if (db.hasIndex()) {
|
||||
hashDbsForIngest.add(db);
|
||||
}
|
||||
}
|
||||
@ -218,7 +219,8 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
|
||||
for (HashDb db : knownBadHashSets) {
|
||||
try {
|
||||
long lookupstart = System.currentTimeMillis();
|
||||
if (db.hasMd5HashOf(file)) {
|
||||
HashInfo hashInfo = db.lookUp(file);
|
||||
if (null != hashInfo) {
|
||||
foundBad = true;
|
||||
knownBadCount += 1;
|
||||
try {
|
||||
@ -231,8 +233,8 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
|
||||
}
|
||||
String hashSetName = db.getHashSetName();
|
||||
|
||||
String comment = "";
|
||||
ArrayList<String> comments = db.lookUp(file).getComments();
|
||||
String comment = "";
|
||||
ArrayList<String> comments = hashInfo.getComments();
|
||||
int i = 0;
|
||||
for (String c : comments) {
|
||||
comment += c;
|
||||
|
@ -243,9 +243,9 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
return hashDb;
|
||||
}
|
||||
|
||||
synchronized void indexHashDatabase(HashDb hashDb, boolean deleteIndexFile) {
|
||||
synchronized void indexHashDatabase(HashDb hashDb) {
|
||||
hashDb.addPropertyChangeListener(this);
|
||||
HashDbIndexer creator = new HashDbIndexer(hashDb, deleteIndexFile);
|
||||
HashDbIndexer creator = new HashDbIndexer(hashDb);
|
||||
creator.execute();
|
||||
}
|
||||
|
||||
@ -788,7 +788,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
public void addHashes(Content content, String comment) throws TskCoreException {
|
||||
// TODO: This only works for AbstractFiles and MD5 hashes at present.
|
||||
// This only works for AbstractFiles and MD5 hashes at present.
|
||||
assert content instanceof AbstractFile;
|
||||
if (content instanceof AbstractFile) {
|
||||
AbstractFile file = (AbstractFile)content;
|
||||
@ -812,23 +812,21 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
|
||||
public HashInfo lookUp(Content content) throws TskCoreException {
|
||||
HashInfo result = null;
|
||||
// TODO: This only works for AbstractFiles and MD5 hashes at present.
|
||||
// This only works for AbstractFiles and MD5 hashes at present.
|
||||
assert content instanceof AbstractFile;
|
||||
if (content instanceof AbstractFile) {
|
||||
AbstractFile file = (AbstractFile)content;
|
||||
if (null != file.getMd5Hash()) {
|
||||
result = SleuthkitJNI.lookupInHashDatabaseVerbose(file.getMd5Hash(), handle);
|
||||
}
|
||||
result = SleuthkitJNI.lookupInHashDatabaseVerbose(file.getMd5Hash(), handle);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
boolean hasLookupIndex() throws TskCoreException {
|
||||
boolean hasIndex() throws TskCoreException {
|
||||
return SleuthkitJNI.hashDatabaseHasLookupIndex(handle);
|
||||
}
|
||||
|
||||
boolean hasIndexOnly() throws TskCoreException {
|
||||
return SleuthkitJNI.hashDatabaseHasLegacyLookupIndexOnly(handle);
|
||||
return SleuthkitJNI.hashDatabaseIsIndexOnly(handle);
|
||||
}
|
||||
|
||||
boolean canBeReIndexed() throws TskCoreException {
|
||||
@ -847,11 +845,9 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
private class HashDbIndexer extends SwingWorker<Object, Void> {
|
||||
private ProgressHandle progress = null;
|
||||
private HashDb hashDb = null;
|
||||
private boolean deleteIndexFile = false;
|
||||
|
||||
HashDbIndexer(HashDb hashDb, boolean deleteIndexFile) {
|
||||
HashDbIndexer(HashDb hashDb) {
|
||||
this.hashDb = hashDb;
|
||||
this.deleteIndexFile = deleteIndexFile;
|
||||
};
|
||||
|
||||
@Override
|
||||
@ -861,7 +857,7 @@ public class HashDbManager implements PropertyChangeListener {
|
||||
progress.start();
|
||||
progress.switchToIndeterminate();
|
||||
try {
|
||||
SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.handle, deleteIndexFile);
|
||||
SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.handle);
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(HashDb.class.getName()).log(Level.SEVERE, "Error indexing hash database", ex);
|
||||
|
@ -146,7 +146,7 @@ public class HashDbSimpleConfigPanel extends javax.swing.JPanel {
|
||||
HashDb db = hashDatabases.get(rowIndex);
|
||||
boolean dbHasIndex = false;
|
||||
try {
|
||||
dbHasIndex = db.hasLookupIndex();
|
||||
dbHasIndex = db.hasIndex();
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(HashDbSimpleConfigPanel.class.getName()).log(Level.SEVERE, "Error getting info for " + db.getHashSetName() + " hash database", ex);
|
||||
|
@ -21,13 +21,9 @@ package org.sleuthkit.autopsy.hashdatabase;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JOptionPane;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
||||
|
||||
/**
|
||||
@ -42,7 +38,6 @@ import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
||||
*/
|
||||
class ModalNoButtons extends javax.swing.JDialog implements PropertyChangeListener {
|
||||
|
||||
private static final String INDEX_FILE_EXTENSION = ".kdb";
|
||||
List<HashDb> unindexed;
|
||||
HashDb toIndex;
|
||||
HashDbConfigPanel hdbmp;
|
||||
@ -211,7 +206,7 @@ class ModalNoButtons extends javax.swing.JDialog implements PropertyChangeListen
|
||||
this.CURRENTLYON_LABEL.setText("Currently indexing 1 database");
|
||||
if (!this.toIndex.isIndexing()) {
|
||||
this.toIndex.addPropertyChangeListener(this);
|
||||
HashDbManager.getInstance().indexHashDatabase(toIndex, okToDeleteOldIndexFile(toIndex));
|
||||
HashDbManager.getInstance().indexHashDatabase(toIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -227,7 +222,7 @@ class ModalNoButtons extends javax.swing.JDialog implements PropertyChangeListen
|
||||
this.CURRENTLYON_LABEL.setText("Currently indexing 1 of " + length);
|
||||
if (!db.isIndexing()) {
|
||||
db.addPropertyChangeListener(this);
|
||||
HashDbManager.getInstance().indexHashDatabase(db, okToDeleteOldIndexFile(db));
|
||||
HashDbManager.getInstance().indexHashDatabase(db);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,23 +250,5 @@ class ModalNoButtons extends javax.swing.JDialog implements PropertyChangeListen
|
||||
this.CURRENTLYON_LABEL.setText("Currently indexing " + currentcount + " of " + length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean okToDeleteOldIndexFile(HashDb hashDb) {
|
||||
boolean deleteOldIndexFile = true;
|
||||
try {
|
||||
if (hashDb.hasLookupIndex()) {
|
||||
String indexPath = hashDb.getIndexPath();
|
||||
File indexFile = new File(indexPath);
|
||||
if (!indexPath.endsWith(INDEX_FILE_EXTENSION)) {
|
||||
deleteOldIndexFile = JOptionPane.showConfirmDialog(this, "Updating index file format, delete " + indexFile.getName() + " file that uses the old file format?", "Delete Obsolete Index File", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (TskCoreException ex) {
|
||||
Logger.getLogger(HashDbConfigPanel.class.getName()).log(Level.SEVERE, "Error getting index info for hash database", ex);
|
||||
JOptionPane.showMessageDialog(null, "Error gettting index information for " + hashDb.getHashSetName() + " hash database. Cannot perform indexing operation.", "Hash Database Index Status Error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
return deleteOldIndexFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user