Merge branch 'develop' of https://github.com/markmckinnon/autopsy into develop

This commit is contained in:
Mark McKinnon 2024-03-20 21:23:30 -04:00
commit 0a24b0866a
4 changed files with 47 additions and 11 deletions

View File

@ -107,6 +107,9 @@ Case.servicesException.notificationTitle={0} Error
Case.servicesException.serviceResourcesCloseError=Could not close case resources for {0} service: {1} Case.servicesException.serviceResourcesCloseError=Could not close case resources for {0} service: {1}
Case_caseType_multiUser=Multi-user case Case_caseType_multiUser=Multi-user case
Case_caseType_singleUser=Single-user case Case_caseType_singleUser=Single-user case
Case_checkImagePaths_exceptionOccurred=An exception occurred while checking if image paths are present
# {0} - paths
Case_checkImagePaths_noPaths=The following images had no associated paths: {0}
CaseDetailsPanel.casePanel.border.title=Case CaseDetailsPanel.casePanel.border.title=Case
CaseDetailsPanel.examinerLabel.text=Name: CaseDetailsPanel.examinerLabel.text=Name:
CaseDetailsPanel.examinerPanel.border.title=Examiner CaseDetailsPanel.examinerPanel.border.title=Examiner

View File

@ -41,6 +41,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement; import java.sql.Statement;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
@ -64,6 +65,7 @@ import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.ThreadSafe; import javax.annotation.concurrent.ThreadSafe;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
@ -194,8 +196,6 @@ public class Case {
private final SleuthkitEventListener sleuthkitEventListener; private final SleuthkitEventListener sleuthkitEventListener;
private CollaborationMonitor collaborationMonitor; private CollaborationMonitor collaborationMonitor;
private Services caseServices; private Services caseServices;
// matches something like '\\.\PHYSICALDRIVE0'
private static final String PLACEHOLDER_DS_PATH_REGEX = "^\\s*\\\\\\\\\\.\\\\PHYSICALDRIVE\\d*\\s*$";
private volatile boolean hasDataSource = false; private volatile boolean hasDataSource = false;
private volatile boolean hasData = false; private volatile boolean hasData = false;
@ -1307,13 +1307,6 @@ public class Case {
String path = entry.getValue(); String path = entry.getValue();
boolean fileExists = (new File(path).exists()|| DriveUtils.driveExists(path)); boolean fileExists = (new File(path).exists()|| DriveUtils.driveExists(path));
if (!fileExists) { if (!fileExists) {
// CT-7336: ignore relocating datasources if file provider is present and placeholder path is used.
if (newCurrentCase.getMetadata() != null
&& !StringUtils.isBlank(newCurrentCase.getMetadata().getContentProviderName())
&& (path == null || path.matches(PLACEHOLDER_DS_PATH_REGEX))) {
continue;
}
try { try {
DataSource ds = newCurrentCase.getSleuthkitCase().getDataSource(obj_id); DataSource ds = newCurrentCase.getSleuthkitCase().getDataSource(obj_id);
String hostName = StringUtils.defaultString(ds.getHost() == null ? "" : ds.getHost().getName()); String hostName = StringUtils.defaultString(ds.getHost() == null ? "" : ds.getHost().getName());
@ -2293,6 +2286,8 @@ public class Case {
checkForCancellation(); checkForCancellation();
openCommunicationChannels(progressIndicator); openCommunicationChannels(progressIndicator);
checkForCancellation(); checkForCancellation();
checkImagePaths();
checkForCancellation();
openFileSystemsInBackground(); openFileSystemsInBackground();
return null; return null;
@ -2312,6 +2307,40 @@ public class Case {
} }
} }
/**
* Check if content provider is present, all images have paths, or throw an error.
* @throws CaseActionException
*/
@Messages({
"# {0} - paths",
"Case_checkImagePaths_noPaths=The following images had no associated paths: {0}",
"Case_checkImagePaths_exceptionOccurred=An exception occurred while checking if image paths are present"
})
private void checkImagePaths() throws CaseActionException {
// if there is a content provider, images don't necessarily need paths
if (StringUtils.isNotBlank(this.metadata.getContentProviderName())) {
return;
}
// identify images without paths
try {
List<Image> noPathImages = new ArrayList<>();
List<Image> images = this.caseDb.getImages();
for (Image img: images) {
if (ArrayUtils.isEmpty(img.getPaths())) {
noPathImages.add(img);
}
}
if (!noPathImages.isEmpty()) {
String imageListStr = noPathImages.stream().map(Image::getName).collect(Collectors.joining(", "));
throw new CaseActionException(Bundle.Case_checkImagePaths_noPaths(imageListStr));
}
} catch (TskCoreException ex) {
throw new CaseActionException(Bundle.Case_checkImagePaths_exceptionOccurred(), ex);
}
}
/** /**
* Starts a background task that reads a sector from each file system of * Starts a background task that reads a sector from each file system of
* each image of a case to do an eager open of the filesystems in the case. * each image of a case to do an eager open of the filesystems in the case.

View File

@ -175,7 +175,8 @@ public class AnalysisResultsViewModel {
"AnalysisResultsViewModel_displayAttributes_score=Score", "AnalysisResultsViewModel_displayAttributes_score=Score",
"AnalysisResultsViewModel_displayAttributes_type=Type", "AnalysisResultsViewModel_displayAttributes_type=Type",
"AnalysisResultsViewModel_displayAttributes_configuration=Configuration", "AnalysisResultsViewModel_displayAttributes_configuration=Configuration",
"AnalysisResultsViewModel_displayAttributes_conclusion=Conclusion" "AnalysisResultsViewModel_displayAttributes_conclusion=Conclusion",
"AnalysisResultsViewModel_displayAttributes_justification=Justification"
}) })
private ResultDisplayAttributes getDisplayAttributes(AnalysisResult analysisResult) { private ResultDisplayAttributes getDisplayAttributes(AnalysisResult analysisResult) {
// The type of BlackboardArtifact.Type of the analysis result. // The type of BlackboardArtifact.Type of the analysis result.
@ -195,7 +196,9 @@ public class AnalysisResultsViewModel {
Pair.of(Bundle.AnalysisResultsViewModel_displayAttributes_configuration(), Pair.of(Bundle.AnalysisResultsViewModel_displayAttributes_configuration(),
normalizeAttr(analysisResult.getConfiguration())), normalizeAttr(analysisResult.getConfiguration())),
Pair.of(Bundle.AnalysisResultsViewModel_displayAttributes_conclusion(), Pair.of(Bundle.AnalysisResultsViewModel_displayAttributes_conclusion(),
normalizeAttr(analysisResult.getConclusion())) normalizeAttr(analysisResult.getConclusion())),
Pair.of(Bundle.AnalysisResultsViewModel_displayAttributes_justification(),
normalizeAttr(analysisResult.getJustification()))
); );
// The BlackboardAttributes sorted by type display name. // The BlackboardAttributes sorted by type display name.

View File

@ -8,5 +8,6 @@ AnalysisResultsContentViewer_title=Analysis Results
AnalysisResultsContentViewer_tooltip=Viewer for Analysis Results related to the selected node. AnalysisResultsContentViewer_tooltip=Viewer for Analysis Results related to the selected node.
AnalysisResultsViewModel_displayAttributes_conclusion=Conclusion AnalysisResultsViewModel_displayAttributes_conclusion=Conclusion
AnalysisResultsViewModel_displayAttributes_configuration=Configuration AnalysisResultsViewModel_displayAttributes_configuration=Configuration
AnalysisResultsViewModel_displayAttributes_justification=Justification
AnalysisResultsViewModel_displayAttributes_score=Score AnalysisResultsViewModel_displayAttributes_score=Score
AnalysisResultsViewModel_displayAttributes_type=Type AnalysisResultsViewModel_displayAttributes_type=Type