19 package org.sleuthkit.autopsy.logicalimager.dsp;
22 import java.nio.file.Path;
23 import java.nio.file.Paths;
24 import java.util.ArrayList;
25 import java.util.Calendar;
26 import java.util.List;
27 import java.util.UUID;
28 import javax.swing.JOptionPane;
29 import static javax.swing.JOptionPane.YES_OPTION;
30 import javax.swing.JPanel;
31 import org.openide.util.NbBundle.Messages;
32 import org.openide.util.lookup.ServiceProvider;
33 import org.openide.util.lookup.ServiceProviders;
48 @ServiceProviders(value = {
49 @ServiceProvider(service = DataSourceProcessor.class)}
53 private static final String LOGICAL_IMAGER_DIR =
"LogicalImager";
74 @Messages({
"LogicalImagerDSProcessor.dataSourceType=Autopsy Logical Imager Results"})
76 return Bundle.LogicalImagerDSProcessor_dataSourceType();
88 return Bundle.LogicalImagerDSProcessor_dataSourceType();
114 return configPanel.validatePanel();
132 "# {0} - imageDirPath",
"LogicalImagerDSProcessor.imageDirPathNotFound={0} not found.\nUSB drive has been ejected.",
133 "# {0} - directory",
"LogicalImagerDSProcessor.failToCreateDirectory=Failed to create directory {0}",
134 "# {0} - directory",
"LogicalImagerDSProcessor.directoryAlreadyExists=Directory {0} already exists",
135 "LogicalImagerDSProcessor.destinationDirectoryConfirmation=Destination directory confirmation",
136 "# {0} - directory",
"LogicalImagerDSProcessor.destinationDirectoryConfirmationMsg=The logical imager folder {0} already exists,\ndo you want to add it again using a new folder name?",
137 "LogicalImagerDSProcessor.noCurrentCase=No current case",
141 configPanel.storeSettings();
143 Path imageDirPath = configPanel.getImageDirPath();
144 List<String> errorList =
new ArrayList<>();
145 List<Content> emptyDataSources =
new ArrayList<>();
147 if (!imageDirPath.toFile().exists()) {
151 String msg = Bundle.LogicalImagerDSProcessor_imageDirPathNotFound(imageDirPath.toString());
159 File logicalImagerDir = Paths.get(moduleDirectory, LOGICAL_IMAGER_DIR).toFile();
160 if (!logicalImagerDir.exists() && !logicalImagerDir.mkdir()) {
162 String msg = Bundle.LogicalImagerDSProcessor_failToCreateDirectory(logicalImagerDir);
167 File dest = Paths.get(logicalImagerDir.toString(), imageDirPath.getFileName().toString()).toFile();
170 int showConfirmDialog = JOptionPane.showConfirmDialog(configPanel,
171 Bundle.LogicalImagerDSProcessor_destinationDirectoryConfirmationMsg(dest.toString()),
172 Bundle.LogicalImagerDSProcessor_destinationDirectoryConfirmation(),
173 JOptionPane.YES_NO_OPTION);
174 if (showConfirmDialog == YES_OPTION) {
177 dest = Paths.get(logicalImagerDir.toString(), uniqueDirectory).toFile();
179 String msg = Bundle.LogicalImagerDSProcessor_directoryAlreadyExists(dest.toString());
185 File src = imageDirPath.toFile();
188 String deviceId = UUID.randomUUID().toString();
189 String timeZone = Calendar.getInstance().getTimeZone().getID();
190 run(deviceId, timeZone, src, dest,
191 progressMonitor, callback);
193 String msg = Bundle.LogicalImagerDSProcessor_noCurrentCase();
218 private void run(String deviceId, String timeZone,
222 addLogicalImageTask =
new AddLogicalImageTask(deviceId, timeZone, src, dest,
223 progressMonitor, callback);
224 Thread thread =
new Thread(addLogicalImageTask);
230 if (addLogicalImageTask != null) {
231 addLogicalImageTask.cancelTask();
static String createTimeStamp()
void done(DataSourceProcessorResult result, List< String > errList, List< Content > newDataSources)
AddLogicalImageTask addLogicalImageTask
void run(String deviceId, String timeZone, File src, File dest, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
String getDataSourceType()
String getModuleDirectory()
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
static Case getCurrentCase()
LogicalImagerDSProcessor()
final LogicalImagerPanel configPanel