From 0f0f7022b77f8f1515147c71cce53fd66f549adf Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 21 Sep 2020 13:57:11 -0400 Subject: [PATCH] 6865 fix alternate filter use for domains --- .../search/DomainSearchCacheLoader.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearchCacheLoader.java b/Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearchCacheLoader.java index 99948592bf..5388afc961 100755 --- a/Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearchCacheLoader.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearchCacheLoader.java @@ -59,23 +59,25 @@ class DomainSearchCacheLoader extends CacheLoader> load(SearchKey key) throws DiscoveryException, SQLException, TskCoreException { List domainResults = getResultDomainsFromDatabase(key); - + //manually add the attributes for filters which use alternate non filters and could be used by grouping or sorting + DiscoveryAttributes.FrequencyAttribute freqAttr = new DiscoveryAttributes.FrequencyAttribute(); + freqAttr.addAttributeToResults(domainResults, key.getSleuthkitCase(), key.getCentralRepository()); // Apply secondary in memory filters for (AbstractFilter filter : key.getFilters()) { if (filter.useAlternateFilter()) { domainResults = filter.applyAlternateFilter(domainResults, key.getSleuthkitCase(), key.getCentralRepository()); } } - + // Grouping by CR Frequency, for example, will require further processing // in order to make the correct decision. The attribute types that require // more information implement their logic by overriding `addAttributeToResults`. List searchAttributes = new ArrayList<>(); searchAttributes.add(key.getGroupAttributeType()); searchAttributes.addAll(key.getFileSortingMethod().getRequiredAttributes()); - + for (AttributeType attr : searchAttributes) { - attr.addAttributeToResults(domainResults, + attr.addAttributeToResults(domainResults, key.getSleuthkitCase(), key.getCentralRepository()); } @@ -244,11 +246,13 @@ class DomainSearchCacheLoader extends CacheLoader bannedDomains = new HashSet() {{ - add("localhost"); - add("127.0.0.1"); - }}; + + private final Set bannedDomains = new HashSet() { + { + add("localhost"); + add("127.0.0.1"); + } + }; /** * Construct a new DomainCallback object. @@ -267,13 +271,13 @@ class DomainSearchCacheLoader extends CacheLoader