19package org.sleuthkit.autopsy.modules.embeddedfileextractor;
21import java.awt.event.ActionEvent;
22import java.nio.file.Paths;
23import java.util.concurrent.ConcurrentHashMap;
24import java.util.concurrent.ExecutionException;
25import java.util.logging.Level;
26import javax.swing.AbstractAction;
27import javax.swing.JOptionPane;
28import javax.swing.SwingWorker;
29import org.sleuthkit.autopsy.coreutils.Logger;
30import net.sf.sevenzipjbinding.SevenZipNativeInitializationException;
31import org.openide.util.NbBundle.Messages;
32import org.openide.windows.WindowManager;
33import org.sleuthkit.autopsy.casemodule.Case;
34import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
35import org.sleuthkit.autopsy.ingest.IngestMessage;
36import org.sleuthkit.autopsy.ingest.IngestServices;
37import org.sleuthkit.autopsy.ingest.runIngestModuleWizard.RunIngestModulesAction;
38import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
39import org.sleuthkit.autopsy.progress.ModalDialogProgressIndicator;
40import org.sleuthkit.datamodel.AbstractFile;
60 @Messages({
"ExtractArchiveWithPasswordAction.name.text=Unzip contents with password",
"ExtractArchiveWithPasswordAction.prompt.text=Enter Password",
61 "ExtractArchiveWithPasswordAction.prompt.title=Enter Password",
62 "ExtractArchiveWithPasswordAction.extractFailed.title=Failed to Unpack Files, with Password",
63 "# {0} - archiveFile",
64 "ExtractArchiveWithPasswordAction.progress.text=Unpacking contents of archive: {0}"})
66 super(Bundle.ExtractArchiveWithPasswordAction_name_text());
72 String password =
getPassword(Bundle.ExtractArchiveWithPasswordAction_prompt_title(),
"");
73 if (password !=
null) {
75 extractWorker.execute();
79 private String
getPassword(String title, String oldPassword) {
80 String password =
null;
81 Object inputValue = JOptionPane.showInputDialog(WindowManager.getDefault().getMainWindow(), Bundle.ExtractArchiveWithPasswordAction_prompt_text(),
82 title, JOptionPane.PLAIN_MESSAGE,
null,
null, oldPassword);
83 if (inputValue !=
null) {
84 password = (String) inputValue;
113 boolean done =
false;
120 progress.start(Bundle.ExtractArchiveWithPasswordAction_progress_text(
archive.getName()));
128 SevenZipExtractor extractor =
new SevenZipExtractor(
null, fileTypeDetector, moduleDirRelative, moduleDirAbsolute,
new FileTaskExecutor(
null));
130 }
catch (SevenZipNativeInitializationException ex) {
132 logger.log(Level.INFO,
"Unable to extract file with password", ex);
136 logger.log(Level.SEVERE,
"Error getting open case unable to perform extraction action", ex);
145 boolean done =
false;
156 }
catch (InterruptedException ex) {
157 logger.log(Level.SEVERE,
"Unable to extract archive successfully", ex);
158 }
catch (ExecutionException ex) {
159 logger.log(Level.SEVERE,
"Execution Exception: Unable to extract archive successfully", ex.getCause());
String getModuleOutputDirectoryRelativePath()
static Case getCurrentCaseThrows()
String getModuleDirectory()
synchronized static Logger getLogger(String name)
static IngestMessage createWarningMessage(String source, String subject, String detailsHtml)
void postMessage(final IngestMessage message)
static synchronized IngestServices getInstance()
void actionPerformed(ActionEvent e)