mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 09:17:42 +00:00
Clean up from diff review, added in PageWorker and SearchWorker changes
This commit is contained in:
parent
62c97436d1
commit
bcce8133d9
@ -29,7 +29,6 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.openide.util.Exceptions;
|
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbUtil;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
||||||
|
@ -30,8 +30,6 @@ import java.util.Map;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.StringJoiner;
|
import java.util.StringJoiner;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
|
||||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNormalizationException;
|
|
||||||
import org.sleuthkit.autopsy.discovery.search.DiscoveryAttributes.AttributeType;
|
import org.sleuthkit.autopsy.discovery.search.DiscoveryAttributes.AttributeType;
|
||||||
import org.sleuthkit.autopsy.discovery.search.DiscoveryAttributes.DataSourceAttribute;
|
import org.sleuthkit.autopsy.discovery.search.DiscoveryAttributes.DataSourceAttribute;
|
||||||
import org.sleuthkit.autopsy.discovery.search.DiscoveryKeyUtils.GroupKey;
|
import org.sleuthkit.autopsy.discovery.search.DiscoveryKeyUtils.GroupKey;
|
||||||
@ -56,8 +54,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
class DomainSearchCacheLoader extends CacheLoader<SearchKey, Map<GroupKey, List<Result>>> {
|
class DomainSearchCacheLoader extends CacheLoader<SearchKey, Map<GroupKey, List<Result>>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<GroupKey, List<Result>> load(SearchKey key) throws DiscoveryException, SQLException, TskCoreException,
|
public Map<GroupKey, List<Result>> load(SearchKey key) throws DiscoveryException, SQLException, TskCoreException {
|
||||||
CentralRepoException, CorrelationAttributeNormalizationException {
|
|
||||||
|
|
||||||
List<Result> domainResults = getResultDomainsFromDatabase(key);
|
List<Result> domainResults = getResultDomainsFromDatabase(key);
|
||||||
|
|
||||||
@ -134,9 +131,15 @@ class DomainSearchCacheLoader extends CacheLoader<SearchKey, Map<GroupKey, List<
|
|||||||
/*SELECT */" domain," +
|
/*SELECT */" domain," +
|
||||||
" MIN(date) AS activity_start," +
|
" MIN(date) AS activity_start," +
|
||||||
" MAX(date) AS activity_end," +
|
" MAX(date) AS activity_end," +
|
||||||
" SUM(CASE WHEN artifact_type_id = " + TSK_WEB_DOWNLOAD.getTypeID() + " THEN 1 ELSE 0 END) AS fileDownloads," +
|
" SUM(CASE " +
|
||||||
" SUM(CASE WHEN artifact_type_id = " + TSK_WEB_HISTORY.getTypeID() + " AND" +
|
" WHEN artifact_type_id = " + TSK_WEB_DOWNLOAD.getTypeID() + " THEN 1 " +
|
||||||
" date BETWEEN " + sixtyDaysAgo.getEpochSecond() + " AND " + currentTime.getEpochSecond() + " THEN 1 ELSE 0 END) AS last60," +
|
" ELSE 0 " +
|
||||||
|
" END) AS fileDownloads," +
|
||||||
|
" SUM(CASE " +
|
||||||
|
" WHEN artifact_type_id = " + TSK_WEB_HISTORY.getTypeID() + " AND" +
|
||||||
|
" date BETWEEN " + sixtyDaysAgo.getEpochSecond() + " AND " + currentTime.getEpochSecond() + " THEN 1 " +
|
||||||
|
" ELSE 0 " +
|
||||||
|
" END) AS last60," +
|
||||||
" data_source_obj_id AS dataSource " +
|
" data_source_obj_id AS dataSource " +
|
||||||
|
|
||||||
"FROM blackboard_artifacts" +
|
"FROM blackboard_artifacts" +
|
||||||
@ -171,11 +174,10 @@ class DomainSearchCacheLoader extends CacheLoader<SearchKey, Map<GroupKey, List<
|
|||||||
* transformation process to be conditional. The date time filter is a good
|
* transformation process to be conditional. The date time filter is a good
|
||||||
* example of the type of conditional handling that follows in the method
|
* example of the type of conditional handling that follows in the method
|
||||||
* below. If no dateTime filter is supplied, then in order for the query to
|
* below. If no dateTime filter is supplied, then in order for the query to
|
||||||
* be correct, an special clause needs to be added in.
|
* be correct, an additional clause needs to be added in.
|
||||||
*
|
*
|
||||||
* @return The whereClause and havingClause as a pair. These methods were
|
* @return The whereClause and havingClause as a pair. These methods are one
|
||||||
* combined into one in order to stress that these clauses are tightly
|
* to stress that these clauses are tightly coupled.
|
||||||
* coupled.
|
|
||||||
*/
|
*/
|
||||||
Pair<String, String> createWhereAndHavingClause(List<AbstractFilter> filters) {
|
Pair<String, String> createWhereAndHavingClause(List<AbstractFilter> filters) {
|
||||||
final StringJoiner whereClause = new StringJoiner(" OR ");
|
final StringJoiner whereClause = new StringJoiner(" OR ");
|
||||||
|
@ -126,7 +126,8 @@ public class SearchFiltering {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A filter to specify date range for artifacts.
|
* A filter to specify date range for artifacts, start and end times should
|
||||||
|
* be in epoch seconds.
|
||||||
*/
|
*/
|
||||||
public static class ArtifactDateRangeFilter extends AbstractFilter {
|
public static class ArtifactDateRangeFilter extends AbstractFilter {
|
||||||
|
|
||||||
|
@ -91,7 +91,8 @@ final class PageWorker extends SwingWorker<Void, Void> {
|
|||||||
try {
|
try {
|
||||||
// Run the search
|
// Run the search
|
||||||
if (resultType == SearchData.Type.DOMAIN) {
|
if (resultType == SearchData.Type.DOMAIN) {
|
||||||
results.addAll(DomainSearch.getDomainsInGroup(System.getProperty(USER_NAME_PROPERTY), searchfilters,
|
DomainSearch domainSearch = new DomainSearch();
|
||||||
|
results.addAll(domainSearch.getDomainsInGroup(System.getProperty(USER_NAME_PROPERTY), searchfilters,
|
||||||
groupingAttribute,
|
groupingAttribute,
|
||||||
groupSort,
|
groupSort,
|
||||||
fileSortMethod, groupKey, startingEntry, pageSize,
|
fileSortMethod, groupKey, startingEntry, pageSize,
|
||||||
|
@ -76,7 +76,8 @@ final class SearchWorker extends SwingWorker<Void, Void> {
|
|||||||
try {
|
try {
|
||||||
// Run the search
|
// Run the search
|
||||||
if (searchType == SearchData.Type.DOMAIN) {
|
if (searchType == SearchData.Type.DOMAIN) {
|
||||||
results.putAll(DomainSearch.getGroupSizes(System.getProperty(USER_NAME_PROPERTY), filters,
|
DomainSearch domainSearch = new DomainSearch();
|
||||||
|
results.putAll(domainSearch.getGroupSizes(System.getProperty(USER_NAME_PROPERTY), filters,
|
||||||
groupingAttr,
|
groupingAttr,
|
||||||
groupSortAlgorithm,
|
groupSortAlgorithm,
|
||||||
fileSort,
|
fileSort,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user