mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Addresses most of the review comments
This commit is contained in:
parent
61b7f89788
commit
c062a20213
@ -1276,7 +1276,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
preparedStatement.setInt(1, referenceSetID);
|
preparedStatement.setInt(1, referenceSetID);
|
||||||
preparedStatement.executeUpdate();
|
preparedStatement.executeUpdate();
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
throw new EamDbException("Error deleting reference set", ex); // NON-NLS
|
throw new EamDbException("Error deleting reference set " + referenceSetID, ex); // NON-NLS
|
||||||
} finally {
|
} finally {
|
||||||
EamDbUtil.closePreparedStatement(preparedStatement);
|
EamDbUtil.closePreparedStatement(preparedStatement);
|
||||||
EamDbUtil.closeConnection(conn);
|
EamDbUtil.closeConnection(conn);
|
||||||
@ -1285,7 +1285,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all entries for this reference set from the reference tables
|
* Remove all entries for this reference set from the reference tables
|
||||||
* (Currently only removes entries from the files table)
|
* (Currently only removes entries from the reference_file table)
|
||||||
* @param referenceSetID
|
* @param referenceSetID
|
||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
@ -1303,7 +1303,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
preparedStatement.setInt(1, referenceSetID);
|
preparedStatement.setInt(1, referenceSetID);
|
||||||
preparedStatement.executeUpdate();
|
preparedStatement.executeUpdate();
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
throw new EamDbException("Error deleting files from reference set", ex); // NON-NLS
|
throw new EamDbException("Error deleting files from reference set " + referenceSetID, ex); // NON-NLS
|
||||||
} finally {
|
} finally {
|
||||||
EamDbUtil.closePreparedStatement(preparedStatement);
|
EamDbUtil.closePreparedStatement(preparedStatement);
|
||||||
EamDbUtil.closeConnection(conn);
|
EamDbUtil.closeConnection(conn);
|
||||||
@ -1369,7 +1369,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
resultSet.next();
|
resultSet.next();
|
||||||
matchingInstances = resultSet.getLong(1);
|
matchingInstances = resultSet.getLong(1);
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
throw new EamDbException("Error determining if file is in reference set.", ex); // NON-NLS
|
throw new EamDbException("Error determining if value (" + value + ") is in reference set " + referenceSetID, ex); // NON-NLS
|
||||||
} finally {
|
} finally {
|
||||||
EamDbUtil.closePreparedStatement(preparedStatement);
|
EamDbUtil.closePreparedStatement(preparedStatement);
|
||||||
EamDbUtil.closeResultSet(resultSet);
|
EamDbUtil.closeResultSet(resultSet);
|
||||||
@ -1388,7 +1388,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
* @return Global known status of the artifact
|
* @return Global known status of the artifact
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isArtifactlKnownBadByReference(CorrelationAttribute.Type aType, String value) throws EamDbException {
|
public boolean isArtifactKnownBadByReference(CorrelationAttribute.Type aType, String value) throws EamDbException {
|
||||||
|
|
||||||
// TEMP: Only support file correlation type
|
// TEMP: Only support file correlation type
|
||||||
if (aType.getId() != CorrelationAttribute.FILES_TYPE_ID) {
|
if (aType.getId() != CorrelationAttribute.FILES_TYPE_ID) {
|
||||||
@ -1537,30 +1537,6 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
EamGlobalSet globalSet = getReferenceSetByID(referenceSetID);
|
EamGlobalSet globalSet = getReferenceSetByID(referenceSetID);
|
||||||
return (getOrganizationByID(globalSet.getOrgID()));
|
return (getOrganizationByID(globalSet.getOrgID()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new reference set
|
|
||||||
*
|
|
||||||
* @param orgID
|
|
||||||
* @param setName
|
|
||||||
* @param version
|
|
||||||
* @param importDate
|
|
||||||
* @return the reference set ID of the newly created set
|
|
||||||
* @throws EamDbException
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int newReferenceSet(int orgID, String setName, String version, TskData.FileKnown knownStatus,
|
|
||||||
boolean isReadOnly) throws EamDbException {
|
|
||||||
EamDb dbManager = EamDb.getInstance();
|
|
||||||
EamGlobalSet eamGlobalSet = new EamGlobalSet(
|
|
||||||
orgID,
|
|
||||||
setName,
|
|
||||||
version,
|
|
||||||
knownStatus,
|
|
||||||
isReadOnly,
|
|
||||||
LocalDate.now());
|
|
||||||
return dbManager.newReferencelSet(eamGlobalSet);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an existing organization.
|
* Update an existing organization.
|
||||||
@ -1634,7 +1610,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int newReferencelSet(EamGlobalSet eamGlobalSet) throws EamDbException {
|
public int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException {
|
||||||
Connection conn = connect();
|
Connection conn = connect();
|
||||||
|
|
||||||
PreparedStatement preparedStatement1 = null;
|
PreparedStatement preparedStatement1 = null;
|
||||||
@ -1796,7 +1772,8 @@ public abstract class AbstractSqlEamDb implements EamDb {
|
|||||||
return (resultSet.next());
|
return (resultSet.next());
|
||||||
|
|
||||||
} catch (SQLException ex) {
|
} catch (SQLException ex) {
|
||||||
throw new EamDbException("Error getting reference instances by type and value.", ex); // NON-NLS
|
throw new EamDbException("Error testing whether reference set exists (name: " + referenceSetName
|
||||||
|
+ " version: " + version, ex); // NON-NLS
|
||||||
} finally {
|
} finally {
|
||||||
EamDbUtil.closePreparedStatement(preparedStatement1);
|
EamDbUtil.closePreparedStatement(preparedStatement1);
|
||||||
EamDbUtil.closeResultSet(resultSet);
|
EamDbUtil.closeResultSet(resultSet);
|
||||||
|
@ -354,7 +354,7 @@ public interface EamDb {
|
|||||||
List<String> getListCasesHavingArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException;
|
List<String> getListCasesHavingArtifactInstancesKnownBad(CorrelationAttribute.Type aType, String value) throws EamDbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a reference set and all hashes contained in it.
|
* Remove a reference set and all values contained in it.
|
||||||
* @param referenceSetID
|
* @param referenceSetID
|
||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
@ -408,7 +408,7 @@ public interface EamDb {
|
|||||||
*
|
*
|
||||||
* @return Global known status of the artifact
|
* @return Global known status of the artifact
|
||||||
*/
|
*/
|
||||||
boolean isArtifactlKnownBadByReference(CorrelationAttribute.Type aType, String value) throws EamDbException;
|
boolean isArtifactKnownBadByReference(CorrelationAttribute.Type aType, String value) throws EamDbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new organization
|
* Add a new organization
|
||||||
@ -477,20 +477,7 @@ public interface EamDb {
|
|||||||
*
|
*
|
||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
int newReferencelSet(EamGlobalSet eamGlobalSet) throws EamDbException;
|
int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException;
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a new reference set
|
|
||||||
*
|
|
||||||
* @param orgID
|
|
||||||
* @param setName
|
|
||||||
* @param version
|
|
||||||
* @param importDate
|
|
||||||
* @return the reference set ID of the newly created set
|
|
||||||
* @throws EamDbException
|
|
||||||
*/
|
|
||||||
int newReferenceSet(int orgID, String setName, String version, TskData.FileKnown knownStatus,
|
|
||||||
boolean isReadOnly) throws EamDbException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a global set by ID
|
* Get a global set by ID
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
package org.sleuthkit.autopsy.centralrepository.datamodel;
|
package org.sleuthkit.autopsy.centralrepository.datamodel;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager;
|
|
||||||
import org.sleuthkit.datamodel.TskData;
|
import org.sleuthkit.datamodel.TskData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -61,6 +60,26 @@ public class EamGlobalSet {
|
|||||||
LocalDate importDate) {
|
LocalDate importDate) {
|
||||||
this(-1, orgID, setName, version, knownStatus, isReadOnly, importDate);
|
this(-1, orgID, setName, version, knownStatus, isReadOnly, importDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new EamGlobalSet object.
|
||||||
|
* This is intended to be used when creating a new global set as the
|
||||||
|
* globalSetID will be unknown to start.
|
||||||
|
* importDate will be automatically set to the current time.
|
||||||
|
* @param orgID
|
||||||
|
* @param setName
|
||||||
|
* @param version
|
||||||
|
* @param knownStatus
|
||||||
|
* @param isReadOnly
|
||||||
|
*/
|
||||||
|
public EamGlobalSet(
|
||||||
|
int orgID,
|
||||||
|
String setName,
|
||||||
|
String version,
|
||||||
|
TskData.FileKnown knownStatus,
|
||||||
|
boolean isReadOnly) {
|
||||||
|
this(-1, orgID, setName, version, knownStatus, isReadOnly, LocalDate.now());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the globalSetID
|
* @return the globalSetID
|
||||||
@ -145,17 +164,6 @@ public class EamGlobalSet {
|
|||||||
public void setFileKnownStatus(TskData.FileKnown fileKnownStatus) {
|
public void setFileKnownStatus(TskData.FileKnown fileKnownStatus) {
|
||||||
this.fileKnownStatus = fileKnownStatus;
|
this.fileKnownStatus = fileKnownStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the FileKnown status as a KnownFilesType
|
|
||||||
* @return KNOWN or KNOWN_BAD
|
|
||||||
*/
|
|
||||||
public HashDbManager.HashDb.KnownFilesType getKnownStatus(){
|
|
||||||
if(fileKnownStatus.equals(TskData.FileKnown.BAD)){
|
|
||||||
return HashDbManager.HashDb.KnownFilesType.KNOWN_BAD;
|
|
||||||
}
|
|
||||||
return HashDbManager.HashDb.KnownFilesType.KNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the importDate
|
* @return the importDate
|
||||||
|
@ -636,7 +636,7 @@ public class SqliteEamDb extends AbstractSqlEamDb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a reference set and all hashes contained in it.
|
* Remove a reference set and all values contained in it.
|
||||||
* @param referenceSetID
|
* @param referenceSetID
|
||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
@ -693,10 +693,10 @@ public class SqliteEamDb extends AbstractSqlEamDb {
|
|||||||
* @return Global known status of the artifact
|
* @return Global known status of the artifact
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isArtifactlKnownBadByReference(CorrelationAttribute.Type aType, String value) throws EamDbException {
|
public boolean isArtifactKnownBadByReference(CorrelationAttribute.Type aType, String value) throws EamDbException {
|
||||||
try{
|
try{
|
||||||
acquireSharedLock();
|
acquireSharedLock();
|
||||||
return super.isArtifactlKnownBadByReference(aType, value);
|
return super.isArtifactKnownBadByReference(aType, value);
|
||||||
} finally {
|
} finally {
|
||||||
releaseSharedLock();
|
releaseSharedLock();
|
||||||
}
|
}
|
||||||
@ -786,10 +786,10 @@ public class SqliteEamDb extends AbstractSqlEamDb {
|
|||||||
* @throws EamDbException
|
* @throws EamDbException
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int newReferencelSet(EamGlobalSet eamGlobalSet) throws EamDbException {
|
public int newReferenceSet(EamGlobalSet eamGlobalSet) throws EamDbException {
|
||||||
try{
|
try{
|
||||||
acquireExclusiveLock();
|
acquireExclusiveLock();
|
||||||
return super.newReferencelSet(eamGlobalSet);
|
return super.newReferenceSet(eamGlobalSet);
|
||||||
} finally {
|
} finally {
|
||||||
releaseExclusiveLock();
|
releaseExclusiveLock();
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ import org.sleuthkit.datamodel.HashEntry;
|
|||||||
import org.sleuthkit.datamodel.HashHitInfo;
|
import org.sleuthkit.datamodel.HashHitInfo;
|
||||||
import org.sleuthkit.datamodel.SleuthkitJNI;
|
import org.sleuthkit.datamodel.SleuthkitJNI;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
import org.sleuthkit.datamodel.TskData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements a singleton that manages the set of hash databases used
|
* This class implements a singleton that manages the set of hash databases used
|
||||||
@ -233,7 +234,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
return hashDb;
|
return hashDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SleuthkitHashSet addHashDatabase(int handle, String hashSetName, boolean searchDuringIngest, boolean sendIngestMessages, SleuthkitHashSet.KnownFilesType knownFilesType) throws TskCoreException {
|
private SleuthkitHashSet addHashDatabase(int handle, String hashSetName, boolean searchDuringIngest, boolean sendIngestMessages, HashDb.KnownFilesType knownFilesType) throws TskCoreException {
|
||||||
// Wrap an object around the handle.
|
// Wrap an object around the handle.
|
||||||
SleuthkitHashSet hashDb = new SleuthkitHashSet(handle, hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);
|
SleuthkitHashSet hashDb = new SleuthkitHashSet(handle, hashSetName, searchDuringIngest, sendIngestMessages, knownFilesType);
|
||||||
|
|
||||||
@ -426,7 +427,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
*/
|
*/
|
||||||
public synchronized List<HashDb> getKnownFileHashSets() {
|
public synchronized List<HashDb> getKnownFileHashSets() {
|
||||||
List<HashDb> hashDbs = new ArrayList<>();
|
List<HashDb> hashDbs = new ArrayList<>();
|
||||||
this.hashSets.stream().filter((db) -> (db.getKnownFilesType() == SleuthkitHashSet.KnownFilesType.KNOWN)).forEach((db) -> {
|
this.hashSets.stream().filter((db) -> (db.getKnownFilesType() == HashDb.KnownFilesType.KNOWN)).forEach((db) -> {
|
||||||
hashDbs.add(db);
|
hashDbs.add(db);
|
||||||
});
|
});
|
||||||
return hashDbs;
|
return hashDbs;
|
||||||
@ -439,7 +440,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
*/
|
*/
|
||||||
public synchronized List<HashDb> getKnownBadFileHashSets() {
|
public synchronized List<HashDb> getKnownBadFileHashSets() {
|
||||||
List<HashDb> hashDbs = new ArrayList<>();
|
List<HashDb> hashDbs = new ArrayList<>();
|
||||||
this.hashSets.stream().filter((db) -> (db.getKnownFilesType() == SleuthkitHashSet.KnownFilesType.KNOWN_BAD)).forEach((db) -> {
|
this.hashSets.stream().filter((db) -> (db.getKnownFilesType() == HashDb.KnownFilesType.KNOWN_BAD)).forEach((db) -> {
|
||||||
hashDbs.add(db);
|
hashDbs.add(db);
|
||||||
});
|
});
|
||||||
return hashDbs;
|
return hashDbs;
|
||||||
@ -478,9 +479,9 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
// Defaults for fields not stored in the central repository:
|
// Defaults for fields not stored in the central repository:
|
||||||
// searchDuringIngest: false
|
// searchDuringIngest: false
|
||||||
// sendIngestMessages: true if the hash set is notable
|
// sendIngestMessages: true if the hash set is notable
|
||||||
boolean sendIngestMessages = globalSet.getKnownStatus().equals(SleuthkitHashSet.KnownFilesType.KNOWN_BAD);
|
boolean sendIngestMessages = convertFileKnown(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(), globalSet.getKnownStatus(), globalSet.isReadOnly(), false, sendIngestMessages));
|
globalSet.getGlobalSetID(), convertFileKnown(globalSet.getFileKnownStatus()), globalSet.isReadOnly(), false, sendIngestMessages));
|
||||||
}
|
}
|
||||||
} catch (EamDbException ex){
|
} catch (EamDbException 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
|
||||||
@ -488,6 +489,13 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
return crHashSets;
|
return crHashSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HashDb.KnownFilesType convertFileKnown(TskData.FileKnown fileKnown){
|
||||||
|
if(fileKnown.equals(TskData.FileKnown.BAD)){
|
||||||
|
return HashDb.KnownFilesType.KNOWN_BAD;
|
||||||
|
}
|
||||||
|
return HashDb.KnownFilesType.KNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restores the last saved hash sets configuration. This supports
|
* Restores the last saved hash sets configuration. This supports
|
||||||
@ -700,7 +708,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
|
|
||||||
public abstract String getDatabasePath() throws TskCoreException;
|
public abstract String getDatabasePath() throws TskCoreException;
|
||||||
|
|
||||||
public abstract SleuthkitHashSet.KnownFilesType getKnownFilesType();
|
public abstract HashDb.KnownFilesType getKnownFilesType();
|
||||||
|
|
||||||
public abstract boolean getSearchDuringIngest();
|
public abstract boolean getSearchDuringIngest();
|
||||||
|
|
||||||
@ -773,7 +781,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
private final String hashSetName;
|
private final String hashSetName;
|
||||||
private boolean searchDuringIngest;
|
private boolean searchDuringIngest;
|
||||||
private boolean sendIngestMessages;
|
private boolean sendIngestMessages;
|
||||||
private final SleuthkitHashSet.KnownFilesType knownFilesType;
|
private final HashDb.KnownFilesType knownFilesType;
|
||||||
private boolean indexing;
|
private boolean indexing;
|
||||||
private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
private final PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
|
||||||
|
|
||||||
@ -1052,7 +1060,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
private final String hashSetName;
|
private final String hashSetName;
|
||||||
private boolean searchDuringIngest;
|
private boolean searchDuringIngest;
|
||||||
private boolean sendIngestMessages;
|
private boolean sendIngestMessages;
|
||||||
private final SleuthkitHashSet.KnownFilesType knownFilesType;
|
private final HashDb.KnownFilesType knownFilesType;
|
||||||
private final int referenceSetID;
|
private final int referenceSetID;
|
||||||
private final String version;
|
private final String version;
|
||||||
private String orgName;
|
private String orgName;
|
||||||
@ -1061,7 +1069,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
|
|
||||||
@Messages({"HashDbManager.CentralRepoHashDb.orgError=Error loading organization"})
|
@Messages({"HashDbManager.CentralRepoHashDb.orgError=Error loading organization"})
|
||||||
private CentralRepoHashSet(String hashSetName, String version, int referenceSetID,
|
private CentralRepoHashSet(String hashSetName, String version, int referenceSetID,
|
||||||
boolean useForIngest, boolean sendHitMessages, SleuthkitHashSet.KnownFilesType knownFilesType,
|
boolean useForIngest, boolean sendHitMessages, HashDb.KnownFilesType knownFilesType,
|
||||||
boolean readOnly)
|
boolean readOnly)
|
||||||
throws TskCoreException{
|
throws TskCoreException{
|
||||||
this.hashSetName = hashSetName;
|
this.hashSetName = hashSetName;
|
||||||
@ -1075,7 +1083,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
try{
|
try{
|
||||||
orgName = EamDb.getInstance().getReferenceSetOrganization(referenceSetID).getName();
|
orgName = EamDb.getInstance().getReferenceSetOrganization(referenceSetID).getName();
|
||||||
} catch (EamDbException ex){
|
} catch (EamDbException ex){
|
||||||
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error looking up central repository organization", ex); //NON-NLS
|
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error looking up central repository organization for reference set " + referenceSetID, ex); //NON-NLS
|
||||||
orgName = Bundle.HashDbManager_CentralRepoHashDb_orgError();
|
orgName = Bundle.HashDbManager_CentralRepoHashDb_orgError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1139,7 +1147,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SleuthkitHashSet.KnownFilesType getKnownFilesType() {
|
public HashDb.KnownFilesType getKnownFilesType() {
|
||||||
return knownFilesType;
|
return knownFilesType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1242,7 +1250,8 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
try{
|
try{
|
||||||
return EamDb.getInstance().isFileHashInReferenceSet(file.getMd5Hash(), this.referenceSetID);
|
return EamDb.getInstance().isFileHashInReferenceSet(file.getMd5Hash(), this.referenceSetID);
|
||||||
} catch (EamDbException ex){
|
} catch (EamDbException ex){
|
||||||
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error performing central reposiotry hash lookup", ex); //NON-NLS
|
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error performing central reposiotry hash lookup for hash "
|
||||||
|
+ file.getMd5Hash() + " in reference set " + referenceSetID, ex); //NON-NLS
|
||||||
throw new TskCoreException("Error performing central reposiotry hash lookup", ex);
|
throw new TskCoreException("Error performing central reposiotry hash lookup", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1273,7 +1282,8 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
result = new HashHitInfo(file.getMd5Hash(), "", "");
|
result = new HashHitInfo(file.getMd5Hash(), "", "");
|
||||||
}
|
}
|
||||||
} catch (EamDbException ex){
|
} catch (EamDbException ex){
|
||||||
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error performing central reposiotry hash lookup", ex); //NON-NLS
|
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error performing central reposiotry hash lookup for hash "
|
||||||
|
+ file.getMd5Hash() + " in reference set " + referenceSetID, ex); //NON-NLS
|
||||||
throw new TskCoreException("Error performing central reposiotry hash lookup", ex);
|
throw new TskCoreException("Error performing central reposiotry hash lookup", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1364,7 +1374,7 @@ public class HashDbManager implements PropertyChangeListener {
|
|||||||
try {
|
try {
|
||||||
SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.getHandle());
|
SleuthkitJNI.createLookupIndexForHashDatabase(hashDb.getHandle());
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
Logger.getLogger(SleuthkitHashSet.class.getName()).log(Level.SEVERE, "Error indexing hash database", ex); //NON-NLS
|
Logger.getLogger(HashDbIndexer.class.getName()).log(Level.SEVERE, "Error indexing hash set " + hashDb.getHashSetName(), ex); //NON-NLS
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
NbBundle.getMessage(this.getClass(),
|
NbBundle.getMessage(this.getClass(),
|
||||||
"HashDbManager.dlgMsg.errorIndexingHashSet",
|
"HashDbManager.dlgMsg.errorIndexingHashSet",
|
||||||
|
@ -202,7 +202,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
|
|
||||||
// Handle legacy known files types.
|
// Handle legacy known files types.
|
||||||
if (knownFilesType.equals("NSRL")) { //NON-NLS
|
if (knownFilesType.equals("NSRL")) { //NON-NLS
|
||||||
knownFilesType = HashDbManager.SleuthkitHashSet.KnownFilesType.KNOWN.toString();
|
knownFilesType = HashDbManager.HashDb.KnownFilesType.KNOWN.toString();
|
||||||
updatedSchema = true;
|
updatedSchema = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
} else {
|
} else {
|
||||||
throw new HashLookupSettingsException(String.format(elementErrorMessage, PATH_ELEMENT));
|
throw new HashLookupSettingsException(String.format(elementErrorMessage, PATH_ELEMENT));
|
||||||
}
|
}
|
||||||
hashDbInfoList.add(new HashDbInfo(hashSetName, HashDbManager.SleuthkitHashSet.KnownFilesType.valueOf(knownFilesType),
|
hashDbInfoList.add(new HashDbInfo(hashSetName, HashDbManager.HashDb.KnownFilesType.valueOf(knownFilesType),
|
||||||
searchDuringIngestFlag, sendIngestMessagesFlag, dbPath));
|
searchDuringIngestFlag, sendIngestMessagesFlag, dbPath));
|
||||||
hashSetNames.add(hashSetName);
|
hashSetNames.add(hashSetName);
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
private final String hashSetName;
|
private final String hashSetName;
|
||||||
private final HashDbManager.SleuthkitHashSet.KnownFilesType knownFilesType;
|
private final HashDbManager.HashDb.KnownFilesType knownFilesType;
|
||||||
private boolean searchDuringIngest;
|
private boolean searchDuringIngest;
|
||||||
private final boolean sendIngestMessages;
|
private final boolean sendIngestMessages;
|
||||||
private final String path;
|
private final String path;
|
||||||
@ -323,7 +323,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
* @param sendIngestMessages Whether or not ingest messages are sent
|
* @param sendIngestMessages Whether or not ingest messages are sent
|
||||||
* @param path The path to the db
|
* @param path The path to the db
|
||||||
*/
|
*/
|
||||||
HashDbInfo(String hashSetName, HashDbManager.SleuthkitHashSet.KnownFilesType knownFilesType, boolean searchDuringIngest, boolean sendIngestMessages, String path) {
|
HashDbInfo(String hashSetName, HashDbManager.HashDb.KnownFilesType knownFilesType, boolean searchDuringIngest, boolean sendIngestMessages, String path) {
|
||||||
this.hashSetName = hashSetName;
|
this.hashSetName = hashSetName;
|
||||||
this.knownFilesType = knownFilesType;
|
this.knownFilesType = knownFilesType;
|
||||||
this.searchDuringIngest = searchDuringIngest;
|
this.searchDuringIngest = searchDuringIngest;
|
||||||
@ -335,7 +335,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
this.dbType = DatabaseType.FILE;
|
this.dbType = DatabaseType.FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HashDbInfo(String hashSetName, String version, int referenceSetID, HashDbManager.SleuthkitHashSet.KnownFilesType knownFilesType, boolean readOnly, boolean searchDuringIngest, boolean sendIngestMessages){
|
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 +407,7 @@ final class HashLookupSettings implements Serializable {
|
|||||||
*
|
*
|
||||||
* @return The known files type setting.
|
* @return The known files type setting.
|
||||||
*/
|
*/
|
||||||
HashDbManager.SleuthkitHashSet.KnownFilesType getKnownFilesType() {
|
HashDbManager.HashDb.KnownFilesType getKnownFilesType() {
|
||||||
return knownFilesType;
|
return knownFilesType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
|
|||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalFileInstance;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalFileInstance;
|
||||||
|
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalSet;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
import org.sleuthkit.datamodel.TskData;
|
import org.sleuthkit.datamodel.TskData;
|
||||||
@ -77,7 +78,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
|||||||
}
|
}
|
||||||
|
|
||||||
void importFile(String hashSetName, String version, int orgId,
|
void importFile(String hashSetName, String version, int orgId,
|
||||||
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.SleuthkitHashSet.KnownFilesType knownFilesType,
|
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
|
||||||
boolean readOnly, String importFileName){
|
boolean readOnly, String importFileName){
|
||||||
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||||
|
|
||||||
@ -139,7 +140,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
|||||||
private final int orgId;
|
private final int orgId;
|
||||||
private final boolean searchDuringIngest;
|
private final boolean searchDuringIngest;
|
||||||
private final boolean sendIngestMessages;
|
private final boolean sendIngestMessages;
|
||||||
private final HashDbManager.SleuthkitHashSet.KnownFilesType knownFilesType;
|
private final HashDbManager.HashDb.KnownFilesType knownFilesType;
|
||||||
private final boolean readOnly;
|
private final boolean readOnly;
|
||||||
private final File importFile;
|
private final File importFile;
|
||||||
private final long totalLines;
|
private final long totalLines;
|
||||||
@ -148,7 +149,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
|||||||
private final AtomicLong numLines = new AtomicLong();
|
private final AtomicLong numLines = new AtomicLong();
|
||||||
|
|
||||||
ImportIDXWorker(String hashSetName, String version, int orgId,
|
ImportIDXWorker(String hashSetName, String version, int orgId,
|
||||||
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.SleuthkitHashSet.KnownFilesType knownFilesType,
|
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
|
||||||
boolean readOnly, File importFile){
|
boolean readOnly, File importFile){
|
||||||
|
|
||||||
this.hashSetName = hashSetName;
|
this.hashSetName = hashSetName;
|
||||||
@ -194,14 +195,14 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
|
|||||||
protected Void doInBackground() throws Exception {
|
protected Void doInBackground() throws Exception {
|
||||||
|
|
||||||
TskData.FileKnown knownStatus;
|
TskData.FileKnown knownStatus;
|
||||||
if (knownFilesType.equals(HashDbManager.SleuthkitHashSet.KnownFilesType.KNOWN)) {
|
if (knownFilesType.equals(HashDbManager.HashDb.KnownFilesType.KNOWN)) {
|
||||||
knownStatus = TskData.FileKnown.KNOWN;
|
knownStatus = TskData.FileKnown.KNOWN;
|
||||||
} else {
|
} else {
|
||||||
knownStatus = TskData.FileKnown.BAD;
|
knownStatus = TskData.FileKnown.BAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create an empty hashset in the central repository
|
// Create an empty hashset in the central repository
|
||||||
referenceSetID = EamDb.getInstance().newReferenceSet(orgId, hashSetName, version, knownStatus, readOnly);
|
referenceSetID = EamDb.getInstance().newReferenceSet(new EamGlobalSet(orgId, hashSetName, version, knownStatus, readOnly));
|
||||||
|
|
||||||
EamDb dbManager = EamDb.getInstance();
|
EamDb dbManager = EamDb.getInstance();
|
||||||
CorrelationAttribute.Type contentType = dbManager.getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID); // get "FILES" type
|
CorrelationAttribute.Type contentType = dbManager.getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID); // get "FILES" type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user