Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
ExportAnalysisResults.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2021 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.report.modules.datasourcesummaryexport;
20 
21 import java.util.Arrays;
22 import java.util.List;
23 import java.util.stream.Collectors;
24 import java.util.stream.Stream;
25 import org.apache.commons.lang3.tuple.Pair;
26 import org.openide.util.NbBundle.Messages;
31 import org.sleuthkit.datamodel.DataSource;
32 
37 @Messages({
38  "ExportAnalysisResults_keyColumn_title=Name",
39  "ExportAnalysisResults_countColumn_title=Count",
40  "ExportAnalysisResults_keywordSearchModuleName=Keyword Search",
41  "ExportAnalysisResults_hashsetHits_tabName=Hashset Hits",
42  "ExportAnalysisResults_keywordHits_tabName=Keyword Hits",
43  "ExportAnalysisResults_interestingItemHits_tabName=Interesting Item Hits",})
44 class ExportAnalysisResults {
45 
46  // Default Column definitions for each table
47  private static final List<ColumnModel<Pair<String, Long>, DefaultCellModel<?>>> DEFAULT_COLUMNS = Arrays.asList(
48  new ColumnModel<>(
49  Bundle.ExportAnalysisResults_keyColumn_title(),
50  (pair) -> new DefaultCellModel<>(pair.getKey()),
51  300
52  ),
53  new ColumnModel<>(
54  Bundle.ExportAnalysisResults_countColumn_title(),
55  (pair) -> new DefaultCellModel<>(pair.getValue()),
56  100
57  )
58  );
59 
60  private final AnalysisSummary analysisSummary;
61 
62  ExportAnalysisResults() {
63  analysisSummary = new AnalysisSummary();
64  }
65 
66  List<ExcelSheetExport> getExports(DataSource dataSource) {
67 
68  DataFetcher<DataSource, List<Pair<String, Long>>> hashsetsFetcher = (ds) -> analysisSummary.getHashsetCounts(ds);
69  DataFetcher<DataSource, List<Pair<String, Long>>> keywordsFetcher = (ds) -> analysisSummary.getKeywordCounts(ds);
70  DataFetcher<DataSource, List<Pair<String, Long>>> interestingItemsFetcher = (ds) -> analysisSummary.getInterestingItemCounts(ds);
71 
72  return Stream.of(
73  getTableExport(hashsetsFetcher, DEFAULT_COLUMNS, Bundle.ExportAnalysisResults_hashsetHits_tabName(), dataSource),
74  getTableExport(keywordsFetcher, DEFAULT_COLUMNS, Bundle.ExportAnalysisResults_keywordHits_tabName(), dataSource),
75  getTableExport(interestingItemsFetcher, DEFAULT_COLUMNS, Bundle.ExportAnalysisResults_interestingItemHits_tabName(), dataSource))
76  .filter(sheet -> sheet != null)
77  .collect(Collectors.toList());
78  }
79 }

Copyright © 2012-2022 Basis Technology. Generated on: Tue Jun 27 2023
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.