20 package org.sleuthkit.autopsy.commonpropertiessearch;
22 import java.sql.SQLException;
23 import java.util.ArrayList;
24 import java.util.List;
27 import java.util.TreeMap;
28 import java.util.stream.Collectors;
29 import java.util.stream.Stream;
30 import org.openide.util.NbBundle;
43 final int frequencyPercentageThreshold;
48 this.frequencyPercentageThreshold = percentageThreshold;
91 abstract String getTabTitle();
94 "AbstractCommonFilesMetadataBuilder.buildCategorySelectionString.doc=Documents",
95 "AbstractCommonFilesMetadataBuilder.buildCategorySelectionString.media=Media",
96 "AbstractCommonFilesMetadataBuilder.buildCategorySelectionString.all=All File Categories"
99 String buildCategorySelectionString() {
100 if (!this.isFilterByDoc() && !this.isFilterByMedia()) {
101 return Bundle.AbstractCommonFilesMetadataBuilder_buildCategorySelectionString_all();
103 List<String> filters =
new ArrayList<>();
104 if (this.isFilterByDoc()) {
105 filters.add(Bundle.AbstractCommonFilesMetadataBuilder_buildCategorySelectionString_doc());
107 if (this.isFilterByMedia()) {
108 filters.add(Bundle.AbstractCommonFilesMetadataBuilder_buildCategorySelectionString_media());
110 return String.join(
", ", filters);
123 "# {0} - threshold percent",
124 "AbstractCommonFilesMetadataBuilder.getPercentFilter.thresholdPercent=, Threshold {0}%"})
125 String getPercentThresholdString() {
126 if (frequencyPercentageThreshold == 0) {
129 return Bundle.AbstractCommonFilesMetadataBuilder_getPercentFilter_thresholdPercent(frequencyPercentageThreshold);
133 static TreeMap<Integer, CommonAttributeValueList> collateMatchesByNumberOfInstances(Map<String, CommonAttributeValue> commonFiles) {
135 TreeMap<Integer, CommonAttributeValueList> instanceCollatedCommonFiles =
new TreeMap<>();
137 for (CommonAttributeValue md5Metadata : commonFiles.values()) {
138 Integer size = md5Metadata.getNumberOfDataSourcesInCurrentCase();
140 if (instanceCollatedCommonFiles.containsKey(size)) {
141 instanceCollatedCommonFiles.get(size).addMetadataToList(md5Metadata);
143 CommonAttributeValueList value =
new CommonAttributeValueList();
144 value.addMetadataToList(md5Metadata);
145 instanceCollatedCommonFiles.put(size, value);
148 return instanceCollatedCommonFiles;
158 static final Set<String> MEDIA_PICS_VIDEO_MIME_TYPES = Stream.of(
164 "image/vnd.adobe.photoshop",
179 "application/vnd.ms-asf",
180 "application/vnd.rn-realmedia",
181 "application/x-shockwave-flash"
182 ).collect(Collectors.toSet());
191 static final Set<String> TEXT_FILES_MIME_TYPES = Stream.of(
198 "application/javascript",
201 "application/x-msoffice",
202 "application/x-ooxml",
203 "application/msword",
204 "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
205 "application/vnd.ms-powerpoint",
206 "application/vnd.openxmlformats-officedocument.presentationml.presentation",
207 "application/vnd.ms-excel",
208 "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
209 "application/vnd.oasis.opendocument.presentation",
210 "application/vnd.oasis.opendocument.spreadsheet",
211 "application/vnd.oasis.opendocument.text"
212 ).collect(Collectors.toSet());
217 boolean isFilterByMedia() {
224 void setFilterByMedia(
boolean filterByMedia) {
231 boolean isFilterByDoc() {
238 void setFilterByDoc(
boolean filterByDoc) {
abstract CommonAttributeCountSearchResults findMatchesByCount()
abstract CommonAttributeCaseSearchResults findMatchesByCase()