19 package org.sleuthkit.autopsy.communications;
21 import com.google.common.collect.ImmutableSet;
22 import java.awt.event.ItemListener;
23 import java.beans.PropertyChangeListener;
24 import java.time.LocalDate;
25 import java.time.ZoneId;
26 import java.util.EnumSet;
27 import java.util.HashMap;
29 import java.util.Map.Entry;
30 import java.util.logging.Level;
31 import java.util.stream.Collectors;
32 import javax.swing.JCheckBox;
33 import org.openide.explorer.ExplorerManager;
34 import org.openide.nodes.AbstractNode;
35 import org.openide.nodes.Children;
36 import org.openide.util.NbBundle;
48 import org.
sleuthkit.datamodel.CommunicationsFilter.AccountTypeFilter;
49 import org.
sleuthkit.datamodel.CommunicationsFilter.DateRangeFilter;
50 import org.
sleuthkit.datamodel.CommunicationsFilter.DeviceFilter;
53 import static org.
sleuthkit.datamodel.Relationship.Type.CALL_LOG;
54 import static org.
sleuthkit.datamodel.Relationship.Type.MESSAGE;
67 private ExplorerManager
em;
72 private final Map<String, JCheckBox>
devicesMap = new HashMap<>();
87 @NbBundle.Messages({
"refreshText=Refresh Results",
118 String eventType = pce.getPropertyName();
119 if (eventType.equals(DATA_ADDED.toString())) {
122 if (null != eventData &&
143 boolean someDevice =
devicesMap.values().stream().anyMatch(JCheckBox::isSelected);
144 boolean someAccountType =
accountTypeMap.values().stream().anyMatch(JCheckBox::isSelected);
157 void updateAndApplyFilters() {
165 dateRangeLabel.setText(
"Date Range ( " + Utils.getUserPreferredZoneId().toString() +
"):");
180 em = ExplorerManager.find(
this);
190 super.removeNotify();
204 Account.Type.PREDEFINED_ACCOUNT_TYPES.forEach(type -> {
205 if (type.equals(Account.Type.CREDIT_CARD)) {
207 }
else if (type.equals(Account.Type.DEVICE)) {
211 final JCheckBox jCheckBox =
new JCheckBox(
212 "<html><table cellpadding=0><tr><td><img src=\""
213 +
FiltersPanel.class.getResource(
"/org/sleuthkit/autopsy/communications/images/"
214 + Utils.getIconFileName(type))
215 +
"\"/></td><td width=" + 3 +
"><td>" + type.getDisplayName() +
"</td></tr></table></html>",
234 for (DataSource dataSource : sleuthkitCase.getDataSources()) {
235 String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName();
237 devicesMap.computeIfAbsent(dataSource.getDeviceId(), ds -> {
238 final JCheckBox jCheckBox =
new JCheckBox(dsName,
false);
245 }
catch (IllegalStateException ex) {
246 logger.log(Level.WARNING,
"Communications Visualization Tool opened with no open case.", ex);
247 }
catch (TskCoreException tskCoreException) {
248 logger.log(Level.SEVERE,
"There was a error loading the datasources for the case.", tskCoreException);
257 @SuppressWarnings(
"unchecked")
261 applyFiltersButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/tick.png")));
265 filtersTitleLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/funnel.png")));
271 public void actionPerformed(java.awt.event.ActionEvent evt) {
276 accountTypesLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/accounts.png")));
281 public void actionPerformed(java.awt.event.ActionEvent evt) {
289 accountTypeRequiredLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/error-icon-16.png")));
294 javax.swing.GroupLayout jPanel2Layout =
new javax.swing.GroupLayout(
jPanel2);
295 jPanel2.setLayout(jPanel2Layout);
296 jPanel2Layout.setHorizontalGroup(
297 jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
298 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
299 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
300 .addGroup(jPanel2Layout.createSequentialGroup()
302 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
304 .addGroup(jPanel2Layout.createSequentialGroup()
306 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
308 .addGroup(jPanel2Layout.createSequentialGroup()
309 .addGap(0, 0, Short.MAX_VALUE)
311 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
315 jPanel2Layout.setVerticalGroup(
316 jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
317 .addGroup(jPanel2Layout.createSequentialGroup()
318 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
321 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
322 .addComponent(
jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
323 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
324 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
331 public void actionPerformed(java.awt.event.ActionEvent evt) {
336 devicesLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/image.png")));
341 public void actionPerformed(java.awt.event.ActionEvent evt) {
346 jScrollPane2.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
347 jScrollPane2.setMinimumSize(
new java.awt.Dimension(27, 75));
349 devicesPane.setMinimumSize(
new java.awt.Dimension(4, 100));
353 deviceRequiredLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/error-icon-16.png")));
358 javax.swing.GroupLayout jPanel3Layout =
new javax.swing.GroupLayout(
jPanel3);
359 jPanel3.setLayout(jPanel3Layout);
360 jPanel3Layout.setHorizontalGroup(
361 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
362 .addGroup(jPanel3Layout.createSequentialGroup()
364 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
366 .addGroup(jPanel3Layout.createSequentialGroup()
368 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
369 .addGroup(jPanel3Layout.createSequentialGroup()
370 .addGap(0, 0, Short.MAX_VALUE)
372 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
374 .addComponent(
jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
376 jPanel3Layout.setVerticalGroup(
377 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
378 .addGroup(jPanel3Layout.createSequentialGroup()
379 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
382 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
383 .addComponent(
jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
384 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
385 .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
393 dateRangeLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/images/calendar.png")));
397 startCheckBox.addChangeListener(
new javax.swing.event.ChangeListener() {
398 public void stateChanged(javax.swing.event.ChangeEvent evt) {
404 endCheckBox.addChangeListener(
new javax.swing.event.ChangeListener() {
405 public void stateChanged(javax.swing.event.ChangeEvent evt) {
412 javax.swing.GroupLayout jPanel4Layout =
new javax.swing.GroupLayout(
jPanel4);
413 jPanel4.setLayout(jPanel4Layout);
414 jPanel4Layout.setHorizontalGroup(
415 jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
416 .addGroup(jPanel4Layout.createSequentialGroup()
418 .addGap(0, 0, Short.MAX_VALUE))
419 .addGroup(jPanel4Layout.createSequentialGroup()
421 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
422 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
424 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
425 .addComponent(
endDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE))
426 .addGroup(jPanel4Layout.createSequentialGroup()
428 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
429 .addComponent(
startDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))))
431 jPanel4Layout.setVerticalGroup(
432 jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
433 .addGroup(jPanel4Layout.createSequentialGroup()
436 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
437 .addComponent(
startDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
439 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
440 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
441 .addComponent(
endDatePicker, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
445 refreshButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/communications/images/arrow-circle-double-135.png")));
451 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
452 this.setLayout(layout);
453 layout.setHorizontalGroup(
454 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
455 .addComponent(
jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
456 .addComponent(
jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
457 .addGroup(layout.createSequentialGroup()
459 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
460 .addComponent(
applyFiltersButton, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
461 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
463 .addComponent(
jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
464 .addGroup(layout.createSequentialGroup()
466 .addComponent(
needsRefreshLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
468 layout.setVerticalGroup(
469 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
470 .addGroup(layout.createSequentialGroup()
472 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
474 .addComponent(
applyFiltersButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
476 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
479 .addComponent(
jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
481 .addComponent(
jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
483 .addComponent(
jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
484 .addContainerGap(19, Short.MAX_VALUE))
493 CommunicationsFilter commsFilter =
new CommunicationsFilter();
497 commsFilter.addAndFilter(
new CommunicationsFilter.RelationshipTypeFilter(
498 ImmutableSet.of(CALL_LOG, MESSAGE)));
502 em.setRootContext(
new AbstractNode(Children.create(
new AccountsRootChildren(commsManager, commsFilter),
true)));
503 }
catch (TskCoreException ex) {
504 logger.log(Level.SEVERE,
"There was an error getting the CommunicationsManager for the current case.", ex);
517 DeviceFilter deviceFilter =
new DeviceFilter(
519 .filter(entry -> entry.getValue().isSelected())
521 .collect(Collectors.toSet()));
531 AccountTypeFilter accountTypeFilter =
new AccountTypeFilter(
533 .filter(entry -> entry.getValue().isSelected())
534 .map(entry -> entry.getKey())
535 .collect(Collectors.toSet()));
536 return accountTypeFilter;
540 ZoneId zone = Utils.getUserPreferredZoneId();
543 return new DateRangeFilter(start, end);
575 map.values().forEach(box -> box.setSelected(selected));
611 private final javax.swing.JLabel
devicesLabel =
new javax.swing.JLabel();
612 private final javax.swing.JPanel
devicesPane =
new javax.swing.JPanel();
613 private final javax.swing.JCheckBox
endCheckBox =
new javax.swing.JCheckBox();
614 private final com.github.lgooddatepicker.components.DatePicker
endDatePicker =
new com.github.lgooddatepicker.components.DatePicker();
616 private final javax.swing.JPanel
jPanel2 =
new javax.swing.JPanel();
617 private final javax.swing.JPanel
jPanel3 =
new javax.swing.JPanel();
618 private final javax.swing.JPanel
jPanel4 =
new javax.swing.JPanel();
619 private final javax.swing.JScrollPane
jScrollPane2 =
new javax.swing.JScrollPane();
620 private final javax.swing.JScrollPane
jScrollPane3 =
new javax.swing.JScrollPane();
622 private final javax.swing.JButton
refreshButton =
new javax.swing.JButton();
623 private final javax.swing.JCheckBox
startCheckBox =
new javax.swing.JCheckBox();
624 private final com.github.lgooddatepicker.components.DatePicker
startDatePicker =
new com.github.lgooddatepicker.components.DatePicker();
static final Logger logger
void updateDeviceFilter()
BlackboardArtifact.Type getBlackboardArtifactType()
void unCheckAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt)
final javax.swing.JCheckBox endCheckBox
void removeIngestModuleEventListener(final PropertyChangeListener listener)
final javax.swing.JPanel jPanel2
final com.github.lgooddatepicker.components.DatePicker endDatePicker
static synchronized IngestManager getInstance()
final javax.swing.JButton applyFiltersButton
void unCheckAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt)
final javax.swing.JLabel filtersTitleLabel
void setAllDevicesSelected(boolean selected)
final javax.swing.JLabel needsRefreshLabel
final javax.swing.JLabel deviceRequiredLabel
final javax.swing.JCheckBox startCheckBox
final javax.swing.JLabel accountTypeRequiredLabel
final com.github.lgooddatepicker.components.DatePicker startDatePicker
void endCheckBoxStateChanged(javax.swing.event.ChangeEvent evt)
final javax.swing.JPanel devicesPane
final javax.swing.JButton refreshButton
void startCheckBoxStateChanged(javax.swing.event.ChangeEvent evt)
void setAllAccountTypesSelected(boolean selected)
final javax.swing.JButton unCheckAllDevicesButton
static final String DISPLAY_TIMES_IN_LOCAL_TIME
final PropertyChangeListener ingestListener
final javax.swing.JLabel devicesLabel
void setAllSelected(Map<?, JCheckBox > map, boolean selected)
final javax.swing.JLabel dateRangeLabel
final javax.swing.JButton checkAllDevicesButton
final javax.swing.JLabel accountTypesLabel
final javax.swing.JScrollPane jScrollPane3
SleuthkitCase getSleuthkitCase()
void checkAllAccountTypesButtonActionPerformed(java.awt.event.ActionEvent evt)
final javax.swing.JButton checkAllAccountTypesButton
final Map< Account.Type, JCheckBox > accountTypeMap
static final long serialVersionUID
final javax.swing.JPanel jPanel4
final javax.swing.JPanel jPanel3
void addIngestModuleEventListener(final PropertyChangeListener listener)
final Map< String, JCheckBox > devicesMap
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void addChangeListener(PreferenceChangeListener listener)
void checkAllDevicesButtonActionPerformed(java.awt.event.ActionEvent evt)
final javax.swing.JScrollPane jScrollPane2
DeviceFilter getDeviceFilter()
DateRangeFilter getDateRangeFilter()
AccountTypeFilter getAccountTypeFilter()
void updateAccountTypeFilter()
final javax.swing.JButton unCheckAllAccountTypesButton
final ItemListener validationListener
final javax.swing.JPanel accountTypePane