mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 02:57:44 +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 NO_SELECTION_TEXT = "No database selected";
|
||||||
private static final String ERROR_GETTING_PATH_TEXT = "Error occurred getting path";
|
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 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 HashDbManager hashSetManager = HashDbManager.getInstance();
|
||||||
private HashSetTableModel hashSetTableModel = new HashSetTableModel();
|
private HashSetTableModel hashSetTableModel = new HashSetTableModel();
|
||||||
|
|
||||||
@ -161,13 +160,10 @@ public final class HashDbConfigPanel extends javax.swing.JPanel implements Optio
|
|||||||
hashDbIndexStatusLabel.setForeground(Color.black);
|
hashDbIndexStatusLabel.setForeground(Color.black);
|
||||||
indexButton.setEnabled(false);
|
indexButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
else if (db.hasLookupIndex()) {
|
else if (db.hasIndex()) {
|
||||||
if (db.hasIndexOnly()) {
|
if (db.hasIndexOnly()) {
|
||||||
hashDbIndexStatusLabel.setText("Index only");
|
hashDbIndexStatusLabel.setText("Index only");
|
||||||
}
|
}
|
||||||
else if (db.getIndexPath().endsWith(LEGACY_INDEX_FILE_EXTENSION)) {
|
|
||||||
hashDbIndexStatusLabel.setText("Indexed (old format)");
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
hashDbIndexStatusLabel.setText("Indexed");
|
hashDbIndexStatusLabel.setText("Indexed");
|
||||||
}
|
}
|
||||||
@ -242,7 +238,7 @@ public final class HashDbConfigPanel extends javax.swing.JPanel implements Optio
|
|||||||
List<HashDb> unindexed = new ArrayList<>();
|
List<HashDb> unindexed = new ArrayList<>();
|
||||||
for (HashDb hashSet : hashSetManager.getAllHashSets()) {
|
for (HashDb hashSet : hashSetManager.getAllHashSets()) {
|
||||||
try {
|
try {
|
||||||
if (!hashSet.hasLookupIndex()) {
|
if (!hashSet.hasIndex()) {
|
||||||
unindexed.add(hashSet);
|
unindexed.add(hashSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -376,7 +372,7 @@ public final class HashDbConfigPanel extends javax.swing.JPanel implements Optio
|
|||||||
|
|
||||||
private boolean indexExists(int rowIndex){
|
private boolean indexExists(int rowIndex){
|
||||||
try {
|
try {
|
||||||
return hashSets.get(rowIndex).hasLookupIndex();
|
return hashSets.get(rowIndex).hasIndex();
|
||||||
}
|
}
|
||||||
catch (TskCoreException ex) {
|
catch (TskCoreException ex) {
|
||||||
Logger.getLogger(HashSetTableModel.class.getName()).log(Level.SEVERE, "Error getting index info for hash database", 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.TskData;
|
||||||
import org.sleuthkit.datamodel.TskException;
|
import org.sleuthkit.datamodel.TskException;
|
||||||
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
||||||
|
import org.sleuthkit.datamodel.HashInfo;
|
||||||
|
|
||||||
public class HashDbIngestModule extends IngestModuleAbstractFile {
|
public class HashDbIngestModule extends IngestModuleAbstractFile {
|
||||||
private static HashDbIngestModule instance = null;
|
private static HashDbIngestModule instance = null;
|
||||||
@ -164,7 +165,7 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
|
|||||||
for (HashDb db : hashDbs) {
|
for (HashDb db : hashDbs) {
|
||||||
if (db.getSearchDuringIngest()) {
|
if (db.getSearchDuringIngest()) {
|
||||||
try {
|
try {
|
||||||
if (db.hasLookupIndex()) {
|
if (db.hasIndex()) {
|
||||||
hashDbsForIngest.add(db);
|
hashDbsForIngest.add(db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -218,7 +219,8 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
|
|||||||
for (HashDb db : knownBadHashSets) {
|
for (HashDb db : knownBadHashSets) {
|
||||||
try {
|
try {
|
||||||
long lookupstart = System.currentTimeMillis();
|
long lookupstart = System.currentTimeMillis();
|
||||||
if (db.hasMd5HashOf(file)) {
|
HashInfo hashInfo = db.lookUp(file);
|
||||||
|
if (null != hashInfo) {
|
||||||
foundBad = true;
|
foundBad = true;
|
||||||
knownBadCount += 1;
|
knownBadCount += 1;
|
||||||
try {
|
try {
|
||||||
@ -232,7 +234,7 @@ public class HashDbIngestModule extends IngestModuleAbstractFile {
|
|||||||
String hashSetName = db.getHashSetName();
|
String hashSetName = db.getHashSetName();
|
||||||
|
|
||||||
String comment = "";
|
String comment = "";
|
||||||
ArrayList<String> comments = db.lookUp(file).getComments();
|
ArrayList<String> comments = hashInfo.getComments();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String c : comments) {
|
for (String c : comments) {
|
||||||
comment += c;
|
comment += c;
|
||||||
|
@ -243,9 +243,9 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
return hashDb;
|
return hashDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized void indexHashDatabase(HashDb hashDb, boolean deleteIndexFile) {
|
synchronized void indexHashDatabase(HashDb hashDb) {
|
||||||
hashDb.addPropertyChangeListener(this);
|
hashDb.addPropertyChangeListener(this);
|
||||||
HashDbIndexer creator = new HashDbIndexer(hashDb, deleteIndexFile);
|
HashDbIndexer creator = new HashDbIndexer(hashDb);
|
||||||
creator.execute();
|
creator.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -788,7 +788,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
* @throws TskCoreException
|
* @throws TskCoreException
|
||||||
*/
|
*/
|
||||||
public void addHashes(Content content, String comment) 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;
|
assert content instanceof AbstractFile;
|
||||||
if (content instanceof AbstractFile) {
|
if (content instanceof AbstractFile) {
|
||||||
AbstractFile file = (AbstractFile)content;
|
AbstractFile file = (AbstractFile)content;
|
||||||
@ -812,23 +812,21 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
|
|
||||||
public HashInfo lookUp(Content content) throws TskCoreException {
|
public HashInfo lookUp(Content content) throws TskCoreException {
|
||||||
HashInfo result = null;
|
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;
|
assert content instanceof AbstractFile;
|
||||||
if (content instanceof AbstractFile) {
|
if (content instanceof AbstractFile) {
|
||||||
AbstractFile file = (AbstractFile)content;
|
AbstractFile file = (AbstractFile)content;
|
||||||
if (null != file.getMd5Hash()) {
|
|
||||||
result = SleuthkitJNI.lookupInHashDatabaseVerbose(file.getMd5Hash(), handle);
|
result = SleuthkitJNI.lookupInHashDatabaseVerbose(file.getMd5Hash(), handle);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasLookupIndex() throws TskCoreException {
|
boolean hasIndex() throws TskCoreException {
|
||||||
return SleuthkitJNI.hashDatabaseHasLookupIndex(handle);
|
return SleuthkitJNI.hashDatabaseHasLookupIndex(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasIndexOnly() throws TskCoreException {
|
boolean hasIndexOnly() throws TskCoreException {
|
||||||
return SleuthkitJNI.hashDatabaseHasLegacyLookupIndexOnly(handle);
|
return SleuthkitJNI.hashDatabaseIsIndexOnly(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean canBeReIndexed() throws TskCoreException {
|
boolean canBeReIndexed() throws TskCoreException {
|
||||||
@ -847,11 +845,9 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
private class HashDbIndexer extends SwingWorker<Object, Void> {
|
private class HashDbIndexer extends SwingWorker<Object, Void> {
|
||||||
private ProgressHandle progress = null;
|
private ProgressHandle progress = null;
|
||||||
private HashDb hashDb = null;
|
private HashDb hashDb = null;
|
||||||
private boolean deleteIndexFile = false;
|
|
||||||
|
|
||||||
HashDbIndexer(HashDb hashDb, boolean deleteIndexFile) {
|
HashDbIndexer(HashDb hashDb) {
|
||||||
this.hashDb = hashDb;
|
this.hashDb = hashDb;
|
||||||
this.deleteIndexFile = deleteIndexFile;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -861,7 +857,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
progress.start();
|
progress.start();
|
||||||
progress.switchToIndeterminate();
|
progress.switchToIndeterminate();
|
||||||
try {
|
try {
|
||||||
SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.handle, deleteIndexFile);
|
SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.handle);
|
||||||
}
|
}
|
||||||
catch (TskCoreException ex) {
|
catch (TskCoreException ex) {
|
||||||
Logger.getLogger(HashDb.class.getName()).log(Level.SEVERE, "Error indexing hash database", 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);
|
HashDb db = hashDatabases.get(rowIndex);
|
||||||
boolean dbHasIndex = false;
|
boolean dbHasIndex = false;
|
||||||
try {
|
try {
|
||||||
dbHasIndex = db.hasLookupIndex();
|
dbHasIndex = db.hasIndex();
|
||||||
}
|
}
|
||||||
catch (TskCoreException ex) {
|
catch (TskCoreException ex) {
|
||||||
Logger.getLogger(HashDbSimpleConfigPanel.class.getName()).log(Level.SEVERE, "Error getting info for " + db.getHashSetName() + " hash database", 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.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
|
||||||
import org.sleuthkit.autopsy.hashdatabase.HashDbManager.HashDb;
|
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 {
|
class ModalNoButtons extends javax.swing.JDialog implements PropertyChangeListener {
|
||||||
|
|
||||||
private static final String INDEX_FILE_EXTENSION = ".kdb";
|
|
||||||
List<HashDb> unindexed;
|
List<HashDb> unindexed;
|
||||||
HashDb toIndex;
|
HashDb toIndex;
|
||||||
HashDbConfigPanel hdbmp;
|
HashDbConfigPanel hdbmp;
|
||||||
@ -211,7 +206,7 @@ class ModalNoButtons extends javax.swing.JDialog implements PropertyChangeListen
|
|||||||
this.CURRENTLYON_LABEL.setText("Currently indexing 1 database");
|
this.CURRENTLYON_LABEL.setText("Currently indexing 1 database");
|
||||||
if (!this.toIndex.isIndexing()) {
|
if (!this.toIndex.isIndexing()) {
|
||||||
this.toIndex.addPropertyChangeListener(this);
|
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);
|
this.CURRENTLYON_LABEL.setText("Currently indexing 1 of " + length);
|
||||||
if (!db.isIndexing()) {
|
if (!db.isIndexing()) {
|
||||||
db.addPropertyChangeListener(this);
|
db.addPropertyChangeListener(this);
|
||||||
HashDbManager.getInstance().indexHashDatabase(db, okToDeleteOldIndexFile(db));
|
HashDbManager.getInstance().indexHashDatabase(db);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,22 +251,4 @@ class ModalNoButtons extends javax.swing.JDialog implements PropertyChangeListen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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