mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
More changes
This commit is contained in:
parent
1bfc7d3044
commit
62442cb0a7
@ -563,8 +563,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
for (HashDbInfo hashDbInfo : hashDbInfoList) {
|
for (HashDbInfo hashDbInfo : hashDbInfoList) {
|
||||||
try {
|
try {
|
||||||
if(hashDbInfo.isFileDatabaseType()){
|
if(hashDbInfo.isFileDatabaseType()){
|
||||||
// ELTODO
|
String dbPath = this.getValidFilePath(hashDbInfo.getHashSetName(), hashDbInfo.getPath());
|
||||||
String dbPath = this.getValidFilePath(hashDbInfo.getHashSetName(), hashDbInfo.getPath(), hashDbInfo.isPathIsRelative());
|
|
||||||
if (dbPath != null) {
|
if (dbPath != null) {
|
||||||
addHashDatabase(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 {
|
||||||
@ -645,12 +644,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getValidFilePath(String hashSetName, String configuredPath, boolean pathIsRelative) {
|
private String getValidFilePath(String hashSetName, String configuredPath) {
|
||||||
|
|
||||||
if (pathIsRelative) {
|
|
||||||
// the path should be modified to be inside the current UserConfigFolder
|
|
||||||
// (e.g. C:\Users\elivis\AppData\Roaming\autopsy\config)
|
|
||||||
}
|
|
||||||
// Check the configured path.
|
// Check the configured path.
|
||||||
File database = new File(configuredPath);
|
File database = new File(configuredPath);
|
||||||
if (database.exists()) {
|
if (database.exists()) {
|
||||||
|
@ -286,8 +286,17 @@ final class HashLookupSettings implements Serializable {
|
|||||||
*/
|
*/
|
||||||
static boolean writeSettings(HashLookupSettings settings) {
|
static boolean writeSettings(HashLookupSettings settings) {
|
||||||
|
|
||||||
// Check if any of the hash database paths are in Windows user directory.
|
/* NOTE: to support JIRA-4177, we need to check if any of the hash
|
||||||
// If so, edit the path so that it always gets updated to be the current user directory path.
|
database paths are in Windows user directory. If so, replace the path
|
||||||
|
with USER_DIR_PLACEHOLDER so that it always gets updated to be the
|
||||||
|
current user directory path. Therefore we have to modify HashLookupSettings
|
||||||
|
contents that are stored to disk. To make sure that some thread doesn't
|
||||||
|
access the path at the wrong time (i.e. while it is replaced USER_DIR_PLACEHOLDER),
|
||||||
|
we need to make a copy of the HashLookupSettings, edit the copy, and save
|
||||||
|
the copy to disk. This way the HashLookupSettings objects that the rest
|
||||||
|
of the code is using is never modified and alsways contains actual path
|
||||||
|
to the hash database.
|
||||||
|
*/
|
||||||
boolean modified = editHashDbPathsInUserDir(settings);
|
boolean modified = editHashDbPathsInUserDir(settings);
|
||||||
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(SERIALIZATION_FILE_PATH))) {
|
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(SERIALIZATION_FILE_PATH))) {
|
||||||
out.writeObject(settings);
|
out.writeObject(settings);
|
||||||
@ -347,7 +356,6 @@ final class HashLookupSettings implements Serializable {
|
|||||||
private boolean searchDuringIngest;
|
private boolean searchDuringIngest;
|
||||||
private final boolean sendIngestMessages;
|
private final boolean sendIngestMessages;
|
||||||
private String path;
|
private String path;
|
||||||
private final boolean pathIsRelative; // flag that the path is relative to PlatformUtil.getUserConfigDirectory()
|
|
||||||
private final String version;
|
private final String version;
|
||||||
private final boolean readOnly;
|
private final boolean readOnly;
|
||||||
private final int referenceSetID;
|
private final int referenceSetID;
|
||||||
@ -368,7 +376,6 @@ final class HashLookupSettings implements Serializable {
|
|||||||
this.knownFilesType = knownFilesType;
|
this.knownFilesType = knownFilesType;
|
||||||
this.searchDuringIngest = searchDuringIngest;
|
this.searchDuringIngest = searchDuringIngest;
|
||||||
this.sendIngestMessages = sendIngestMessages;
|
this.sendIngestMessages = sendIngestMessages;
|
||||||
this.pathIsRelative = true; // ELTODO
|
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.referenceSetID = -1;
|
this.referenceSetID = -1;
|
||||||
this.version = "";
|
this.version = "";
|
||||||
@ -385,7 +392,6 @@ final class HashLookupSettings implements Serializable {
|
|||||||
this.searchDuringIngest = searchDuringIngest;
|
this.searchDuringIngest = searchDuringIngest;
|
||||||
this.sendIngestMessages = sendIngestMessages;
|
this.sendIngestMessages = sendIngestMessages;
|
||||||
this.path = "";
|
this.path = "";
|
||||||
this.pathIsRelative = true; // ELTODO
|
|
||||||
dbType = DatabaseType.CENTRAL_REPOSITORY;
|
dbType = DatabaseType.CENTRAL_REPOSITORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,7 +406,6 @@ final class HashLookupSettings implements Serializable {
|
|||||||
this.version = "";
|
this.version = "";
|
||||||
this.readOnly = false;
|
this.readOnly = false;
|
||||||
this.dbType = DatabaseType.FILE;
|
this.dbType = DatabaseType.FILE;
|
||||||
this.pathIsRelative = true; // ELTODO
|
|
||||||
if (fileTypeDb.hasIndexOnly()) {
|
if (fileTypeDb.hasIndexOnly()) {
|
||||||
this.path = fileTypeDb.getIndexPath();
|
this.path = fileTypeDb.getIndexPath();
|
||||||
} else {
|
} else {
|
||||||
@ -414,7 +419,6 @@ final class HashLookupSettings implements Serializable {
|
|||||||
this.readOnly = ! centralRepoDb.isUpdateable();
|
this.readOnly = ! centralRepoDb.isUpdateable();
|
||||||
this.searchDuringIngest = centralRepoDb.getSearchDuringIngest();
|
this.searchDuringIngest = centralRepoDb.getSearchDuringIngest();
|
||||||
this.sendIngestMessages = centralRepoDb.getSendIngestMessages();
|
this.sendIngestMessages = centralRepoDb.getSendIngestMessages();
|
||||||
this.pathIsRelative = true; // ELTODO
|
|
||||||
this.path = "";
|
this.path = "";
|
||||||
this.referenceSetID = centralRepoDb.getReferenceSetID();
|
this.referenceSetID = centralRepoDb.getReferenceSetID();
|
||||||
this.dbType = DatabaseType.CENTRAL_REPOSITORY;
|
this.dbType = DatabaseType.CENTRAL_REPOSITORY;
|
||||||
@ -498,13 +502,6 @@ final class HashLookupSettings implements Serializable {
|
|||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return ELTODO
|
|
||||||
*/
|
|
||||||
boolean isPathIsRelative() {
|
|
||||||
return pathIsRelative;
|
|
||||||
}
|
|
||||||
|
|
||||||
int getReferenceSetID(){
|
int getReferenceSetID(){
|
||||||
return referenceSetID;
|
return referenceSetID;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user