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;
50 @ServiceProviders(value = {
51 @ServiceProvider(service = DataSourceProcessor.class)}
55 private static final String LOGICAL_IMAGER_DIR =
"LogicalImager";
76 @Messages({
"LogicalImagerDSProcessor.dataSourceType=Autopsy Logical Imager Results"})
78 return Bundle.LogicalImagerDSProcessor_dataSourceType();
90 return Bundle.LogicalImagerDSProcessor_dataSourceType();
116 return configPanel.validatePanel();
135 run(null, progressMonitor, callback);
154 "# {0} - imageDirPath",
"LogicalImagerDSProcessor.imageDirPathNotFound={0} not found.\nUSB drive has been ejected.",
155 "# {0} - directory",
"LogicalImagerDSProcessor.failToCreateDirectory=Failed to create directory {0}",
156 "# {0} - directory",
"LogicalImagerDSProcessor.directoryAlreadyExists=Directory {0} already exists",
157 "LogicalImagerDSProcessor.destinationDirectoryConfirmation=Destination directory confirmation",
158 "# {0} - directory",
"LogicalImagerDSProcessor.destinationDirectoryConfirmationMsg=The logical imager folder {0} already exists,\ndo you want to add it again using a new folder name?",
159 "LogicalImagerDSProcessor.noCurrentCase=No current case",
163 configPanel.storeSettings();
164 Path imageDirPath = configPanel.getImageDirPath();
165 List<String> errorList =
new ArrayList<>();
166 List<Content> emptyDataSources =
new ArrayList<>();
168 if (!imageDirPath.toFile().exists()) {
172 String msg = Bundle.LogicalImagerDSProcessor_imageDirPathNotFound(imageDirPath.toString());
180 File logicalImagerDir = Paths.get(moduleDirectory, LOGICAL_IMAGER_DIR).toFile();
181 if (!logicalImagerDir.exists() && !logicalImagerDir.mkdir()) {
183 String msg = Bundle.LogicalImagerDSProcessor_failToCreateDirectory(logicalImagerDir);
188 File dest = Paths.get(logicalImagerDir.toString(), imageDirPath.getFileName().toString()).toFile();
191 int showConfirmDialog = JOptionPane.showConfirmDialog(configPanel,
192 Bundle.LogicalImagerDSProcessor_destinationDirectoryConfirmationMsg(dest.toString()),
193 Bundle.LogicalImagerDSProcessor_destinationDirectoryConfirmation(),
194 JOptionPane.YES_NO_OPTION);
195 if (showConfirmDialog == YES_OPTION) {
198 dest = Paths.get(logicalImagerDir.toString(), uniqueDirectory).toFile();
200 String msg = Bundle.LogicalImagerDSProcessor_directoryAlreadyExists(dest.toString());
206 File src = imageDirPath.toFile();
209 String deviceId = UUID.randomUUID().toString();
210 String timeZone = Calendar.getInstance().getTimeZone().getID();
211 run(deviceId, timeZone, src, dest, host,
212 progressMonitor, callback);
214 String msg = Bundle.LogicalImagerDSProcessor_noCurrentCase();
240 private void run(String deviceId, String timeZone,
241 File src, File dest, Host host,
244 addLogicalImageTask =
new AddLogicalImageTask(deviceId, timeZone, src, dest, host,
245 progressMonitor, callback);
246 Thread thread =
new Thread(addLogicalImageTask);
252 if (addLogicalImageTask != null) {
253 addLogicalImageTask.cancelTask();
static String createTimeStamp()
void run(String deviceId, String timeZone, File src, File dest, Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void done(DataSourceProcessorResult result, List< String > errList, List< Content > newDataSources)
AddLogicalImageTask addLogicalImageTask
String getDataSourceType()
String getModuleDirectory()
void run(DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
void run(Host host, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback)
static Case getCurrentCase()
LogicalImagerDSProcessor()
final LogicalImagerPanel configPanel