Merge branch 'release-4.5.0' of https://github.com/sleuthkit/autopsy into 3087-CrSchemaChanges

This commit is contained in:
William Schaefer 2017-09-26 15:01:28 -04:00
commit 1630562ffb
13 changed files with 167 additions and 207 deletions

View File

@ -36,7 +36,7 @@ import javax.swing.event.DocumentListener;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
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.EamOrganization; import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
@ -48,7 +48,7 @@ import org.sleuthkit.autopsy.centralrepository.optionspanel.AddNewOrganizationDi
public class EamCaseEditDetailsDialog extends JDialog { public class EamCaseEditDetailsDialog extends JDialog {
private final static Logger LOGGER = Logger.getLogger(EamCaseEditDetailsDialog.class.getName()); private final static Logger LOGGER = Logger.getLogger(EamCaseEditDetailsDialog.class.getName());
private EamCase eamCase; private CorrelationCase eamCase;
private EamDb dbManager; private EamDb dbManager;
private Boolean contentChanged = false; private Boolean contentChanged = false;
private final Collection<JTextField> textBoxes = new ArrayList<>(); private final Collection<JTextField> textBoxes = new ArrayList<>();
@ -69,7 +69,7 @@ public class EamCaseEditDetailsDialog extends JDialog {
try { try {
this.dbManager = EamDb.getInstance(); this.dbManager = EamDb.getInstance();
this.eamCase = this.dbManager.getCaseDetails(Case.getCurrentCase().getName()); this.eamCase = this.dbManager.getCaseByUUID(Case.getCurrentCase().getName());
if(this.eamCase == null){ if(this.eamCase == null){
this.eamCase = dbManager.newCase(Case.getCurrentCase()); this.eamCase = dbManager.newCase(Case.getCurrentCase());
} }

View File

@ -50,7 +50,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
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.datamodel.AbstractFile; import org.sleuthkit.datamodel.AbstractFile;
@ -167,7 +167,7 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
EamDb dbManager = EamDb.getInstance(); EamDb dbManager = EamDb.getInstance();
int selectedRowModelIdx = otherCasesTable.convertRowIndexToModel(selectedRowViewIdx); int selectedRowModelIdx = otherCasesTable.convertRowIndexToModel(selectedRowViewIdx);
CorrelationAttribute eamArtifact = (CorrelationAttribute) tableModel.getRow(selectedRowModelIdx); CorrelationAttribute eamArtifact = (CorrelationAttribute) tableModel.getRow(selectedRowModelIdx);
EamCase eamCasePartial = eamArtifact.getInstances().get(0).getEamCase(); CorrelationCase eamCasePartial = eamArtifact.getInstances().get(0).getCorrelationCase();
if (eamCasePartial == null) { if (eamCasePartial == null) {
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem, JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetailsReference(), Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetailsReference(),
@ -177,7 +177,7 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
} }
caseDisplayName = eamCasePartial.getDisplayName(); caseDisplayName = eamCasePartial.getDisplayName();
// query case details // query case details
EamCase eamCase = dbManager.getCaseDetails(eamCasePartial.getCaseUUID()); CorrelationCase eamCase = dbManager.getCaseByUUID(eamCasePartial.getCaseUUID());
if (eamCase == null) { if (eamCase == null) {
JOptionPane.showConfirmDialog(showCaseDetailsMenuItem, JOptionPane.showConfirmDialog(showCaseDetailsMenuItem,
Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(), Bundle.DataContentViewerOtherCases_caseDetailsDialog_noDetails(),
@ -421,9 +421,9 @@ public class DataContentViewerOtherCases extends javax.swing.JPanel implements D
try { try {
EamDb dbManager = EamDb.getInstance(); EamDb dbManager = EamDb.getInstance();
Collection<CorrelationAttributeInstance> artifactInstances = dbManager.getArtifactInstancesByTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue()).stream() Collection<CorrelationAttributeInstance> artifactInstances = dbManager.getArtifactInstancesByTypeValue(corAttr.getCorrelationType(), corAttr.getCorrelationValue()).stream()
.filter(artifactInstance -> !artifactInstance.getEamCase().getCaseUUID().equals(caseUUID) .filter(artifactInstance -> !artifactInstance.getCorrelationCase().getCaseUUID().equals(caseUUID)
|| !artifactInstance.getEamDataSource().getName().equals(dataSourceName) || !artifactInstance.getCorrelationDataSource().getName().equals(dataSourceName)
|| !artifactInstance.getEamDataSource().getDeviceID().equals(deviceId)) || !artifactInstance.getCorrelationDataSource().getDeviceID().equals(deviceId))
.collect(Collectors.toList()); .collect(Collectors.toList());
return artifactInstances; return artifactInstances;
} catch (EamDbException ex) { } catch (EamDbException ex) {

View File

@ -133,18 +133,18 @@ public class DataContentViewerOtherCasesTableModel extends AbstractTableModel {
switch (colId) { switch (colId) {
case CASE_NAME: case CASE_NAME:
if (null != eamArtifactInstance.getEamCase()) { if (null != eamArtifactInstance.getCorrelationCase()) {
value = eamArtifactInstance.getEamCase().getDisplayName(); value = eamArtifactInstance.getCorrelationCase().getDisplayName();
} }
break; break;
case DEVICE: case DEVICE:
if (null != eamArtifactInstance.getEamDataSource()) { if (null != eamArtifactInstance.getCorrelationDataSource()) {
value = eamArtifactInstance.getEamDataSource().getDeviceID(); value = eamArtifactInstance.getCorrelationDataSource().getDeviceID();
} }
break; break;
case DATA_SOURCE: case DATA_SOURCE:
if (null != eamArtifactInstance.getEamDataSource()) { if (null != eamArtifactInstance.getCorrelationDataSource()) {
value = eamArtifactInstance.getEamDataSource().getName(); value = eamArtifactInstance.getCorrelationDataSource().getName();
} }
break; break;
case FILE_PATH: case FILE_PATH:

View File

@ -198,7 +198,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
* @param eamCase The case to add * @param eamCase The case to add
*/ */
@Override @Override
public void newCase(EamCase eamCase) throws EamDbException { public void newCase(CorrelationCase eamCase) throws EamDbException {
Connection conn = connect(); Connection conn = connect();
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
@ -259,12 +259,12 @@ public abstract class AbstractSqlEamDb implements EamDb {
* @param case The case to add * @param case The case to add
*/ */
@Override @Override
public EamCase newCase(Case autopsyCase) throws EamDbException{ public CorrelationCase newCase(Case autopsyCase) throws EamDbException{
if(autopsyCase == null){ if(autopsyCase == null){
throw new EamDbException("Case is null"); throw new EamDbException("Case is null");
} }
EamCase curCeCase = new EamCase( CorrelationCase curCeCase = new CorrelationCase(
-1, -1,
autopsyCase.getName(), // unique case ID autopsyCase.getName(), // unique case ID
EamOrganization.getDefault(), EamOrganization.getDefault(),
@ -285,7 +285,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
* @param eamCase The case to update * @param eamCase The case to update
*/ */
@Override @Override
public void updateCase(EamCase eamCase) throws EamDbException { public void updateCase(CorrelationCase eamCase) throws EamDbException {
Connection conn = connect(); Connection conn = connect();
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
@ -349,10 +349,12 @@ public abstract class AbstractSqlEamDb implements EamDb {
* @return The retrieved case * @return The retrieved case
*/ */
@Override @Override
public EamCase getCaseDetails(String caseUUID) throws EamDbException { public CorrelationCase getCaseByUUID(String caseUUID) throws EamDbException {
// @@@ We should have a cache here...
Connection conn = connect(); Connection conn = connect();
EamCase eamCaseResult = null; CorrelationCase eamCaseResult = null;
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
@ -386,11 +388,11 @@ public abstract class AbstractSqlEamDb implements EamDb {
* @return List of cases * @return List of cases
*/ */
@Override @Override
public List<EamCase> getCases() throws EamDbException { public List<CorrelationCase> getCases() throws EamDbException {
Connection conn = connect(); Connection conn = connect();
List<EamCase> cases = new ArrayList<>(); List<CorrelationCase> cases = new ArrayList<>();
EamCase eamCaseResult; CorrelationCase eamCaseResult;
PreparedStatement preparedStatement = null; PreparedStatement preparedStatement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
@ -450,27 +452,27 @@ public abstract class AbstractSqlEamDb implements EamDb {
* *
* @param eamDataSource the data source to update * @param eamDataSource the data source to update
*/ */
@Override // @Override
public void updateDataSource(CorrelationDataSource eamDataSource) throws EamDbException { // public void updateDataSource(CorrelationDataSource eamDataSource) throws EamDbException {
Connection conn = connect(); // Connection conn = connect();
// BC: This needs to be updated because device_id is not unique. Query needs to also use case_id
PreparedStatement preparedStatement = null; // PreparedStatement preparedStatement = null;
String sql = "UPDATE data_sources SET name=? WHERE device_id=?"; // String sql = "UPDATE data_sources SET name=? WHERE device_id=?";
//
try { // try {
preparedStatement = conn.prepareStatement(sql); // preparedStatement = conn.prepareStatement(sql);
//
preparedStatement.setString(1, eamDataSource.getName()); // preparedStatement.setString(1, eamDataSource.getName());
preparedStatement.setString(2, eamDataSource.getDeviceID()); // preparedStatement.setString(2, eamDataSource.getDeviceID());
//
preparedStatement.executeUpdate(); // preparedStatement.executeUpdate();
} catch (SQLException ex) { // } catch (SQLException ex) {
throw new EamDbException("Error updating case.", ex); // NON-NLS // throw new EamDbException("Error updating case.", ex); // NON-NLS
} finally { // } finally {
EamDbUtil.closePreparedStatement(preparedStatement); // EamDbUtil.closePreparedStatement(preparedStatement);
EamDbUtil.closeConnection(conn); // EamDbUtil.closeConnection(conn);
} // }
} // }
/** /**
* Retrieves Data Source details based on data source device ID * Retrieves Data Source details based on data source device ID
@ -568,8 +570,8 @@ public abstract class AbstractSqlEamDb implements EamDb {
preparedStatement = conn.prepareStatement(sql.toString()); preparedStatement = conn.prepareStatement(sql.toString());
for (CorrelationAttributeInstance eamInstance : eamInstances) { for (CorrelationAttributeInstance eamInstance : eamInstances) {
if(! eamArtifact.getCorrelationValue().isEmpty()){ if(! eamArtifact.getCorrelationValue().isEmpty()){
preparedStatement.setString(1, eamInstance.getEamCase().getCaseUUID()); preparedStatement.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
preparedStatement.setString(2, eamInstance.getEamDataSource().getDeviceID()); preparedStatement.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
preparedStatement.setString(3, eamArtifact.getCorrelationValue()); preparedStatement.setString(3, eamArtifact.getCorrelationValue());
preparedStatement.setString(4, eamInstance.getFilePath()); preparedStatement.setString(4, eamInstance.getFilePath());
preparedStatement.setByte(5, eamInstance.getKnownStatus().getFileKnownValue()); preparedStatement.setByte(5, eamInstance.getKnownStatus().getFileKnownValue());
@ -928,8 +930,8 @@ public abstract class AbstractSqlEamDb implements EamDb {
for (CorrelationAttributeInstance eamInstance : eamInstances) { for (CorrelationAttributeInstance eamInstance : eamInstances) {
if(! eamArtifact.getCorrelationValue().isEmpty()){ if(! eamArtifact.getCorrelationValue().isEmpty()){
bulkPs.setString(1, eamInstance.getEamCase().getCaseUUID()); bulkPs.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
bulkPs.setString(2, eamInstance.getEamDataSource().getDeviceID()); bulkPs.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
bulkPs.setString(3, eamArtifact.getCorrelationValue()); bulkPs.setString(3, eamArtifact.getCorrelationValue());
bulkPs.setString(4, eamInstance.getFilePath()); bulkPs.setString(4, eamInstance.getFilePath());
bulkPs.setByte(5, eamInstance.getKnownStatus().getFileKnownValue()); bulkPs.setByte(5, eamInstance.getKnownStatus().getFileKnownValue());
@ -962,7 +964,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
* Executes a bulk insert of the cases * Executes a bulk insert of the cases
*/ */
@Override @Override
public void bulkInsertCases(List<EamCase> cases) throws EamDbException { public void bulkInsertCases(List<CorrelationCase> cases) throws EamDbException {
Connection conn = connect(); Connection conn = connect();
if (cases.isEmpty()) { if (cases.isEmpty()) {
@ -978,7 +980,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
+ getConflictClause(); + getConflictClause();
bulkPs = conn.prepareStatement(sql); bulkPs = conn.prepareStatement(sql);
for (EamCase eamCase : cases) { for (CorrelationCase eamCase : cases) {
bulkPs.setString(1, eamCase.getCaseUUID()); bulkPs.setString(1, eamCase.getCaseUUID());
if (null == eamCase.getOrg()) { if (null == eamCase.getOrg()) {
bulkPs.setNull(2, Types.INTEGER); bulkPs.setNull(2, Types.INTEGER);
@ -1075,8 +1077,8 @@ public abstract class AbstractSqlEamDb implements EamDb {
try { try {
preparedQuery = conn.prepareStatement(sqlQuery.toString()); preparedQuery = conn.prepareStatement(sqlQuery.toString());
preparedQuery.setString(1, eamInstance.getEamCase().getCaseUUID()); preparedQuery.setString(1, eamInstance.getCorrelationCase().getCaseUUID());
preparedQuery.setString(2, eamInstance.getEamDataSource().getDeviceID()); preparedQuery.setString(2, eamInstance.getCorrelationDataSource().getDeviceID());
preparedQuery.setString(3, eamArtifact.getCorrelationValue()); preparedQuery.setString(3, eamArtifact.getCorrelationValue());
preparedQuery.setString(4, eamInstance.getFilePath()); preparedQuery.setString(4, eamInstance.getFilePath());
resultSet = preparedQuery.executeQuery(); resultSet = preparedQuery.executeQuery();
@ -1103,12 +1105,12 @@ public abstract class AbstractSqlEamDb implements EamDb {
// in the database, but we don't expect the user to be tagging large numbers // in the database, but we don't expect the user to be tagging large numbers
// of items (that didn't have the CE ingest module run on them) at once. // of items (that didn't have the CE ingest module run on them) at once.
if(null == getCaseDetails(eamInstance.getEamCase().getCaseUUID())){ if(null == getCaseByUUID(eamInstance.getCorrelationCase().getCaseUUID())){
newCase(eamInstance.getEamCase()); newCase(eamInstance.getCorrelationCase());
} }
if (null == getDataSourceDetails(eamInstance.getEamDataSource().getDeviceID())) { if (null == getDataSourceDetails(eamInstance.getCorrelationDataSource().getDeviceID())) {
newDataSource(eamInstance.getEamDataSource()); newDataSource(eamInstance.getCorrelationDataSource());
} }
eamArtifact.getInstances().get(0).setKnownStatus(knownStatus); eamArtifact.getInstances().get(0).setKnownStatus(knownStatus);
@ -1836,7 +1838,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
* *
* @throws SQLException when an expected column name is not in the resultSet * @throws SQLException when an expected column name is not in the resultSet
*/ */
private EamCase getEamCaseFromResultSet(ResultSet resultSet) throws SQLException { private CorrelationCase getEamCaseFromResultSet(ResultSet resultSet) throws SQLException {
if (null == resultSet) { if (null == resultSet) {
return null; return null;
} }
@ -1853,8 +1855,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
resultSet.getString("poc_phone")); resultSet.getString("poc_phone"));
} }
EamCase eamCase = new EamCase(resultSet.getString("case_uid"), resultSet.getString("case_name")); CorrelationCase eamCase = new CorrelationCase(resultSet.getInt("case_id"), resultSet.getString("case_uid"), resultSet.getString("case_name"));
eamCase.setID(resultSet.getInt("case_id"));
eamCase.setOrg(eamOrg); eamCase.setOrg(eamOrg);
eamCase.setCreationDate(resultSet.getString("creation_date")); eamCase.setCreationDate(resultSet.getString("creation_date"));
eamCase.setCaseNumber(resultSet.getString("case_number")); eamCase.setCaseNumber(resultSet.getString("case_number"));
@ -1911,7 +1912,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
return null; return null;
} }
CorrelationAttributeInstance eamArtifactInstance = new CorrelationAttributeInstance( CorrelationAttributeInstance eamArtifactInstance = new CorrelationAttributeInstance(
new EamCase(resultSet.getString("case_uid"), resultSet.getString("case_name")), new CorrelationCase(resultSet.getString("case_uid"), resultSet.getString("case_name")),
new CorrelationDataSource(-1, resultSet.getString("device_id"), resultSet.getString("name")), new CorrelationDataSource(-1, resultSet.getString("device_id"), resultSet.getString("name")),
resultSet.getString("file_path"), resultSet.getString("file_path"),
resultSet.getString("comment"), resultSet.getString("comment"),

View File

@ -53,52 +53,52 @@ public class CorrelationAttributeInstance implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private String ID; private int ID;
private EamCase eamCase; private CorrelationCase correlationCase;
private CorrelationDataSource eamDataSource; private CorrelationDataSource correlationDataSource;
private String filePath; private String filePath;
private String comment; private String comment;
private TskData.FileKnown knownStatus; private TskData.FileKnown knownStatus;
private GlobalStatus globalStatus; private GlobalStatus globalStatus;
public CorrelationAttributeInstance( public CorrelationAttributeInstance(
EamCase eamCase, CorrelationCase eamCase,
CorrelationDataSource eamDataSource CorrelationDataSource eamDataSource
) { ) {
this("", eamCase, eamDataSource, "", null, TskData.FileKnown.UNKNOWN, GlobalStatus.LOCAL); this(-1, eamCase, eamDataSource, "", null, TskData.FileKnown.UNKNOWN, GlobalStatus.LOCAL);
} }
public CorrelationAttributeInstance( public CorrelationAttributeInstance(
EamCase eamCase, CorrelationCase eamCase,
CorrelationDataSource eamDataSource, CorrelationDataSource eamDataSource,
String filePath String filePath
) { ) {
this("", eamCase, eamDataSource, filePath, null, TskData.FileKnown.UNKNOWN, GlobalStatus.LOCAL); this(-1, eamCase, eamDataSource, filePath, null, TskData.FileKnown.UNKNOWN, GlobalStatus.LOCAL);
} }
public CorrelationAttributeInstance( public CorrelationAttributeInstance(
EamCase eamCase, CorrelationCase eamCase,
CorrelationDataSource eamDataSource, CorrelationDataSource eamDataSource,
String filePath, String filePath,
String comment String comment
) { ) {
this("", eamCase, eamDataSource, filePath, comment, TskData.FileKnown.UNKNOWN, GlobalStatus.LOCAL); this(-1, eamCase, eamDataSource, filePath, comment, TskData.FileKnown.UNKNOWN, GlobalStatus.LOCAL);
} }
public CorrelationAttributeInstance( public CorrelationAttributeInstance(
EamCase eamCase, CorrelationCase eamCase,
CorrelationDataSource eamDataSource, CorrelationDataSource eamDataSource,
String filePath, String filePath,
String comment, String comment,
TskData.FileKnown knownStatus, TskData.FileKnown knownStatus,
GlobalStatus globalStatus GlobalStatus globalStatus
) { ) {
this("", eamCase, eamDataSource, filePath, comment, knownStatus, globalStatus); this(-1, eamCase, eamDataSource, filePath, comment, knownStatus, globalStatus);
} }
public CorrelationAttributeInstance( public CorrelationAttributeInstance(
String ID, int ID,
EamCase eamCase, CorrelationCase eamCase,
CorrelationDataSource eamDataSource, CorrelationDataSource eamDataSource,
String filePath, String filePath,
String comment, String comment,
@ -106,8 +106,8 @@ public class CorrelationAttributeInstance implements Serializable {
GlobalStatus globalStatus GlobalStatus globalStatus
) { ) {
this.ID = ID; this.ID = ID;
this.eamCase = eamCase; this.correlationCase = eamCase;
this.eamDataSource = eamDataSource; this.correlationDataSource = eamDataSource;
// Lower case paths to normalize paths and improve correlation results, if this causes significant issues on case-sensitive file systems, remove // Lower case paths to normalize paths and improve correlation results, if this causes significant issues on case-sensitive file systems, remove
this.filePath = filePath.toLowerCase(); this.filePath = filePath.toLowerCase();
this.comment = comment; this.comment = comment;
@ -116,9 +116,9 @@ public class CorrelationAttributeInstance implements Serializable {
} }
public Boolean equals(CorrelationAttributeInstance otherInstance) { public Boolean equals(CorrelationAttributeInstance otherInstance) {
return ((this.getID().equals(otherInstance.getID())) return ((this.getID() == otherInstance.getID())
&& (this.getEamCase().equals(otherInstance.getEamCase())) && (this.getCorrelationCase().equals(otherInstance.getCorrelationCase()))
&& (this.getEamDataSource().equals(otherInstance.getEamDataSource())) && (this.getCorrelationDataSource().equals(otherInstance.getCorrelationDataSource()))
&& (this.getFilePath().equals(otherInstance.getFilePath())) && (this.getFilePath().equals(otherInstance.getFilePath()))
&& (this.getGlobalStatus().equals(otherInstance.getGlobalStatus())) && (this.getGlobalStatus().equals(otherInstance.getGlobalStatus()))
&& (this.getKnownStatus().equals(otherInstance.getKnownStatus())) && (this.getKnownStatus().equals(otherInstance.getKnownStatus()))
@ -128,8 +128,8 @@ public class CorrelationAttributeInstance implements Serializable {
@Override @Override
public String toString() { public String toString() {
return this.getID() return this.getID()
+ this.getEamCase().getCaseUUID() + this.getCorrelationCase().getCaseUUID()
+ this.getEamDataSource().getName() + this.getCorrelationDataSource().getName()
+ this.getFilePath() + this.getFilePath()
+ this.getGlobalStatus() + this.getGlobalStatus()
+ this.getKnownStatus() + this.getKnownStatus()
@ -137,45 +137,24 @@ public class CorrelationAttributeInstance implements Serializable {
} }
/** /**
* @return the ID * @return the database ID
*/ */
public String getID() { int getID() {
return ID; return ID;
} }
/**
* @param ID the ID to set
*/
public void setID(String ID) {
this.ID = ID;
}
/** /**
* @return the eamCase * @return the eamCase
*/ */
public EamCase getEamCase() { public CorrelationCase getCorrelationCase() {
return eamCase; return correlationCase;
}
/**
* @param eamCase the eamCase to set
*/
public void setEamCase(EamCase eamCase) {
this.eamCase = eamCase;
} }
/** /**
* @return the eamDataSource * @return the eamDataSource
*/ */
public CorrelationDataSource getEamDataSource() { public CorrelationDataSource getCorrelationDataSource() {
return eamDataSource; return correlationDataSource;
}
/**
* @param eamDataSource the eamDataSource to set
*/
public void setEamDataSource(CorrelationDataSource eamDataSource) {
this.eamDataSource = eamDataSource;
} }
/** /**
@ -185,14 +164,6 @@ public class CorrelationAttributeInstance implements Serializable {
return filePath; return filePath;
} }
/**
* @param filePath the filePath to set
*/
public void setFilePath(String filePath) {
// Lower case paths to normalize paths and improve correlation results, if this causes significant issues on case-sensitive file systems, remove
this.filePath = filePath.toLowerCase();
}
/** /**
* @return the comment * @return the comment
*/ */

View File

@ -29,13 +29,13 @@ import org.openide.util.NbBundle.Messages;
* Used to store info about a case. * Used to store info about a case.
* *
*/ */
public class EamCase implements Serializable { public class CorrelationCase implements Serializable {
private static long serialVersionUID = 1L; private static long serialVersionUID = 1L;
private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss (z)"); private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss (z)");
private int ID; private int databaseId;
private String caseUUID; private String caseUUID; // globally unique
private EamOrganization org; private EamOrganization org;
private String displayName; private String displayName;
private String creationDate; private String creationDate;
@ -45,11 +45,20 @@ public class EamCase implements Serializable {
private String examinerPhone; private String examinerPhone;
private String notes; private String notes;
public EamCase(String caseUUID, String displayName) { /**
*
* @param caseUUID Globally unique identifier
* @param displayName
*/
public CorrelationCase(String caseUUID, String displayName) {
this(-1, caseUUID, null, displayName, DATE_FORMAT.format(new Date()), null, null, null, null, null); this(-1, caseUUID, null, displayName, DATE_FORMAT.format(new Date()), null, null, null, null, null);
} }
CorrelationCase(int ID, String caseUUID, String displayName) {
this(ID, caseUUID, null, displayName, DATE_FORMAT.format(new Date()), null, null, null, null, null);
}
public EamCase(int ID, public CorrelationCase(int ID,
String caseUUID, String caseUUID,
EamOrganization org, EamOrganization org,
String displayName, String displayName,
@ -59,7 +68,7 @@ public class EamCase implements Serializable {
String examinerEmail, String examinerEmail,
String examinerPhone, String examinerPhone,
String notes) { String notes) {
this.ID = ID; this.databaseId = ID;
this.caseUUID = caseUUID; this.caseUUID = caseUUID;
this.org = org; this.org = org;
this.displayName = displayName; this.displayName = displayName;
@ -149,18 +158,13 @@ public class EamCase implements Serializable {
} }
/** /**
* @return the ID * @return the database ID for the case or -1 if it is unknown (or not in the DB)
*/ */
public int getID() { int getID() {
return ID; // @@@ Should probably have some lazy logic here to lead the ID from the DB if it is -1
return databaseId;
} }
/**
* @param ID the ID to set
*/
public void setID(int ID) {
this.ID = ID;
}
/** /**
* @return the caseUUID * @return the caseUUID
@ -169,12 +173,6 @@ public class EamCase implements Serializable {
return caseUUID; return caseUUID;
} }
/**
* @param caseUUID the caseUUID to set
*/
public void setCaseUUID(String caseUUID) {
this.caseUUID = caseUUID;
}
/** /**
* @return the org * @return the org
@ -287,5 +285,4 @@ public class EamCase implements Serializable {
public void setNotes(String notes) { public void setNotes(String notes) {
this.notes = notes; this.notes = notes;
} }
} }

View File

@ -34,7 +34,7 @@ public class CorrelationDataSource implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final int dataSourceId; //< Id in the central repo private final int dataSourceId; //< Id in the central repo
private final String deviceID; private final String deviceID; //< Unique to its associated case (not necessarily globally unique)
private final String name; private final String name;
@ -73,7 +73,7 @@ public class CorrelationDataSource implements Serializable {
public String toString() { public String toString() {
StringBuilder str = new StringBuilder(); StringBuilder str = new StringBuilder();
str.append("("); str.append("(");
str.append("ID=").append(Integer.toString(getDataSourceID())); str.append("ID=").append(Integer.toString(getID()));
str.append(",deviceID=").append(getDeviceID()); str.append(",deviceID=").append(getDeviceID());
str.append(",name=").append(getName()); str.append(",name=").append(getName());
str.append(")"); str.append(")");
@ -81,13 +81,16 @@ public class CorrelationDataSource implements Serializable {
} }
/** /**
* Get the database row ID
*
* @return the ID * @return the ID
*/ */
public int getDataSourceID() { int getID() {
return dataSourceId; return dataSourceId;
} }
/** /**
* Get the device ID that is unique to the case
* @return the deviceID * @return the deviceID
*/ */
public String getDeviceID() { public String getDeviceID() {

View File

@ -97,7 +97,7 @@ public class EamArtifactUtil {
// make an instance for the BB source file // make an instance for the BB source file
CorrelationAttributeInstance eamInstance = new CorrelationAttributeInstance( CorrelationAttributeInstance eamInstance = new CorrelationAttributeInstance(
new EamCase(currentCase.getName(), currentCase.getDisplayName()), new CorrelationCase(currentCase.getName(), currentCase.getDisplayName()),
CorrelationDataSource.fromTSKDataSource(bbSourceFile.getDataSource()), CorrelationDataSource.fromTSKDataSource(bbSourceFile.getDataSource()),
bbSourceFile.getParentPath() + bbSourceFile.getName(), bbSourceFile.getParentPath() + bbSourceFile.getName(),
"", "",
@ -249,7 +249,7 @@ public class EamArtifactUtil {
CorrelationAttribute.Type filesType = EamDb.getInstance().getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID); CorrelationAttribute.Type filesType = EamDb.getInstance().getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID);
eamArtifact = new CorrelationAttribute(filesType, af.getMd5Hash()); eamArtifact = new CorrelationAttribute(filesType, af.getMd5Hash());
CorrelationAttributeInstance cei = new CorrelationAttributeInstance( CorrelationAttributeInstance cei = new CorrelationAttributeInstance(
new EamCase(Case.getCurrentCase().getName(), Case.getCurrentCase().getDisplayName()), new CorrelationCase(Case.getCurrentCase().getName(), Case.getCurrentCase().getDisplayName()),
CorrelationDataSource.fromTSKDataSource(af.getDataSource()), CorrelationDataSource.fromTSKDataSource(af.getDataSource()),
af.getParentPath() + af.getName(), af.getParentPath() + af.getName(),
comment, comment,

View File

@ -147,21 +147,21 @@ public interface EamDb {
* *
* @param eamCase The case to add * @param eamCase The case to add
*/ */
void newCase(EamCase eamCase) throws EamDbException; void newCase(CorrelationCase eamCase) throws EamDbException;
/** /**
* Creates new Case in the database from the given case * Creates new Case in the database from the given case
* *
* @param case The case to add * @param case The case to add
*/ */
EamCase newCase(Case autopsyCase) throws EamDbException; CorrelationCase newCase(Case autopsyCase) throws EamDbException;
/** /**
* Updates an existing Case in the database * Updates an existing Case in the database
* *
* @param eamCase The case to update * @param eamCase The case to update
*/ */
void updateCase(EamCase eamCase) throws EamDbException; void updateCase(CorrelationCase eamCase) throws EamDbException;
/** /**
* Retrieves Case details based on Case UUID * Retrieves Case details based on Case UUID
@ -170,14 +170,14 @@ public interface EamDb {
* *
* @return The retrieved case * @return The retrieved case
*/ */
EamCase getCaseDetails(String caseUUID) throws EamDbException; CorrelationCase getCaseByUUID(String caseUUID) throws EamDbException;
/** /**
* Retrieves cases that are in DB. * Retrieves cases that are in DB.
* *
* @return List of cases * @return List of cases
*/ */
List<EamCase> getCases() throws EamDbException; List<CorrelationCase> getCases() throws EamDbException;
/** /**
* Creates new Data Source in the database * Creates new Data Source in the database
@ -191,7 +191,7 @@ public interface EamDb {
* *
* @param eamDataSource the data source to update * @param eamDataSource the data source to update
*/ */
void updateDataSource(CorrelationDataSource eamDataSource) throws EamDbException; //void updateDataSource(CorrelationDataSource eamDataSource) throws EamDbException;
/** /**
* Retrieves Data Source details based on data source device ID * Retrieves Data Source details based on data source device ID
@ -312,7 +312,7 @@ public interface EamDb {
/** /**
* Executes a bulk insert of the cases * Executes a bulk insert of the cases
*/ */
void bulkInsertCases(List<EamCase> cases) throws EamDbException; void bulkInsertCases(List<CorrelationCase> cases) throws EamDbException;
/** /**
* Sets an eamArtifact instance to the given known status. If eamArtifact * Sets an eamArtifact instance to the given known status. If eamArtifact

View File

@ -271,7 +271,7 @@ public class SqliteEamDb extends AbstractSqlEamDb {
* @param case The case to add * @param case The case to add
*/ */
@Override @Override
public EamCase newCase(Case autopsyCase) throws EamDbException { public CorrelationCase newCase(Case autopsyCase) throws EamDbException {
try{ try{
acquireExclusiveLock(); acquireExclusiveLock();
return super.newCase(autopsyCase); return super.newCase(autopsyCase);
@ -288,7 +288,7 @@ public class SqliteEamDb extends AbstractSqlEamDb {
* @param eamCase The case to add * @param eamCase The case to add
*/ */
@Override @Override
public void newCase(EamCase eamCase) throws EamDbException { public void newCase(CorrelationCase eamCase) throws EamDbException {
try{ try{
acquireExclusiveLock(); acquireExclusiveLock();
super.newCase(eamCase); super.newCase(eamCase);
@ -303,7 +303,7 @@ public class SqliteEamDb extends AbstractSqlEamDb {
* @param eamCase The case to update * @param eamCase The case to update
*/ */
@Override @Override
public void updateCase(EamCase eamCase) throws EamDbException { public void updateCase(CorrelationCase eamCase) throws EamDbException {
try{ try{
acquireExclusiveLock(); acquireExclusiveLock();
super.updateCase(eamCase); super.updateCase(eamCase);
@ -320,10 +320,10 @@ public class SqliteEamDb extends AbstractSqlEamDb {
* @return The retrieved case * @return The retrieved case
*/ */
@Override @Override
public EamCase getCaseDetails(String caseUUID) throws EamDbException { public CorrelationCase getCaseByUUID(String caseUUID) throws EamDbException {
try{ try{
acquireSharedLock(); acquireSharedLock();
return super.getCaseDetails(caseUUID); return super.getCaseByUUID(caseUUID);
} finally { } finally {
releaseSharedLock(); releaseSharedLock();
} }
@ -335,7 +335,7 @@ public class SqliteEamDb extends AbstractSqlEamDb {
* @return List of cases * @return List of cases
*/ */
@Override @Override
public List<EamCase> getCases() throws EamDbException { public List<CorrelationCase> getCases() throws EamDbException {
try{ try{
acquireSharedLock(); acquireSharedLock();
return super.getCases(); return super.getCases();
@ -364,15 +364,15 @@ public class SqliteEamDb extends AbstractSqlEamDb {
* *
* @param eamDataSource the data source to update * @param eamDataSource the data source to update
*/ */
@Override // @Override
public void updateDataSource(CorrelationDataSource eamDataSource) throws EamDbException { // public void updateDataSource(CorrelationDataSource eamDataSource) throws EamDbException {
try{ // try{
acquireExclusiveLock(); // acquireExclusiveLock();
super.updateDataSource(eamDataSource); // super.updateDataSource(eamDataSource);
} finally { // } finally {
releaseExclusiveLock(); // releaseExclusiveLock();
} // }
} // }
/** /**
* Retrieves Data Source details based on data source device ID * Retrieves Data Source details based on data source device ID
@ -561,7 +561,7 @@ public class SqliteEamDb extends AbstractSqlEamDb {
* Executes a bulk insert of the cases * Executes a bulk insert of the cases
*/ */
@Override @Override
public void bulkInsertCases(List<EamCase> cases) throws EamDbException { public void bulkInsertCases(List<CorrelationCase> cases) throws EamDbException {
try{ try{
acquireExclusiveLock(); acquireExclusiveLock();
super.bulkInsertCases(cases); super.bulkInsertCases(cases);

View File

@ -34,7 +34,7 @@ import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil; import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource;
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;
@ -279,7 +279,7 @@ public class CaseEventListener implements PropertyChangeListener {
LOGGER.log(Level.SEVERE, "Error adding tag.", ex); // NON-NLS LOGGER.log(Level.SEVERE, "Error adding tag.", ex); // NON-NLS
} }
EamCase curCeCase = new EamCase( CorrelationCase curCeCase = new CorrelationCase(
-1, -1,
curCase.getName(), // unique case ID curCase.getName(), // unique case ID
EamOrganization.getDefault(), EamOrganization.getDefault(),
@ -298,7 +298,7 @@ public class CaseEventListener implements PropertyChangeListener {
try { try {
// NOTE: Cannot determine if the opened case is a new case or a reopened case, // NOTE: Cannot determine if the opened case is a new case or a reopened case,
// so check for existing name in DB and insert if missing. // so check for existing name in DB and insert if missing.
EamCase existingCase = dbManager.getCaseDetails(curCeCase.getCaseUUID()); CorrelationCase existingCase = dbManager.getCaseByUUID(curCeCase.getCaseUUID());
if (null == existingCase) { if (null == existingCase) {
dbManager.newCase(curCeCase); dbManager.newCase(curCeCase);
@ -321,7 +321,7 @@ public class CaseEventListener implements PropertyChangeListener {
String newName = (String)evt.getNewValue(); String newName = (String)evt.getNewValue();
try { try {
// See if the case is in the database. If it is, update the display name. // See if the case is in the database. If it is, update the display name.
EamCase existingCase = dbManager.getCaseDetails(Case.getCurrentCase().getName()); CorrelationCase existingCase = dbManager.getCaseByUUID(Case.getCurrentCase().getName());
if (null != existingCase) { if (null != existingCase) {
existingCase.setDisplayName(newName); existingCase.setDisplayName(newName);

View File

@ -18,7 +18,7 @@
*/ */
package org.sleuthkit.autopsy.centralrepository.ingestmodule; package org.sleuthkit.autopsy.centralrepository.ingestmodule;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamCase; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import java.util.List; import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
@ -64,7 +64,7 @@ class IngestModule implements FileIngestModule {
private static final IngestModuleReferenceCounter refCounter = new IngestModuleReferenceCounter(); private static final IngestModuleReferenceCounter refCounter = new IngestModuleReferenceCounter();
private static final IngestModuleReferenceCounter warningMsgRefCounter = new IngestModuleReferenceCounter(); private static final IngestModuleReferenceCounter warningMsgRefCounter = new IngestModuleReferenceCounter();
private long jobId; private long jobId;
private EamCase eamCase; private CorrelationCase eamCase;
private CorrelationDataSource eamDataSource; private CorrelationDataSource eamDataSource;
private Blackboard blackboard; private Blackboard blackboard;
private CorrelationAttribute.Type filesType; private CorrelationAttribute.Type filesType;
@ -216,7 +216,7 @@ class IngestModule implements FileIngestModule {
throw new IngestModuleException("Cannot run on a multi-user case with a SQLite central repository."); // NON-NLS throw new IngestModuleException("Cannot run on a multi-user case with a SQLite central repository."); // NON-NLS
} }
jobId = context.getJobId(); jobId = context.getJobId();
eamCase = new EamCase(Case.getCurrentCase().getName(), Case.getCurrentCase().getDisplayName()); eamCase = new CorrelationCase(Case.getCurrentCase().getName(), Case.getCurrentCase().getDisplayName());
try { try {
eamDataSource = CorrelationDataSource.fromTSKDataSource(context.getDataSource()); eamDataSource = CorrelationDataSource.fromTSKDataSource(context.getDataSource());
@ -256,9 +256,9 @@ class IngestModule implements FileIngestModule {
} }
// ensure we have this case defined in the EAM DB // ensure we have this case defined in the EAM DB
EamCase existingCase; CorrelationCase existingCase;
Case curCase = Case.getCurrentCase(); Case curCase = Case.getCurrentCase();
EamCase curCeCase = new EamCase( CorrelationCase curCeCase = new CorrelationCase(
-1, -1,
curCase.getName(), // unique case ID curCase.getName(), // unique case ID
EamOrganization.getDefault(), EamOrganization.getDefault(),
@ -270,7 +270,7 @@ class IngestModule implements FileIngestModule {
null, null,
null); null);
try { try {
existingCase = dbManager.getCaseDetails(curCeCase.getCaseUUID()); existingCase = dbManager.getCaseByUUID(curCeCase.getCaseUUID());
if (existingCase == null) { if (existingCase == null) {
dbManager.newCase(curCeCase); dbManager.newCase(curCeCase);
} }

View File

@ -23,13 +23,12 @@ import java.awt.event.ActionEvent;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import org.openide.DialogDisplayer; import org.openide.DialogDisplayer;
import org.openide.WizardDescriptor; import org.openide.WizardDescriptor;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.openide.util.actions.CallableSystemAction;
import org.openide.windows.WindowManager; import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.autopsy.ingest.IngestJobSettings;
import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.autopsy.ingest.IngestManager;
@ -41,7 +40,7 @@ import org.sleuthkit.datamodel.Directory;
* When the data source is pressed, it should open the wizard for ingest * When the data source is pressed, it should open the wizard for ingest
* modules. * modules.
*/ */
public final class RunIngestModulesAction extends CallableSystemAction { public final class RunIngestModulesAction extends AbstractAction {
@Messages("RunIngestModulesAction.name=Run Ingest Modules") @Messages("RunIngestModulesAction.name=Run Ingest Modules")
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -51,6 +50,21 @@ public final class RunIngestModulesAction extends CallableSystemAction {
* used instead of this wizard and is retained for backwards compatibility. * used instead of this wizard and is retained for backwards compatibility.
*/ */
private static final String EXECUTION_CONTEXT = "org.sleuthkit.autopsy.ingest.RunIngestModulesDialog"; private static final String EXECUTION_CONTEXT = "org.sleuthkit.autopsy.ingest.RunIngestModulesDialog";
/**
* Display any warnings that the ingestJobSettings have.
*
* @param ingestJobSettings
*/
private static void showWarnings(IngestJobSettings ingestJobSettings) {
List<String> warnings = ingestJobSettings.getWarnings();
if (warnings.isEmpty() == false) {
StringBuilder warningMessage = new StringBuilder(1024);
for (String warning : warnings) {
warningMessage.append(warning).append("\n");
}
JOptionPane.showMessageDialog(null, warningMessage.toString());
}
}
private final List<Content> dataSources = new ArrayList<>(); private final List<Content> dataSources = new ArrayList<>();
private final IngestJobSettings.IngestType ingestType; private final IngestJobSettings.IngestType ingestType;
@ -103,35 +117,9 @@ public final class RunIngestModulesAction extends CallableSystemAction {
} }
} }
/**
* Display any warnings that the ingestJobSettings have.
*
* @param ingestJobSettings
*/
private static void showWarnings(IngestJobSettings ingestJobSettings) {
List<String> warnings = ingestJobSettings.getWarnings();
if (warnings.isEmpty() == false) {
StringBuilder warningMessage = new StringBuilder(1024);
for (String warning : warnings) {
warningMessage.append(warning).append("\n");
}
JOptionPane.showMessageDialog(null, warningMessage.toString());
}
}
@Override @Override
public void performAction() { public Object clone() throws CloneNotSupportedException {
actionPerformed(null); throw new CloneNotSupportedException("Clone is not supported for the RunIngestModulesAction");
} }
@Override
public String getName() {
return Bundle.RunIngestModulesAction_name();
}
@Override
public HelpCtx getHelpCtx() {
return HelpCtx.DEFAULT_HELP;
}
} }