19 package org.sleuthkit.autopsy.report;
21 import java.awt.Dimension;
22 import java.awt.Toolkit;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
25 import java.awt.event.WindowAdapter;
26 import java.awt.event.WindowEvent;
28 import java.io.IOException;
29 import java.sql.ResultSet;
30 import java.sql.SQLException;
31 import java.text.DateFormat;
32 import java.text.SimpleDateFormat;
33 import java.util.ArrayList;
34 import java.util.Arrays;
35 import java.util.Collection;
36 import java.util.Collections;
37 import java.util.Date;
38 import java.util.HashMap;
39 import java.util.HashSet;
40 import java.util.Iterator;
41 import java.util.List;
43 import java.util.Map.Entry;
44 import java.util.concurrent.ExecutionException;
45 import java.util.logging.Level;
46 import javax.swing.JDialog;
47 import javax.swing.JFrame;
48 import javax.swing.SwingWorker;
49 import org.openide.filesystems.FileUtil;
50 import org.openide.util.NbBundle;
76 class ReportGenerator {
77 private static final Logger logger = Logger.getLogger(ReportGenerator.class.getName());
79 private Case currentCase = Case.getCurrentCase();
80 private SleuthkitCase skCase = currentCase.getSleuthkitCase();
82 private Map<TableReportModule, ReportProgressPanel> tableProgress;
83 private Map<GeneralReportModule, ReportProgressPanel> generalProgress;
84 private Map<FileReportModule, ReportProgressPanel> fileProgress;
86 private String reportPath;
87 private ReportGenerationPanel panel =
new ReportGenerationPanel();
89 static final String REPORTS_DIR =
"Reports";
91 private List<String> errorList;
97 private void displayReportErrors(){
98 if(!errorList.isEmpty()){
99 String errorString =
"";
100 for(String error : errorList)
101 errorString += error +
"\n";
102 MessageNotifyUtil.Notify.error(
103 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.notifyErr.errsDuringRptGen"), errorString);
108 ReportGenerator(Map<TableReportModule, Boolean> tableModuleStates, Map<GeneralReportModule, Boolean> generalModuleStates, Map<FileReportModule, Boolean> fileListModuleStates) {
110 DateFormat dateFormat =
new SimpleDateFormat(
"MM-dd-yyyy-HH-mm-ss");
111 Date date =
new Date();
112 String dateNoTime = dateFormat.format(date);
113 this.reportPath = currentCase.getCaseDirectory() + File.separator + REPORTS_DIR + File.separator + currentCase.getName() +
" " + dateNoTime + File.separator;
115 this.errorList =
new ArrayList<String>();
119 FileUtil.createFolder(
new File(this.reportPath));
120 }
catch (IOException ex) {
121 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedMakeRptFolder"));
122 logger.log(Level.SEVERE,
"Failed to make report folder, may be unable to generate reports.", ex);
127 generalProgress =
new HashMap<>();
128 tableProgress =
new HashMap<>();
129 fileProgress =
new HashMap<>();
130 setupProgressPanels(tableModuleStates, generalModuleStates, fileListModuleStates);
140 private void setupProgressPanels(Map<TableReportModule, Boolean> tableModuleStates, Map<GeneralReportModule, Boolean> generalModuleStates, Map<FileReportModule, Boolean> fileListModuleStates) {
141 if (null != tableModuleStates) {
142 for (Entry<TableReportModule, Boolean> entry : tableModuleStates.entrySet()) {
143 if (entry.getValue()) {
144 TableReportModule module = entry.getKey();
145 String reportFilePath = module.getRelativeFilePath();
146 if (reportFilePath != null) {
147 tableProgress.put(module, panel.addReport(module.getName(), reportPath + reportFilePath));
150 tableProgress.put(module, panel.addReport(module.getName(), null));
156 if (null != generalModuleStates) {
157 for (Entry<GeneralReportModule, Boolean> entry : generalModuleStates.entrySet()) {
158 if (entry.getValue()) {
159 GeneralReportModule module = entry.getKey();
160 String reportFilePath = module.getRelativeFilePath();
161 if (reportFilePath != null) {
162 generalProgress.put(module, panel.addReport(module.getName(), reportPath + reportFilePath));
165 generalProgress.put(module, panel.addReport(module.getName(), null));
171 if (null != fileListModuleStates) {
172 for(Entry<FileReportModule, Boolean> entry : fileListModuleStates.entrySet()) {
173 if (entry.getValue()) {
174 FileReportModule module = entry.getKey();
175 String reportFilePath = module.getRelativeFilePath();
176 if (reportFilePath != null) {
177 fileProgress.put(module, panel.addReport(module.getName(), reportPath + reportFilePath));
180 fileProgress.put(module, panel.addReport(module.getName(), null));
190 public void displayProgressPanels() {
191 final JDialog dialog =
new JDialog(
new JFrame(),
true);
192 dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
193 dialog.setTitle(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.displayProgress.title.text"));
194 dialog.add(this.panel);
197 panel.addCloseAction(
new ActionListener() {
199 public void actionPerformed(ActionEvent e) {
204 dialog.addWindowListener(
new WindowAdapter() {
206 public void windowClosing(WindowEvent e) {
211 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
212 int w = dialog.getSize().width;
213 int h = dialog.getSize().height;
216 dialog.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
217 dialog.setVisible(
true);
223 public void generateGeneralReports() {
224 GeneralReportsWorker worker =
new GeneralReportsWorker();
234 public void generateTableReports(Map<ARTIFACT_TYPE, Boolean> artifactTypeSelections, Map<String, Boolean> tagNameSelections) {
235 if (!tableProgress.isEmpty() && null != artifactTypeSelections) {
236 TableReportsWorker worker =
new TableReportsWorker(artifactTypeSelections, tagNameSelections);
247 public void generateFileListReports(Map<FileReportDataTypes, Boolean> enabledInfo) {
248 if (!fileProgress.isEmpty() && null != enabledInfo) {
249 List<FileReportDataTypes> enabled =
new ArrayList<>();
250 for (Entry<FileReportDataTypes, Boolean> e : enabledInfo.entrySet()) {
252 enabled.add(e.getKey());
255 FileReportsWorker worker =
new FileReportsWorker(enabled);
267 for (Entry<GeneralReportModule, ReportProgressPanel> entry : generalProgress.entrySet()) {
280 }
catch (InterruptedException | ExecutionException ex) {
282 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errors.reportErrorTitle"),
283 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errors.reportErrorText") + ex.getLocalizedMessage(),
285 logger.log(Level.SEVERE,
"failed to generate reports", ex);
288 catch (java.util.concurrent.CancellationException ex ) { }
290 displayReportErrors();
301 private List<FileReportDataTypes> enabledInfo = Arrays.asList(FileReportDataTypes.values());
305 enabledInfo = enabled;
306 for (Entry<FileReportModule, ReportProgressPanel> entry : fileProgress.entrySet()) {
307 fileModules.add(entry.getKey());
313 for (FileReportModule module : fileModules) {
318 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.queryingDb.text"));
322 List<AbstractFile> files =
getFiles();
323 int numFiles = files.size();
324 for (FileReportModule module : fileModules) {
325 module.startReport(reportPath);
326 module.startTable(enabledInfo);
327 fileProgress.get(module).setIndeterminate(
false);
328 fileProgress.get(module).setMaximumProgress(numFiles);
335 if (fileModules.isEmpty()) {
339 Iterator<FileReportModule> iter = fileModules.iterator();
340 while (iter.hasNext()) {
341 FileReportModule module = iter.next();
346 module.addRow(file, enabledInfo);
350 if ((i % 100) == 0) {
352 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.processingFile.text",
359 for (FileReportModule module : fileModules) {
373 List<AbstractFile> absFiles;
380 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errors.reportErrorTitle"),
381 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errors.reportErrorText") + ex.getLocalizedMessage(),
383 logger.log(Level.SEVERE,
"failed to generate reports. Unable to get all files in the image.", ex);
392 }
catch (InterruptedException | ExecutionException ex) {
394 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errors.reportErrorTitle"),
395 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errors.reportErrorText") + ex.getLocalizedMessage(),
397 logger.log(Level.SEVERE,
"failed to generate reports", ex);
400 catch (java.util.concurrent.CancellationException ex ) { }
402 displayReportErrors();
417 private List<Content>
images =
new ArrayList<>();
419 TableReportsWorker(Map<ARTIFACT_TYPE, Boolean> artifactTypeSelections, Map<String, Boolean> tagNameSelections) {
421 for (Entry<TableReportModule, ReportProgressPanel> entry : tableProgress.entrySet()) {
422 tableModules.add(entry.getKey());
426 for (Entry<ARTIFACT_TYPE, Boolean> entry : artifactTypeSelections.entrySet()) {
427 if (entry.getValue()) {
428 artifactTypes.add(entry.getKey());
433 if (null != tagNameSelections) {
434 for (Entry<String, Boolean> entry : tagNameSelections.entrySet()) {
435 if (entry.getValue() ==
true) {
436 tagNamesFilter.add(entry.getKey());
445 for (TableReportModule module : tableModules) {
448 module.startReport(reportPath);
466 for (TableReportModule module : tableModules) {
479 StringBuilder comment =
new StringBuilder();
480 if (!tagNamesFilter.isEmpty()) {
481 comment.append(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.artifactTable.taggedResults.text"));
482 comment.append(makeCommaSeparatedList(tagNamesFilter));
488 removeCancelledTableReportModules();
489 if (tableModules.isEmpty()) {
493 for (TableReportModule module : tableModules) {
494 tableProgress.get(module).updateStatusLabel(
495 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.processing",
496 type.getDisplayName()));
501 writeKeywordHits(tableModules, comment.toString(),
tagNamesFilter);
504 writeHashsetHits(tableModules, comment.toString(),
tagNamesFilter);
508 List<ArtifactData> unsortedArtifacts = getFilteredArtifacts(type, tagNamesFilter);
510 if (unsortedArtifacts.isEmpty()) {
517 Collections.sort(unsortedArtifacts);
525 List<String> columnHeaders = getArtifactTableColumnHeaders(type.getTypeID());
526 if (columnHeaders == null) {
531 for (TableReportModule module : tableModules) {
532 module.startDataType(type.getDisplayName(), comment.toString());
533 module.startTable(columnHeaders);
536 boolean msgSent =
false;
539 for (TableReportModule module : tableModules) {
542 List<String> rowData = artifactData.getRow();
543 if (rowData.isEmpty()) {
544 if (msgSent ==
false) {
546 "ReportGenerator.msgShow.skippingArtRow.title",
548 NbBundle.getMessage(
this.getClass(),
549 "ReportGenerator.msgShow.skippingArtRow.msg"),
556 module.addRow(rowData);
560 for (TableReportModule module : tableModules) {
561 tableProgress.get(module).increment();
563 module.endDataType();
571 @SuppressWarnings(
"deprecation")
574 removeCancelledTableReportModules();
575 if (tableModules.isEmpty()) {
580 List<ContentTag> tags;
585 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedGetContentTags"));
586 logger.log(Level.SEVERE,
"failed to get content tags", ex);
591 for (TableReportModule module : tableModules) {
594 tableProgress.get(module).updateStatusLabel(
595 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.processing",
597 ArrayList<String> columnHeaders =
new ArrayList<>(Arrays.asList(
598 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.tag"),
599 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.file"),
600 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.comment"),
601 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.timeModified"),
602 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.timeChanged"),
603 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.timeAccessed"),
604 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.timeCreated"),
605 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.size"),
606 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.htmlOutput.header.hash")));
608 StringBuilder comment =
new StringBuilder();
609 if (!tagNamesFilter.isEmpty()) {
611 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.makeContTagTab.taggedFiles.msg"));
612 comment.append(makeCommaSeparatedList(tagNamesFilter));
614 if (module instanceof ReportHTML) {
615 ReportHTML htmlReportModule = (ReportHTML)module;
617 htmlReportModule.startContentTagsTable(columnHeaders);
621 module.startTable(columnHeaders);
634 fileName = tag.getContent().getUniquePath();
636 fileName = tag.getContent().getName();
639 ArrayList<String> rowData =
new ArrayList<>(Arrays.asList(tag.getName().getDisplayName(), fileName, tag.getComment()));
640 for (TableReportModule module : tableModules) {
642 if (module instanceof ReportHTML) {
643 ReportHTML htmlReportModule = (ReportHTML)module;
644 htmlReportModule.addRowWithTaggedContentHyperlink(rowData, tag);
647 module.addRow(rowData);
656 for (TableReportModule module : tableModules) {
657 tableProgress.get(module).increment();
659 module.endDataType();
667 }
catch (InterruptedException | ExecutionException ex) {
669 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errors.reportErrorTitle"),
670 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errors.reportErrorText") + ex.getLocalizedMessage(),
672 logger.log(Level.SEVERE,
"failed to generate reports", ex);
675 catch (java.util.concurrent.CancellationException ex ) { }
677 displayReportErrors();
685 @SuppressWarnings(
"deprecation")
688 removeCancelledTableReportModules();
689 if (tableModules.isEmpty()) {
693 List<BlackboardArtifactTag> tags;
698 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedGetBBArtifactTags"));
699 logger.log(Level.SEVERE,
"failed to get blackboard artifact tags", ex);
705 for (TableReportModule module : tableModules) {
706 tableProgress.get(module).updateStatusLabel(
707 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.processing",
709 StringBuilder comment =
new StringBuilder();
710 if (!tagNamesFilter.isEmpty()) {
712 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.makeBbArtTagTab.taggedRes.msg"));
713 comment.append(makeCommaSeparatedList(tagNamesFilter));
716 module.startTable(
new ArrayList<>(Arrays.asList(
717 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.tagTable.header.resultType"),
718 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.tagTable.header.tag"),
719 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.tagTable.header.comment"),
720 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.tagTable.header.srcFile"))));
730 for (TableReportModule module : tableModules) {
731 row =
new ArrayList<>(Arrays.asList(tag.getArtifact().getArtifactTypeName(), tag.getName().getDisplayName(), tag.getComment(), tag.getContent().getName()));
740 for (TableReportModule module : tableModules) {
741 tableProgress.get(module).increment();
743 module.endDataType();
753 return tagNamesFilter.isEmpty() || tagNamesFilter.contains(tagName);
756 void removeCancelledTableReportModules() {
757 Iterator<TableReportModule> iter = tableModules.iterator();
758 while (iter.hasNext()) {
759 TableReportModule module = iter.next();
771 for (TableReportModule module : tableModules) {
772 tableProgress.get(module).updateStatusLabel(
773 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.createdThumb.text"));
775 if (module instanceof ReportHTML) {
776 ReportHTML htmlModule = (ReportHTML) module;
777 htmlModule.startDataType(
778 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.thumbnailTable.name"),
779 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.thumbnailTable.desc"));
780 List<String> emptyHeaders =
new ArrayList<>();
781 for (
int i = 0; i < ReportHTML.THUMBNAIL_COLUMNS; i++) {
782 emptyHeaders.add(
"");
784 htmlModule.startTable(emptyHeaders);
786 htmlModule.addThumbnailRows(images);
788 htmlModule.endTable();
789 htmlModule.endDataType();
805 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.errGetContentFromBBArtifact"));
806 logger.log(Level.WARNING,
"Error while getting content from a blackboard artifact to report on.", ex);
848 private Boolean failsTagFilter(HashSet<String> tagNames, HashSet<String> tagsNamesFilter)
850 if (null == tagsNamesFilter || tagsNamesFilter.isEmpty()) {
854 HashSet<String> filteredTagNames =
new HashSet<>(tagNames);
855 filteredTagNames.retainAll(tagsNamesFilter);
856 return filteredTagNames.isEmpty();
866 private List<ArtifactData> getFilteredArtifacts(ARTIFACT_TYPE type, HashSet<String> tagNamesFilter) {
867 List<ArtifactData> artifacts =
new ArrayList<>();
869 for (BlackboardArtifact artifact : skCase.getBlackboardArtifacts(type)) {
870 List<BlackboardArtifactTag> tags = Case.getCurrentCase().getServices().getTagsManager().getBlackboardArtifactTagsByArtifact(artifact);
871 HashSet<String> uniqueTagNames =
new HashSet<>();
872 for (BlackboardArtifactTag tag : tags) {
873 uniqueTagNames.add(tag.getName().getDisplayName());
875 if(failsTagFilter(uniqueTagNames, tagNamesFilter)) {
879 artifacts.add(
new ArtifactData(artifact, skCase.getBlackboardAttributes(artifact), uniqueTagNames));
880 }
catch (TskCoreException ex) {
881 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedGetBBAttribs"));
882 logger.log(Level.SEVERE,
"Failed to get Blackboard Attributes when generating report.", ex);
886 catch (TskCoreException ex) {
887 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedGetBBArtifacts"));
888 logger.log(Level.SEVERE,
"Failed to get Blackboard Artifacts when generating report.", ex);
897 @SuppressWarnings(
"deprecation")
898 private
void writeKeywordHits(List<TableReportModule> tableModules, String comment, HashSet<String> tagNamesFilter) {
905 String keywordListQuery =
906 "SELECT att.value_text AS list " +
907 "FROM blackboard_attributes AS att, blackboard_artifacts AS art " +
908 "WHERE att.attribute_type_id = " + ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() +
" " +
909 "AND art.artifact_type_id = " + ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID() +
" " +
910 "AND att.artifact_id = art.artifact_id " +
913 try (CaseDbQuery dbQuery = skCase.executeQuery(keywordListQuery)) {
914 ResultSet listsRs = dbQuery.getResultSet();
915 List<String> lists =
new ArrayList<>();
916 while(listsRs.next()) {
917 String list = listsRs.getString(
"list");
919 list = NbBundle.getMessage(this.getClass(),
"ReportGenerator.writeKwHits.userSrchs");
925 for (TableReportModule module : tableModules) {
926 module.startDataType(ARTIFACT_TYPE.TSK_KEYWORD_HIT.getDisplayName(), comment);
927 module.addSetIndex(lists);
928 tableProgress.get(module).updateStatusLabel(
929 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.processing",
930 ARTIFACT_TYPE.TSK_KEYWORD_HIT.getDisplayName()));
933 catch (TskCoreException | SQLException ex) {
934 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedQueryKWLists"));
935 logger.log(Level.SEVERE,
"Failed to query keyword lists: ", ex);
940 String keywordsQuery =
941 "SELECT art.artifact_id, art.obj_id, att1.value_text AS keyword, att2.value_text AS preview, att3.value_text AS list, f.name AS name, f.parent_path AS parent_path " +
942 "FROM blackboard_artifacts AS art, blackboard_attributes AS att1, blackboard_attributes AS att2, blackboard_attributes AS att3, tsk_files AS f " +
943 "WHERE (att1.artifact_id = art.artifact_id) " +
944 "AND (att2.artifact_id = art.artifact_id) " +
945 "AND (att3.artifact_id = art.artifact_id) " +
946 "AND (f.obj_id = art.obj_id) " +
947 "AND (att1.attribute_type_id = " + ATTRIBUTE_TYPE.TSK_KEYWORD.getTypeID() +
") " +
948 "AND (att2.attribute_type_id = " + ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW.getTypeID() +
") " +
949 "AND (att3.attribute_type_id = " + ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() +
") " +
950 "AND (art.artifact_type_id = " + ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID() +
") " +
951 "ORDER BY list, keyword, parent_path, name";
953 try (CaseDbQuery dbQuery = skCase.executeQuery(keywordsQuery)) {
954 ResultSet resultSet = dbQuery.getResultSet();
956 String currentKeyword =
"";
957 String currentList =
"";
958 while (resultSet.next()) {
960 if (tableModules.isEmpty()) {
963 Iterator<TableReportModule> iter = tableModules.iterator();
964 while (iter.hasNext()) {
965 TableReportModule module = iter.next();
966 if (tableProgress.get(module).getStatus() == ReportStatus.CANCELED) {
972 HashSet<String> uniqueTagNames = getUniqueTagNames(resultSet.getLong(
"artifact_id"));
973 if(failsTagFilter(uniqueTagNames, tagNamesFilter)) {
976 String tagsList = makeCommaSeparatedList(uniqueTagNames);
978 Long objId = resultSet.getLong(
"obj_id");
979 String keyword = resultSet.getString(
"keyword");
980 String preview = resultSet.getString(
"preview");
981 String list = resultSet.getString(
"list");
982 String uniquePath =
"";
985 AbstractFile f = skCase.getAbstractFileById(objId);
987 uniquePath = skCase.getAbstractFileById(objId).getUniquePath();
989 }
catch (TskCoreException ex) {
991 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedGetAbstractFileByID"));
992 logger.log(Level.WARNING,
"Failed to get Abstract File by ID.", ex);
996 if((!list.equals(currentList) && !list.isEmpty()) || (list.isEmpty() && !currentList.equals(
997 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.writeKwHits.userSrchs")))) {
998 if(!currentList.isEmpty()) {
999 for (TableReportModule module : tableModules) {
1004 currentList = list.isEmpty() ? NbBundle
1005 .getMessage(this.getClass(),
"ReportGenerator.writeKwHits.userSrchs") : list;
1006 currentKeyword =
"";
1007 for (TableReportModule module : tableModules) {
1008 module.startSet(currentList);
1009 tableProgress.get(module).updateStatusLabel(
1010 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.processingList",
1011 ARTIFACT_TYPE.TSK_KEYWORD_HIT.getDisplayName(), currentList));
1014 if (!keyword.equals(currentKeyword)) {
1015 if(!currentKeyword.equals(
"")) {
1016 for (TableReportModule module : tableModules) {
1020 currentKeyword = keyword;
1021 for (TableReportModule module : tableModules) {
1022 module.addSetElement(currentKeyword);
1023 module.startTable(getArtifactTableColumnHeaders(ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()));
1027 String previewreplace = EscapeUtil.escapeHtml(preview);
1028 for (TableReportModule module : tableModules) {
1029 module.addRow(Arrays.asList(
new String[] {previewreplace.replaceAll(
"<!",
""), uniquePath, tagsList}));
1034 for (TableReportModule module : tableModules) {
1035 tableProgress.get(module).increment();
1036 module.endDataType();
1038 }
catch (TskCoreException | SQLException ex) {
1039 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedQueryKWs"));
1040 logger.log(Level.SEVERE,
"Failed to query keywords: ", ex);
1048 @SuppressWarnings(
"deprecation")
1049 private
void writeHashsetHits(List<TableReportModule> tableModules, String comment, HashSet<String> tagNamesFilter) {
1050 String hashsetsQuery =
1051 "SELECT att.value_text AS list " +
1052 "FROM blackboard_attributes AS att, blackboard_artifacts AS art " +
1053 "WHERE att.attribute_type_id = " + ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() +
" " +
1054 "AND art.artifact_type_id = " + ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID() +
" " +
1055 "AND att.artifact_id = art.artifact_id " +
1058 try (CaseDbQuery dbQuery = skCase.executeQuery(hashsetsQuery)) {
1060 ResultSet listsRs = dbQuery.getResultSet();
1061 List<String> lists =
new ArrayList<>();
1062 while(listsRs.next()) {
1063 lists.add(listsRs.getString(
"list"));
1066 for (TableReportModule module : tableModules) {
1067 module.startDataType(ARTIFACT_TYPE.TSK_HASHSET_HIT.getDisplayName(), comment);
1068 module.addSetIndex(lists);
1069 tableProgress.get(module).updateStatusLabel(
1070 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.processing",
1071 ARTIFACT_TYPE.TSK_HASHSET_HIT.getDisplayName()));
1073 }
catch (TskCoreException | SQLException ex) {
1074 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedQueryHashsetLists"));
1075 logger.log(Level.SEVERE,
"Failed to query hashset lists: ", ex);
1079 String hashsetHitsQuery =
1080 "SELECT art.artifact_id, art.obj_id, att.value_text AS setname, f.name AS name, f.size AS size, f.parent_path AS parent_path " +
1081 "FROM blackboard_artifacts AS art, blackboard_attributes AS att, tsk_files AS f " +
1082 "WHERE (att.artifact_id = art.artifact_id) " +
1083 "AND (f.obj_id = art.obj_id) " +
1084 "AND (att.attribute_type_id = " + ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID() +
") " +
1085 "AND (art.artifact_type_id = " + ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID() +
") " +
1086 "ORDER BY setname, parent_path, name, size";
1088 try (CaseDbQuery dbQuery = skCase.executeQuery(hashsetHitsQuery)) {
1090 ResultSet resultSet = dbQuery.getResultSet();
1091 String currentSet =
"";
1092 while (resultSet.next()) {
1094 if (tableModules.isEmpty()) {
1097 Iterator<TableReportModule> iter = tableModules.iterator();
1098 while (iter.hasNext()) {
1099 TableReportModule module = iter.next();
1100 if (tableProgress.get(module).getStatus() == ReportStatus.CANCELED) {
1106 HashSet<String> uniqueTagNames = getUniqueTagNames(resultSet.getLong(
"artifact_id"));
1107 if(failsTagFilter(uniqueTagNames, tagNamesFilter)) {
1110 String tagsList = makeCommaSeparatedList(uniqueTagNames);
1112 Long objId = resultSet.getLong(
"obj_id");
1113 String set = resultSet.getString(
"setname");
1114 String size = resultSet.getString(
"size");
1115 String uniquePath =
"";
1118 AbstractFile f = skCase.getAbstractFileById(objId);
1120 uniquePath = skCase.getAbstractFileById(objId).getUniquePath();
1122 }
catch (TskCoreException ex) {
1124 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedGetAbstractFileFromID"));
1125 logger.log(Level.WARNING,
"Failed to get Abstract File from ID.", ex);
1130 if(!set.equals(currentSet)) {
1131 if(!currentSet.isEmpty()) {
1132 for (TableReportModule module : tableModules) {
1138 for (TableReportModule module : tableModules) {
1139 module.startSet(currentSet);
1140 module.startTable(getArtifactTableColumnHeaders(ARTIFACT_TYPE.TSK_HASHSET_HIT.getTypeID()));
1141 tableProgress.get(module).updateStatusLabel(
1142 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.progress.processingList",
1143 ARTIFACT_TYPE.TSK_HASHSET_HIT.getDisplayName(), currentSet));
1148 for (TableReportModule module : tableModules) {
1149 module.addRow(Arrays.asList(
new String[] {uniquePath, size, tagsList}));
1154 for (TableReportModule module : tableModules) {
1155 tableProgress.get(module).increment();
1156 module.endDataType();
1158 }
catch (TskCoreException | SQLException ex) {
1159 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedQueryHashsetHits"));
1160 logger.log(Level.SEVERE,
"Failed to query hashsets hits: ", ex);
1170 private List<String> getArtifactTableColumnHeaders(
int artifactTypeId) {
1171 ArrayList<String> columnHeaders;
1173 BlackboardArtifact.ARTIFACT_TYPE type = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifactTypeId);
1175 case TSK_WEB_BOOKMARK:
1176 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1177 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.url"),
1178 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.title"),
1179 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateCreated"),
1180 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.program"),
1181 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1183 case TSK_WEB_COOKIE:
1184 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1185 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.url"),
1186 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1187 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.name"),
1188 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.value"),
1189 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.program"),
1190 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1192 case TSK_WEB_HISTORY:
1193 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1194 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.url"),
1195 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateAccessed"),
1196 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.referrer"),
1197 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.title"),
1198 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.program"),
1199 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.urlDomainDecoded"),
1200 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1202 case TSK_WEB_DOWNLOAD:
1203 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1204 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dest"),
1205 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.sourceUrl"),
1206 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateAccessed"),
1207 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.program"),
1208 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1210 case TSK_RECENT_OBJECT:
1211 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1212 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.path"),
1213 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1214 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1216 case TSK_INSTALLED_PROG:
1217 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1218 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.progName"),
1219 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.instDateTime"),
1220 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1222 case TSK_KEYWORD_HIT:
1223 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1224 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.preview"),
1225 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1227 case TSK_HASHSET_HIT:
1228 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1229 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.file"),
1230 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.size")}));
1232 case TSK_DEVICE_ATTACHED:
1233 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1234 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.devMake"),
1235 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.devModel"),
1236 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.deviceId"),
1237 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1238 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1240 case TSK_WEB_SEARCH_QUERY:
1241 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1242 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.text"),
1243 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.domain"),
1244 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateAccessed"),
1245 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.progName"),
1246 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1248 case TSK_METADATA_EXIF:
1249 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1250 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTaken"),
1251 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.devManufacturer"),
1252 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.devModel"),
1253 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.latitude"),
1254 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.longitude"),
1255 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.altitude"),
1256 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1259 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1260 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.personName"),
1261 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.phoneNumber"),
1262 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.phoneNumHome"),
1263 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.phoneNumOffice"),
1264 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.phoneNumMobile"),
1265 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.email"),
1266 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1269 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1270 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.msgType"),
1271 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.direction"),
1272 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.readStatus"),
1273 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1274 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.fromPhoneNum"),
1275 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.fromEmail"),
1276 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.toPhoneNum"),
1277 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.toEmail"),
1278 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.subject"),
1279 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.text"),
1280 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1283 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1284 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.personName"),
1285 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.fromPhoneNum"),
1286 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.toPhoneNum"),
1287 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1288 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.direction"),
1289 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1291 case TSK_CALENDAR_ENTRY:
1292 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1293 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.calendarEntryType"),
1294 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.description"),
1295 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.startDateTime"),
1296 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.endDateTime"),
1297 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.location"),
1298 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1300 case TSK_SPEED_DIAL_ENTRY:
1301 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1302 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.shortCut"),
1303 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.personName"),
1304 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.phoneNumber"),
1305 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1307 case TSK_BLUETOOTH_PAIRING:
1308 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1309 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.deviceName"),
1310 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.deviceAddress"),
1311 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1312 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1314 case TSK_GPS_TRACKPOINT:
1315 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1316 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.latitude"),
1317 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.longitude"),
1318 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1319 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1321 case TSK_GPS_BOOKMARK:
1322 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1323 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.latitude"),
1324 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.longitude"),
1325 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.altitude"),
1326 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.name"),
1327 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.locationAddress"),
1328 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1329 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1331 case TSK_GPS_LAST_KNOWN_LOCATION:
1332 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1333 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.latitude"),
1334 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.longitude"),
1335 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.altitude"),
1336 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.name"),
1337 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.locationAddress"),
1338 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1339 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1341 case TSK_GPS_SEARCH:
1342 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1343 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.latitude"),
1344 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.longitude"),
1345 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.altitude"),
1346 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.name"),
1347 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.locationAddress"),
1348 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1349 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1351 case TSK_SERVICE_ACCOUNT:
1352 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1353 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.category"),
1354 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.userId"),
1355 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.password"),
1356 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.personName"),
1357 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.appName"),
1358 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.url"),
1359 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.appPath"),
1360 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.description"),
1361 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.replytoAddress"),
1362 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.mailServer"),
1363 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile") }));
1365 case TSK_ENCRYPTION_DETECTED:
1366 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1367 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.name"),
1368 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1370 case TSK_EXT_MISMATCH_DETECTED:
1371 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1372 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.file"),
1373 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.extension.text"),
1374 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.mimeType.text"),
1375 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.path")}));
1378 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1379 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.processorArchitecture.text"),
1380 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.osName.text"),
1381 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.osInstallDate.text"),
1382 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.srcFile")}));
1385 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[] {
1386 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskEmailTo"),
1387 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskEmailFrom"),
1388 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskSubject"),
1389 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskDateTimeSent"),
1390 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskDateTimeRcvd"),
1391 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskPath"),
1392 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskEmailCc"),
1393 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskEmailBcc"),
1394 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskMsgId")}));
1396 case TSK_INTERESTING_FILE_HIT:
1397 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[]{
1398 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskSetName"),
1399 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskInterestingFilesCategory"),
1400 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskPath")}));
1403 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[]{
1404 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskGpsRouteCategory"),
1405 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1406 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.latitudeEnd"),
1407 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.longitudeEnd"),
1408 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.latitudeStart"),
1409 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.longitudeStart"),
1410 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.name"),
1411 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.location"),
1412 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.program")}));
1414 case TSK_INTERESTING_ARTIFACT_HIT:
1415 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[]{
1416 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.tskSetName"),
1417 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.associatedArtifact"),
1418 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.program")}));
1421 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[]{
1422 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.program"),
1423 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.associatedArtifact"),
1424 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.dateTime"),
1425 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.count")}));
1428 case TSK_OS_ACCOUNT:
1429 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[]{
1430 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.userName"),
1431 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.userId")}));
1434 case TSK_REMOTE_DRIVE:
1435 columnHeaders =
new ArrayList<>(Arrays.asList(
new String[]{
1436 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.localPath"),
1437 NbBundle.getMessage(this.getClass(),
"ReportGenerator.artTableColHdr.remotePath")}));
1442 columnHeaders.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.artTableColHdr.tags"));
1444 return columnHeaders;
1455 public Map<Integer, String> getMappedAttributes(List<BlackboardAttribute> attList, TableReportModule... module) {
1456 Map<Integer, String> attributes =
new HashMap<>();
1457 int size = ATTRIBUTE_TYPE.values().length;
1458 for (
int n = 0; n <= size; n++) {
1459 attributes.put(n,
"");
1461 for (BlackboardAttribute tempatt : attList) {
1463 Integer type = tempatt.getAttributeTypeID();
1464 if (type.equals(ATTRIBUTE_TYPE.TSK_DATETIME.getTypeID()) ||
1465 type.equals(ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED.getTypeID()) ||
1466 type.equals(ATTRIBUTE_TYPE.TSK_DATETIME_CREATED.getTypeID()) ||
1467 type.equals(ATTRIBUTE_TYPE.TSK_DATETIME_MODIFIED.getTypeID()) ||
1468 type.equals(ATTRIBUTE_TYPE.TSK_DATETIME_SENT.getTypeID()) ||
1469 type.equals(ATTRIBUTE_TYPE.TSK_DATETIME_RCVD.getTypeID()) ||
1470 type.equals(ATTRIBUTE_TYPE.TSK_DATETIME_START.getTypeID()) ||
1471 type.equals(ATTRIBUTE_TYPE.TSK_DATETIME_END.getTypeID())
1473 if (module.length > 0) {
1474 value = module[0].dateToString(tempatt.getValueLong());
1476 SimpleDateFormat sdf =
new java.text.SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss");
1477 value = sdf.format(
new java.util.Date((tempatt.getValueLong() * 1000)));
1481 value = tempatt.getDisplayString();
1484 if (value == null) {
1487 value = EscapeUtil.escapeHtml(value);
1488 attributes.put(type, value);
1499 private String makeCommaSeparatedList(Collection<String> items) {
1501 for (Iterator<String> iterator = items.iterator(); iterator.hasNext(); ) {
1502 list += iterator.next() + (iterator.hasNext() ?
", " :
"");
1513 private String getFileUniquePath(
long objId) {
1515 AbstractFile af = skCase.getAbstractFileById(objId);
1517 return af.getUniquePath();
1523 catch (TskCoreException ex) {
1524 errorList.add(NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.failedGetAbstractFileByID"));
1525 logger.log(Level.WARNING,
"Failed to get Abstract File by ID.", ex);
1542 this.attributes = attrs;
1567 List<String> thisRow =
getRow();
1568 List<String> otherRow = otherArtifactData.
getRow();
1569 for (
int i = 0; i < thisRow.size(); i++) {
1570 int compare = thisRow.get(i).compareTo(otherRow.get(i));
1583 if (rowData == null) {
1587 for (
int i = 0; i < rowData.size(); i++) {
1588 if (rowData.get(i) == null)
1593 NbBundle.getMessage(
this.getClass(),
"ReportGenerator.errList.coreExceptionWhileGenRptRow"));
1594 logger.log(Level.WARNING,
"Core exception while generating row data for artifact report.", ex);
1595 rowData = Collections.<String>emptyList();
1610 List<String> orderedRowData =
new ArrayList<>();
1613 case TSK_WEB_BOOKMARK:
1618 orderedRowData.add(getFileUniquePath(
getObjectID()));
1620 case TSK_WEB_COOKIE:
1626 orderedRowData.add(getFileUniquePath(
getObjectID()));
1628 case TSK_WEB_HISTORY:
1635 orderedRowData.add(getFileUniquePath(
getObjectID()));
1637 case TSK_WEB_DOWNLOAD:
1642 orderedRowData.add(getFileUniquePath(
getObjectID()));
1644 case TSK_RECENT_OBJECT:
1647 orderedRowData.add(getFileUniquePath(
getObjectID()));
1649 case TSK_INSTALLED_PROG:
1652 orderedRowData.add(getFileUniquePath(
getObjectID()));
1654 case TSK_DEVICE_ATTACHED:
1659 orderedRowData.add(getFileUniquePath(
getObjectID()));
1661 case TSK_WEB_SEARCH_QUERY:
1666 orderedRowData.add(getFileUniquePath(
getObjectID()));
1668 case TSK_METADATA_EXIF:
1675 orderedRowData.add(getFileUniquePath(
getObjectID()));
1684 orderedRowData.add(getFileUniquePath(
getObjectID()));
1697 orderedRowData.add(getFileUniquePath(
getObjectID()));
1705 orderedRowData.add(getFileUniquePath(
getObjectID()));
1707 case TSK_CALENDAR_ENTRY:
1713 orderedRowData.add(getFileUniquePath(
getObjectID()));
1715 case TSK_SPEED_DIAL_ENTRY:
1719 orderedRowData.add(getFileUniquePath(
getObjectID()));
1721 case TSK_BLUETOOTH_PAIRING:
1725 orderedRowData.add(getFileUniquePath(
getObjectID()));
1727 case TSK_GPS_TRACKPOINT:
1731 orderedRowData.add(getFileUniquePath(
getObjectID()));
1733 case TSK_GPS_BOOKMARK:
1740 orderedRowData.add(getFileUniquePath(
getObjectID()));
1742 case TSK_GPS_LAST_KNOWN_LOCATION:
1749 orderedRowData.add(getFileUniquePath(
getObjectID()));
1751 case TSK_GPS_SEARCH:
1758 orderedRowData.add(getFileUniquePath(
getObjectID()));
1760 case TSK_SERVICE_ACCOUNT:
1771 orderedRowData.add(getFileUniquePath(
getObjectID()));
1773 case TSK_TOOL_OUTPUT:
1776 orderedRowData.add(getFileUniquePath(
getObjectID()));
1778 case TSK_ENCRYPTION_DETECTED:
1780 orderedRowData.add(getFileUniquePath(
getObjectID()));
1782 case TSK_EXT_MISMATCH_DETECTED:
1785 orderedRowData.add(file.
getName());
1788 if (!attrs.isEmpty()) {
1789 orderedRowData.add(attrs.get(0).getValueString());
1791 orderedRowData.add(
"");
1796 orderedRowData.add(null);
1797 orderedRowData.add(null);
1798 orderedRowData.add(null);
1799 orderedRowData.add(null);
1806 orderedRowData.add(getFileUniquePath(
getObjectID()));
1819 case TSK_INTERESTING_FILE_HIT:
1823 if (pathToShow.isEmpty())
1827 orderedRowData.add(pathToShow);
1840 case TSK_INTERESTING_ARTIFACT_HIT:
1851 case TSK_OS_ACCOUNT:
1855 case TSK_REMOTE_DRIVE:
1860 orderedRowData.add(makeCommaSeparatedList(
getTags()));
1862 return orderedRowData;
1870 return ReportGenerator.this.getMappedAttributes(attributes);
1880 @SuppressWarnings(
"deprecation")
1881 private HashSet<String> getUniqueTagNames(
long artifactId) throws
TskCoreException {
1882 HashSet<String> uniqueTagNames =
new HashSet<>();
1884 String query =
"SELECT display_name, artifact_id FROM tag_names AS tn, blackboard_artifact_tags AS bat " +
1885 "WHERE tn.tag_name_id = bat.tag_name_id AND bat.artifact_id = " + artifactId;
1887 try (
CaseDbQuery dbQuery = skCase.executeQuery(query)) {
1888 ResultSet tagNameRows = dbQuery.getResultSet();
1889 while (tagNameRows.next()) {
1890 uniqueTagNames.add(tagNameRows.getString(
"display_name"));
1893 catch (TskCoreException | SQLException ex) {
1894 throw new TskCoreException(
"Error getting tag names for artifact: ", ex);
1897 return uniqueTagNames;
List< FileReportModule > fileModules
void checkIfTagHasImage(ContentTag contentTag)
static boolean thumbnailSupported(Content content)
List< ARTIFACT_TYPE > artifactTypes
void generateReport(String baseReportDir, ReportProgressPanel progressPanel)
BlackboardArtifact getArtifact()
HashSet< String > getTags()
static ARTIFACT_TYPE fromID(int ID)
List< BlackboardAttribute > getAttributes()
Map< Integer, String > getMappedAttributes()
TskData.TSK_DB_FILES_TYPE_ENUM getType()
int compareTo(ArtifactData otherArtifactData)
String getNameExtension()
List< TableReportModule > tableModules
synchronized String getUniquePath()
BlackboardArtifact getArtifact()
AbstractFile getAbstractFileById(long id)
List< String > getOrderedRowDataAsStrings()
TagsManager getTagsManager()
void checkIfFileIsImage(AbstractFile file)
boolean passesTagNamesFilter(String tagName)
void makeContentTagsTables()
SleuthkitCase getSleuthkitCase()
void checkIfTagHasImage(BlackboardArtifactTag artifactTag)
void updateStatusLabel(final String status)
List< AbstractFile > findAllFilesWhere(String sqlWhereClause)
void makeThumbnailTable()
void setMaximumProgress(final int max)
static Case getCurrentCase()
static void show(String title, String message, MessageType type, ActionListener actionListener)
BlackboardArtifact artifact
List< BlackboardAttribute > attributes
List< AbstractFile > getFiles()
void makeBlackboardArtifactTagsTables()
TSK_PROCESSOR_ARCHITECTURE
ArrayList< BlackboardAttribute > getGenInfoAttributes(ATTRIBUTE_TYPE attr_type)
void makeBlackboardArtifactTables()
void setIndeterminate(final boolean indeterminate)
HashSet< String > tagNamesFilter