From ce9bd67bfc11247c11b07ba6987d62cf2658f157 Mon Sep 17 00:00:00 2001 From: Joe Ho Date: Mon, 23 Sep 2019 11:43:48 -0400 Subject: [PATCH] Add *_users.txt to report --- .../dsp/AddLogicalImageTask.java | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/logicalimager/dsp/AddLogicalImageTask.java b/Core/src/org/sleuthkit/autopsy/logicalimager/dsp/AddLogicalImageTask.java index f5d728b633..94ecce0d96 100644 --- a/Core/src/org/sleuthkit/autopsy/logicalimager/dsp/AddLogicalImageTask.java +++ b/Core/src/org/sleuthkit/autopsy/logicalimager/dsp/AddLogicalImageTask.java @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.logicalimager.dsp; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; +import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStreamReader; import java.nio.file.Files; @@ -53,14 +54,14 @@ import org.sleuthkit.datamodel.TskCoreException; /** * A runnable that - copy the logical image folder to a destination folder - add - * SearchResults.txt and users.txt files to report - add an image data source to the + * SearchResults.txt and *_users.txt files to report - add an image data source to the * case database. */ final class AddLogicalImageTask implements Runnable { private final static Logger LOGGER = Logger.getLogger(AddLogicalImageTask.class.getName()); private final static String SEARCH_RESULTS_TXT = "SearchResults.txt"; //NON-NLS - private final static String USERS_TXT = "users.txt"; //NON-NLS + private final static String USERS_TXT = "_users.txt"; //NON-NLS private final static String MODULE_NAME = "Logical Imager"; //NON-NLS private final static String ROOT_STR = "root"; // NON-NLS private final static String VHD_EXTENSION = ".vhd"; // NON-NLS @@ -102,7 +103,7 @@ final class AddLogicalImageTask implements Runnable { } /** - * Add SearchResults.txt and users.txt to the case + * Add SearchResults.txt and *_users.txt to the case * report Adds the image to the case database. */ @Messages({ @@ -148,7 +149,7 @@ final class AddLogicalImageTask implements Runnable { return; } - // Add the SearchResults.txt and users.txt to the case report + // Add the SearchResults.txt and *_users.txt to the case report String resultsFilename; if (Paths.get(dest.toString(), SEARCH_RESULTS_TXT).toFile().exists()) { resultsFilename = SEARCH_RESULTS_TXT; @@ -167,15 +168,25 @@ final class AddLogicalImageTask implements Runnable { } progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(resultsFilename)); - progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingToReport(USERS_TXT)); - status = addReport(Paths.get(dest.toString(), USERS_TXT), USERS_TXT + " " + src.getName()); - if (status != null) { - errorList.add(status); - callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); - return; + // All all *_users.txt files to report + File[] userFiles = dest.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.endsWith(USERS_TXT); + } + }); + + for (File userFile : userFiles) { + progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingToReport(userFile.getName())); + status = addReport(userFile.toPath(), userFile.getName() + " " + src.getName()); + if (status != null) { + errorList.add(status); + callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); + return; + } + progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(userFile.getName())); } - progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(USERS_TXT)); - + // Get all VHD files in the dest directory List imagePaths = new ArrayList<>(); for (File f : dest.listFiles()) {