Merge branch 'develop' of https://github.com/sleuthkit/autopsy into 4568-DataSourceSummary

This commit is contained in:
William Schaefer 2019-01-04 11:31:10 -05:00
commit a26d0dbf70
18 changed files with 381 additions and 311 deletions

View File

@ -85,9 +85,6 @@ final class CasePropertiesPanel extends javax.swing.JPanel {
EamDb dbManager = EamDb.getInstance(); EamDb dbManager = EamDb.getInstance();
if (dbManager != null) { if (dbManager != null) {
CorrelationCase correlationCase = dbManager.getCase(theCase); CorrelationCase correlationCase = dbManager.getCase(theCase);
if (null == correlationCase) {
correlationCase = dbManager.newCase(theCase);
}
currentOrg = correlationCase.getOrg(); currentOrg = correlationCase.getOrg();
} }
} catch (EamDbException ex) { } catch (EamDbException ex) {

View File

@ -20,6 +20,8 @@ package org.sleuthkit.autopsy.casemodule;
import java.awt.Window; import java.awt.Window;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.concurrent.CancellationException; import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -423,6 +425,22 @@ final class LocalDiskSelectionDialog extends JDialog {
if (disks.size() > 0) { if (disks.size() > 0) {
localDiskTable.setEnabled(true); localDiskTable.setEnabled(true);
localDiskTable.clearSelection(); localDiskTable.clearSelection();
// Remove the partition the application is running on.
String userConfigPath = PlatformUtil.getUserConfigDirectory();
for (Iterator<LocalDisk> iterator = disks.iterator(); iterator.hasNext();) {
LocalDisk disk = iterator.next();
String diskPath = disk.getPath();
if (diskPath.startsWith("\\\\.\\")) {
// Strip out UNC prefix to get the drive letter.
diskPath = diskPath.substring(4);
}
if (userConfigPath.startsWith(diskPath)) {
iterator.remove();
}
}
Collections.sort(disks, (LocalDisk disk1, LocalDisk disk2) -> disk1.getName().compareToIgnoreCase(disk2.getName()));
} }
fireUpdateEvent(); fireUpdateEvent();
ready = true; ready = true;

View File

@ -92,9 +92,6 @@ final class NewCaseWizardAction extends CallableSystemAction {
EamDb dbManager = EamDb.getInstance(); EamDb dbManager = EamDb.getInstance();
if (dbManager != null) { if (dbManager != null) {
CorrelationCase cRCase = dbManager.getCase(Case.getCurrentCaseThrows()); CorrelationCase cRCase = dbManager.getCase(Case.getCurrentCaseThrows());
if (cRCase == null) {
cRCase = dbManager.newCase(Case.getCurrentCaseThrows());
}
if (!organizationName.isEmpty()) { if (!organizationName.isEmpty()) {
for (EamOrganization org : dbManager.getOrganizations()) { for (EamOrganization org : dbManager.getOrganizations()) {
if (org.getName().equals(organizationName)) { if (org.getName().equals(organizationName)) {

View File

@ -1675,9 +1675,6 @@ 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.
CorrelationCase correlationCaseWithId = getCaseByUUID(eamArtifact.getCorrelationCase().getCaseUUID()); CorrelationCase correlationCaseWithId = getCaseByUUID(eamArtifact.getCorrelationCase().getCaseUUID());
if (null == correlationCaseWithId) {
correlationCaseWithId = newCase(eamArtifact.getCorrelationCase());
}
if (null == getDataSource(correlationCaseWithId, eamArtifact.getCorrelationDataSource().getDataSourceObjectID())) { if (null == getDataSource(correlationCaseWithId, eamArtifact.getCorrelationDataSource().getDataSourceObjectID())) {
newDataSource(eamArtifact.getCorrelationDataSource()); newDataSource(eamArtifact.getCorrelationDataSource());
} }

View File

@ -200,9 +200,6 @@ public class EamArtifactUtil {
// make an instance for the BB source file // make an instance for the BB source file
CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows()); CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows());
if (null == correlationCase) {
correlationCase = EamDb.getInstance().newCase(Case.getCurrentCaseThrows());
}
return new CorrelationAttributeInstance( return new CorrelationAttributeInstance(
correlationType, correlationType,
value, value,
@ -322,9 +319,6 @@ public class EamArtifactUtil {
CorrelationAttributeInstance.Type filesType = EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID); CorrelationAttributeInstance.Type filesType = EamDb.getInstance().getCorrelationTypeById(CorrelationAttributeInstance.FILES_TYPE_ID);
CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows()); CorrelationCase correlationCase = EamDb.getInstance().getCase(Case.getCurrentCaseThrows());
if (null == correlationCase) {
correlationCase = EamDb.getInstance().newCase(Case.getCurrentCaseThrows());
}
return new CorrelationAttributeInstance( return new CorrelationAttributeInstance(
filesType, filesType,
af.getMd5Hash(), af.getMd5Hash(),

View File

@ -444,9 +444,6 @@ final class CaseEventListener implements PropertyChangeListener {
try { try {
CorrelationCase correlationCase = dbManager.getCase(openCase); CorrelationCase correlationCase = dbManager.getCase(openCase);
if (null == correlationCase) {
correlationCase = dbManager.newCase(openCase);
}
if (null == dbManager.getDataSource(correlationCase, newDataSource.getId())) { if (null == dbManager.getDataSource(correlationCase, newDataSource.getId())) {
CorrelationDataSource.fromTSKDataSource(correlationCase, newDataSource); CorrelationDataSource.fromTSKDataSource(correlationCase, newDataSource);
} }

View File

@ -297,15 +297,6 @@ final class CentralRepoIngestModule implements FileIngestModule {
} catch (EamDbException ex) { } catch (EamDbException ex) {
throw new IngestModuleException("Unable to get case from central repository database ", ex); throw new IngestModuleException("Unable to get case from central repository database ", ex);
} }
if (eamCase == null) {
// ensure we have this case defined in the EAM DB
try {
eamCase = centralRepoDb.newCase(autopsyCase);
} catch (EamDbException ex) {
logger.log(Level.SEVERE, "Error creating new case in ingest module start up.", ex); // NON-NLS
throw new IngestModuleException("Error creating new case in ingest module start up.", ex); // NON-NLS
}
}
try { try {
eamDataSource = CorrelationDataSource.fromTSKDataSource(eamCase, context.getDataSource()); eamDataSource = CorrelationDataSource.fromTSKDataSource(eamCase, context.getDataSource());

View File

@ -24,6 +24,7 @@ import java.util.concurrent.CancellationException;
import java.util.logging.Level; import java.util.logging.Level;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Point; import java.awt.Point;
import java.util.Collections;
import javax.swing.SwingWorker; import javax.swing.SwingWorker;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
@ -388,10 +389,14 @@ class SelectDriveDialog extends javax.swing.JDialog {
loadingDisks = false; loadingDisks = false;
disks = new ArrayList<>(); disks = new ArrayList<>();
disks.addAll(partitions); disks.addAll(partitions);
if (disks.size() > 0) { if (disks.size() > 0) {
diskTable.setEnabled(true); diskTable.setEnabled(true);
diskTable.clearSelection(); diskTable.clearSelection();
Collections.sort(disks, (LocalDisk disk1, LocalDisk disk2) -> disk1.getName().compareToIgnoreCase(disk2.getName()));
} }
ready = true; ready = true;
} }
} }

View File

@ -193,11 +193,6 @@ ReportHTML.writeSum.warningMsg=<span>Warning, this report was run before ingest
# examiner as a regex signature to skip report.html and summary.html # examiner as a regex signature to skip report.html and summary.html
# #
ReportHTML.writeSum.reportGenOn.text=HTML Report Generated on {0} ReportHTML.writeSum.reportGenOn.text=HTML Report Generated on {0}
ReportHTML.writeSum.caseName=Case\:
ReportHTML.writeSum.caseNum=Case Number\:
ReportHTML.writeSum.examiner=Examiner\:
ReportHTML.writeSum.noExaminer=<i>No examiner</i>
ReportHTML.writeSum.numImages=Number of Images\:
ReportHTML.writeSum.imageInfoHeading=<h2>Image Information\:</h2> ReportHTML.writeSum.imageInfoHeading=<h2>Image Information\:</h2>
ReportHTML.writeSum.softwareInfoHeading=<h2>Software Information\:</h2> ReportHTML.writeSum.softwareInfoHeading=<h2>Software Information\:</h2>
ReportHTML.writeSum.ingestHistoryHeading=<h2>Ingest History\:</h2> ReportHTML.writeSum.ingestHistoryHeading=<h2>Ingest History\:</h2>
@ -225,7 +220,6 @@ ReportWizardPanel1.nextButton.text=Next >
ReportWizardPanel1.finishButton.text=Finish ReportWizardPanel1.finishButton.text=Finish
ReportWizardPanel2.finishButton.text=Finish ReportWizardPanel2.finishButton.text=Finish
ReportWizardPanel2.nextButton.text=Next > ReportWizardPanel2.nextButton.text=Next >
ReportHTML.writeSum.noCaseNum=<i>No case number</i>
ReportBodyFile.generateReport.srcModuleName.text=TSK Body File ReportBodyFile.generateReport.srcModuleName.text=TSK Body File
ReportExcel.endReport.srcModuleName.text=Excel Report ReportExcel.endReport.srcModuleName.text=Excel Report
ReportHTML.writeIndex.srcModuleName.text=HTML Report ReportHTML.writeIndex.srcModuleName.text=HTML Report

View File

@ -26,6 +26,7 @@ import java.util.logging.Level;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -302,6 +303,15 @@ class ReportExcel implements TableReportModule {
return text.replaceAll("[\\/\\:\\?\\*\\\\]", "_"); return text.replaceAll("[\\/\\:\\?\\*\\\\]", "_");
} }
@Messages({
"ReportExcel.writeSummary.sheetName=Summary",
"ReportExcel.writeSummary.summary=Summary",
"ReportExcel.writeSummary.caseName=Case Name:",
"ReportExcel.writeSummary.numImages=Number of Images:",
"ReportExcel.writeSummary.caseNum=Case Number:",
"ReportExcel.writeSummary.caseNotes=Case Notes:",
"ReportExcel.writeSummary.examiner=Examiner:"
})
private void writeSummaryWorksheet() { private void writeSummaryWorksheet() {
Case currentCase; Case currentCase;
try { try {
@ -310,12 +320,12 @@ class ReportExcel implements TableReportModule {
logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS
return; return;
} }
sheet = wb.createSheet(NbBundle.getMessage(this.getClass(), "ReportExcel.sheetName.text")); sheet = wb.createSheet(Bundle.ReportExcel_writeSummary_sheetName());
rowIndex = 0; rowIndex = 0;
Row row = sheet.createRow(rowIndex); Row row = sheet.createRow(rowIndex);
row.setRowStyle(setStyle); row.setRowStyle(setStyle);
row.createCell(0).setCellValue(NbBundle.getMessage(this.getClass(), "ReportExcel.cellVal.summary")); row.createCell(0).setCellValue(Bundle.ReportExcel_writeSummary_summary());
++rowIndex; ++rowIndex;
sheet.createRow(rowIndex); sheet.createRow(rowIndex);
@ -323,25 +333,21 @@ class ReportExcel implements TableReportModule {
row = sheet.createRow(rowIndex); row = sheet.createRow(rowIndex);
row.setRowStyle(setStyle); row.setRowStyle(setStyle);
row.createCell(0).setCellValue(NbBundle.getMessage(this.getClass(), "ReportExcel.cellVal.caseName")); row.createCell(0).setCellValue(Bundle.ReportExcel_writeSummary_caseName());
row.createCell(1).setCellValue(currentCase.getDisplayName()); row.createCell(1).setCellValue(currentCase.getDisplayName());
++rowIndex; ++rowIndex;
row = sheet.createRow(rowIndex); if (!currentCase.getNumber().isEmpty()) {
row.setRowStyle(setStyle); row = sheet.createRow(rowIndex);
row.createCell(0).setCellValue(NbBundle.getMessage(this.getClass(), "ReportExcel.cellVal.caseNum")); row.setRowStyle(setStyle);
row.createCell(1).setCellValue(currentCase.getNumber()); row.createCell(0).setCellValue(Bundle.ReportExcel_writeSummary_caseNum());
++rowIndex; row.createCell(1).setCellValue(currentCase.getNumber());
++rowIndex;
}
row = sheet.createRow(rowIndex); row = sheet.createRow(rowIndex);
row.setRowStyle(setStyle); row.setRowStyle(setStyle);
row.createCell(0).setCellValue(NbBundle.getMessage(this.getClass(), "ReportExcel.cellVal.examiner")); row.createCell(0).setCellValue(Bundle.ReportExcel_writeSummary_numImages());
row.createCell(1).setCellValue(currentCase.getExaminer());
++rowIndex;
row = sheet.createRow(rowIndex);
row.setRowStyle(setStyle);
row.createCell(0).setCellValue(NbBundle.getMessage(this.getClass(), "ReportExcel.cellVal.numImages"));
int numImages; int numImages;
try { try {
numImages = currentCase.getDataSources().size(); numImages = currentCase.getDataSources().size();
@ -351,6 +357,22 @@ class ReportExcel implements TableReportModule {
row.createCell(1).setCellValue(numImages); row.createCell(1).setCellValue(numImages);
++rowIndex; ++rowIndex;
if (!currentCase.getCaseNotes().isEmpty()) {
row = sheet.createRow(rowIndex);
row.setRowStyle(setStyle);
row.createCell(0).setCellValue(Bundle.ReportExcel_writeSummary_caseNotes());
row.createCell(1).setCellValue(currentCase.getCaseNotes());
++rowIndex;
}
if (!currentCase.getExaminer().isEmpty()) {
row = sheet.createRow(rowIndex);
row.setRowStyle(setStyle);
row.createCell(0).setCellValue(Bundle.ReportExcel_writeSummary_examiner());
row.createCell(1).setCellValue(currentCase.getExaminer());
++rowIndex;
}
sheet.autoSizeColumn(0); sheet.autoSizeColumn(0);
sheet.autoSizeColumn(1); sheet.autoSizeColumn(1);
} }

View File

@ -51,10 +51,15 @@ import javax.swing.JPanel;
import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringEscapeUtils;
import org.openide.filesystems.FileUtil; import org.openide.filesystems.FileUtil;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.casemodule.services.Services; import org.sleuthkit.autopsy.casemodule.services.Services;
import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
import org.sleuthkit.autopsy.coreutils.EscapeUtil; import org.sleuthkit.autopsy.coreutils.EscapeUtil;
import org.sleuthkit.autopsy.coreutils.ImageUtils; import org.sleuthkit.autopsy.coreutils.ImageUtils;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -1226,6 +1231,13 @@ class ReportHTML implements TableReportModule {
} }
} }
@Messages({
"ReportHTML.writeSum.case=Case:",
"ReportHTML.writeSum.caseNumber=Case Number:",
"ReportHTML.writeSum.caseNumImages=Number of Images:",
"ReportHTML.writeSum.caseNotes=Notes:",
"ReportHTML.writeSum.examiner=Examiner:"
})
/** /**
* Write the case details section of the summary for this report. * Write the case details section of the summary for this report.
* *
@ -1233,16 +1245,24 @@ class ReportHTML implements TableReportModule {
*/ */
private StringBuilder writeSummaryCaseDetails() { private StringBuilder writeSummaryCaseDetails() {
StringBuilder summary = new StringBuilder(); StringBuilder summary = new StringBuilder();
final boolean agencyLogoSet = reportBranding.getAgencyLogoPath() != null && !reportBranding.getAgencyLogoPath().isEmpty();
// Case
String caseName = currentCase.getDisplayName(); String caseName = currentCase.getDisplayName();
String caseNumber = currentCase.getNumber(); String caseNumber = currentCase.getNumber();
String examiner = currentCase.getExaminer();
final boolean agencyLogoSet = reportBranding.getAgencyLogoPath() != null && !reportBranding.getAgencyLogoPath().isEmpty();
int imagecount; int imagecount;
try { try {
imagecount = currentCase.getDataSources().size(); imagecount = currentCase.getDataSources().size();
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
imagecount = 0; imagecount = 0;
} }
String caseNotes = currentCase.getCaseNotes();
// Examiner
String examinerName = currentCase.getExaminer();
// Start the layout.
summary.append("<div class=\"title\">\n"); //NON-NLS summary.append("<div class=\"title\">\n"); //NON-NLS
if (agencyLogoSet) { if (agencyLogoSet) {
summary.append("<div class=\"left\">\n"); //NON-NLS summary.append("<div class=\"left\">\n"); //NON-NLS
@ -1254,17 +1274,31 @@ class ReportHTML implements TableReportModule {
final String align = agencyLogoSet ? "right" : "left"; //NON-NLS NON-NLS final String align = agencyLogoSet ? "right" : "left"; //NON-NLS NON-NLS
summary.append("<div class=\"").append(align).append("\">\n"); //NON-NLS summary.append("<div class=\"").append(align).append("\">\n"); //NON-NLS
summary.append("<table>\n"); //NON-NLS summary.append("<table>\n"); //NON-NLS
summary.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "ReportHTML.writeSum.caseName")) //NON-NLS
.append("</td><td>").append(caseName).append("</td></tr>\n"); //NON-NLS NON-NLS // Case details
summary.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "ReportHTML.writeSum.caseNum")) //NON-NLS summary.append("<tr><td>").append(Bundle.ReportHTML_writeSum_case()).append("</td><td>") //NON-NLS
.append("</td><td>").append(!caseNumber.isEmpty() ? caseNumber : NbBundle //NON-NLS .append(formatHtmlString(caseName)).append("</td></tr>\n"); //NON-NLS
.getMessage(this.getClass(), "ReportHTML.writeSum.noCaseNum")).append("</td></tr>\n"); //NON-NLS
summary.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "ReportHTML.writeSum.examiner")).append("</td><td>") //NON-NLS if (!caseNumber.isEmpty()) {
.append(!examiner.isEmpty() ? examiner : NbBundle summary.append("<tr><td>").append(Bundle.ReportHTML_writeSum_caseNumber()).append("</td><td>") //NON-NLS
.getMessage(this.getClass(), "ReportHTML.writeSum.noExaminer")) .append(formatHtmlString(caseNumber)).append("</td></tr>\n"); //NON-NLS
.append("</td></tr>\n"); //NON-NLS }
summary.append("<tr><td>").append(NbBundle.getMessage(this.getClass(), "ReportHTML.writeSum.numImages")) //NON-NLS
.append("</td><td>").append(imagecount).append("</td></tr>\n"); //NON-NLS summary.append("<tr><td>").append(Bundle.ReportHTML_writeSum_caseNumImages()).append("</td><td>") //NON-NLS
.append(imagecount).append("</td></tr>\n"); //NON-NLS
if (!caseNotes.isEmpty()) {
summary.append("<tr><td>").append(Bundle.ReportHTML_writeSum_caseNotes()).append("</td><td>") //NON-NLS
.append(formatHtmlString(caseNotes)).append("</td></tr>\n"); //NON-NLS
}
// Examiner details
if (!examinerName.isEmpty()) {
summary.append("<tr><td>").append(Bundle.ReportHTML_writeSum_examiner()).append("</td><td>") //NON-NLS
.append(formatHtmlString(examinerName)).append("</td></tr>\n"); //NON-NLS
}
// End the layout.
summary.append("</table>\n"); //NON-NLS summary.append("</table>\n"); //NON-NLS
summary.append("</div>\n"); //NON-NLS summary.append("</div>\n"); //NON-NLS
summary.append("<div class=\"clear\"></div>\n"); //NON-NLS summary.append("<div class=\"clear\"></div>\n"); //NON-NLS
@ -1414,4 +1448,17 @@ class ReportHTML implements TableReportModule {
+ thumbFile.getName(); + thumbFile.getName();
} }
/**
* Apply escape sequence to special characters. Line feed and carriage
* return character combinations will be converted to HTML line breaks.
*
* @param text The text to format.
*
* @return The formatted text.
*/
private String formatHtmlString(String text) {
String formattedString = StringEscapeUtils.escapeHtml4(text);
return formattedString.replaceAll("(\r\n|\r|\n|\n\r)", "<br>");
}
} }

View File

@ -1,241 +1,251 @@
///* /*
// * *
// * Autopsy Forensic Browser * Autopsy Forensic Browser
// * *
// * Copyright 2018 Basis Technology Corp. * Copyright 2018 Basis Technology Corp.
// * Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
// * *
// * Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at * You may obtain a copy of the License at
// * *
// * http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
// * *
// * Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
// * limitations under the License. * limitations under the License.
// */ */
//package org.sleuthkit.autopsy.commonfilessearch; package org.sleuthkit.autopsy.commonfilessearch;
//
//import java.nio.file.Path; import java.nio.file.Path;
//import java.sql.SQLException; import java.sql.SQLException;
//import junit.framework.Test; import java.util.Set;
//import org.netbeans.junit.NbModuleSuite; import junit.framework.Test;
//import org.netbeans.junit.NbTestCase; import org.netbeans.junit.NbModuleSuite;
//import org.openide.util.Exceptions; import org.netbeans.junit.NbTestCase;
//import junit.framework.Assert; import org.openide.util.Exceptions;
//import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import junit.framework.Assert;
//import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
//import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException; import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
//import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
//import org.sleuthkit.autopsy.commonfilesearch.AllInterCaseCommonAttributeSearcher; import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeSearcher;
//import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeCountSearchResults; import org.sleuthkit.autopsy.commonfilesearch.AllInterCaseCommonAttributeSearcher;
//import org.sleuthkit.autopsy.commonfilesearch.SingleInterCaseCommonAttributeSearcher; import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeCountSearchResults;
//import static org.sleuthkit.autopsy.commonfilessearch.InterCaseTestUtils.*; import org.sleuthkit.autopsy.commonfilesearch.SingleInterCaseCommonAttributeSearcher;
//import org.sleuthkit.datamodel.TskCoreException; import static org.sleuthkit.autopsy.commonfilessearch.InterCaseTestUtils.*;
// import org.sleuthkit.datamodel.TskCoreException;
///**
// * Tests with case 3 as the current case. /**
// * * Tests with case 3 as the current case.
// * If I use the search all cases option: One node for Hash A (1_1_A.jpg, *
// * 1_2_A.jpg, 3_1_A.jpg) If I search for matches only in Case 1: One node for * If I use the search all cases option: One node for Hash A (1_1_A.jpg,
// * Hash A (1_1_A.jpg, 1_2_A.jpg, 3_1_A.jpg) If I search for matches only in Case * 1_2_A.jpg, 3_1_A.jpg) If I search for matches only in Case 1: One node for
// * 2: No matches If I only search in the current case (existing mode), allowing * Hash A (1_1_A.jpg, 1_2_A.jpg, 3_1_A.jpg) If I search for matches only in Case
// * all data sources: One node for Hash C (3_1_C.jpg, 3_2_C.jpg) * 2: No matches If I only search in the current case (existing mode), allowing
// * * all data sources: One node for Hash C (3_1_C.jpg, 3_2_C.jpg)
// */ *
//public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase { */
// public class IngestedWithHashAndFileTypeInterCaseTests extends NbTestCase {
// private final InterCaseTestUtils utils;
// private final InterCaseTestUtils utils;
// public static Test suite() {
// NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileTypeInterCaseTests.class). public static Test suite() {
// clusters(".*"). NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(IngestedWithHashAndFileTypeInterCaseTests.class).
// enableModules(".*"); clusters(".*").
// return conf.suite(); enableModules(".*");
// } return conf.suite();
// }
// public IngestedWithHashAndFileTypeInterCaseTests(String name) {
// super(name); public IngestedWithHashAndFileTypeInterCaseTests(String name) {
// this.utils = new InterCaseTestUtils(this); super(name);
// } this.utils = new InterCaseTestUtils(this);
// }
// @Override
// public void setUp() { @Override
// this.utils.clearTestDir(); public void setUp() {
// try { this.utils.clearTestDir();
// this.utils.enableCentralRepo(); try {
// this.utils.enableCentralRepo();
// String[] cases = new String[]{
// CASE1, String[] cases = new String[]{
// CASE2, CASE1,
// CASE3}; CASE2,
// CASE3};
// Path[][] paths = {
// {this.utils.case1DataSet1Path, this.utils.case1DataSet2Path}, Path[][] paths = {
// {this.utils.case2DataSet1Path, this.utils.case2DataSet2Path}, {this.utils.case1DataSet1Path, this.utils.case1DataSet2Path},
// {this.utils.case3DataSet1Path, this.utils.case3DataSet2Path}}; {this.utils.case2DataSet1Path, this.utils.case2DataSet2Path},
// {this.utils.case3DataSet1Path, this.utils.case3DataSet2Path}};
// this.utils.createCases(cases, paths, this.utils.getIngestSettingsForHashAndFileType(), InterCaseTestUtils.CASE3);
// } catch (TskCoreException | EamDbException ex) { this.utils.createCases(cases, paths, this.utils.getIngestSettingsForHashAndFileType(), InterCaseTestUtils.CASE3);
// Exceptions.printStackTrace(ex); } catch (TskCoreException | EamDbException ex) {
// Assert.fail(ex.getMessage()); Exceptions.printStackTrace(ex);
// } Assert.fail(ex.getMessage());
// } }
// }
// @Override
// public void tearDown() { @Override
// this.utils.clearTestDir(); public void tearDown() {
// this.utils.tearDown(); this.utils.clearTestDir();
// } this.utils.tearDown();
// }
// /**
// * Search All cases with no file type filtering. /**
// */ * Search All cases with no file type filtering.
// public void testOne() { */
// try { public void testOne() {
// AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(false, false, this.utils.FILE_TYPE, 0); try {
// CommonAttributeCountSearchResults metadata = builder.findMatchesByCount(); AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(false, false, this.utils.FILE_TYPE, 0);
// CommonAttributeCountSearchResults metadata = builder.findMatchesByCount();
// assertTrue("Results should not be empty", metadata.size() != 0);
// assertTrue("Results should not be empty", metadata.size() != 0);
// //case 1 data set 1
// assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1)); //case 1 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_1, CASE1", 1, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1)); assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_1, CASE1", 1, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1)); assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_1, CASE1", 1, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_1, CASE1", 1, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1));
// //case 1 data set 2
// assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1)); //case 1 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_2, CASE1", 1, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1)); assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_2, CASE1", 1, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1)); assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_2, CASE1", 1, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_2, CASE1", 1, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1));
// //case 2 data set 1
// assertEquals("Verify Existence or Count failed for HASH_B_PDF, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2)); //case 2 data set 1
// assertEquals("Verify Existence or Count failed for HASH_B_JPG, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2)); assertEquals("Verify Existence or Count failed for HASH_B_PDF, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_B_JPG, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2));
// //case 2 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2)); //case 2 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2)); assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2)); assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2));
// //case 3 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE3_DATASET_1, CASE3", 1, getInstanceCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3)); //case 3 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE3_DATASET_1, CASE3", 1, getInstanceCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3)); assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE3_DATASET_1, CASE3", 1, getInstanceCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3)); assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE3_DATASET_1, CASE3", 1, getInstanceCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3)); assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_D_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3)); assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_D_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3));
// //case 3 data set 2
// assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3)); //case 3 data set 2
// assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3)); assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE3_DATASET_2, CASE3", 1, getInstanceCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3)); assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE3_DATASET_2, CASE3", 1, getInstanceCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3));
// } catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) {
// Exceptions.printStackTrace(ex); } catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) {
// Assert.fail(ex.getMessage()); Exceptions.printStackTrace(ex);
// } Assert.fail(ex.getMessage());
// } }
// }
// /**
// * Search All cases with no file type filtering. /**
// */ * Search All cases with no file type filtering.
// public void testTwo() { */
// try { public void testTwo() {
// int matchesMustAlsoBeFoundInThisCase = this.utils.getCaseMap().get(CASE2); try {
// CorrelationAttributeInstance.Type fileType = CorrelationAttributeInstance.getDefaultCorrelationTypes().get(0); int matchesMustAlsoBeFoundInThisCase = 0;
// AbstractCommonAttributeSearcher builder = new SingleInterCaseCommonAttributeSearcher(matchesMustAlsoBeFoundInThisCase, false, false, fileType, 0);
// // Filter out the time stamp to get the correct case name.
// CommonAttributeCountSearchResults metadata = builder.findMatchesByCount(); Set<String> caseNames = this.utils.getCaseMap().keySet();
// for (String caseName : caseNames) {
// assertTrue("Results should not be empty", metadata.size() != 0); if (caseName.substring(0, caseName.length() - 20).equalsIgnoreCase(CASE2)) {
// // Case match found. Get the number of matches.
// //case 1 data set 1 matchesMustAlsoBeFoundInThisCase = this.utils.getCaseMap().get(caseName);
// assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1)); }
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_1, CASE1", 1, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1)); }
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_1, CASE1", 1, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1)); CorrelationAttributeInstance.Type fileType = CorrelationAttributeInstance.getDefaultCorrelationTypes().get(0);
// AbstractCommonAttributeSearcher builder = new SingleInterCaseCommonAttributeSearcher(matchesMustAlsoBeFoundInThisCase, false, false, fileType, 0);
// //case 1 data set 2
// assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1)); CommonAttributeCountSearchResults metadata = builder.findMatchesByCount();
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_2, CASE1", 1, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_2, CASE1", 1, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1)); assertTrue("Results should not be empty", metadata.size() != 0);
//
// //case 2 data set 1 //case 1 data set 1
// assertEquals("Verify Existence or Count failed for HASH_B_PDF, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2)); assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_B_JPG, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2)); assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_1, CASE1", 1, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_1, CASE1", 1, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1));
// //case 2 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2)); //case 1 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2)); assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2)); assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_2, CASE1", 1, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_2, CASE1", 1, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1));
// //case 3 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE3_DATASET_1, CASE3", 1, getInstanceCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3)); //case 2 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE3_DATASET_1, CASE3", 1, getInstanceCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3)); assertEquals("Verify Existence or Count failed for HASH_B_PDF, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3)); assertEquals("Verify Existence or Count failed for HASH_B_JPG, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_D_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3)); //case 2 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2));
// //case 3 data set 2 assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3)); assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE3_DATASET_2, CASE3", 1, getInstanceCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3)); //case 3 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE3_DATASET_1, CASE3", 1, getInstanceCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3));
// } catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) { assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE3_DATASET_1, CASE3", 1, getInstanceCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3));
// Exceptions.printStackTrace(ex); assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3));
// Assert.fail(ex.getMessage()); assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3));
// } assertEquals("Verify Existence or Count failed for HASH_D_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3));
// }
// //case 3 data set 2
// /** assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3));
// * We should be able to observe that certain files are no longer returned in assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3));
// * the result set since they exist too frequently assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE3_DATASET_2, CASE3", 1, getInstanceCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3));
// */
// public void testThree() { } catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) {
// try { Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// CorrelationAttributeInstance.Type fileType = CorrelationAttributeInstance.getDefaultCorrelationTypes().get(0); }
// AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(false, false, fileType, 50); }
//
// CommonAttributeCountSearchResults metadata = builder.findMatchesByCount(); /**
// metadata.filterMetadata(); * We should be able to observe that certain files are no longer returned in
// assertTrue("Results should not be empty", metadata.size() != 0); * the result set since they exist too frequently
// */
// //case 1 data set 1 public void testThree() {
// assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1)); try {
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1)); CorrelationAttributeInstance.Type fileType = CorrelationAttributeInstance.getDefaultCorrelationTypes().get(0);
// AbstractCommonAttributeSearcher builder = new AllInterCaseCommonAttributeSearcher(false, false, fileType, 50);
// //case 1 data set 2
// assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1)); CommonAttributeCountSearchResults metadata = builder.findMatchesByCount();
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1)); metadata.filterMetadata();
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1)); assertTrue("Results should not be empty", metadata.size() != 0);
//
// //case 2 data set 1 //case 1 data set 1
// assertEquals("Verify Existence or Count failed for HASH_B_PDF, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2)); assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_1, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_B_JPG, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2)); assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_1, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_1, CASE1", 0, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_1, CASE1));
// //case 2 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE2_DATASET_2, CASE2", 0, getInstanceCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2)); //case 1 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE2_DATASET_2, CASE2", 0, getInstanceCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2)); assertEquals("Verify Existence or Count failed for HASH_0_DAT, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_0_DAT, CASE1_DATASET_2, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2)); assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_A_PDF, CASE1_DATASET_2, CASE1));
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE1_DATASET_2, CASE1", 0, getInstanceCount(metadata, HASH_A_JPG, CASE1_DATASET_2, CASE1));
// //case 3 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3)); //case 2 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3)); assertEquals("Verify Existence or Count failed for HASH_B_PDF, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_PDF, CASE2_DATASET_1, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3)); assertEquals("Verify Existence or Count failed for HASH_B_JPG, CASE2_DATASET_1, CASE2", 0, getInstanceCount(metadata, HASH_B_JPG, CASE2_DATASET_1, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_D_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3)); //case 2 data set 2
// assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE2_DATASET_2, CASE2", 0, getInstanceCount(metadata, HASH_A_PDF, CASE2_DATASET_2, CASE2));
// //case 3 data set 2 assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE2_DATASET_2, CASE2", 0, getInstanceCount(metadata, HASH_A_JPG, CASE2_DATASET_2, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3)); assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE2_DATASET_2, CASE2", 1, getInstanceCount(metadata, HASH_D_DOC, CASE2_DATASET_2, CASE2));
// assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3));
// assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE3_DATASET_2, CASE3", 1, getInstanceCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3)); //case 3 data set 1
// assertEquals("Verify Existence or Count failed for HASH_A_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_A_JPG, CASE3_DATASET_1, CASE3));
// } catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) { assertEquals("Verify Existence or Count failed for HASH_A_PDF, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_A_PDF, CASE3_DATASET_1, CASE3));
// Exceptions.printStackTrace(ex); assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_1, CASE3));
// Assert.fail(ex.getMessage()); assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_1, CASE3));
// } assertEquals("Verify Existence or Count failed for HASH_D_JPG, CASE3_DATASET_1, CASE3", 0, getInstanceCount(metadata, HASH_D_JPG, CASE3_DATASET_1, CASE3));
// }
//} //case 3 data set 2
assertEquals("Verify Existence or Count failed for HASH_C_JPG, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_JPG, CASE3_DATASET_2, CASE3));
assertEquals("Verify Existence or Count failed for HASH_C_PDF, CASE3_DATASET_2, CASE3", 0, getInstanceCount(metadata, HASH_C_PDF, CASE3_DATASET_2, CASE3));
assertEquals("Verify Existence or Count failed for HASH_D_DOC, CASE3_DATASET_2, CASE3", 1, getInstanceCount(metadata, HASH_D_DOC, CASE3_DATASET_2, CASE3));
} catch (TskCoreException | NoCurrentCaseException | SQLException | EamDbException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
}
}

View File

@ -59,6 +59,7 @@ import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeCountSearchResults;
import org.sleuthkit.autopsy.datamodel.utils.DataSourceLoader; import org.sleuthkit.autopsy.datamodel.utils.DataSourceLoader;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValue; import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValue;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValueList; import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValueList;
import org.sleuthkit.autopsy.coreutils.TimeStampUtils;
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode; import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
import org.sleuthkit.autopsy.modules.dataSourceIntegrity.DataSourceIntegrityModuleFactory; import org.sleuthkit.autopsy.modules.dataSourceIntegrity.DataSourceIntegrityModuleFactory;
import org.sleuthkit.autopsy.modules.embeddedfileextractor.EmbeddedFileExtractorModuleFactory; import org.sleuthkit.autopsy.modules.embeddedfileextractor.EmbeddedFileExtractorModuleFactory;
@ -426,7 +427,7 @@ class InterCaseTestUtils {
boolean sameFileName = testFileName.equalsIgnoreCase(fileName); boolean sameFileName = testFileName.equalsIgnoreCase(fileName);
boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource); boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);
boolean sameCrCase = testCaseName.equalsIgnoreCase(crCase); boolean sameCrCase = TimeStampUtils.removeTimeStamp(testCaseName).equalsIgnoreCase(crCase);
if (sameFileName && sameDataSource && sameCrCase) { if (sameFileName && sameDataSource && sameCrCase) {
tally++; tally++;
@ -443,7 +444,7 @@ class InterCaseTestUtils {
final String testDataSource = node.getDataSource(); final String testDataSource = node.getDataSource();
boolean sameFileName = testFileName.equalsIgnoreCase(fileName); boolean sameFileName = testFileName.equalsIgnoreCase(fileName);
boolean sameCaseName = testCaseName.equalsIgnoreCase(crCase); boolean sameCaseName = TimeStampUtils.removeTimeStamp(testCaseName).equalsIgnoreCase(crCase);
boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource); boolean sameDataSource = testDataSource.equalsIgnoreCase(dataSource);
if (sameFileName && sameDataSource && sameCaseName) { if (sameFileName && sameDataSource && sameCaseName) {