mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
minor changes and refactoring
This commit is contained in:
parent
983cf3352a
commit
e73863fce7
@ -40,7 +40,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
/**
|
||||
* Providing data for the data source analysis tab.
|
||||
*/
|
||||
public class AnalysisSummary implements DataSourceSummaryDataModel {
|
||||
public class AnalysisSummary implements EventUpdateGovernor {
|
||||
|
||||
private static final BlackboardAttribute.Type TYPE_SET_NAME = new BlackboardAttribute.Type(ATTRIBUTE_TYPE.TSK_SET_NAME);
|
||||
|
||||
|
@ -32,7 +32,7 @@ import org.sleuthkit.datamodel.TskData;
|
||||
/**
|
||||
* Provides methods to query for data source overview details.
|
||||
*/
|
||||
public class ContainerSummary implements DataSourceSummaryDataModel {
|
||||
public class ContainerSummary implements EventUpdateGovernor {
|
||||
private static final Set<Integer> ARTIFACT_UPDATE_TYPE_IDS = new HashSet<>(Arrays.asList(
|
||||
BlackboardArtifact.ARTIFACT_TYPE.TSK_OS_INFO.getTypeID(),
|
||||
BlackboardArtifact.ARTIFACT_TYPE.TSK_DATA_SOURCE_USAGE.getTypeID()
|
||||
|
@ -23,9 +23,11 @@ import java.util.Set;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
|
||||
/**
|
||||
* Interface for data model classes in data source summary.
|
||||
* Interface for determiining when data should update based on autopsy (i.e.
|
||||
* case/ingest) events.
|
||||
*/
|
||||
public interface DataSourceSummaryDataModel {
|
||||
public interface EventUpdateGovernor {
|
||||
|
||||
/**
|
||||
* @return The set of Case Events for which data should be updated.
|
||||
*/
|
||||
@ -34,14 +36,16 @@ public interface DataSourceSummaryDataModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The set of BlackboardArtifact id's for which data shoulde be updated.
|
||||
*/
|
||||
* @return The set of BlackboardArtifact id's for which data shoulde be
|
||||
* updated.
|
||||
*/
|
||||
default Set<Integer> getArtifactIdUpdates() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Whether or not the content should be updated on receiving new content.
|
||||
*
|
||||
* @return True if it should refresh on new content.
|
||||
*/
|
||||
default boolean shouldRefreshOnNewContent() {
|
@ -28,7 +28,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
/**
|
||||
* Provides methods to query for datasource files by mime type.
|
||||
*/
|
||||
public class MimeTypeSummary implements DataSourceSummaryDataModel {
|
||||
public class MimeTypeSummary implements EventUpdateGovernor {
|
||||
|
||||
private final SleuthkitCaseProvider provider;
|
||||
|
||||
|
@ -43,7 +43,7 @@ import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
|
||||
/**
|
||||
* Helper class for getting data for the Recent Files Data Summary tab.
|
||||
*/
|
||||
public class RecentFilesSummary implements DataSourceSummaryDataModel {
|
||||
public class RecentFilesSummary implements EventUpdateGovernor {
|
||||
|
||||
private final static BlackboardAttribute.Type DATETIME_ACCESSED_ATT = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_ACCESSED);
|
||||
private final static BlackboardAttribute.Type DOMAIN_ATT = new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN);
|
||||
|
@ -42,7 +42,7 @@ import org.sleuthkit.datamodel.TskCoreException;
|
||||
/**
|
||||
* Provides information to populate Top Programs Summary queries.
|
||||
*/
|
||||
public class TopProgramsSummary implements DataSourceSummaryDataModel {
|
||||
public class TopProgramsSummary implements EventUpdateGovernor {
|
||||
|
||||
private static final Set<Integer> ARTIFACT_UPDATE_TYPE_IDS = new HashSet<>(Arrays.asList(
|
||||
ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID()
|
||||
|
@ -27,7 +27,7 @@ import org.sleuthkit.datamodel.TskData;
|
||||
/**
|
||||
* Provides information for the DataSourceSummaryCountsPanel.
|
||||
*/
|
||||
public class TypesSummary implements DataSourceSummaryDataModel {
|
||||
public class TypesSummary implements EventUpdateGovernor {
|
||||
|
||||
private final SleuthkitCaseProvider provider;
|
||||
|
||||
|
@ -47,7 +47,7 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
|
||||
* time, the data being provided for domains is fictitious and is done as a
|
||||
* placeholder.
|
||||
*/
|
||||
public class UserActivitySummary implements DataSourceSummaryDataModel {
|
||||
public class UserActivitySummary implements EventUpdateGovernor {
|
||||
|
||||
private static final BlackboardArtifact.Type TYPE_DEVICE_ATTACHED = new BlackboardArtifact.Type(ARTIFACT_TYPE.TSK_DEVICE_ATTACHED);
|
||||
|
||||
|
@ -30,7 +30,6 @@ import java.util.stream.Stream;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingWorker;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.DataSourceSummaryDataModel;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.DataFetchResult;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.DataFetchWorker;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.uiutils.DataFetchWorker.DataFetchComponents;
|
||||
@ -41,6 +40,7 @@ import org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent;
|
||||
import org.sleuthkit.autopsy.ingest.ModuleContentEvent;
|
||||
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
|
||||
import org.sleuthkit.datamodel.DataSource;
|
||||
import org.sleuthkit.autopsy.datasourcesummary.datamodel.EventUpdateGovernor;
|
||||
|
||||
/**
|
||||
* Base class from which other tabs in data source summary derive.
|
||||
@ -95,11 +95,10 @@ abstract class BaseDataSourceSummaryPanel extends JPanel {
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
protected BaseDataSourceSummaryPanel(DataSourceSummaryDataModel...dataModels) {
|
||||
this(
|
||||
getUnionSet(DataSourceSummaryDataModel::getCaseEventUpdates, dataModels),
|
||||
getUnionSet(DataSourceSummaryDataModel::getArtifactIdUpdates, dataModels),
|
||||
Stream.of(dataModels).anyMatch(DataSourceSummaryDataModel::shouldRefreshOnNewContent)
|
||||
protected BaseDataSourceSummaryPanel(EventUpdateGovernor...dataModels) {
|
||||
this(getUnionSet(EventUpdateGovernor::getCaseEventUpdates, dataModels),
|
||||
getUnionSet(EventUpdateGovernor::getArtifactIdUpdates, dataModels),
|
||||
Stream.of(dataModels).anyMatch(EventUpdateGovernor::shouldRefreshOnNewContent)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package org.sleuthkit.autopsy.datasourcesummary.ui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author gregd
|
||||
*/
|
||||
public class EventUpdateHandler {
|
||||
|
||||
}
|
@ -113,6 +113,7 @@ public final class RecentFilesPanel extends BaseDataSourceSummaryPanel {
|
||||
JTablePanel<RecentFileDetails> pane = (JTablePanel<RecentFileDetails>) openedDocPane;
|
||||
pane.setModel(tableModel);
|
||||
pane.setColumnModel(JTablePanel.getTableColumnModel(list));
|
||||
pane.setKeyFunction((recentFile) -> recentFile.getPath());
|
||||
tablePanelList.add(pane);
|
||||
|
||||
DataFetchWorker.DataFetchComponents<DataSource, List<RecentFileDetails>> worker
|
||||
@ -147,6 +148,7 @@ public final class RecentFilesPanel extends BaseDataSourceSummaryPanel {
|
||||
|
||||
JTablePanel<RecentDownloadDetails> pane = (JTablePanel<RecentDownloadDetails>) downloadsPane;
|
||||
pane.setModel(tableModel);
|
||||
pane.setKeyFunction((download) -> download.getPath());
|
||||
pane.setColumnModel(JTablePanel.getTableColumnModel(list));
|
||||
tablePanelList.add(pane);
|
||||
|
||||
@ -182,6 +184,7 @@ public final class RecentFilesPanel extends BaseDataSourceSummaryPanel {
|
||||
|
||||
JTablePanel<RecentAttachmentDetails> pane = (JTablePanel<RecentAttachmentDetails>) attachmentsPane;
|
||||
pane.setModel(tableModel);
|
||||
pane.setKeyFunction((attachment) -> attachment.getPath());
|
||||
pane.setColumnModel(JTablePanel.getTableColumnModel(list));
|
||||
tablePanelList.add(pane);
|
||||
|
||||
|
@ -116,7 +116,8 @@ public class UserActivityPanel extends BaseDataSourceSummaryPanel {
|
||||
Bundle.UserActivityPanel_TopProgramsTableModel_lastrun_header(),
|
||||
(prog) -> new DefaultCellModel(getFormatted(prog.getLastRun())),
|
||||
150)
|
||||
));
|
||||
))
|
||||
.setKeyFunction((prog) -> prog.getProgramPath() + prog.getProgramName());
|
||||
|
||||
// set up recent domains table
|
||||
private final JTablePanel<TopDomainsResult> recentDomainsTable = JTablePanel.getJTablePanel(Arrays.asList(
|
||||
@ -135,7 +136,8 @@ public class UserActivityPanel extends BaseDataSourceSummaryPanel {
|
||||
Bundle.UserActivityPanel_TopDomainsTableModel_lastAccess_header(),
|
||||
(recentDomain) -> new DefaultCellModel(getFormatted(recentDomain.getLastVisit())),
|
||||
150)
|
||||
));
|
||||
))
|
||||
.setKeyFunction((domain) -> domain.getDomain());
|
||||
|
||||
// top web searches table
|
||||
private final JTablePanel<TopWebSearchResult> topWebSearchesTable = JTablePanel.getJTablePanel(Arrays.asList(
|
||||
@ -157,7 +159,8 @@ public class UserActivityPanel extends BaseDataSourceSummaryPanel {
|
||||
(webSearch) -> new DefaultCellModel(webSearch.getTranslatedResult()),
|
||||
250
|
||||
)
|
||||
));
|
||||
))
|
||||
.setKeyFunction((query) -> query.getSearchString());
|
||||
|
||||
// top devices attached table
|
||||
private final JTablePanel<TopDeviceAttachedResult> topDevicesAttachedTable = JTablePanel.getJTablePanel(Arrays.asList(
|
||||
@ -186,7 +189,8 @@ public class UserActivityPanel extends BaseDataSourceSummaryPanel {
|
||||
},
|
||||
250
|
||||
)
|
||||
));
|
||||
))
|
||||
.setKeyFunction((topDevice) -> topDevice.getDeviceId());
|
||||
|
||||
// top accounts table
|
||||
private final JTablePanel<TopAccountResult> topAccountsTable = JTablePanel.getJTablePanel(Arrays.asList(
|
||||
@ -202,7 +206,8 @@ public class UserActivityPanel extends BaseDataSourceSummaryPanel {
|
||||
(account) -> new DefaultCellModel(getFormatted(account.getLastAccess())),
|
||||
150
|
||||
)
|
||||
));
|
||||
))
|
||||
.setKeyFunction((topAccount) -> topAccount.getAccountType());
|
||||
|
||||
private final List<JTablePanel<?>> tables = Arrays.asList(
|
||||
topProgramsTable,
|
||||
|
Loading…
x
Reference in New Issue
Block a user