19 package org.sleuthkit.autopsy.report.taggedhashes;
21 import java.util.ArrayList;
22 import java.util.List;
23 import java.util.logging.Level;
25 import javax.swing.JOptionPane;
26 import javax.swing.JPanel;
27 import org.openide.util.lookup.ServiceProvider;
28 import org.openide.windows.WindowManager;
55 return "Add Tagged Hashes";
60 return "Adds hashes of tagged files to a hash set.";
75 JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
"No open Case",
"Exception while getting open case.", JOptionPane.ERROR_MESSAGE);
79 progressPanel.
start();
82 HashDb hashSet = configPanel.getSelectedHashDatabase();
83 if (hashSet != null) {
87 List<TagName> tagNames = configPanel.getSelectedTagNames();
88 ArrayList<String> failedExports =
new ArrayList<>();
89 for (TagName tagName : tagNames) {
97 for (ContentTag tag : tags) {
99 Content content = tag.getContent();
100 if (content instanceof AbstractFile) {
101 if (null != ((AbstractFile) content).getMd5Hash()) {
104 }
catch (TskCoreException ex) {
106 failedExports.add(tag.getContent().getName());
109 JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
"Unable to add the " + (tags.size() > 1 ?
"files" :
"file") +
" to the hash set. Hashes have not been calculated. Please configure and run an appropriate ingest module.",
"Add to Hash Set Error", JOptionPane.ERROR_MESSAGE);
114 }
catch (TskCoreException ex) {
116 JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
"Error getting selected tags for case.",
"Hash Export Error", JOptionPane.ERROR_MESSAGE);
119 if (!failedExports.isEmpty()) {
120 StringBuilder errorMessage =
new StringBuilder(
"Failed to export hashes for the following files: ");
121 for (
int i = 0; i < failedExports.size(); ++i) {
122 errorMessage.append(failedExports.get(i));
123 if (failedExports.size() > 1 && i < failedExports.size() - 1) {
124 errorMessage.append(
",");
126 if (i == failedExports.size() - 1) {
127 errorMessage.append(
".");
130 JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), errorMessage.toString(),
"Hash Export Error", JOptionPane.ERROR_MESSAGE);
139 configPanel =
new AddTaggedHashesToHashDbConfigPanel();
void complete(ReportStatus reportStatus)
JPanel getConfigurationPanel()
abstract String getHashSetName()
void setIndeterminate(boolean indeterminate)
void generateReport(String reportPath, ReportProgressPanel progressPanel)
TagsManager getTagsManager()
String getRelativeFilePath()
AddTaggedHashesToHashDb()
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
void updateStatusLabel(String statusMessage)
AddTaggedHashesToHashDbConfigPanel configPanel
abstract void addHashes(Content content)