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;
53 return "Add Tagged Hashes";
58 return "Adds hashes of tagged files to a hash set.";
69 progressPanel.
start();
72 HashDb hashSet = configPanel.getSelectedHashDatabase();
73 if (hashSet != null) {
77 List<TagName> tagNames = configPanel.getSelectedTagNames();
78 ArrayList<String> failedExports =
new ArrayList<>();
79 for (TagName tagName : tagNames) {
87 for (ContentTag tag : tags) {
89 Content content = tag.getContent();
90 if (content instanceof AbstractFile) {
91 if (null != ((AbstractFile) content).getMd5Hash()) {
94 }
catch (TskCoreException ex) {
96 failedExports.add(tag.getContent().getName());
99 JOptionPane.showMessageDialog(null,
"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);
104 }
catch (TskCoreException ex) {
106 JOptionPane.showMessageDialog(null,
"Error getting selected tags for case.",
"Hash Export Error", JOptionPane.ERROR_MESSAGE);
109 if (!failedExports.isEmpty()) {
110 StringBuilder errorMessage =
new StringBuilder(
"Failed to export hashes for the following files: ");
111 for (
int i = 0; i < failedExports.size(); ++i) {
112 errorMessage.append(failedExports.get(i));
113 if (failedExports.size() > 1 && i < failedExports.size() - 1) {
114 errorMessage.append(
",");
116 if (i == failedExports.size() - 1) {
117 errorMessage.append(
".");
120 JOptionPane.showMessageDialog(null, errorMessage.toString(),
"Hash Export Error", JOptionPane.ERROR_MESSAGE);
129 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()
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
void updateStatusLabel(String statusMessage)
AddTaggedHashesToHashDbConfigPanel configPanel
abstract void addHashes(Content content)