added open file systems method to case open method

This commit is contained in:
Greg DiCristofaro 2020-04-13 11:56:40 -04:00
parent 45d98486dc
commit 22bb45f80f

View File

@ -60,6 +60,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.openide.util.Exceptions;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
@ -125,6 +126,7 @@ import org.sleuthkit.datamodel.CaseDbConnectionInfo;
import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.DataSource; import org.sleuthkit.datamodel.DataSource;
import org.sleuthkit.datamodel.FileSystem;
import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.Report; import org.sleuthkit.datamodel.Report;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
@ -1979,6 +1981,8 @@ public class Case {
openAppServiceCaseResources(progressIndicator); openAppServiceCaseResources(progressIndicator);
checkForCancellation(); checkForCancellation();
openCommunicationChannels(progressIndicator); openCommunicationChannels(progressIndicator);
checkForCancellation();
openFileSystems();
return null; return null;
} catch (CaseActionException ex) { } catch (CaseActionException ex) {
@ -1997,6 +2001,51 @@ public class Case {
} }
} }
/**
* Reads a sector from each file system of each image of a case to do an eager open of the filesystems in case.
* @throws CaseActionCancelledException Exception thrown if task is cancelled.
*/
private void openFileSystems() throws CaseActionCancelledException {
String caseName = (this.caseDb != null) ? this.caseDb.getDatabaseName() : "null";
List<Image> images = null;
try {
images = this.caseDb.getImages();
} catch (TskCoreException ex) {
logger.log(
Level.SEVERE,
String.format("Could not obtain images while opening case: %s.", caseName),
ex);
return;
}
checkForCancellation();
byte[] tempBuff = new byte[512];
for (Image image : images) {
Collection<FileSystem> fileSystems = this.caseDb.getFileSystems(image);
checkForCancellation();
for (FileSystem fileSystem : fileSystems) {
try {
fileSystem.read(tempBuff, 0, 512);
}
catch (TskCoreException ex) {
String imageStr = image.getName();
String fileSysStr = fileSystem.getName();
logger.log(
Level.WARNING,
String.format("Could not open filesystem: %s in image: %s for case: %s.", fileSysStr, imageStr, caseName),
ex);
}
checkForCancellation();
}
}
}
/** /**
* A case action (interface CaseAction<T, V, R>) that opens a case, deletes * A case action (interface CaseAction<T, V, R>) that opens a case, deletes
* a data source from the case, and closes the case. * a data source from the case, and closes the case.