mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
Cleanup
This commit is contained in:
parent
f00ceeea27
commit
0ea88c0f68
@ -147,15 +147,15 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
*
|
*
|
||||||
* @throws HashDbManagerException
|
* @throws HashDbManagerException
|
||||||
*/
|
*/
|
||||||
public synchronized HashDatabase addExistingHashDatabase(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages, HashDatabase.KnownFilesType knownFilesType) throws HashDbManagerException {
|
public synchronized HashDb addExistingHashDatabase(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages, HashDatabase.KnownFilesType knownFilesType) throws HashDbManagerException {
|
||||||
HashDatabase hashDb = null;
|
HashDb hashDb = null;
|
||||||
hashDb = this.addExistingHashDatabaseNoSave(hashSetName, path, searchDuringIngest, sendIngestMessages, knownFilesType);
|
hashDb = this.addExistingHashDatabaseNoSave(hashSetName, path, searchDuringIngest, sendIngestMessages, knownFilesType);
|
||||||
this.save();
|
this.save();
|
||||||
return hashDb;
|
return hashDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized HashDatabase addExistingHashDatabaseNoSave(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages, HashDatabase.KnownFilesType knownFilesType) throws HashDbManagerException {
|
synchronized HashDb addExistingHashDatabaseNoSave(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages, HashDatabase.KnownFilesType knownFilesType) throws HashDbManagerException {
|
||||||
HashDatabase hashDb = null;
|
HashDb hashDb = null;
|
||||||
try {
|
try {
|
||||||
if (!new File(path).exists()) {
|
if (!new File(path).exists()) {
|
||||||
throw new HashDbManagerException(NbBundle.getMessage(HashDbManager.class, "HashDbManager.hashDbDoesNotExistExceptionMsg", path));
|
throw new HashDbManagerException(NbBundle.getMessage(HashDbManager.class, "HashDbManager.hashDbDoesNotExistExceptionMsg", path));
|
||||||
@ -169,7 +169,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
throw new HashDbManagerException(NbBundle.getMessage(HashDbManager.class, "HashDbManager.duplicateHashSetNameExceptionMsg", hashSetName));
|
throw new HashDbManagerException(NbBundle.getMessage(HashDbManager.class, "HashDbManager.duplicateHashSetNameExceptionMsg", hashSetName));
|
||||||
}
|
}
|
||||||
|
|
||||||
hashDb = addFileHashDatabase(SleuthkitJNI.openHashDatabase(path), hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);
|
hashDb = addHashDatabase(SleuthkitJNI.openHashDatabase(path), hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
throw new HashDbManagerException(ex.getMessage());
|
throw new HashDbManagerException(ex.getMessage());
|
||||||
}
|
}
|
||||||
@ -194,10 +194,10 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
*
|
*
|
||||||
* @throws HashDbManagerException
|
* @throws HashDbManagerException
|
||||||
*/
|
*/
|
||||||
public synchronized HashDatabase addNewHashDatabase(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages,
|
public synchronized HashDb addNewHashDatabase(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages,
|
||||||
HashDatabase.KnownFilesType knownFilesType) throws HashDbManagerException {
|
HashDb.KnownFilesType knownFilesType) throws HashDbManagerException {
|
||||||
|
|
||||||
HashDatabase hashDb = null;
|
HashDb hashDb = null;
|
||||||
hashDb = this.addNewHashDatabaseNoSave(hashSetName, path, searchDuringIngest, sendIngestMessages, knownFilesType);
|
hashDb = this.addNewHashDatabaseNoSave(hashSetName, path, searchDuringIngest, sendIngestMessages, knownFilesType);
|
||||||
|
|
||||||
this.save();
|
this.save();
|
||||||
@ -205,9 +205,9 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
return hashDb;
|
return hashDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized HashDatabase addNewHashDatabaseNoSave(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages,
|
public synchronized HashDb addNewHashDatabaseNoSave(String hashSetName, String path, boolean searchDuringIngest, boolean sendIngestMessages,
|
||||||
HashDatabase.KnownFilesType knownFilesType) throws HashDbManagerException {
|
HashDb.KnownFilesType knownFilesType) throws HashDbManagerException {
|
||||||
HashDatabase hashDb = null;
|
HashDb hashDb = null;
|
||||||
try {
|
try {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
@ -226,14 +226,14 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
throw new HashDbManagerException(NbBundle.getMessage(HashDbManager.class, "HashDbManager.duplicateHashSetNameExceptionMsg", hashSetName));
|
throw new HashDbManagerException(NbBundle.getMessage(HashDbManager.class, "HashDbManager.duplicateHashSetNameExceptionMsg", hashSetName));
|
||||||
}
|
}
|
||||||
|
|
||||||
hashDb = addFileHashDatabase(SleuthkitJNI.createHashDatabase(path), hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);
|
hashDb = addHashDatabase(SleuthkitJNI.createHashDatabase(path), hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
throw new HashDbManagerException(ex.getMessage());
|
throw new HashDbManagerException(ex.getMessage());
|
||||||
}
|
}
|
||||||
return hashDb;
|
return hashDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashDatabase addFileHashDatabase(int handle, String hashSetName, boolean searchDuringIngest, boolean sendIngestMessages, HashDatabase.KnownFilesType knownFilesType) throws TskCoreException {
|
private HashDatabase addHashDatabase(int handle, String hashSetName, boolean searchDuringIngest, boolean sendIngestMessages, HashDatabase.KnownFilesType knownFilesType) throws TskCoreException {
|
||||||
// Wrap an object around the handle.
|
// Wrap an object around the handle.
|
||||||
HashDatabase hashDb = new HashDatabase(handle, hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);
|
HashDatabase hashDb = new HashDatabase(handle, hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);
|
||||||
|
|
||||||
@ -400,20 +400,6 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets all of the file hash databases used to classify files as known or known
|
|
||||||
* bad.
|
|
||||||
*
|
|
||||||
* @return A list, possibly empty, of hash databases.
|
|
||||||
*/
|
|
||||||
synchronized List<HashDatabase> getAllFileHashSets() {
|
|
||||||
List<HashDatabase> hashDbs = new ArrayList<>();
|
|
||||||
this.hashSets.stream().filter((thisSet) -> (thisSet instanceof HashDatabase)).forEach((thisSet) -> {
|
|
||||||
hashDbs.add((HashDatabase)thisSet);
|
|
||||||
});
|
|
||||||
return hashDbs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all of the hash databases used to classify files as known or known
|
* Gets all of the hash databases used to classify files as known or known
|
||||||
* bad. Will add any new central repository databases to the list before
|
* bad. Will add any new central repository databases to the list before
|
||||||
@ -551,7 +537,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
if(hashDbInfo.isFileDatabaseType()){
|
if(hashDbInfo.isFileDatabaseType()){
|
||||||
String dbPath = this.getValidFilePath(hashDbInfo.getHashSetName(), hashDbInfo.getPath());
|
String dbPath = this.getValidFilePath(hashDbInfo.getHashSetName(), hashDbInfo.getPath());
|
||||||
if (dbPath != null) {
|
if (dbPath != null) {
|
||||||
addFileHashDatabase(SleuthkitJNI.openHashDatabase(dbPath), hashDbInfo.getHashSetName(), hashDbInfo.getSearchDuringIngest(), hashDbInfo.getSendIngestMessages(), hashDbInfo.getKnownFilesType());
|
addHashDatabase(SleuthkitJNI.openHashDatabase(dbPath), hashDbInfo.getHashSetName(), hashDbInfo.getSearchDuringIngest(), hashDbInfo.getSendIngestMessages(), hashDbInfo.getKnownFilesType());
|
||||||
} else {
|
} else {
|
||||||
logger.log(Level.WARNING, Bundle.HashDbManager_noDbPath_message(hashDbInfo.getHashSetName()));
|
logger.log(Level.WARNING, Bundle.HashDbManager_noDbPath_message(hashDbInfo.getHashSetName()));
|
||||||
allDatabasesLoadedCorrectly = false;
|
allDatabasesLoadedCorrectly = false;
|
||||||
|
@ -305,13 +305,16 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
|
|||||||
public void saveSettings() {
|
public void saveSettings() {
|
||||||
//Checking for for any unindexed databases
|
//Checking for for any unindexed databases
|
||||||
List<HashDatabase> unindexed = new ArrayList<>();
|
List<HashDatabase> unindexed = new ArrayList<>();
|
||||||
for (HashDatabase db : hashSetManager.getAllFileHashSets()) {
|
for (HashDb db : hashSetManager.getAllHashSets()) {
|
||||||
try {
|
if(db instanceof HashDatabase){
|
||||||
if (!db.hasIndex()) {
|
try {
|
||||||
unindexed.add(db);
|
HashDatabase hashDatabase = (HashDatabase)db;
|
||||||
|
if (!hashDatabase.hasIndex()) {
|
||||||
|
unindexed.add(hashDatabase);
|
||||||
|
}
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index info for hash database", ex); //NON-NLS
|
||||||
}
|
}
|
||||||
} catch (TskCoreException ex) {
|
|
||||||
Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index info for hash database", ex); //NON-NLS
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user