19package org.sleuthkit.autopsy.casemodule;
22import java.io.IOException;
23import java.nio.file.Path;
24import java.nio.file.Paths;
25import java.util.ArrayList;
26import java.util.Arrays;
29import java.util.logging.Level;
30import javax.swing.JPanel;
31import javax.swing.filechooser.FileFilter;
32import org.apache.commons.io.FilenameUtils;
33import org.openide.modules.InstalledFileLocator;
34import org.openide.util.NbBundle;
35import org.openide.util.NbBundle.Messages;
36import org.openide.util.lookup.ServiceProvider;
37import org.openide.util.lookup.ServiceProviders;
38import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
39import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
40import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessor;
41import org.sleuthkit.autopsy.coreutils.ExecUtil;
42import org.sleuthkit.autopsy.coreutils.Logger;
43import org.sleuthkit.autopsy.coreutils.PlatformUtil;
44import org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor;
45import org.sleuthkit.datamodel.Host;
46import org.sleuthkit.datamodel.TskCoreException;
54@ServiceProviders(value = {
59 "LocalFilesDSProcessor.logicalEvidenceFilter.desc=Logical Evidence Files (L01)"
157 run(
null, progressMonitor, callback);
179 boolean createTimestamp =
configPanel.getCreateTimestamp();
180 boolean modifiedTimestamp =
configPanel.getModifiedTimestamp();
181 boolean accessTimestamp =
configPanel.getAccessTimestamp();
188 final List<String> errors =
new ArrayList<>();
189 errors.add(ex.getMessage());
193 logger.log(Level.WARNING,
"Exception while getting open case.", ex);
198 accessTimestamp, modifiedTimestamp, progressMonitor, callback);
214 final List<String> extractedPaths =
new ArrayList<>();
217 List<String> command =
new ArrayList<>();
218 for (
final String l01Path : logicalEvidenceFilePaths) {
220 command.add(ewfexportPath.toAbsolutePath().toString());
222 command.add(
"files");
225 if (!l01Dir.exists()) {
230 command.add(dirPath.toString());
231 command.add(l01Path);
232 ProcessBuilder processBuilder =
new ProcessBuilder(command);
233 processBuilder.directory(l01Dir);
236 Path logFileName = Paths.get(l01Dir.toString(), dirPath.toString() +
LOG_FILE_EXTENSION);
237 File logFile =
new File(logFileName.toString());
238 Path errFileName = Paths.get(l01Dir.toString(), dirPath.toString() +
LOG_FILE_EXTENSION);
239 File errFile =
new File(errFileName.toString());
240 processBuilder.redirectError(ProcessBuilder.Redirect.appendTo(errFile));
241 processBuilder.redirectOutput(ProcessBuilder.Redirect.appendTo(logFile));
244 if (l01Dir.toPath().resolve(dirPath).toFile().exists()) {
245 extractedPaths.add(l01Dir.toPath().resolve(dirPath).toString());
247 throw new L01Exception(
"Can not process the selected L01 file, ewfExport was unable to extract any files from it.");
250 }
catch (SecurityException ex) {
251 throw new L01Exception(
"Security exception occcured while trying to extract l01 contents", ex);
252 }
catch (IOException ex) {
253 throw new L01Exception(
"IOException occcured while trying to extract l01 contents", ex);
256 return extractedPaths;
264 static FileFilter getLogicalEvidenceFilter() {
265 return LOGICAL_EVIDENCE_FILTER;
279 throw new L01Exception(
"L01 files are only supported on windows currently");
288 executablePath = Paths.get(
289 ewfRoot.getAbsolutePath(),
293 executablePath = Paths.get(
294 ewfRoot.getAbsolutePath(),
301 final File ewfexport = executablePath.toFile();
302 if (
null == ewfexport || !ewfexport.exists()) {
305 if (!ewfexport.canExecute()) {
309 return executablePath;
337 new Thread(
new AddLocalFilesTask(deviceId, rootVirtualDirectoryName,
localFilePaths, host,
false,
false,
false,progressMonitor, callback)).start();
367 public void run(String deviceId, String rootVirtualDirectoryName, List<String>
localFilePaths, Host host,
boolean createTimestamp,
boolean accessTimestamp,
369 new Thread(
new AddLocalFilesTask(deviceId, rootVirtualDirectoryName,
localFilePaths, host, createTimestamp, accessTimestamp, modifiedTimestamp,
370 progressMonitor, callback)).start();
397 run(deviceId, rootVirtualDirectoryName,
localFilePaths,
null, progressMonitor, callback);
430 List<String> filePaths = Arrays.asList(
new String[]{dataSourcePath.toString()});
433 if (filePaths.size() == 1) {
434 for (
final String path : filePaths) {
440 logger.log(Level.WARNING,
"File extension was .l01 but contents of logical evidence file were unable to be extracted", ex);
444 logger.log(Level.WARNING,
"Exception while getting open case.", ex);
455 process(deviceId, dataSourcePath,
null, progressMonitor, callBack);
460 List<String> filePaths = Arrays.asList(
new String[]{dataSourcePath.toString()});
461 run(deviceId,
"", filePaths, host, progressMonitor, callBack);
467 private final class L01Exception
extends Exception {
471 L01Exception(
final String message) {
475 L01Exception(
final String message,
final Throwable cause) {
476 super(message, cause);
static Case getCurrentCaseThrows()
String getModuleDirectory()
static final long serialVersionUID
void run(Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
String getDataSourceType()
static final String UNIQUENESS_CONSTRAINT_SEPERATOR
void run(String deviceId, String rootVirtualDirectoryName, List< String > localFilePaths, Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
static final String EWFEXPORT_32_BIT_DIR
void run(String deviceId, String rootVirtualDirectoryName, List< String > localFilePaths, Host host, boolean createTimestamp, boolean accessTimestamp, boolean modifiedTimestamp, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
List< String > localFilePaths
static final String DATA_SOURCE_TYPE
void process(String deviceId, Path dataSourcePath, Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
void run(String deviceId, String rootVirtualDirectoryName, List< String > localFilePaths, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack)
static final Logger logger
static final List< String > LOGICAL_EVIDENCE_EXTENSIONS
List< String > extractLogicalEvidenceFileContents(final List< String > logicalEvidenceFilePaths)
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
final LogicalFilesDspPanel configPanel
static final String EWFEXPORT_64_BIT_DIR
static final String LOGICAL_EVIDENCE_DESC
int canProcess(Path dataSourcePath)
static final GeneralFilter LOGICAL_EVIDENCE_FILTER
static final String LOG_FILE_EXTENSION
static final String EWFEXPORT_WINDOWS_EXE
static final String L01_EXTRACTION_DIR
static final String EWFEXPORT_DIR
Path locateEwfexportExecutable()
void done(DataSourceProcessorResult result, List< String > errList, List< Content > newDataSources)
static int execute(ProcessBuilder processBuilder)
synchronized static Logger getLogger(String name)