mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Merge branch '6714-displayDomainGroups-with6713' of https://github.com/wschaeferB/autopsy into 6715-DomainSummaryDisplay-Integrated
This commit is contained in:
commit
9b105b10c8
@ -278,21 +278,6 @@ public class DiscoveryAttributes {
|
||||
currentFiles.clear();
|
||||
}
|
||||
} else {
|
||||
ResultDomain domain = (ResultDomain) result;
|
||||
try {
|
||||
CorrelationAttributeInstance.Type domainAttributeType
|
||||
= centralRepoDb.getCorrelationTypeById(CorrelationAttributeInstance.DOMAIN_TYPE_ID);
|
||||
Long count = centralRepoDb.getCountArtifactInstancesByTypeValue(domainAttributeType, domain.getDomain());
|
||||
domain.setFrequency(SearchData.Frequency.fromCount(count));
|
||||
} catch (CentralRepoException ex) {
|
||||
throw new DiscoveryException("Error encountered querying the central repository.", ex);
|
||||
} catch (CorrelationAttributeNormalizationException ex) {
|
||||
logger.log(Level.INFO, "Domain [%s] could not be normalized for central repository querying, skipping...", domain.getDomain());
|
||||
}
|
||||
}
|
||||
|
||||
if (hashesToLookUp.size() >= BATCH_SIZE) {
|
||||
computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
|
||||
ResultDomain domainInstance = (ResultDomain) result;
|
||||
domainsToQuery.add(domainInstance);
|
||||
|
||||
@ -319,7 +304,7 @@ public class DiscoveryAttributes {
|
||||
final StringJoiner joiner = new StringJoiner(", ");
|
||||
|
||||
final CorrelationAttributeInstance.Type attributeType = centralRepository.getCorrelationTypeById(CorrelationAttributeInstance.DOMAIN_TYPE_ID);
|
||||
for(ResultDomain domainInstance : domainsToQuery) {
|
||||
for (ResultDomain domainInstance : domainsToQuery) {
|
||||
try {
|
||||
final String domainValue = domainInstance.getDomain();
|
||||
final String normalizedDomain = CorrelationAttributeNormalizer.normalize(attributeType, domainValue);
|
||||
@ -333,10 +318,10 @@ public class DiscoveryAttributes {
|
||||
}
|
||||
|
||||
final String tableName = CentralRepoDbUtil.correlationTypeToInstanceTableName(attributeType);
|
||||
final String domainFrequencyQuery = " value AS domain_name, COUNT(*) AS frequency " +
|
||||
"FROM " + tableName + " " +
|
||||
"WHERE value IN (" + joiner + ") " +
|
||||
"GROUP BY value";
|
||||
final String domainFrequencyQuery = " value AS domain_name, COUNT(*) AS frequency "
|
||||
+ "FROM " + tableName + " "
|
||||
+ "WHERE value IN (" + joiner + ") "
|
||||
+ "GROUP BY value";
|
||||
|
||||
final DomainFrequencyCallback frequencyCallback = new DomainFrequencyCallback(resultDomainTable);
|
||||
centralRepository.processSelectClause(domainFrequencyQuery, frequencyCallback);
|
||||
@ -366,7 +351,7 @@ public class DiscoveryAttributes {
|
||||
Long frequency = resultSet.getLong("frequency");
|
||||
|
||||
List<ResultDomain> domainInstances = domainLookup.get(domain);
|
||||
for(ResultDomain domainInstance : domainInstances) {
|
||||
for (ResultDomain domainInstance : domainInstances) {
|
||||
domainInstance.setFrequency(SearchData.Frequency.fromCount(frequency));
|
||||
}
|
||||
}
|
||||
@ -733,7 +718,7 @@ public class DiscoveryAttributes {
|
||||
FILE_TAG(new FileTagAttribute(), Bundle.DiscoveryAttributes_GroupingAttributeType_tag_displayName()),
|
||||
OBJECT_DETECTED(new ObjectDetectedAttribute(), Bundle.DiscoveryAttributes_GroupingAttributeType_object_displayName()),
|
||||
MOST_RECENT_DATE(new MostRecentActivityDateAttribute(), Bundle.DiscoveryAttributes_GroupingAttributeType_mostRecentDate_displayName()),
|
||||
FIRST_DATE(new MostRecentActivityDateAttribute(), Bundle.DiscoveryAttributes_GroupingAttributeType_firstDate_displayName()),
|
||||
FIRST_DATE(new FirstActivityDateAttribute(), Bundle.DiscoveryAttributes_GroupingAttributeType_firstDate_displayName()),
|
||||
NO_GROUPING(new NoGroupingAttribute(), Bundle.DiscoveryAttributes_GroupingAttributeType_none_displayName());
|
||||
|
||||
private final AttributeType attributeType;
|
||||
|
@ -22,6 +22,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
@ -166,6 +167,7 @@ public class DiscoveryKeyUtils {
|
||||
|
||||
/**
|
||||
* Get the fileSorting
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ResultsSorter.SortingMethod getFileSortingMethod() {
|
||||
@ -938,6 +940,9 @@ public class DiscoveryKeyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Key representing a date of most recent activity.
|
||||
*/
|
||||
static class MostRecentActivityDateGroupKey extends GroupKey {
|
||||
|
||||
private final Long epochDate;
|
||||
@ -1020,6 +1025,9 @@ public class DiscoveryKeyUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Key representing a date of first activity.
|
||||
*/
|
||||
static class FirstActivityDateGroupKey extends GroupKey {
|
||||
|
||||
private final Long epochDate;
|
||||
@ -1030,7 +1038,7 @@ public class DiscoveryKeyUtils {
|
||||
FirstActivityDateGroupKey(Result result) {
|
||||
if (result instanceof ResultDomain) {
|
||||
epochDate = ((ResultDomain) result).getActivityStart();
|
||||
dateNameString = new SimpleDateFormat("yyyy/MM/dd").format(new Date(TimeUnit.SECONDS.toMillis(epochDate)));
|
||||
dateNameString = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()).format(new Date(TimeUnit.SECONDS.toMillis(epochDate)));
|
||||
} else {
|
||||
epochDate = Long.MAX_VALUE;
|
||||
dateNameString = Bundle.DiscoveryKeyUtils_FirstActivityDateGroupKey_noDate();
|
||||
|
@ -36,8 +36,8 @@ import org.sleuthkit.datamodel.SleuthkitCase;
|
||||
class DomainSearchCache {
|
||||
|
||||
private static final int MAXIMUM_CACHE_SIZE = 10;
|
||||
private static final LoadingCache<SearchKey, Map<GroupKey, List<Result>>> cache =
|
||||
CacheBuilder.newBuilder()
|
||||
private static final LoadingCache<SearchKey, Map<GroupKey, List<Result>>> cache
|
||||
= CacheBuilder.newBuilder()
|
||||
.maximumSize(MAXIMUM_CACHE_SIZE)
|
||||
.build(new DomainSearchCacheLoader());
|
||||
|
||||
@ -57,7 +57,7 @@ class DomainSearchCache {
|
||||
groupSortingType, domainSortingMethod, caseDb, centralRepoDb);
|
||||
|
||||
return cache.get(searchKey);
|
||||
} catch (Throwable ex) {
|
||||
} catch (ExecutionException ex) {
|
||||
throw new DiscoveryException("Error fetching results from cache", ex.getCause());
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import javax.swing.DefaultListModel;
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.discovery.search.SearchData;
|
||||
import org.sleuthkit.autopsy.discovery.search.SearchFiltering.ArtifactTypeFilter;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
@ -133,10 +134,11 @@ class ArtifactTypeFilterPanel extends AbstractDiscoveryFilterPanel {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NbBundle.Messages({"ArtifactTypeFilterPanel.selectionNeeded.text=At least one Result type must be selected."})
|
||||
@Override
|
||||
String checkForError() {
|
||||
if (artifactTypeCheckbox.isSelected() && artifactList.getSelectedValuesList().isEmpty()) {
|
||||
return "At least one Result type must be selected.";
|
||||
return Bundle.ArtifactTypeFilterPanel_selectionNeeded_text();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -278,13 +278,15 @@ class DateFilterPanel extends AbstractDiscoveryFilterPanel {
|
||||
}
|
||||
}
|
||||
|
||||
@NbBundle.Messages({"DateFilterPanel.invalidRange.text=Range or Only Last must be selected",
|
||||
"DateFilterPanel.startOrEndNeeded.text=A start or end date must be specified to use the range filter"})
|
||||
@Override
|
||||
String checkForError() {
|
||||
if (dateFilterCheckBox.isSelected()) {
|
||||
if (!(rangeRadioButton.isSelected() || mostRecentRadioButton.isSelected())) {
|
||||
return "Range or Only Last must be selected";
|
||||
return Bundle.DateFilterPanel_invalidRange_text();
|
||||
} else if (rangeRadioButton.isSelected() && !(startCheckBox.isSelected() || endCheckBox.isSelected())) {
|
||||
return "A start or end date must be specified to use the range filter";
|
||||
return Bundle.DateFilterPanel_startOrEndNeeded_text();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
@ -292,7 +294,6 @@ class DateFilterPanel extends AbstractDiscoveryFilterPanel {
|
||||
|
||||
@Override
|
||||
AbstractFilter getFilter() {
|
||||
|
||||
if (dateFilterCheckBox.isSelected()) {
|
||||
LocalDate startDate = LocalDate.MIN;
|
||||
LocalDate endDate = LocalDate.MAX;
|
||||
|
Loading…
x
Reference in New Issue
Block a user