19 package org.sleuthkit.autopsy.datasourcesummary.ui;
21 import java.awt.Component;
22 import java.text.DateFormat;
23 import java.text.SimpleDateFormat;
24 import java.util.Arrays;
25 import java.util.Date;
26 import java.util.List;
27 import java.util.Locale;
28 import org.apache.commons.lang.StringUtils;
29 import org.openide.util.NbBundle.Messages;
49 "UserActivityPanel_tab_title=User Activity",
50 "UserActivityPanel_TopProgramsTableModel_name_header=Program",
51 "UserActivityPanel_TopProgramsTableModel_folder_header=Folder",
52 "UserActivityPanel_TopProgramsTableModel_count_header=Run Times",
53 "UserActivityPanel_TopProgramsTableModel_lastrun_header=Last Run",
54 "UserActivityPanel_TopDomainsTableModel_domain_header=Domain",
55 "UserActivityPanel_TopDomainsTableModel_count_header=Visits",
56 "UserActivityPanel_TopDomainsTableModel_lastAccess_header=Last Accessed",
57 "UserActivityPanel_TopWebSearchTableModel_searchString_header=Search String",
58 "UserActivityPanel_TopWebSearchTableModel_dateAccessed_header=Date Accessed",
59 "UserActivityPanel_TopWebSearchTableModel_translatedResult_header=Translated",
60 "UserActivityPanel_TopDeviceAttachedTableModel_deviceId_header=Device Id",
61 "UserActivityPanel_TopDeviceAttachedTableModel_makeModel_header=Make and Model",
62 "UserActivityPanel_TopDeviceAttachedTableModel_dateAccessed_header=Last Accessed",
63 "UserActivityPanel_TopAccountTableModel_accountType_header=Account Type",
64 "UserActivityPanel_TopAccountTableModel_lastAccess_header=Last Accessed",
65 "UserActivityPanel_noDataExists=No communication data exists"})
68 private static final long serialVersionUID = 1L;
69 private static final DateFormat DATETIME_FORMAT =
new SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss", Locale.getDefault());
70 private static final int TOP_PROGS_COUNT = 10;
71 private static final int TOP_DOMAINS_COUNT = 10;
72 private static final int TOP_SEARCHES_COUNT = 10;
73 private static final int TOP_ACCOUNTS_COUNT = 5;
74 private static final int TOP_DEVICES_COUNT = 10;
75 private static final String ANDROID_FACTORY =
"org.python.proxies.module$AndroidModuleFactory";
76 private static final String ANDROID_MODULE_NAME =
"Android Analyzer";
86 return date == null ?
"" : DATETIME_FORMAT.format(date);
93 Bundle.UserActivityPanel_TopProgramsTableModel_name_header(),
96 .setTooltip(prog.getProgramPath());
101 Bundle.UserActivityPanel_TopProgramsTableModel_folder_header(),
105 prog.getProgramPath(),
106 prog.getProgramName()))
112 Bundle.UserActivityPanel_TopProgramsTableModel_count_header(),
114 String runTimes = prog.getRunTimes() == null ?
"" : Long.toString(prog.getRunTimes());
115 return new DefaultCellModel(runTimes);
120 Bundle.UserActivityPanel_TopProgramsTableModel_lastrun_header(),
121 (prog) ->
new DefaultCellModel(getFormatted(prog.getLastRun())),
124 .setKeyFunction((prog) -> prog.getProgramPath() +
":" + prog.getProgramName());
130 Bundle.UserActivityPanel_TopDomainsTableModel_domain_header(),
135 Bundle.UserActivityPanel_TopDomainsTableModel_count_header(),
137 String visitTimes = recentDomain.getVisitTimes() == null ?
"" : Long.toString(recentDomain.getVisitTimes());
143 Bundle.UserActivityPanel_TopDomainsTableModel_lastAccess_header(),
144 (recentDomain) ->
new DefaultCellModel(getFormatted(recentDomain.getLastVisit())),
147 .setKeyFunction((domain) -> domain.getDomain());
153 Bundle.UserActivityPanel_TopWebSearchTableModel_searchString_header(),
159 Bundle.UserActivityPanel_TopWebSearchTableModel_dateAccessed_header(),
160 (webSearch) ->
new DefaultCellModel(getFormatted(webSearch.getDateAccessed())),
165 Bundle.UserActivityPanel_TopWebSearchTableModel_translatedResult_header(),
170 .setKeyFunction((query) -> query.getSearchString());
176 Bundle.UserActivityPanel_TopDeviceAttachedTableModel_deviceId_header(),
182 Bundle.UserActivityPanel_TopDeviceAttachedTableModel_dateAccessed_header(),
188 Bundle.UserActivityPanel_TopDeviceAttachedTableModel_makeModel_header(),
190 String make = StringUtils.isBlank(device.getDeviceMake()) ?
"" : device.getDeviceMake().trim();
191 String model = StringUtils.isBlank(device.getDeviceModel()) ?
"" : device.getDeviceModel().trim();
192 String makeModelString = (make.isEmpty() || model.isEmpty())
194 : String.format(
"%s - %s", make, model);
200 .setKeyFunction((topDevice) -> topDevice.getDeviceId());
206 Bundle.UserActivityPanel_TopAccountTableModel_accountType_header(),
212 Bundle.UserActivityPanel_TopAccountTableModel_lastAccess_header(),
217 .setKeyFunction((topAccount) -> topAccount.getAccountType());
219 private final List<JTablePanel<?>> tables = Arrays.asList(
223 topDevicesAttachedTable,
250 super(topProgramsData, userActivityData);
252 this.topProgramsData = topProgramsData;
255 this.dataFetchComponents = Arrays.asList(
258 (dataSource) -> topProgramsData.
getTopPrograms(dataSource, TOP_PROGS_COUNT),
260 showResultWithModuleCheck(topProgramsTable, result,
266 (dataSource) -> userActivityData.
getRecentDomains(dataSource, TOP_DOMAINS_COUNT),
268 showResultWithModuleCheck(recentDomainsTable, result,
276 showResultWithModuleCheck(topWebSearchesTable, result,
282 (dataSource) -> userActivityData.
getRecentDevices(dataSource, TOP_DEVICES_COUNT),
284 showResultWithModuleCheck(topDevicesAttachedTable, result,
290 (dataSource) -> userActivityData.
getRecentAccounts(dataSource, TOP_ACCOUNTS_COUNT),
292 showResultWithModuleCheck(topAccountsTable, result,
294 ANDROID_MODULE_NAME);
315 fetchInformation(dataFetchComponents, dataSource);
320 onNewDataSource(dataFetchComponents, tables, dataSource);
334 @SuppressWarnings(
"unchecked")
336 private
void initComponents() {
338 javax.swing.JScrollPane contentScrollPane =
new javax.swing.JScrollPane();
339 javax.swing.JPanel contentPanel =
new javax.swing.JPanel();
340 javax.swing.JPanel ingestRunningPanel = ingestRunningLabel;
341 javax.swing.JLabel programsRunLabel =
new javax.swing.JLabel();
342 javax.swing.Box.Filler filler1 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2));
343 javax.swing.JPanel topProgramsTablePanel = topProgramsTable;
344 javax.swing.Box.Filler filler3 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 20),
new java.awt.Dimension(0, 20),
new java.awt.Dimension(0, 20));
345 javax.swing.JLabel recentDomainsLabel =
new javax.swing.JLabel();
346 javax.swing.Box.Filler filler2 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2));
347 javax.swing.JPanel recentDomainsTablePanel = recentDomainsTable;
348 javax.swing.Box.Filler filler4 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 20),
new java.awt.Dimension(0, 20),
new java.awt.Dimension(0, 20));
349 javax.swing.JLabel topWebSearchLabel =
new javax.swing.JLabel();
350 javax.swing.Box.Filler filler5 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2));
351 javax.swing.JPanel topWebSearches = topWebSearchesTable;
352 javax.swing.Box.Filler filler6 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 20),
new java.awt.Dimension(0, 20),
new java.awt.Dimension(0, 20));
353 javax.swing.JLabel topDevicesAttachedLabel =
new javax.swing.JLabel();
354 javax.swing.Box.Filler filler7 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2));
355 javax.swing.JPanel recentDevicesAttached = topDevicesAttachedTable;
356 javax.swing.Box.Filler filler8 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 20),
new java.awt.Dimension(0, 20),
new java.awt.Dimension(0, 20));
357 javax.swing.JLabel recentAccountsLabel =
new javax.swing.JLabel();
358 javax.swing.Box.Filler filler9 =
new javax.swing.Box.Filler(
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2),
new java.awt.Dimension(0, 2));
359 javax.swing.JPanel topAccounts = topAccountsTable;
361 setLayout(
new java.awt.BorderLayout());
363 contentScrollPane.setMaximumSize(null);
364 contentScrollPane.setMinimumSize(null);
366 contentPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
367 contentPanel.setMaximumSize(
new java.awt.Dimension(32767, 450));
368 contentPanel.setMinimumSize(
new java.awt.Dimension(10, 450));
369 contentPanel.setLayout(
new javax.swing.BoxLayout(contentPanel, javax.swing.BoxLayout.PAGE_AXIS));
371 ingestRunningPanel.setAlignmentX(0.0F);
372 ingestRunningPanel.setMaximumSize(
new java.awt.Dimension(32767, 25));
373 ingestRunningPanel.setMinimumSize(
new java.awt.Dimension(10, 25));
374 ingestRunningPanel.setPreferredSize(
new java.awt.Dimension(10, 25));
375 contentPanel.add(ingestRunningPanel);
377 programsRunLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
378 org.openide.awt.Mnemonics.setLocalizedText(programsRunLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.programsRunLabel.text"));
379 programsRunLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
380 contentPanel.add(programsRunLabel);
381 contentPanel.add(filler1);
383 topProgramsTablePanel.setAlignmentX(0.0F);
384 topProgramsTablePanel.setMaximumSize(
new java.awt.Dimension(32767, 106));
385 topProgramsTablePanel.setMinimumSize(
new java.awt.Dimension(10, 106));
386 topProgramsTablePanel.setPreferredSize(
new java.awt.Dimension(10, 106));
387 contentPanel.add(topProgramsTablePanel);
388 contentPanel.add(filler3);
390 recentDomainsLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
391 org.openide.awt.Mnemonics.setLocalizedText(recentDomainsLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.recentDomainsLabel.text"));
392 contentPanel.add(recentDomainsLabel);
393 contentPanel.add(filler2);
395 recentDomainsTablePanel.setAlignmentX(0.0F);
396 recentDomainsTablePanel.setMaximumSize(
new java.awt.Dimension(32767, 106));
397 recentDomainsTablePanel.setMinimumSize(
new java.awt.Dimension(10, 106));
398 recentDomainsTablePanel.setPreferredSize(
new java.awt.Dimension(10, 106));
399 contentPanel.add(recentDomainsTablePanel);
400 contentPanel.add(filler4);
402 topWebSearchLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
403 org.openide.awt.Mnemonics.setLocalizedText(topWebSearchLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.topWebSearchLabel.text"));
404 contentPanel.add(topWebSearchLabel);
405 contentPanel.add(filler5);
407 topWebSearches.setAlignmentX(0.0F);
408 topWebSearches.setMaximumSize(
new java.awt.Dimension(32767, 106));
409 topWebSearches.setMinimumSize(
new java.awt.Dimension(10, 106));
410 topWebSearches.setPreferredSize(
new java.awt.Dimension(10, 106));
411 contentPanel.add(topWebSearches);
412 contentPanel.add(filler6);
414 topDevicesAttachedLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
415 org.openide.awt.Mnemonics.setLocalizedText(topDevicesAttachedLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.topDevicesAttachedLabel.text"));
416 contentPanel.add(topDevicesAttachedLabel);
417 contentPanel.add(filler7);
419 recentDevicesAttached.setAlignmentX(0.0F);
420 recentDevicesAttached.setMaximumSize(
new java.awt.Dimension(32767, 106));
421 recentDevicesAttached.setMinimumSize(
new java.awt.Dimension(10, 106));
422 recentDevicesAttached.setPreferredSize(
new java.awt.Dimension(10, 106));
423 contentPanel.add(recentDevicesAttached);
424 contentPanel.add(filler8);
426 recentAccountsLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
427 org.openide.awt.Mnemonics.setLocalizedText(recentAccountsLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.recentAccountsLabel.text"));
428 contentPanel.add(recentAccountsLabel);
429 contentPanel.add(filler9);
431 topAccounts.setAlignmentX(0.0F);
432 topAccounts.setMaximumSize(
new java.awt.Dimension(32767, 106));
433 topAccounts.setMinimumSize(
new java.awt.Dimension(10, 106));
434 topAccounts.setPreferredSize(
new java.awt.Dimension(10, 106));
435 contentPanel.add(topAccounts);
437 contentScrollPane.setViewportView(contentPanel);
439 add(contentScrollPane, java.awt.BorderLayout.CENTER);
void fetchInformation(DataSource dataSource)
final List< DataFetchComponents< DataSource,?> > dataFetchComponents
void onNewDataSource(DataSource dataSource)
List< TopAccountResult > getRecentAccounts(DataSource dataSource, int count)
List< TopWebSearchResult > getMostRecentWebSearches(DataSource dataSource, int count)
static final String RECENT_ACTIVITY_MODULE_NAME
List< TopDeviceAttachedResult > getRecentDevices(DataSource dataSource, int count)
UserActivityPanel(TopProgramsSummary topProgramsData, UserActivitySummary userActivityData)
final TopProgramsSummary topProgramsData
static final String RECENT_ACTIVITY_FACTORY
List< TopProgramsResult > getTopPrograms(DataSource dataSource, int count)
static< T > JTablePanel< T > getJTablePanel(List< ColumnModel< T >> columns)
List< TopDomainsResult > getRecentDomains(DataSource dataSource, int count)
String getShortFolderName(String strPath, String applicationName)
String getShortFolderName(String path, String appName)
static String getFormatted(Date date)
DefaultCellModel setTooltip(String tooltip)