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())
97 .setPopupMenu(getPopup(prog));
102 Bundle.UserActivityPanel_TopProgramsTableModel_folder_header(),
106 prog.getProgramPath(),
107 prog.getProgramName()))
109 .setPopupMenu(getPopup(prog));
114 Bundle.UserActivityPanel_TopProgramsTableModel_count_header(),
116 String runTimes = prog.getRunTimes() == null ?
"" : Long.toString(prog.getRunTimes());
117 return new DefaultCellModel(runTimes)
118 .setPopupMenu(getPopup(prog));
123 Bundle.UserActivityPanel_TopProgramsTableModel_lastrun_header(),
125 return new DefaultCellModel(getFormatted(prog.getLastAccessed()))
126 .setPopupMenu(getPopup(prog));
130 .setKeyFunction((prog) -> prog.getProgramPath() +
":" + prog.getProgramName());
136 Bundle.UserActivityPanel_TopDomainsTableModel_domain_header(),
139 .setPopupMenu(getPopup(recentDomain));
144 Bundle.UserActivityPanel_TopDomainsTableModel_count_header(),
146 String visitTimes = recentDomain.getVisitTimes() == null ?
"" : Long.toString(recentDomain.getVisitTimes());
153 Bundle.UserActivityPanel_TopDomainsTableModel_lastAccess_header(),
155 return new DefaultCellModel(getFormatted(recentDomain.getLastAccessed()))
156 .setPopupMenu(getPopup(recentDomain));
160 .setKeyFunction((domain) -> domain.getDomain());
166 Bundle.UserActivityPanel_TopWebSearchTableModel_searchString_header(),
169 .setPopupMenu(getPopup(webSearch));
175 Bundle.UserActivityPanel_TopWebSearchTableModel_dateAccessed_header(),
184 Bundle.UserActivityPanel_TopWebSearchTableModel_translatedResult_header(),
186 return new DefaultCellModel(webSearch.getTranslatedResult())
187 .setPopupMenu(getPopup(webSearch));
192 .setKeyFunction((query) -> query.getSearchString());
198 Bundle.UserActivityPanel_TopDeviceAttachedTableModel_deviceId_header(),
201 .setPopupMenu(getPopup(device));
207 Bundle.UserActivityPanel_TopDeviceAttachedTableModel_dateAccessed_header(),
216 Bundle.UserActivityPanel_TopDeviceAttachedTableModel_makeModel_header(),
218 String make = StringUtils.isBlank(device.getDeviceMake()) ?
"" : device.getDeviceMake().trim();
219 String model = StringUtils.isBlank(device.getDeviceModel()) ?
"" : device.getDeviceModel().trim();
220 String makeModelString = (make.isEmpty() || model.isEmpty())
222 : String.format(
"%s - %s", make, model);
223 return new DefaultCellModel(makeModelString)
224 .setPopupMenu(getPopup(device));
229 .setKeyFunction((topDevice) -> topDevice.getDeviceId());
235 Bundle.UserActivityPanel_TopAccountTableModel_accountType_header(),
238 .setPopupMenu(getPopup(account));
244 Bundle.UserActivityPanel_TopAccountTableModel_lastAccess_header(),
252 .setKeyFunction((topAccount) -> topAccount.getAccountType());
254 private final List<JTablePanel<?>> tables = Arrays.asList(
258 topDevicesAttachedTable,
281 super(userActivityData);
282 this.userActivityData = userActivityData;
285 this.dataFetchComponents = Arrays.asList(
288 (dataSource) -> userActivityData.
getTopPrograms(dataSource, TOP_PROGS_COUNT),
292 (dataSource) -> userActivityData.
getRecentDomains(dataSource, TOP_DOMAINS_COUNT),
300 (dataSource) -> userActivityData.
getRecentDevices(dataSource, TOP_DEVICES_COUNT),
304 (dataSource) -> userActivityData.
getRecentAccounts(dataSource, TOP_ACCOUNTS_COUNT),
321 return record == null ? null : Arrays.asList(getArtifactNavigateItem(record.
getArtifact()));
338 fetchInformation(dataFetchComponents, dataSource);
343 onNewDataSource(dataFetchComponents, tables, dataSource);
357 @SuppressWarnings(
"unchecked")
359 private
void initComponents() {
361 javax.swing.JScrollPane contentScrollPane =
new javax.swing.JScrollPane();
362 javax.swing.JPanel contentPanel =
new javax.swing.JPanel();
363 javax.swing.JPanel ingestRunningPanel = ingestRunningLabel;
364 javax.swing.JLabel programsRunLabel =
new javax.swing.JLabel();
365 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));
366 javax.swing.JPanel topProgramsTablePanel = topProgramsTable;
367 javax.swing.JLabel rightClickForMoreOptions1 =
new javax.swing.JLabel();
368 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));
369 javax.swing.JLabel recentDomainsLabel =
new javax.swing.JLabel();
370 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));
371 javax.swing.JPanel recentDomainsTablePanel = recentDomainsTable;
372 javax.swing.JLabel rightClickForMoreOptions2 =
new javax.swing.JLabel();
373 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));
374 javax.swing.JLabel topWebSearchLabel =
new javax.swing.JLabel();
375 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));
376 javax.swing.JPanel topWebSearches = topWebSearchesTable;
377 javax.swing.JLabel rightClickForMoreOptions3 =
new javax.swing.JLabel();
378 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));
379 javax.swing.JLabel topDevicesAttachedLabel =
new javax.swing.JLabel();
380 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));
381 javax.swing.JPanel recentDevicesAttached = topDevicesAttachedTable;
382 javax.swing.JLabel rightClickForMoreOptions4 =
new javax.swing.JLabel();
383 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));
384 javax.swing.JLabel recentAccountsLabel =
new javax.swing.JLabel();
385 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));
386 javax.swing.JPanel topAccounts = topAccountsTable;
387 javax.swing.JLabel rightClickForMoreOptions5 =
new javax.swing.JLabel();
389 setLayout(
new java.awt.BorderLayout());
391 contentScrollPane.setMaximumSize(null);
392 contentScrollPane.setMinimumSize(null);
394 contentPanel.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
395 contentPanel.setMaximumSize(
new java.awt.Dimension(32767, 450));
396 contentPanel.setMinimumSize(
new java.awt.Dimension(10, 450));
397 contentPanel.setLayout(
new javax.swing.BoxLayout(contentPanel, javax.swing.BoxLayout.PAGE_AXIS));
399 ingestRunningPanel.setAlignmentX(0.0F);
400 ingestRunningPanel.setMaximumSize(
new java.awt.Dimension(32767, 25));
401 ingestRunningPanel.setMinimumSize(
new java.awt.Dimension(10, 25));
402 ingestRunningPanel.setPreferredSize(
new java.awt.Dimension(10, 25));
403 contentPanel.add(ingestRunningPanel);
405 programsRunLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
406 org.openide.awt.Mnemonics.setLocalizedText(programsRunLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.programsRunLabel.text"));
407 programsRunLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
408 contentPanel.add(programsRunLabel);
409 contentPanel.add(filler1);
411 topProgramsTablePanel.setAlignmentX(0.0F);
412 topProgramsTablePanel.setMaximumSize(
new java.awt.Dimension(32767, 106));
413 topProgramsTablePanel.setMinimumSize(
new java.awt.Dimension(10, 106));
414 topProgramsTablePanel.setPreferredSize(
new java.awt.Dimension(10, 106));
415 contentPanel.add(topProgramsTablePanel);
417 org.openide.awt.Mnemonics.setLocalizedText(rightClickForMoreOptions1,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.rightClickForMoreOptions1.text"));
418 contentPanel.add(rightClickForMoreOptions1);
419 contentPanel.add(filler3);
421 recentDomainsLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
422 org.openide.awt.Mnemonics.setLocalizedText(recentDomainsLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.recentDomainsLabel.text"));
423 contentPanel.add(recentDomainsLabel);
424 contentPanel.add(filler2);
426 recentDomainsTablePanel.setAlignmentX(0.0F);
427 recentDomainsTablePanel.setMaximumSize(
new java.awt.Dimension(32767, 106));
428 recentDomainsTablePanel.setMinimumSize(
new java.awt.Dimension(10, 106));
429 recentDomainsTablePanel.setPreferredSize(
new java.awt.Dimension(10, 106));
430 contentPanel.add(recentDomainsTablePanel);
432 org.openide.awt.Mnemonics.setLocalizedText(rightClickForMoreOptions2,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.rightClickForMoreOptions2.text"));
433 contentPanel.add(rightClickForMoreOptions2);
434 contentPanel.add(filler4);
436 topWebSearchLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
437 org.openide.awt.Mnemonics.setLocalizedText(topWebSearchLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.topWebSearchLabel.text"));
438 contentPanel.add(topWebSearchLabel);
439 contentPanel.add(filler5);
441 topWebSearches.setAlignmentX(0.0F);
442 topWebSearches.setMaximumSize(
new java.awt.Dimension(32767, 106));
443 topWebSearches.setMinimumSize(
new java.awt.Dimension(10, 106));
444 topWebSearches.setPreferredSize(
new java.awt.Dimension(10, 106));
445 contentPanel.add(topWebSearches);
447 org.openide.awt.Mnemonics.setLocalizedText(rightClickForMoreOptions3,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.rightClickForMoreOptions3.text"));
448 contentPanel.add(rightClickForMoreOptions3);
449 contentPanel.add(filler6);
451 topDevicesAttachedLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
452 org.openide.awt.Mnemonics.setLocalizedText(topDevicesAttachedLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.topDevicesAttachedLabel.text"));
453 contentPanel.add(topDevicesAttachedLabel);
454 contentPanel.add(filler7);
456 recentDevicesAttached.setAlignmentX(0.0F);
457 recentDevicesAttached.setMaximumSize(
new java.awt.Dimension(32767, 106));
458 recentDevicesAttached.setMinimumSize(
new java.awt.Dimension(10, 106));
459 recentDevicesAttached.setPreferredSize(
new java.awt.Dimension(10, 106));
460 contentPanel.add(recentDevicesAttached);
462 org.openide.awt.Mnemonics.setLocalizedText(rightClickForMoreOptions4,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.rightClickForMoreOptions4.text"));
463 contentPanel.add(rightClickForMoreOptions4);
464 contentPanel.add(filler8);
466 recentAccountsLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
467 org.openide.awt.Mnemonics.setLocalizedText(recentAccountsLabel,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.recentAccountsLabel.text"));
468 contentPanel.add(recentAccountsLabel);
469 contentPanel.add(filler9);
471 topAccounts.setAlignmentX(0.0F);
472 topAccounts.setMaximumSize(
new java.awt.Dimension(32767, 106));
473 topAccounts.setMinimumSize(
new java.awt.Dimension(10, 106));
474 topAccounts.setPreferredSize(
new java.awt.Dimension(10, 106));
475 contentPanel.add(topAccounts);
477 org.openide.awt.Mnemonics.setLocalizedText(rightClickForMoreOptions5,
org.openide.util.NbBundle.getMessage(
UserActivityPanel.class,
"UserActivityPanel.rightClickForMoreOptions5.text"));
478 contentPanel.add(rightClickForMoreOptions5);
480 contentScrollPane.setViewportView(contentPanel);
482 add(contentScrollPane, java.awt.BorderLayout.CENTER);
final UserActivitySummary userActivityData
void fetchInformation(DataSource dataSource)
final List< DataFetchComponents< DataSource,?> > dataFetchComponents
List< MenuItem > getPopup(LastAccessedArtifact record)
void onNewDataSource(DataSource dataSource)
List< TopAccountResult > getRecentAccounts(DataSource dataSource, int count)
UserActivityPanel(UserActivitySummary userActivityData)
void showDataFetchResult(DataFetchResult< T > result, String errorMessage, String noResultsMessage)
List< TopWebSearchResult > getMostRecentWebSearches(DataSource dataSource, int count)
List< TopDeviceAttachedResult > getRecentDevices(DataSource dataSource, int count)
String getShortFolderName(String strPath, String applicationName)
static< T > JTablePanel< T > getJTablePanel(List< ColumnModel< T >> columns)
List< TopProgramsResult > getTopPrograms(DataSource dataSource, int count)
DefaultCellModel setPopupMenu(List< MenuItem > popupMenu)
List< TopDomainsResult > getRecentDomains(DataSource dataSource, int count)
String getShortFolderName(String path, String appName)
static String getFormatted(Date date)
BlackboardArtifact getArtifact()
DefaultCellModel setTooltip(String tooltip)