Autopsy  4.20.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
SingleInterCaseCommonAttributeSearcher.java
Go to the documentation of this file.
1 /*
2  *
3  * Autopsy Forensic Browser
4  *
5  * Copyright 2018-2019 Basis Technology Corp.
6  * Contact: carrier <at> sleuthkit <dot> org
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */
20 package org.sleuthkit.autopsy.commonpropertiessearch;
21 
22 import java.sql.SQLException;
23 import java.util.HashSet;
24 import java.util.Map;
25 import java.util.Set;
26 import org.openide.util.NbBundle;
31 import org.sleuthkit.datamodel.TskCoreException;
33 import static org.sleuthkit.autopsy.commonpropertiessearch.AbstractCommonAttributeSearcher.MEDIA_PICS_VIDEO_MIME_TYPES;
34 
39 public class SingleInterCaseCommonAttributeSearcher extends InterCaseCommonAttributeSearcher {
40 
41  private final int corrleationCaseId;
42  private String correlationCaseName;
43 
54  public SingleInterCaseCommonAttributeSearcher(int correlationCaseId, boolean filterByMediaMimeType,
55  boolean filterByDocMimeType, Type corAttrType, int percentageThreshold) throws CentralRepoException {
56  super(filterByMediaMimeType, filterByDocMimeType, corAttrType, percentageThreshold);
57 
58  this.corrleationCaseId = correlationCaseId;
59  this.correlationCaseName = "";
60  }
61 
73  @Override
75 
76  CorrelationCase correlationCase = this.getCorrelationCaseFromId(this.corrleationCaseId);
77  this.correlationCaseName = correlationCase.getDisplayName();
78  InterCaseSearchResultsProcessor eamDbAttrInst = new InterCaseSearchResultsProcessor(this.corAttrType);
79  Set<String> mimeTypesToFilterOn = new HashSet<>();
80  if (isFilterByMedia()) {
81  mimeTypesToFilterOn.addAll(MEDIA_PICS_VIDEO_MIME_TYPES);
82  }
83  if (isFilterByDoc()) {
84  mimeTypesToFilterOn.addAll(TEXT_FILES_MIME_TYPES);
85  }
86  Map<Integer, CommonAttributeValueList> interCaseCommonFiles = eamDbAttrInst.findSingleInterCaseValuesByCount(Case.getCurrentCase(), mimeTypesToFilterOn, correlationCase);
87 
88  return new CommonAttributeCountSearchResults(interCaseCommonFiles, this.frequencyPercentageThreshold, this.corAttrType);
89  }
90 
102  @Override
104 
105  CorrelationCase correlationCase = this.getCorrelationCaseFromId(this.corrleationCaseId);
106  this.correlationCaseName = correlationCase.getDisplayName();
107  InterCaseSearchResultsProcessor eamDbAttrInst = new InterCaseSearchResultsProcessor(this.corAttrType);
108  Set<String> mimeTypesToFilterOn = new HashSet<>();
109  if (isFilterByMedia()) {
110  mimeTypesToFilterOn.addAll(MEDIA_PICS_VIDEO_MIME_TYPES);
111  }
112  if (isFilterByDoc()) {
113  mimeTypesToFilterOn.addAll(TEXT_FILES_MIME_TYPES);
114  }
115  Map<String, Map<String, CommonAttributeValueList>> interCaseCommonFiles = eamDbAttrInst.findSingleInterCaseValuesByCase(Case.getCurrentCase(), mimeTypesToFilterOn, correlationCase);
116 
117  return new CommonAttributeCaseSearchResults(interCaseCommonFiles, this.frequencyPercentageThreshold, this.corAttrType);
118  }
119 
120  @NbBundle.Messages({
121  "# {0} - case name",
122  "# {1} - attr type",
123  "# {2} - threshold string",
124  "SingleInterCaseCommonAttributeSearcher.buildTabTitle.titleInterSingle=Common Properties (Central Repository Case: {0}, {1}{2})"})
125 
126  @Override
127  String getTabTitle() {
128  String typeString = this.corAttrType.getDisplayName();
129  if (typeString.equals("Files")) {
130  typeString = this.buildCategorySelectionString();
131  }
132  return Bundle.SingleInterCaseCommonAttributeSearcher_buildTabTitle_titleInterSingle(this.correlationCaseName, typeString, this.getPercentThresholdString());
133  }
134 }
SingleInterCaseCommonAttributeSearcher(int correlationCaseId, boolean filterByMediaMimeType, boolean filterByDocMimeType, Type corAttrType, int percentageThreshold)

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