mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
fixing official set hash db info issue
This commit is contained in:
parent
db192c53c5
commit
d37aa7b2e7
@ -520,8 +520,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
// sendIngestMessages: true if the hash set is notable
|
// sendIngestMessages: true if the hash set is notable
|
||||||
boolean sendIngestMessages = KnownFilesType.fromFileKnown(globalSet.getFileKnownStatus()).equals(HashDb.KnownFilesType.KNOWN_BAD);
|
boolean sendIngestMessages = KnownFilesType.fromFileKnown(globalSet.getFileKnownStatus()).equals(HashDb.KnownFilesType.KNOWN_BAD);
|
||||||
crHashSets.add(new HashDbInfo(globalSet.getSetName(), globalSet.getVersion(),
|
crHashSets.add(new HashDbInfo(globalSet.getSetName(), globalSet.getVersion(),
|
||||||
globalSet.getGlobalSetID(), KnownFilesType.fromFileKnown(globalSet.getFileKnownStatus()),
|
globalSet.getGlobalSetID(), KnownFilesType.fromFileKnown(globalSet.getFileKnownStatus()), globalSet.isReadOnly(), false, sendIngestMessages));
|
||||||
globalSet.isReadOnly(), false, sendIngestMessages, false));
|
|
||||||
}
|
}
|
||||||
} catch (CentralRepoException ex) {
|
} catch (CentralRepoException ex) {
|
||||||
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error loading central repository hash sets", ex); //NON-NLS
|
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error loading central repository hash sets", ex); //NON-NLS
|
||||||
@ -612,7 +611,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
String filename = file.getName();
|
String filename = file.getName();
|
||||||
Matcher match = OFFICIAL_FILENAME.matcher(filename);
|
Matcher match = OFFICIAL_FILENAME.matcher(filename);
|
||||||
if (match == null) {
|
if (!match.find()) {
|
||||||
throw new HashDbManagerException(String.format("File with name: %s does not match regex of: %s", filename, OFFICIAL_FILENAME.toString()));
|
throw new HashDbManagerException(String.format("File with name: %s does not match regex of: %s", filename, OFFICIAL_FILENAME.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,13 +625,12 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
|
|
||||||
return new HashDbInfo(
|
return new HashDbInfo(
|
||||||
hashdbName,
|
hashdbName,
|
||||||
"", // version
|
|
||||||
-1, //reference set id
|
|
||||||
knownFilesType,
|
knownFilesType,
|
||||||
true, // readonly
|
false, //searchDuringIngest
|
||||||
false, //searchDuringIngest,
|
|
||||||
false, //sendIngestMessages
|
false, //sendIngestMessages
|
||||||
true); // isOfficialSet
|
file.getAbsolutePath(),
|
||||||
|
true, // read only
|
||||||
|
true); // official set
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,10 +130,12 @@ final class HashLookupSettings implements Serializable {
|
|||||||
try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(SERIALIZATION_FILE_PATH))) {
|
try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(SERIALIZATION_FILE_PATH))) {
|
||||||
HashLookupSettings filesSetsSettings = (HashLookupSettings) in.readObject();
|
HashLookupSettings filesSetsSettings = (HashLookupSettings) in.readObject();
|
||||||
|
|
||||||
/* NOTE: to support JIRA-4177, we need to check if any of the hash
|
/*
|
||||||
database paths are in Windows user directory. If so, we replace the path
|
* NOTE: to support JIRA-4177, we need to check if any of the
|
||||||
with USER_DIR_PLACEHOLDER before saving to disk. When reading from disk,
|
* hash database paths are in Windows user directory. If so, we
|
||||||
USER_DIR_PLACEHOLDER needs to be replaced with current user directory path.
|
* replace the path with USER_DIR_PLACEHOLDER before saving to
|
||||||
|
* disk. When reading from disk, USER_DIR_PLACEHOLDER needs to
|
||||||
|
* be replaced with current user directory path.
|
||||||
*/
|
*/
|
||||||
convertPlaceholderToPath(filesSetsSettings);
|
convertPlaceholderToPath(filesSetsSettings);
|
||||||
return filesSetsSettings;
|
return filesSetsSettings;
|
||||||
@ -292,10 +294,11 @@ final class HashLookupSettings implements Serializable {
|
|||||||
*/
|
*/
|
||||||
static boolean writeSettings(HashLookupSettings settings) {
|
static boolean writeSettings(HashLookupSettings settings) {
|
||||||
|
|
||||||
/* NOTE: to support JIRA-4177, we need to check if any of the hash
|
/*
|
||||||
database paths are in Windows user directory. If so, replace the path
|
* NOTE: to support JIRA-4177, we need to check if any of the hash
|
||||||
with USER_DIR_PLACEHOLDER so that when it is read, it gets updated to be
|
* database paths are in Windows user directory. If so, replace the path
|
||||||
the current user directory path.
|
* with USER_DIR_PLACEHOLDER so that when it is read, it gets updated to
|
||||||
|
* be the current user directory path.
|
||||||
*/
|
*/
|
||||||
convertPathToPlaceholder(settings);
|
convertPathToPlaceholder(settings);
|
||||||
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(SERIALIZATION_FILE_PATH))) {
|
try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(SERIALIZATION_FILE_PATH))) {
|
||||||
@ -310,9 +313,9 @@ final class HashLookupSettings implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For file type hash sets, check if hash set paths needs to be modified
|
* For file type hash sets, check if hash set paths needs to be modified per
|
||||||
* per JIRA-4177. If the file path is in current Windows user directory,
|
* JIRA-4177. If the file path is in current Windows user directory, replace
|
||||||
* replace the path with USER_DIR_PLACEHOLDER.
|
* the path with USER_DIR_PLACEHOLDER.
|
||||||
*
|
*
|
||||||
* @param settings HashLookupSettings settings object to examiner and modify
|
* @param settings HashLookupSettings settings object to examiner and modify
|
||||||
*/
|
*/
|
||||||
@ -349,7 +352,6 @@ final class HashLookupSettings implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the serializable information within a hash lookup in order to
|
* Represents the serializable information within a hash lookup in order to
|
||||||
* be written to disk. Used to hand off information when loading and saving
|
* be written to disk. Used to hand off information when loading and saving
|
||||||
@ -385,6 +387,25 @@ final class HashLookupSettings implements Serializable {
|
|||||||
* @param path The path to the db
|
* @param path The path to the db
|
||||||
*/
|
*/
|
||||||
HashDbInfo(String hashSetName, HashDbManager.HashDb.KnownFilesType knownFilesType, boolean searchDuringIngest, boolean sendIngestMessages, String path) {
|
HashDbInfo(String hashSetName, HashDbManager.HashDb.KnownFilesType knownFilesType, boolean searchDuringIngest, boolean sendIngestMessages, String path) {
|
||||||
|
this(hashSetName, knownFilesType, searchDuringIngest, sendIngestMessages, path, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a HashDbInfo object for files type
|
||||||
|
*
|
||||||
|
* @param hashSetName The name of the hash set
|
||||||
|
* @param knownFilesType The known files type
|
||||||
|
* @param searchDuringIngest Whether or not the db is searched during
|
||||||
|
* ingest
|
||||||
|
* @param sendIngestMessages Whether or not ingest messages are sent
|
||||||
|
* @param path The path to the db
|
||||||
|
* @param readOnly Whether or not the hash set should be
|
||||||
|
* readOnly
|
||||||
|
* @param officialSet Whether or not the hash set is a Standard
|
||||||
|
* Official Hash Set.
|
||||||
|
*/
|
||||||
|
HashDbInfo(String hashSetName, HashDbManager.HashDb.KnownFilesType knownFilesType, boolean searchDuringIngest,
|
||||||
|
boolean sendIngestMessages, String path, boolean readOnly, boolean officialSet) {
|
||||||
this.hashSetName = hashSetName;
|
this.hashSetName = hashSetName;
|
||||||
this.knownFilesType = knownFilesType;
|
this.knownFilesType = knownFilesType;
|
||||||
this.searchDuringIngest = searchDuringIngest;
|
this.searchDuringIngest = searchDuringIngest;
|
||||||
@ -392,12 +413,12 @@ final class HashLookupSettings implements Serializable {
|
|||||||
this.path = path;
|
this.path = path;
|
||||||
this.referenceSetID = -1;
|
this.referenceSetID = -1;
|
||||||
this.version = "";
|
this.version = "";
|
||||||
this.readOnly = false;
|
this.readOnly = readOnly;
|
||||||
this.dbType = DatabaseType.FILE;
|
this.dbType = DatabaseType.FILE;
|
||||||
this.officialSet = false;
|
this.officialSet = officialSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashDbInfo(String hashSetName, String version, int referenceSetID, HashDbManager.HashDb.KnownFilesType knownFilesType, boolean readOnly, boolean searchDuringIngest, boolean sendIngestMessages, boolean officialSet){
|
HashDbInfo(String hashSetName, String version, int referenceSetID, HashDbManager.HashDb.KnownFilesType knownFilesType, boolean readOnly, boolean searchDuringIngest, boolean sendIngestMessages) {
|
||||||
this.hashSetName = hashSetName;
|
this.hashSetName = hashSetName;
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.referenceSetID = referenceSetID;
|
this.referenceSetID = referenceSetID;
|
||||||
@ -407,7 +428,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
this.sendIngestMessages = sendIngestMessages;
|
this.sendIngestMessages = sendIngestMessages;
|
||||||
this.path = "";
|
this.path = "";
|
||||||
dbType = DatabaseType.CENTRAL_REPOSITORY;
|
dbType = DatabaseType.CENTRAL_REPOSITORY;
|
||||||
this.officialSet = officialSet;
|
this.officialSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashDbInfo(HashDbManager.HashDb db) throws TskCoreException {
|
HashDbInfo(HashDbManager.HashDb db) throws TskCoreException {
|
||||||
@ -451,8 +472,6 @@ final class HashLookupSettings implements Serializable {
|
|||||||
return officialSet;
|
return officialSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the hash set name.
|
* Gets the hash set name.
|
||||||
*
|
*
|
||||||
@ -464,6 +483,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the version for the hash set
|
* Get the version for the hash set
|
||||||
|
*
|
||||||
* @return version
|
* @return version
|
||||||
*/
|
*/
|
||||||
String getVersion() {
|
String getVersion() {
|
||||||
@ -472,6 +492,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether the hash set is read only (only applies to central repo)
|
* Get whether the hash set is read only (only applies to central repo)
|
||||||
|
*
|
||||||
* @return readOnly
|
* @return readOnly
|
||||||
*/
|
*/
|
||||||
boolean isReadOnly() {
|
boolean isReadOnly() {
|
||||||
@ -524,6 +545,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the path.
|
* Sets the path.
|
||||||
|
*
|
||||||
* @param path the path to set
|
* @param path the path to set
|
||||||
*/
|
*/
|
||||||
public void setPath(String path) {
|
public void setPath(String path) {
|
||||||
@ -536,6 +558,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the database is a normal file type.
|
* Returns whether the database is a normal file type.
|
||||||
|
*
|
||||||
* @return true if database is type FILE
|
* @return true if database is type FILE
|
||||||
*/
|
*/
|
||||||
boolean isFileDatabaseType() {
|
boolean isFileDatabaseType() {
|
||||||
@ -620,9 +643,11 @@ final class HashLookupSettings implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This overrides the default deserialization code so we can
|
* This overrides the default deserialization code so we can properly
|
||||||
* properly set the dbType enum given an old settings file.
|
* set the dbType enum given an old settings file.
|
||||||
|
*
|
||||||
* @param stream
|
* @param stream
|
||||||
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws ClassNotFoundException
|
* @throws ClassNotFoundException
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user