19 package org.sleuthkit.autopsy.discovery.search;
 
   21 import com.google.common.collect.ImmutableSet;
 
   22 import java.util.ArrayList;
 
   23 import java.util.Arrays;
 
   24 import java.util.Collection;
 
   25 import java.util.Collections;
 
   26 import java.util.EnumSet;
 
   27 import java.util.List;
 
   29 import org.openide.util.NbBundle;
 
   52         "SearchData.prevNotable.displayName=Previously Notable",
 
   53         "SearchData.notPrevNotable.displayName=Previously Not Notable" 
   63             this.ranking = ranking;
 
   64             this.displayName = displayName;
 
   84         "SearchData.PageViews.rangeTemplate={0}-{1} page views",
 
   85         "SearchData.PageViews.over1000=1000+ page views" 
   99             this.maxValue = maxValue;
 
  100             this.minValue = minValue;
 
  106                 return Bundle.SearchData_PageViews_over1000();
 
  108                 return Bundle.SearchData_PageViews_rangeTemplate(Long.toString(minValue), Long.toString(maxValue));
 
  116             return count >= minValue && count <= maxValue;
 
  124                 if (view.covers(count)) {
 
  136         "SearchData.Frequency.unique.displayName=Unique (1)",
 
  137         "SearchData.Frequency.rare.displayName=Rare (2-10)",
 
  138         "SearchData.Frequency.common.displayName=Common (11 - 100)",
 
  139         "SearchData.Frequency.verycommon.displayName=Very Common (100+)",
 
  140         "SearchData.Frequency.known.displayName=Known (NSRL)",
 
  141         "SearchData.Frequency.unknown.displayName=Unknown",})
 
  143         UNIQUE(0, 1, Bundle.SearchData_Frequency_unique_displayName()),
 
  144         RARE(1, 10, Bundle.SearchData_Frequency_rare_displayName()),
 
  145         COMMON(2, 100, Bundle.SearchData_Frequency_common_displayName()),
 
  146         VERY_COMMON(3, 0, Bundle.SearchData_Frequency_verycommon_displayName()),
 
  147         KNOWN(4, 0, Bundle.SearchData_Frequency_known_displayName()),
 
  148         UNKNOWN(5, 0, Bundle.SearchData_Frequency_unknown_displayName());
 
  161         Frequency(
int ranking, 
int maxOccur, String displayName) {
 
  162             this.ranking = ranking;
 
  163             this.maxOccur = maxOccur;
 
  164             this.displayName = displayName;
 
  184             if (count <= UNIQUE.getMaxOccur()) {
 
  186             } 
else if (count <= RARE.getMaxOccur()) {
 
  188             } 
else if (count <= COMMON.getMaxOccur()) {
 
  201             return Arrays.asList(UNIQUE, RARE, COMMON, VERY_COMMON, KNOWN);
 
  211             return Arrays.asList(KNOWN, UNKNOWN);
 
  233         "SearchData.FileSize.XXLARGE.displayName=XXLarge",
 
  234         "SearchData.FileSize.XLARGE.displayName=XLarge",
 
  235         "SearchData.FileSize.LARGE.displayName=Large",
 
  236         "SearchData.FileSize.MEDIUM.displayName=Medium",
 
  237         "SearchData.FileSize.SMALL.displayName=Small",
 
  238         "SearchData.FileSize.XSMALL.displayName=XSmall",
 
  239         "SearchData.FileSize.10PlusGb=: 10GB+",
 
  240         "SearchData.FileSize.5gbto10gb=: 5-10GB",
 
  241         "SearchData.FileSize.1gbto5gb=: 1-5GB",
 
  242         "SearchData.FileSize.100mbto1gb=: 100MB-1GB",
 
  243         "SearchData.FileSize.200PlusMb=: 200MB+",
 
  244         "SearchData.FileSize.50mbto200mb=: 50-200MB",
 
  245         "SearchData.FileSize.500kbto100mb=: 500KB-100MB",
 
  246         "SearchData.FileSize.1mbto50mb=: 1-50MB",
 
  247         "SearchData.FileSize.100kbto1mb=: 100KB-1MB",
 
  248         "SearchData.FileSize.16kbto100kb=: 16-100KB",
 
  249         "SearchData.FileSize.upTo500kb=: 0-500KB",
 
  250         "SearchData.FileSize.upTo16kb=: 0-16KB",})
 
  252         XXLARGE_VIDEO(0, 10000 * BYTES_PER_MB, -1, Bundle.SearchData_FileSize_XXLARGE_displayName(), Bundle.SearchData_FileSize_10PlusGb()),
 
  253         XLARGE_VIDEO(1, 5000 * BYTES_PER_MB, 10000 * BYTES_PER_MB, Bundle.SearchData_FileSize_XLARGE_displayName(), Bundle.SearchData_FileSize_5gbto10gb()),
 
  254         LARGE_VIDEO(2, 1000 * BYTES_PER_MB, 5000 * BYTES_PER_MB, Bundle.SearchData_FileSize_LARGE_displayName(), Bundle.SearchData_FileSize_1gbto5gb()),
 
  255         MEDIUM_VIDEO(3, 100 * BYTES_PER_MB, 1000 * BYTES_PER_MB, Bundle.SearchData_FileSize_MEDIUM_displayName(), Bundle.SearchData_FileSize_100mbto1gb()),
 
  256         SMALL_VIDEO(4, 500000, 100 * BYTES_PER_MB, Bundle.SearchData_FileSize_SMALL_displayName(), Bundle.SearchData_FileSize_500kbto100mb()),
 
  257         XSMALL_VIDEO(5, 0, 500000, Bundle.SearchData_FileSize_XSMALL_displayName(), Bundle.SearchData_FileSize_upTo500kb()),
 
  258         XXLARGE_IMAGE(6, 200 * BYTES_PER_MB, -1, Bundle.SearchData_FileSize_XXLARGE_displayName(), Bundle.SearchData_FileSize_200PlusMb()),
 
  259         XLARGE_IMAGE(7, 50 * BYTES_PER_MB, 200 * BYTES_PER_MB, Bundle.SearchData_FileSize_XLARGE_displayName(), Bundle.SearchData_FileSize_50mbto200mb()),
 
  260         LARGE_IMAGE(8, 1 * BYTES_PER_MB, 50 * BYTES_PER_MB, Bundle.SearchData_FileSize_LARGE_displayName(), Bundle.SearchData_FileSize_1mbto50mb()),
 
  261         MEDIUM_IMAGE(9, 100000, 1 * BYTES_PER_MB, Bundle.SearchData_FileSize_MEDIUM_displayName(), Bundle.SearchData_FileSize_100kbto1mb()),
 
  262         SMALL_IMAGE(10, 16000, 100000, Bundle.SearchData_FileSize_SMALL_displayName(), Bundle.SearchData_FileSize_16kbto100kb()),
 
  263         XSMALL_IMAGE(11, 0, 16000, Bundle.SearchData_FileSize_XSMALL_displayName(), Bundle.SearchData_FileSize_upTo16kb());
 
  270         final static long NO_MAXIMUM = -1;
 
  282         FileSize(
int ranking, 
long minB, 
long maxB, String displayName, String displaySize) {
 
  283             this.ranking = ranking;
 
  284             this.minBytes = minB;
 
  286                 this.maxBytes = maxB;
 
  288                 this.maxBytes = NO_MAXIMUM;
 
  290             this.sizeGroup = displayName;
 
  291             this.displaySize = displaySize;
 
  303             if (size > XXLARGE_IMAGE.getMinBytes()) {
 
  304                 return XXLARGE_IMAGE;
 
  305             } 
else if (size > XLARGE_IMAGE.getMinBytes()) {
 
  307             } 
else if (size > LARGE_IMAGE.getMinBytes()) {
 
  309             } 
else if (size > MEDIUM_IMAGE.getMinBytes()) {
 
  311             } 
else if (size > SMALL_IMAGE.getMinBytes()) {
 
  327             if (size > XXLARGE_VIDEO.getMinBytes()) {
 
  328                 return XXLARGE_VIDEO;
 
  329             } 
else if (size > XLARGE_VIDEO.getMinBytes()) {
 
  331             } 
else if (size > LARGE_VIDEO.getMinBytes()) {
 
  333             } 
else if (size > MEDIUM_VIDEO.getMinBytes()) {
 
  335             } 
else if (size > SMALL_VIDEO.getMinBytes()) {
 
  371             return sizeGroup + displaySize;
 
  390             return Arrays.asList(XXLARGE_IMAGE, XLARGE_IMAGE, LARGE_IMAGE, MEDIUM_IMAGE, SMALL_IMAGE, XSMALL_IMAGE);
 
  399             return Arrays.asList(XXLARGE_VIDEO, XLARGE_VIDEO, LARGE_VIDEO, MEDIUM_VIDEO, SMALL_VIDEO, XSMALL_VIDEO);
 
  405             = 
new ImmutableSet.Builder<String>()
 
  410                             "application/xhtml+xml", 
 
  411                             "application/x-msoffice", 
 
  412                             "application/msword", 
 
  413                             "application/msword2", 
 
  414                             "application/vnd.wordperfect", 
 
  415                             "application/vnd.openxmlformats-officedocument.wordprocessingml.document", 
 
  416                             "application/vnd.ms-powerpoint", 
 
  417                             "application/vnd.openxmlformats-officedocument.presentationml.presentation", 
 
  418                             "application/vnd.ms-excel", 
 
  419                             "application/vnd.ms-excel.sheet.4", 
 
  420                             "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 
 
  421                             "application/vnd.oasis.opendocument.presentation", 
 
  422                             "application/vnd.oasis.opendocument.spreadsheet", 
 
  423                             "application/vnd.oasis.opendocument.text"  
  427             = 
new ImmutableSet.Builder<String>()
 
  428                     .add(
"application/pdf", 
 
  429                             "application/xhtml+xml").build(); 
 
  446         "SearchData.FileType.Audio.displayName=Audio",
 
  447         "SearchData.FileType.Video.displayName=Video",
 
  448         "SearchData.FileType.Image.displayName=Image",
 
  449         "SearchData.FileType.Documents.displayName=Document",
 
  450         "SearchData.FileType.Executables.displayName=Executable",
 
  451         "SearchData.AttributeType.Domain.displayName=Domain",
 
  452         "SearchData.FileType.Other.displayName=Other/Unknown"})
 
  461         OTHER(5, Bundle.SearchData_FileType_Other_displayName(), 
new ArrayList<>(), 
new ArrayList<>());
 
  478         Type(
int value, String displayName, Collection<String> mediaTypes, Collection<BlackboardArtifact.ARTIFACT_TYPE> artifactTypes) {
 
  479             this.ranking = value;
 
  480             this.displayName = displayName;
 
  481             this.mediaTypes = mediaTypes;
 
  482             this.artifactTypes = artifactTypes;
 
  491             return Collections.unmodifiableCollection(mediaTypes);
 
  500             return Collections.unmodifiableCollection(artifactTypes);
 
  523         "SearchData.Score.notable.displayName=Notable",
 
  524         "SearchData.Score.interesting.displayName=Interesting",
 
  525         "SearchData.Score.unknown.displayName=Unknown",})
 
  527         NOTABLE(0, Bundle.SearchData_Score_notable_displayName()),
 
  528         INTERESTING(1, Bundle.SearchData_Score_interesting_displayName()),
 
  529         UNKNOWN(2, Bundle.SearchData_Score_unknown_displayName());
 
  540         Score(
int ranking, String displayName) {
 
  541             this.ranking = ranking;
 
  542             this.displayName = displayName;
 
  560             return Arrays.asList(NOTABLE, INTERESTING);
 
static Collection< String > getDocTypesWithoutImageExtraction()
 
static List< FileSize > getDefaultSizeOptions()
 
Collection< String > getMediaTypes()
 
final Collection< String > mediaTypes
 
static FileSize fromVideoSize(long size)
 
static List< Score > getOptionsForFiltering()
 
static Frequency fromCount(long count)
 
Type(int value, String displayName, Collection< String > mediaTypes, Collection< BlackboardArtifact.ARTIFACT_TYPE > artifactTypes)
 
static final ImmutableSet< String > IMAGE_UNSUPPORTED_DOC_TYPES
 
Collection< BlackboardArtifact.ARTIFACT_TYPE > getArtifactTypes()
 
Frequency(int ranking, int maxOccur, String displayName)
 
static List< Frequency > getOptionsForFilteringWithCr()
 
final Collection< BlackboardArtifact.ARTIFACT_TYPE > artifactTypes
 
FileSize(int ranking, long minB, long maxB, String displayName, String displaySize)
 
static final long BYTES_PER_MB
 
PageViews(long minValue, long maxValue)
 
static final ImmutableSet< String > DOCUMENT_MIME_TYPES
 
boolean covers(long count)
 
static List< FileSize > getOptionsForVideos()
 
static List< Frequency > getOptionsForFilteringWithoutCr()
 
static FileSize fromImageSize(long size)
 
static PageViews fromPageViewCount(long count)
 
Score(int ranking, String displayName)
 
static final Set< BlackboardArtifact.ARTIFACT_TYPE > DOMAIN_ARTIFACT_TYPES
 
PreviouslyNotable(int ranking, String displayName)