Add *_users.txt to report

This commit is contained in:
Joe Ho 2019-09-23 11:43:48 -04:00
parent 7408e461d1
commit ce9bd67bfc

View File

@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.logicalimager.dsp;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.file.Files; 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 * 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. * case database.
*/ */
final class AddLogicalImageTask implements Runnable { final class AddLogicalImageTask implements Runnable {
private final static Logger LOGGER = Logger.getLogger(AddLogicalImageTask.class.getName()); 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 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 MODULE_NAME = "Logical Imager"; //NON-NLS
private final static String ROOT_STR = "root"; // NON-NLS private final static String ROOT_STR = "root"; // NON-NLS
private final static String VHD_EXTENSION = ".vhd"; // 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. * report Adds the image to the case database.
*/ */
@Messages({ @Messages({
@ -148,7 +149,7 @@ final class AddLogicalImageTask implements Runnable {
return; 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; String resultsFilename;
if (Paths.get(dest.toString(), SEARCH_RESULTS_TXT).toFile().exists()) { if (Paths.get(dest.toString(), SEARCH_RESULTS_TXT).toFile().exists()) {
resultsFilename = SEARCH_RESULTS_TXT; resultsFilename = SEARCH_RESULTS_TXT;
@ -167,14 +168,24 @@ final class AddLogicalImageTask implements Runnable {
} }
progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(resultsFilename)); progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(resultsFilename));
progressMonitor.setProgressText(Bundle.AddLogicalImageTask_addingToReport(USERS_TXT)); // All all *_users.txt files to report
status = addReport(Paths.get(dest.toString(), USERS_TXT), USERS_TXT + " " + src.getName()); 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) { if (status != null) {
errorList.add(status); errorList.add(status);
callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources); callback.done(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS, errorList, emptyDataSources);
return; return;
} }
progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(USERS_TXT)); progressMonitor.setProgressText(Bundle.AddLogicalImageTask_doneAddingToReport(userFile.getName()));
}
// Get all VHD files in the dest directory // Get all VHD files in the dest directory
List<String> imagePaths = new ArrayList<>(); List<String> imagePaths = new ArrayList<>();