Merge pull request #5741 from ethteck/6163_geoloc_Type_Filter

6163 New panel for type filtering in the geolocation tool
This commit is contained in:
Richard Cordovano 2020-03-31 19:29:44 -04:00 committed by GitHub
commit 4ef6fd95f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 360 additions and 165 deletions

View File

@ -75,6 +75,7 @@ import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.Tag;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.autopsy.datamodel.utils.IconsUtil;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import static org.sleuthkit.autopsy.datamodel.AbstractContentNode.NO_DESCR;
import org.sleuthkit.autopsy.texttranslation.TextTranslationService;
@ -270,7 +271,7 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
* @param artifact The artifact to represent.
*/
public BlackboardArtifactNode(BlackboardArtifact artifact) {
this(artifact, ExtractedContent.getIconFilePath(artifact.getArtifactTypeID()));
this(artifact, IconsUtil.getIconFilePath(artifact.getArtifactTypeID()));
}
/**

View File

@ -37,6 +37,7 @@ import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.utils.IconsUtil;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.ingest.ModuleDataEvent;
import org.sleuthkit.datamodel.Blackboard;
@ -98,85 +99,6 @@ public class ExtractedContent implements AutopsyVisitableItem {
return skCase;
}
@SuppressWarnings("deprecation")
static String getIconFilePath(int typeID) {
String filePath = "org/sleuthkit/autopsy/images/"; //NON-NLS
if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()) {
return filePath + "bookmarks.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()) {
return filePath + "cookies.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) {
return filePath + "history.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) {
return filePath + "downloads.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()) {
return filePath + "recent_docs.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()) {
return filePath + "gps_trackpoint.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()) {
return filePath + "programs.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()) {
return filePath + "usb_devices.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
return filePath + "mail-icon-16.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EXTRACTED_TEXT.getTypeID()) {
return filePath + "text-file.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID()) {
return filePath + "searchquery.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) {
return filePath + "camera-icon-16.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_OS_INFO.getTypeID()) {
return filePath + "computer.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SERVICE_ACCOUNT.getTypeID()) {
return filePath + "account-icon-16.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT.getTypeID()) {
return filePath + "contact.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) {
return filePath + "message.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()) {
return filePath + "calllog.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALENDAR_ENTRY.getTypeID()) {
return filePath + "calendar.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SPEED_DIAL_ENTRY.getTypeID()) {
return filePath + "speeddialentry.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING.getTypeID()) {
return filePath + "bluetooth.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK.getTypeID()) {
return filePath + "gpsfav.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID()) {
return filePath + "gps-lastlocation.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID()) {
return filePath + "gps-search.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID()) {
return filePath + "installed.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.getTypeID()
|| typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED.getTypeID()) {
return filePath + "encrypted-file.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID()) {
return filePath + "mismatch-16.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE.getTypeID()
|| typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACK.getTypeID()) {
return filePath + "gps_trackpoint.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_REMOTE_DRIVE.getTypeID()) {
return filePath + "drive_network.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_FACE_DETECTED.getTypeID()) {
return filePath + "face.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WIFI_NETWORK.getTypeID()) {
return filePath + "network-wifi.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID()) {
return filePath + "network-wifi.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID()) {
return filePath + "sim_card.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER.getTypeID()) {
return filePath + "Bluetooth.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID()) {
return filePath + "devices.png"; //NON-NLS
} else if (typeID == BlackboardArtifact.ARTIFACT_TYPE.TSK_VERIFICATION_FAILED.getTypeID()) {
return filePath + "validationFailed.png"; //NON-NLS
}
return filePath + "artifact-icon.png"; //NON-NLS
}
public class RootNode extends DisplayableItemNode {
public RootNode(SleuthkitCase skCase) {
@ -368,7 +290,7 @@ public class ExtractedContent implements AutopsyVisitableItem {
super(Children.create(new ArtifactFactory(type), true), Lookups.singleton(type.getDisplayName()));
super.setName(type.getTypeName());
this.type = type;
this.setIconBaseWithExtension(ExtractedContent.getIconFilePath(type.getTypeID())); //NON-NLS
this.setIconBaseWithExtension(IconsUtil.getIconFilePath(type.getTypeID())); //NON-NLS
updateDisplayName();
}

View File

@ -0,0 +1,110 @@
/*
* Autopsy Forensic Browser
*
* Copyright 2020 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.datamodel.utils;
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
/**
* Utility methods for handling icons
*/
public final class IconsUtil {
private IconsUtil() {
}
@SuppressWarnings("deprecation")
public static String getIconFilePath(int typeID) {
String imageFile;
if (typeID == ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()) {
imageFile = "bookmarks.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()) {
imageFile = "cookies.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) {
imageFile = "history.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) {
imageFile = "downloads.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_RECENT_OBJECT.getTypeID()) {
imageFile = "recent_docs.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()) {
imageFile = "gps_trackpoint.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_INSTALLED_PROG.getTypeID()) {
imageFile = "programs.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()) {
imageFile = "usb_devices.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_EMAIL_MSG.getTypeID()) {
imageFile = "mail-icon-16.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_EXTRACTED_TEXT.getTypeID()) {
imageFile = "text-file.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_WEB_SEARCH_QUERY.getTypeID()) {
imageFile = "searchquery.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) {
imageFile = "camera-icon-16.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_OS_INFO.getTypeID()) {
imageFile = "computer.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_SERVICE_ACCOUNT.getTypeID()) {
imageFile = "account-icon-16.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_CONTACT.getTypeID()) {
imageFile = "contact.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) {
imageFile = "message.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()) {
imageFile = "calllog.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_CALENDAR_ENTRY.getTypeID()) {
imageFile = "calendar.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_SPEED_DIAL_ENTRY.getTypeID()) {
imageFile = "speeddialentry.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING.getTypeID()) {
imageFile = "bluetooth.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_GPS_BOOKMARK.getTypeID()) {
imageFile = "gpsfav.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID()) {
imageFile = "gps-lastlocation.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID()) {
imageFile = "gps-search.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_PROG_RUN.getTypeID()) {
imageFile = "installed.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.getTypeID()
|| typeID == ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED.getTypeID()) {
imageFile = "encrypted-file.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_EXT_MISMATCH_DETECTED.getTypeID()) {
imageFile = "mismatch-16.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_GPS_ROUTE.getTypeID()) {
imageFile = "gps_trackpoint.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_REMOTE_DRIVE.getTypeID()) {
imageFile = "drive_network.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_FACE_DETECTED.getTypeID()) {
imageFile = "face.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_WIFI_NETWORK.getTypeID()) {
imageFile = "network-wifi.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID()) {
imageFile = "network-wifi.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID()) {
imageFile = "sim_card.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER.getTypeID()) {
imageFile = "Bluetooth.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID()) {
imageFile = "devices.png"; //NON-NLS
} else if (typeID == ARTIFACT_TYPE.TSK_VERIFICATION_FAILED.getTypeID()) {
imageFile = "validationFailed.png"; //NON-NLS
} else {
imageFile = "artifact-icon.png"; //NON-NLS
}
return "/org/sleuthkit/autopsy/images/" + imageFile;
}
}

View File

@ -28,6 +28,7 @@ import org.sleuthkit.autopsy.geolocation.datamodel.GeoLocationDataException;
import org.sleuthkit.autopsy.geolocation.datamodel.Track;
import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint;
import org.sleuthkit.autopsy.geolocation.datamodel.WaypointBuilder;
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
/**
* The business logic for filtering waypoints.
@ -60,6 +61,7 @@ abstract class AbstractWaypointFetcher implements WaypointBuilder.WaypointFilter
Case currentCase = Case.getCurrentCase();
WaypointBuilder.getAllWaypoints(currentCase.getSleuthkitCase(),
filters.getDataSources(),
filters.getArtifactTypes(),
filters.showAllWaypoints(),
filters.getMostRecentNumDays(),
filters.showWaypointsWithoutTimeStamp(),
@ -77,12 +79,13 @@ abstract class AbstractWaypointFetcher implements WaypointBuilder.WaypointFilter
@Override
public void process(List<Waypoint> waypoints) {
List<Track> tracks = null;
try {
tracks = Track.getTracks(Case.getCurrentCase().getSleuthkitCase(), filters.getDataSources());
} catch (GeoLocationDataException ex) {
logger.log(Level.WARNING, "Exception thrown while retrieving list of Tracks", ex);
if (filters.getArtifactTypes().contains(ARTIFACT_TYPE.TSK_GPS_TRACK)) {
try {
tracks = Track.getTracks(Case.getCurrentCase().getSleuthkitCase(), filters.getDataSources());
} catch (GeoLocationDataException ex) {
logger.log(Level.WARNING, "Exception thrown while retrieving list of Tracks", ex);
}
}
List<Waypoint> completeList = createWaypointList(waypoints, tracks);

View File

@ -7,15 +7,15 @@ RefreshPanel.closeButton.text=
WaypointDetailPanel.closeButton.text=
WaypointDetailPanel.imageLabel.text=
GeoFilterPanel.waypointSettings.border.title=
GeoFilterPanel.allButton.text=Show All
GeoFilterPanel.mostRecentButton.text=Show only last
GeoFilterPanel.allButton.text=All
GeoFilterPanel.mostRecentButton.text=Only last
GeoFilterPanel.applyButton.text=Apply
GeoFilterPanel.showWaypointsWOTSCheckBox.text=Include waypoints with no time stamps
GeoFilterPanel.daysLabel.text=days of activity
CheckBoxListPanel.titleLabel.text=jLabel1
CheckBoxListPanel.checkButton.text=Check All
CheckBoxListPanel.uncheckButton.text=Uncheck All
GeoFilterPanel.optionsLabel.text=Waypoints
GeoFilterPanel.optionsLabel.text=Dates
OptionsCategory_Name_Geolocation=Geolocation
OptionsCategory_Keywords_Geolocation=Geolocation Settings
GeolocationSettingsPanel.tilePane.border.title=Map Tile Data Source
@ -37,3 +37,5 @@ GeolocationTopComponent.reportButton.text=KML Report
GeolocationTopComponent.coordLabel.text=
MapPanel.zoomInBtn.text=
MapPanel.zoomOutBtn.text=
GeoFilterPanel.showLabel.text=Show:
GeoFilterPanel.showLabel.toolTipText=Show:

View File

@ -1,8 +1,10 @@
CTL_OpenGeolocation=Geolocation
CTL_GeolocationTopComponentAction=GeolocationTopComponent
CTL_GeolocationTopComponent=Geolocation
GeoFilterPanel_ArtifactType_List_Title=Types
GeoFilterPanel_DataSource_List_Title=Data Sources
GeoFilterPanel_empty_dataSource=Data Source list is empty.
GeoFilterPanel_empty_artifactType=Unable to apply filter, please select one or more artifact types.
GeoFilterPanel_empty_dataSource=Unable to apply filter, please select one or more data sources.
GeolocationSettings_mbtile_does_not_exist_message=The file supplied does not exist.\nPlease verify that the file exists and try again.
GeolocationSettings_mbtile_does_not_exist_title=File Not Found
GeolocationSettings_mbtile_not_valid_message=The supplied file is not a raster tile file.
@ -44,15 +46,15 @@ RefreshPanel.closeButton.text=
WaypointDetailPanel.closeButton.text=
WaypointDetailPanel.imageLabel.text=
GeoFilterPanel.waypointSettings.border.title=
GeoFilterPanel.allButton.text=Show All
GeoFilterPanel.mostRecentButton.text=Show only last
GeoFilterPanel.allButton.text=All
GeoFilterPanel.mostRecentButton.text=Only last
GeoFilterPanel.applyButton.text=Apply
GeoFilterPanel.showWaypointsWOTSCheckBox.text=Include waypoints with no time stamps
GeoFilterPanel.daysLabel.text=days of activity
CheckBoxListPanel.titleLabel.text=jLabel1
CheckBoxListPanel.checkButton.text=Check All
CheckBoxListPanel.uncheckButton.text=Uncheck All
GeoFilterPanel.optionsLabel.text=Waypoints
GeoFilterPanel.optionsLabel.text=Dates
OptionsCategory_Name_Geolocation=Geolocation
OptionsCategory_Keywords_Geolocation=Geolocation Settings
GeolocationSettingsPanel.tilePane.border.title=Map Tile Data Source
@ -74,4 +76,6 @@ GeolocationTopComponent.reportButton.text=KML Report
GeolocationTopComponent.coordLabel.text=
MapPanel.zoomInBtn.text=
MapPanel.zoomOutBtn.text=
GeoFilterPanel.showLabel.text=Show:
GeoFilterPanel.showLabel.toolTipText=Show:
WaypointExtractAction_label=Extract Files(s)

View File

@ -18,11 +18,15 @@
*/
package org.sleuthkit.autopsy.geolocation;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
@ -60,6 +64,20 @@ final class CheckBoxJList<T extends CheckBoxJList.CheckboxListItem> extends JLis
* @return
*/
String getDisplayName();
/**
* Returns whether an icon has been configured for this item
*
* @return
*/
boolean hasIcon();
/**
* Returns Icon to display next to the checkbox
*
* @return
*/
Icon getIcon();
}
/**
@ -73,7 +91,9 @@ final class CheckBoxJList<T extends CheckBoxJList.CheckboxListItem> extends JLis
* Do all of the UI initialization.
*/
private void initalize() {
setCellRenderer(new CellRenderer());
CellRenderer cellRenderer = new CellRenderer();
cellRenderer.init();
setCellRenderer(cellRenderer);
addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
@ -91,18 +111,35 @@ final class CheckBoxJList<T extends CheckBoxJList.CheckboxListItem> extends JLis
/**
* A ListCellRenderer that renders list elements as check boxes.
*/
class CellRenderer extends JCheckBox implements ListCellRenderer<CheckBoxJList.CheckboxListItem> {
class CellRenderer extends JPanel implements ListCellRenderer<CheckBoxJList.CheckboxListItem> {
private static final long serialVersionUID = 1L;
private final JCheckBox checkbox = new JCheckBox();
private final JLabel label = new JLabel();
public void init() {
setLayout(new BorderLayout(2, 0));
add(checkbox, BorderLayout.WEST);
add(label, BorderLayout.CENTER);
}
@Override
public Component getListCellRendererComponent(
JList<? extends CheckBoxJList.CheckboxListItem> list, CheckBoxJList.CheckboxListItem value, int index,
boolean isSelected, boolean cellHasFocus) {
setBackground(list.getBackground());
setSelected(value.isChecked());
setText(value.getDisplayName());
checkbox.setSelected(value.isChecked());
checkbox.setBackground(list.getBackground());
checkbox.setEnabled(list.isEnabled());
label.setText(value.getDisplayName());
label.setEnabled(list.isEnabled());
if (value.hasIcon()) {
label.setIcon(value.getIcon());
}
setEnabled(list.isEnabled());
return this;
}

View File

@ -52,8 +52,8 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
* @param displayName display name for the checkbox
* @param obj Object that the checkbox represents
*/
void addElement(String displayName, T obj) {
ObjectCheckBox<T> newCheckBox = new ObjectCheckBox<>(displayName, true, obj);
void addElement(String displayName, Icon icon, T obj) {
ObjectCheckBox<T> newCheckBox = new ObjectCheckBox<>(displayName, icon, true, obj);
if(!model.contains(newCheckBox)) {
model.addElement(newCheckBox);
@ -220,17 +220,20 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
private final T object;
private final String displayName;
private final Icon icon;
private boolean checked;
/**
* Constructs a new ObjectCheckBox
*
* @param displayName String to show as the check box label
* @param icon Icon to show before the check box (may be null)
* @param initialState Sets the initial state of the check box
* @param object Object that the check box represents.
*/
ObjectCheckBox(String displayName, boolean initialState, T object) {
ObjectCheckBox(String displayName, Icon icon, boolean initialState, T object) {
this.displayName = displayName;
this.icon = icon;
this.object = object;
this.checked = initialState;
}
@ -254,6 +257,16 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
return displayName;
}
@Override
public boolean hasIcon() {
return icon != null;
}
@Override
public Icon getIcon() {
return icon;
}
@Override
public boolean equals(Object obj) {
if(obj instanceof ObjectCheckBox) {

View File

@ -61,7 +61,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="0" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="1" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -79,7 +79,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="1" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="9" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="2" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -92,7 +92,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="30" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="3" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="-20" insetsBottom="0" insetsRight="5" anchor="18" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -108,7 +108,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="9" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -120,7 +120,22 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="9" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="17" weightX="1.0" weightY="0.0"/>
<GridBagConstraints gridX="3" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="5" insetsBottom="0" insetsRight="5" anchor="17" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="showLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/geolocation/Bundle.properties" key="GeoFilterPanel.showLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/geolocation/Bundle.properties" key="GeoFilterPanel.showLabel.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="5" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>

View File

@ -22,17 +22,22 @@ import java.awt.GridBagConstraints;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import javafx.util.Pair;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingWorker;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.utils.IconsUtil;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.DataSource;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
@ -49,24 +54,27 @@ class GeoFilterPanel extends javax.swing.JPanel {
private static final Logger logger = Logger.getLogger(GeoFilterPanel.class.getName());
private final SpinnerNumberModel numberModel;
private final CheckBoxListPanel<DataSource> checkboxPanel;
private final CheckBoxListPanel<DataSource> dsCheckboxPanel;
private final CheckBoxListPanel<ARTIFACT_TYPE> atCheckboxPanel;
// Make sure to update if
// Make sure to update if other GPS artifacts are added
@SuppressWarnings("deprecation")
private static final BlackboardArtifact.ARTIFACT_TYPE[] GPS_ARTIFACT_TYPES = {
BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK,
BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION,
BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE,
BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH,
BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACK,
BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT
private static final ARTIFACT_TYPE[] GPS_ARTIFACT_TYPES = {
ARTIFACT_TYPE.TSK_GPS_BOOKMARK,
ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION,
ARTIFACT_TYPE.TSK_GPS_ROUTE,
ARTIFACT_TYPE.TSK_GPS_SEARCH,
ARTIFACT_TYPE.TSK_GPS_TRACK,
ARTIFACT_TYPE.TSK_GPS_TRACKPOINT,
ARTIFACT_TYPE.TSK_METADATA_EXIF
};
/**
* Creates new GeoFilterPanel
*/
@Messages({
"GeoFilterPanel_DataSource_List_Title=Data Sources"
"GeoFilterPanel_DataSource_List_Title=Data Sources",
"GeoFilterPanel_ArtifactType_List_Title=Types"
})
GeoFilterPanel() {
// numberModel is used in initComponents
@ -76,10 +84,15 @@ class GeoFilterPanel extends javax.swing.JPanel {
// The gui builder cannot handle using CheckBoxListPanel due to its
// use of generics so we will initalize it here.
checkboxPanel = new CheckBoxListPanel<>();
checkboxPanel.setPanelTitle(Bundle.GeoFilterPanel_DataSource_List_Title());
checkboxPanel.setPanelTitleIcon(new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/image.png")));
checkboxPanel.setSetAllSelected(true);
dsCheckboxPanel = new CheckBoxListPanel<>();
dsCheckboxPanel.setPanelTitle(Bundle.GeoFilterPanel_DataSource_List_Title());
dsCheckboxPanel.setPanelTitleIcon(new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/image.png")));
dsCheckboxPanel.setSetAllSelected(true);
atCheckboxPanel = new CheckBoxListPanel<>();
atCheckboxPanel.setPanelTitle(Bundle.GeoFilterPanel_ArtifactType_List_Title());
atCheckboxPanel.setPanelTitleIcon(new ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/extracted_content.png")));
atCheckboxPanel.setSetAllSelected(true);
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
@ -89,7 +102,17 @@ class GeoFilterPanel extends javax.swing.JPanel {
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 15, 0, 15);
add(checkboxPanel, gridBagConstraints);
add(dsCheckboxPanel, gridBagConstraints);
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 4;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.weighty = 1.0;
gridBagConstraints.insets = new java.awt.Insets(0, 15, 0, 15);
add(atCheckboxPanel, gridBagConstraints);
}
@Override
@ -98,7 +121,8 @@ class GeoFilterPanel extends javax.swing.JPanel {
mostRecentButton.setEnabled(enabled);
allButton.setEnabled(enabled);
showWaypointsWOTSCheckBox.setEnabled(enabled && mostRecentButton.isSelected());
checkboxPanel.setEnabled(enabled);
dsCheckboxPanel.setEnabled(enabled);
atCheckboxPanel.setEnabled(enabled);
daysLabel.setEnabled(enabled);
daysSpinner.setEnabled(enabled);
}
@ -115,11 +139,12 @@ class GeoFilterPanel extends javax.swing.JPanel {
* Clears the data source list.
*/
void clearDataSourceList() {
checkboxPanel.clearList();
dsCheckboxPanel.clearList();
atCheckboxPanel.clearList();
}
boolean hasDataSources() {
return !checkboxPanel.isEmpty();
return !dsCheckboxPanel.isEmpty();
}
/**
@ -139,18 +164,24 @@ class GeoFilterPanel extends javax.swing.JPanel {
* @throws GeoLocationUIException
*/
@Messages({
"GeoFilterPanel_empty_dataSource=Data Source list is empty."
"GeoFilterPanel_empty_dataSource=Unable to apply filter, please select one or more data sources.",
"GeoFilterPanel_empty_artifactType=Unable to apply filter, please select one or more artifact types."
})
GeoFilter getFilterState() throws GeoLocationUIException {
List<DataSource> dataSources = checkboxPanel.getSelectedElements();
List<DataSource> dataSources = dsCheckboxPanel.getSelectedElements();
if (dataSources.isEmpty()) {
throw new GeoLocationUIException(Bundle.GeoFilterPanel_empty_dataSource());
}
List<ARTIFACT_TYPE> artifactTypes = atCheckboxPanel.getSelectedElements();
if (artifactTypes.isEmpty()) {
throw new GeoLocationUIException(Bundle.GeoFilterPanel_empty_artifactType());
}
return new GeoFilter(allButton.isSelected(),
showWaypointsWOTSCheckBox.isSelected(),
numberModel.getNumber().intValue(),
dataSources);
dataSources,
artifactTypes);
}
/**
@ -180,6 +211,7 @@ class GeoFilterPanel extends javax.swing.JPanel {
showWaypointsWOTSCheckBox = new javax.swing.JCheckBox();
daysSpinner = new javax.swing.JSpinner(numberModel);
daysLabel = new javax.swing.JLabel();
showLabel = new javax.swing.JLabel();
javax.swing.JPanel buttonPanel = new javax.swing.JPanel();
applyButton = new javax.swing.JButton();
javax.swing.JLabel optionsLabel = new javax.swing.JLabel();
@ -199,7 +231,7 @@ class GeoFilterPanel extends javax.swing.JPanel {
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridwidth = 4;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.weightx = 1.0;
@ -214,40 +246,46 @@ class GeoFilterPanel extends javax.swing.JPanel {
});
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridwidth = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 0);
waypointSettings.add(mostRecentButton, gridBagConstraints);
org.openide.awt.Mnemonics.setLocalizedText(showWaypointsWOTSCheckBox, org.openide.util.NbBundle.getMessage(GeoFilterPanel.class, "GeoFilterPanel.showWaypointsWOTSCheckBox.text")); // NOI18N
showWaypointsWOTSCheckBox.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.gridy = 3;
gridBagConstraints.gridwidth = 3;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(0, 30, 0, 0);
gridBagConstraints.insets = new java.awt.Insets(0, -20, 0, 5);
waypointSettings.add(showWaypointsWOTSCheckBox, gridBagConstraints);
daysSpinner.setEnabled(false);
daysSpinner.setPreferredSize(new java.awt.Dimension(75, 26));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints.insets = new java.awt.Insets(9, 0, 0, 0);
waypointSettings.add(daysSpinner, gridBagConstraints);
org.openide.awt.Mnemonics.setLocalizedText(daysLabel, org.openide.util.NbBundle.getMessage(GeoFilterPanel.class, "GeoFilterPanel.daysLabel.text")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
gridBagConstraints.weightx = 1.0;
gridBagConstraints.insets = new java.awt.Insets(9, 5, 0, 0);
gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5);
waypointSettings.add(daysLabel, gridBagConstraints);
org.openide.awt.Mnemonics.setLocalizedText(showLabel, org.openide.util.NbBundle.getMessage(GeoFilterPanel.class, "GeoFilterPanel.showLabel.text")); // NOI18N
showLabel.setToolTipText(org.openide.util.NbBundle.getMessage(GeoFilterPanel.class, "GeoFilterPanel.showLabel.toolTipText")); // NOI18N
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
waypointSettings.add(showLabel, gridBagConstraints);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 2;
@ -300,6 +338,7 @@ class GeoFilterPanel extends javax.swing.JPanel {
private javax.swing.JLabel daysLabel;
private javax.swing.JSpinner daysSpinner;
private javax.swing.JRadioButton mostRecentButton;
private javax.swing.JLabel showLabel;
private javax.swing.JCheckBox showWaypointsWOTSCheckBox;
// End of variables declaration//GEN-END:variables
@ -312,6 +351,7 @@ class GeoFilterPanel extends javax.swing.JPanel {
private final boolean showWithoutTimeStamp;
private final int mostRecentNumDays;
private final List<DataSource> dataSources;
private final List<ARTIFACT_TYPE> artifactTypes;
/**
* Construct a Geolocation filter. showAll and mostRecentNumDays are
@ -332,12 +372,17 @@ class GeoFilterPanel extends javax.swing.JPanel {
* showAll is true.
* @param dataSources A list of dataSources to filter waypoint
* for.
* @param artifactTypes A list of artifactTypes to filter waypoint
* for.
*/
GeoFilter(boolean showAll, boolean withoutTimeStamp, int mostRecentNumDays, List<DataSource> dataSources) {
GeoFilter(boolean showAll, boolean withoutTimeStamp,
int mostRecentNumDays, List<DataSource> dataSources,
List<ARTIFACT_TYPE> artifactTypes) {
this.showAll = showAll;
this.showWithoutTimeStamp = withoutTimeStamp;
this.mostRecentNumDays = mostRecentNumDays;
this.dataSources = dataSources;
this.artifactTypes = artifactTypes;
}
/**
@ -380,6 +425,31 @@ class GeoFilterPanel extends javax.swing.JPanel {
List<DataSource> getDataSources() {
return Collections.unmodifiableList(dataSources);
}
/**
* Returns a list of artifact types to filter the waypoints by, or null
* if all types should be include.
*
* @return A list of artifactTypes or null if all artifactTypes should
* be included.
*/
List<ARTIFACT_TYPE> getArtifactTypes() {
return Collections.unmodifiableList(artifactTypes);
}
}
/**
* Container for data sources and artifact types to be given as filter options
*/
final private class Sources {
final List<Pair<String, DataSource>> dataSources;
final Map<ARTIFACT_TYPE, Long> artifactTypes;
private Sources(List<Pair<String, DataSource>> dataSources,
Map<ARTIFACT_TYPE, Long> artifactTypes) {
this.dataSources = dataSources;
this.artifactTypes = artifactTypes;
}
}
/**
@ -388,25 +458,32 @@ class GeoFilterPanel extends javax.swing.JPanel {
* doInBackground creates a list of Pair objects that contain the
* display name of the data source and the data source object.
*/
final private class DataSourceUpdater extends SwingWorker<List<Pair<String, DataSource>>, Void> {
final private class DataSourceUpdater extends SwingWorker<Sources, Void> {
@Override
protected List<Pair<String, DataSource>> doInBackground() throws Exception {
protected Sources doInBackground() throws Exception {
SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase();
List<Pair<String, DataSource>> validSources = new ArrayList<>();
HashMap<ARTIFACT_TYPE, Long> atCountsTotal = new HashMap<>();
for (DataSource dataSource : sleuthkitCase.getDataSources()) {
if (isGPSDataSource(sleuthkitCase, dataSource)) {
Map<ARTIFACT_TYPE, Long> atCounts = getGPSDataSources(sleuthkitCase, dataSource);
if (!atCounts.isEmpty()) {
for (Map.Entry<ARTIFACT_TYPE, Long> entry : atCounts.entrySet()) {
atCountsTotal.putIfAbsent(entry.getKey(), 0L);
atCountsTotal.put(entry.getKey(), atCountsTotal.get(entry.getKey()) + entry.getValue());
}
String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName();
Pair<String, DataSource> pair = new Pair<>(dsName, dataSource);
validSources.add(pair);
}
}
return validSources;
return new Sources(validSources, atCountsTotal);
}
/**
* Returns whether or not the given data source has GPS artifacts.
* Returns a Map representing the number of sources found for each
* artifact type. If no data was found, an empty map is returned.
*
* @param sleuthkitCase The current sleuthkitCase
* @param dataSource
@ -415,19 +492,20 @@ class GeoFilterPanel extends javax.swing.JPanel {
*
* @throws TskCoreException
*/
private boolean isGPSDataSource(SleuthkitCase sleuthkitCase, DataSource dataSource) throws TskCoreException {
private Map<ARTIFACT_TYPE, Long> getGPSDataSources(SleuthkitCase sleuthkitCase, DataSource dataSource) throws TskCoreException {
HashMap<ARTIFACT_TYPE, Long> ret = new HashMap<>();
for (BlackboardArtifact.ARTIFACT_TYPE type : GPS_ARTIFACT_TYPES) {
if (sleuthkitCase.getBlackboardArtifactsTypeCount(type.getTypeID(), dataSource.getId()) > 0) {
return true;
long count = sleuthkitCase.getBlackboardArtifactsTypeCount(type.getTypeID(), dataSource.getId());
if (count > 0) {
ret.put(type, count);
}
}
return false;
return ret;
}
@Override
public void done() {
List<Pair<String, DataSource>> sources = null;
Sources sources = null;
try {
sources = get();
} catch (InterruptedException | ExecutionException ex) {
@ -440,8 +518,14 @@ class GeoFilterPanel extends javax.swing.JPanel {
}
if (sources != null) {
for (Pair<String, DataSource> source : sources) {
checkboxPanel.addElement(source.getKey(), source.getValue());
for (Pair<String, DataSource> source : sources.dataSources) {
dsCheckboxPanel.addElement(source.getKey(), null, source.getValue());
}
for (Map.Entry<ARTIFACT_TYPE, Long> entry : sources.artifactTypes.entrySet()) {
String dispName = entry.getKey().getDisplayName() + " (" + entry.getValue() + ")";
String iconPath = IconsUtil.getIconFilePath(entry.getKey().getTypeID());
Icon icon = new ImageIcon(getClass().getResource(iconPath));
atCheckboxPanel.addElement(dispName, icon, entry.getKey());
}
}

View File

@ -166,7 +166,6 @@ public final class GeolocationTopComponent extends TopComponent {
Bundle.GLTopComponent_No_dataSource_message(),
Bundle.GLTopComponent_No_dataSource_Title(),
JOptionPane.ERROR_MESSAGE);
}
}
@ -290,7 +289,7 @@ public final class GeolocationTopComponent extends TopComponent {
filters = geoFilterPanel.getFilterState();
} catch (GeoLocationUIException ex) {
JOptionPane.showMessageDialog(this,
Bundle.GeoTopComponent_filer_data_invalid_msg(),
ex.getMessage(),
Bundle.GeoTopComponent_filer_data_invalid_Title(),
JOptionPane.INFORMATION_MESSAGE);
return;

View File

@ -26,6 +26,7 @@ import java.util.List;
import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.CaseDbAccessManager;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.SleuthkitCase;
@ -189,7 +190,7 @@ public final class WaypointBuilder {
public static List<Waypoint> getTrackpointWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
List<BlackboardArtifact> artifacts = null;
try {
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT);
artifacts = skCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_GPS_TRACKPOINT);
} catch (TskCoreException ex) {
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_TRACKPOINT", ex);//NON-NLS
}
@ -237,7 +238,7 @@ public final class WaypointBuilder {
static public List<Waypoint> getEXIFWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
List<BlackboardArtifact> artifacts = null;
try {
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF);
artifacts = skCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_METADATA_EXIF);
} catch (TskCoreException ex) {
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_LAST_KNOWN_LOCATION", ex);//NON-NLS
}
@ -289,7 +290,7 @@ public final class WaypointBuilder {
public static List<Waypoint> getSearchWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
List<BlackboardArtifact> artifacts = null;
try {
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH);
artifacts = skCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_GPS_SEARCH);
} catch (TskCoreException ex) {
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_SEARCH", ex);//NON-NLS
}
@ -339,7 +340,7 @@ public final class WaypointBuilder {
public static List<Waypoint> getLastKnownWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
List<BlackboardArtifact> artifacts = null;
try {
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION);
artifacts = skCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION);
} catch (TskCoreException ex) {
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_LAST_KNOWN_LOCATION", ex);//NON-NLS
}
@ -390,7 +391,7 @@ public final class WaypointBuilder {
public static List<Waypoint> getBookmarkWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
List<BlackboardArtifact> artifacts = null;
try {
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK);
artifacts = skCase.getBlackboardArtifacts(ARTIFACT_TYPE.TSK_GPS_BOOKMARK);
} catch (TskCoreException ex) {
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_BOOKMARK", ex);//NON-NLS
}
@ -444,6 +445,9 @@ public final class WaypointBuilder {
* Pass a null or empty list to show way points for
* all dataSources.
*
* @param artifactTypes List of types from which we want to get
* waypoints.
*
* @param showAll True to get all waypoints.
*
* @param cntDaysFromRecent Number of days from the most recent time stamp
@ -459,7 +463,7 @@ public final class WaypointBuilder {
*
* @throws GeoLocationDataException
*/
static public void getAllWaypoints(SleuthkitCase skCase, List<DataSource> dataSources, boolean showAll, int cntDaysFromRecent, boolean noTimeStamp, WaypointFilterQueryCallBack queryCallBack) throws GeoLocationDataException {
static public void getAllWaypoints(SleuthkitCase skCase, List<DataSource> dataSources, List<ARTIFACT_TYPE> artifactTypes, boolean showAll, int cntDaysFromRecent, boolean noTimeStamp, WaypointFilterQueryCallBack queryCallBack) throws GeoLocationDataException {
String query = buildQuery(dataSources, showAll, cntDaysFromRecent, noTimeStamp);
logger.log(Level.INFO, query);
@ -480,9 +484,10 @@ public final class WaypointBuilder {
int artifact_type_id = rs.getInt("artifact_type_id"); //NON-NLS
long artifact_id = rs.getLong("artifact_id"); //NON-NLS
BlackboardArtifact.ARTIFACT_TYPE type = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact_type_id);
waypoints.addAll(getWaypointForArtifact(skCase.getBlackboardArtifact(artifact_id), type));
ARTIFACT_TYPE type = ARTIFACT_TYPE.fromID(artifact_type_id);
if (artifactTypes.contains(type)) {
waypoints.addAll(getWaypointForArtifact(skCase.getBlackboardArtifact(artifact_id), type));
}
}
queryCallBack.process(waypoints);
@ -624,7 +629,7 @@ public final class WaypointBuilder {
*
* @throws GeoLocationDataException
*/
static private List<Waypoint> getWaypointForArtifact(BlackboardArtifact artifact, BlackboardArtifact.ARTIFACT_TYPE type) throws GeoLocationDataException {
static private List<Waypoint> getWaypointForArtifact(BlackboardArtifact artifact, ARTIFACT_TYPE type) throws GeoLocationDataException {
List<Waypoint> waypoints = new ArrayList<>();
switch (type) {
case TSK_METADATA_EXIF:

View File

@ -5,7 +5,7 @@ build.xml.stylesheet.CRC32=eaf9f76a@1.42.2
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=2e7964b0
nbproject/build-impl.xml.script.CRC32=b72261eb
nbproject/build-impl.xml.stylesheet.CRC32=0f381476@2.47.1
nbproject/build-impl.xml.stylesheet.CRC32=473dc988@2.76.1
nbproject/platform.xml.data.CRC32=2e7964b0
nbproject/platform.xml.script.CRC32=6dcbd131
nbproject/platform.xml.stylesheet.CRC32=45ddf0e0@2.72.1
nbproject/platform.xml.stylesheet.CRC32=ae64f0b6@2.76.1