mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 11:07:43 +00:00
merged in the datamodel again
This commit is contained in:
commit
c54861d6df
@ -18,155 +18,48 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.geolocation.datamodel;
|
package org.sleuthkit.autopsy.geolocation.datamodel;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
|
||||||
import org.sleuthkit.datamodel.TskCoreException;
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilities for simplifying and reducing redundant when getting Artifact
|
* Utilities for simplifying the use of Waypoint Artifacts.
|
||||||
* attributes.
|
|
||||||
*/
|
*/
|
||||||
final class ArtifactUtils {
|
final class ArtifactUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private constructor for this Utility class.
|
* Private constructor for this Utility class.
|
||||||
*/
|
*/
|
||||||
private ArtifactUtils() {
|
private ArtifactUtils() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for getting a String attribute from an artifact. This
|
* Gets the list of attributes from the artifact and puts them into a map
|
||||||
* will work for all attributes
|
* with the ATRIBUTE_TYPE as the key.
|
||||||
*
|
*
|
||||||
* @param artifact The BlackboardArtifact to get the attributeType
|
* @param artifact BlackboardArtifact current artifact
|
||||||
* @param attributeType BlackboardAttribute attributeType
|
|
||||||
*
|
*
|
||||||
* @return String value for the given attribute or null if attribute was not
|
* @return A Map of BlackboardAttributes for the given artifact with
|
||||||
* set for the given artifact
|
* ATTRIBUTE_TYPE as the key.
|
||||||
*
|
*
|
||||||
* @throws TskCoreException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException {
|
static Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> getAttributesFromArtifactAsMap(BlackboardArtifact artifact) throws GeoLocationDataException {
|
||||||
if (artifact == null) {
|
Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap = new HashMap<>();
|
||||||
return null;
|
try {
|
||||||
|
List<BlackboardAttribute> attributeList = artifact.getAttributes();
|
||||||
|
for (BlackboardAttribute attribute : attributeList) {
|
||||||
|
BlackboardAttribute.ATTRIBUTE_TYPE type = BlackboardAttribute.ATTRIBUTE_TYPE.fromID(attribute.getAttributeType().getTypeID());
|
||||||
|
attributeMap.put(type, attribute);
|
||||||
|
}
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
throw new GeoLocationDataException("Unable to get attributes from artifact", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
BlackboardAttribute attribute;
|
return attributeMap;
|
||||||
try{
|
|
||||||
attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType));
|
|
||||||
} catch(TskCoreException ex) {
|
|
||||||
throw new GeoLocationDataException(String.format("Failed to get double attribute for artifact: %d", artifact.getArtifactID()), ex);
|
|
||||||
}
|
|
||||||
return (attribute != null ? attribute.getDisplayString() : null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function for getting a Double attribute from an artifact.
|
|
||||||
*
|
|
||||||
* @param artifact The BlackboardArtifact to get the attributeType
|
|
||||||
* @param attributeType BlackboardAttribute attributeType
|
|
||||||
*
|
|
||||||
* @return Double value for the given attribute.
|
|
||||||
*
|
|
||||||
* @throws TskCoreException
|
|
||||||
*/
|
|
||||||
static Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException {
|
|
||||||
if (artifact == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlackboardAttribute attribute;
|
|
||||||
try{
|
|
||||||
attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType));
|
|
||||||
} catch(TskCoreException ex) {
|
|
||||||
throw new GeoLocationDataException(String.format("Failed to get double attribute for artifact: %d", artifact.getArtifactID()), ex);
|
|
||||||
}
|
|
||||||
return (attribute != null ? attribute.getValueDouble() : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function for getting a Long attribute from an artifact.
|
|
||||||
*
|
|
||||||
* @param artifact The BlackboardArtifact to get the attributeType
|
|
||||||
* @param attributeType BlackboardAttribute attributeType
|
|
||||||
*
|
|
||||||
* @return Long value for the given attribute.
|
|
||||||
*
|
|
||||||
* @throws TskCoreException
|
|
||||||
*/
|
|
||||||
static Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException {
|
|
||||||
if (artifact == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.LONG
|
|
||||||
|| attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlackboardAttribute attribute;
|
|
||||||
try{
|
|
||||||
attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType));
|
|
||||||
} catch(TskCoreException ex) {
|
|
||||||
throw new GeoLocationDataException(String.format("Failed to get double attribute for artifact: %d", artifact.getArtifactID()), ex);
|
|
||||||
}
|
|
||||||
return (attribute != null ? attribute.getValueLong() : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function for getting a Integer attribute from an artifact.
|
|
||||||
*
|
|
||||||
* @param artifact The BlackboardArtifact to get the attributeType
|
|
||||||
* @param attributeType BlackboardAttribute attributeType
|
|
||||||
*
|
|
||||||
* @return Integer value for the given attribute.
|
|
||||||
*
|
|
||||||
* @throws TskCoreException
|
|
||||||
*/
|
|
||||||
static Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException {
|
|
||||||
if (artifact == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlackboardAttribute attribute;
|
|
||||||
try{
|
|
||||||
attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType));
|
|
||||||
} catch(TskCoreException ex) {
|
|
||||||
throw new GeoLocationDataException(String.format("Failed to get double attribute for artifact: %d", artifact.getArtifactID()), ex);
|
|
||||||
}
|
|
||||||
return (attribute != null ? attribute.getValueInt() : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a list of artifacts for the given BlackboardArtifact.Type.
|
|
||||||
*
|
|
||||||
* @param skCase Currently open case
|
|
||||||
* @param type BlackboardArtifact.Type to retrieve
|
|
||||||
*
|
|
||||||
* @return List of BlackboardArtifacts
|
|
||||||
*
|
|
||||||
* @throws GeoLocationDataException
|
|
||||||
*/
|
|
||||||
static List<BlackboardArtifact> getArtifactsForType(SleuthkitCase skCase, BlackboardArtifact.ARTIFACT_TYPE type) throws GeoLocationDataException {
|
|
||||||
List<BlackboardArtifact> artifacts;
|
|
||||||
try{
|
|
||||||
artifacts = skCase.getBlackboardArtifacts(type);
|
|
||||||
} catch(TskCoreException ex) {
|
|
||||||
throw new GeoLocationDataException(String.format("Unable to get artifacts for type: %s", type.getLabel()), ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return artifacts;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.geolocation.datamodel;
|
|||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
@ -43,81 +44,39 @@ class ArtifactWaypoint implements Waypoint {
|
|||||||
final private List<Waypoint.Property> immutablePropertiesList;
|
final private List<Waypoint.Property> immutablePropertiesList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a simple waypoint with the given artifact and assign the given
|
* Construct a waypoint with the given artifact.
|
||||||
* type.
|
|
||||||
*
|
|
||||||
* This constructor is for use with artifacts that use the basic attributes
|
|
||||||
* of: TSK_NAME TSK_GEO_LONGITUDE TSK_GEO_LATITUDE TSK_GEO_ALITUDE
|
|
||||||
* TSK_DATETIME
|
|
||||||
*
|
*
|
||||||
* @param artifact BlackboardArtifact for this waypoint
|
* @param artifact BlackboardArtifact for this waypoint
|
||||||
* @param type Waypoint type
|
|
||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException Exception will be thrown if artifact did
|
||||||
|
* not have a valid longitude and latitude.
|
||||||
*/
|
*/
|
||||||
protected ArtifactWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
protected ArtifactWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
||||||
this(artifact,
|
this(artifact,
|
||||||
getLabelFromArtifact(artifact));
|
ArtifactUtils.getAttributesFromArtifactAsMap(artifact));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For use by subclasses that want to customize the label, but use the basic
|
* Constructor that sets all of the member variables.
|
||||||
* attributes of: TSK_GEO_LONGITUDE TSK_GEO_LATITUDE TSK_GEO_ALITUDE
|
|
||||||
* TSK_DATETIME
|
|
||||||
*
|
*
|
||||||
* @param artifact BlackboardArtifact for this waypoint
|
* @param artifact BlackboardArtifact for this waypoint
|
||||||
* @param label String label for this waypoint
|
* @param label String waypoint label
|
||||||
* @param type Waypoint type
|
* @param timestamp Long timestamp, epoch seconds
|
||||||
|
* @param latitude Double waypoint latitude
|
||||||
|
* @param longitude Double waypoint longitude
|
||||||
|
* @param altitude Double waypoint altitude
|
||||||
|
* @param image AbstractFile image for waypoint, this maybe null
|
||||||
|
* @param type Waypoint.Type value for waypoint
|
||||||
|
* @param attributeMap A Map of attributes for the given artifact
|
||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException Exception will be thrown if artifact did
|
||||||
|
* not have a valid longitude and latitude.
|
||||||
*/
|
*/
|
||||||
protected ArtifactWaypoint(BlackboardArtifact artifact, String label) throws GeoLocationDataException {
|
protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
this(artifact,
|
if (longitude == null || latitude == null) {
|
||||||
label,
|
throw new GeoLocationDataException("Invalid waypoint, null value passed for longitude or latitude");
|
||||||
getTimestampFromArtifact(artifact),
|
}
|
||||||
null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor for use by Waypoint subclasses that want to customize the
|
|
||||||
* label, specify the timestamp or supply and image.
|
|
||||||
*
|
|
||||||
* Uses the following attributes to set longitude, latitude, altitude:
|
|
||||||
* TSK_GEO_LONGITUDE TSK_GEO_LATITUDE TSK_GEO_ALITUDE
|
|
||||||
*
|
|
||||||
* @param artifact BlackboardArtifact for this waypoint
|
|
||||||
* @param label String waypoint label
|
|
||||||
* @param timestamp Long timestamp, epoch seconds
|
|
||||||
* @param image AbstractFile image for waypoint, this maybe null
|
|
||||||
* @param type Waypoint.Type value for waypoint
|
|
||||||
*
|
|
||||||
* @throws GeoLocationDataException
|
|
||||||
*/
|
|
||||||
protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, AbstractFile image) throws GeoLocationDataException {
|
|
||||||
this(artifact,
|
|
||||||
label,
|
|
||||||
timestamp,
|
|
||||||
ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE),
|
|
||||||
ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE),
|
|
||||||
ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE),
|
|
||||||
image);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Private constructor that sets all of the member variables.
|
|
||||||
*
|
|
||||||
* @param artifact BlackboardArtifact for this waypoint
|
|
||||||
* @param label String waypoint label
|
|
||||||
* @param timestamp Long timestamp, epoch seconds
|
|
||||||
* @param latitude Double waypoint latitude
|
|
||||||
* @param longitude Double waypoint longitude
|
|
||||||
* @param altitude Double waypoint altitude
|
|
||||||
* @param image AbstractFile image for waypoint, this maybe null
|
|
||||||
* @param type Waypoint.Type value for waypoint
|
|
||||||
*
|
|
||||||
* @throws GeoLocationDataException
|
|
||||||
*/
|
|
||||||
private ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image) throws GeoLocationDataException {
|
|
||||||
this.artifact = artifact;
|
this.artifact = artifact;
|
||||||
this.label = label;
|
this.label = label;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
@ -126,7 +85,26 @@ class ArtifactWaypoint implements Waypoint {
|
|||||||
this.latitude = latitude;
|
this.latitude = latitude;
|
||||||
this.altitude = altitude;
|
this.altitude = altitude;
|
||||||
|
|
||||||
immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.getOtherGeolocationProperties(artifact));
|
immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.createGeolocationProperties(attributeMap));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new ArtifactWaypoint.
|
||||||
|
*
|
||||||
|
* @param artifact BlackboardArtifact for this waypoint
|
||||||
|
* @param attributeMap A Map of the BlackboardAttributes for the given
|
||||||
|
* artifact.
|
||||||
|
*
|
||||||
|
* @throws GeoLocationDataException
|
||||||
|
*/
|
||||||
|
private ArtifactWaypoint(BlackboardArtifact artifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
|
this(artifact,
|
||||||
|
getLabelFromArtifact(attributeMap),
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME).getValueLong() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE).getValueDouble() : null,
|
||||||
|
null, attributeMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,48 +145,26 @@ class ArtifactWaypoint implements Waypoint {
|
|||||||
public AbstractFile getImage() {
|
public AbstractFile getImage() {
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Waypoint.Property> getOtherProperties() {
|
public List<Waypoint.Property> getOtherProperties() {
|
||||||
return immutablePropertiesList;
|
return immutablePropertiesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the timestamp attribute based on type for the given artifact.
|
* Gets the label for this waypoint.
|
||||||
*
|
*
|
||||||
* @param artifact BlackboardArtifact for waypoint
|
* @param artifact BlackboardArtifact for waypoint
|
||||||
*
|
*
|
||||||
* @return Long timestamp or null if a value was not found.
|
* @return Returns a label for the waypoint, or empty string if no label was
|
||||||
*
|
* found.
|
||||||
* @throws GeoLocationDataException
|
|
||||||
*/
|
*/
|
||||||
private static Long getTimestampFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException {
|
private static String getLabelFromArtifact(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) {
|
||||||
if (artifact == null) {
|
BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
|
||||||
return null;
|
if (attribute != null) {
|
||||||
|
return attribute.getDisplayString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME);
|
return "";
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the label for this waypoint based on the artifact type.
|
|
||||||
*
|
|
||||||
* This is the original waypoint naming code from the KML report, we may
|
|
||||||
* what to thinki about better ways to name some of the point.
|
|
||||||
*
|
|
||||||
* @param artifact BlackboardArtifact for waypoint
|
|
||||||
*
|
|
||||||
* @return Returns a label for the waypoint based on artifact type, or empty
|
|
||||||
* string if no label was found.
|
|
||||||
*
|
|
||||||
* @throws GeoLocationDataException
|
|
||||||
*/
|
|
||||||
private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException {
|
|
||||||
|
|
||||||
String typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
|
|
||||||
if (typeLabel == null) {
|
|
||||||
typeLabel = "";
|
|
||||||
}
|
|
||||||
return typeLabel;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.geolocation.datamodel;
|
package org.sleuthkit.autopsy.geolocation.datamodel;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
@ -36,22 +37,26 @@ final class EXIFWaypoint extends ArtifactWaypoint {
|
|||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
protected EXIFWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
protected EXIFWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
||||||
this(artifact, getImageFromArtifact(artifact));
|
this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact), getImageFromArtifact(artifact));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private constructor to help with the construction of EXIFWaypoints.
|
* Constructs new waypoint using the given artifact and attribute map.
|
||||||
*
|
*
|
||||||
* @param artifact Waypoint BlackboardArtifact
|
* @param artifact Waypoint BlackboardArtifact
|
||||||
* @param image EXIF AbstractFile image
|
* @param attributeMap Map of artifact attributes
|
||||||
|
* @param image EXIF AbstractFile image
|
||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
private EXIFWaypoint(BlackboardArtifact artifact, AbstractFile image) throws GeoLocationDataException {
|
private EXIFWaypoint(BlackboardArtifact artifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap, AbstractFile image) throws GeoLocationDataException {
|
||||||
super(artifact,
|
super(artifact,
|
||||||
image != null ? image.getName() : "",
|
image != null ? image.getName() : "",
|
||||||
ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED),
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED).getValueLong() : null,
|
||||||
image);
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE).getValueDouble() : null,
|
||||||
|
image, attributeMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,15 +73,14 @@ final class EXIFWaypoint extends ArtifactWaypoint {
|
|||||||
AbstractFile abstractFile = null;
|
AbstractFile abstractFile = null;
|
||||||
BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
|
BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
|
||||||
if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) {
|
if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) {
|
||||||
|
|
||||||
try{
|
try {
|
||||||
abstractFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID());
|
abstractFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID());
|
||||||
} catch(TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
throw new GeoLocationDataException(String.format("Unable to getAbstractFileByID for artifact: %d", artifact.getArtifactID(), artifact.getArtifactID()), ex);
|
throw new GeoLocationDataException(String.format("Unable to getAbstractFileByID for artifact: %d", artifact.getArtifactID(), artifact.getArtifactID()), ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return abstractFile;
|
return abstractFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,31 @@
|
|||||||
/*
|
/*
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
* Autopsy Forensic Browser
|
||||||
* To change this template file, choose Tools | Templates
|
*
|
||||||
* and open the template in the editor.
|
* Copyright 2019 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.geolocation.datamodel;
|
package org.sleuthkit.autopsy.geolocation.datamodel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* An exception class for the Geolocation dateModel;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class GeoLocationDataException extends Exception {
|
public class GeoLocationDataException extends Exception {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor when error message is not available
|
|
||||||
*/
|
|
||||||
public GeoLocationDataException() {
|
|
||||||
super("No error message available.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create exception containing the error message
|
* Create exception containing the error message
|
||||||
*
|
*
|
||||||
|
@ -20,36 +20,31 @@ package org.sleuthkit.autopsy.geolocation.datamodel;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GeolocationUtilis class for common to be share across in the package
|
* GeolocationUtilis class for common shared between Routes and Waypoints.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
final class GeolocationUtils {
|
final class GeolocationUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a list of attributes that are related to a geolocation waypoint
|
* This is a list of attributes that are already being handled by the
|
||||||
* but are for information\artifact properties purpose. They are not needed
|
* waypoint classes and will have get functions.
|
||||||
* for the placement of a point on a map;
|
|
||||||
*/
|
*/
|
||||||
private static final BlackboardAttribute.ATTRIBUTE_TYPE[] OTHER_GEO_ATTRIBUTES = {
|
private static final BlackboardAttribute.ATTRIBUTE_TYPE[] ALREADY_HANDLED_ATTRIBUTES = {
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION,
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME,
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START,
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE,
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END,
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE,
|
||||||
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE,
|
||||||
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME,
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED,
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VELOCITY,
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START,
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_BEARING,
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START,
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_HPRECISION,
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END,
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VPRECISION,
|
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END,};
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_MAPDATUM,
|
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME,
|
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_SOURCE,
|
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG,
|
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MAKE,
|
|
||||||
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MODEL
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a Utility class that should not be constructed.
|
* This is a Utility class that should not be constructed.
|
||||||
@ -59,7 +54,9 @@ final class GeolocationUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of Waypoint.Property objects for the given artifact.
|
* Get a list of Waypoint.Property objects for the given artifact. This list
|
||||||
|
* will not include attributes that the Waypoint interfact has get functions
|
||||||
|
* for.
|
||||||
*
|
*
|
||||||
* @param artifact Blackboard artifact to get attributes\properties from
|
* @param artifact Blackboard artifact to get attributes\properties from
|
||||||
*
|
*
|
||||||
@ -67,20 +64,21 @@ final class GeolocationUtils {
|
|||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
static List<Waypoint.Property> getOtherGeolocationProperties(BlackboardArtifact artifact) throws GeoLocationDataException {
|
static List<Waypoint.Property> createGeolocationProperties(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
List<Waypoint.Property> list = new ArrayList<>();
|
List<Waypoint.Property> list = new ArrayList<>();
|
||||||
|
|
||||||
for (BlackboardAttribute.ATTRIBUTE_TYPE type : OTHER_GEO_ATTRIBUTES) {
|
Set<BlackboardAttribute.ATTRIBUTE_TYPE> keys = attributeMap.keySet();
|
||||||
String key = type.getDisplayName();
|
|
||||||
String value = ArtifactUtils.getString(artifact, type);
|
|
||||||
|
|
||||||
if (value == null) {
|
for (BlackboardAttribute.ATTRIBUTE_TYPE type : ALREADY_HANDLED_ATTRIBUTES) {
|
||||||
value = "";
|
keys.remove(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (BlackboardAttribute.ATTRIBUTE_TYPE type : keys) {
|
||||||
|
String key = type.getDisplayName();
|
||||||
|
String value = attributeMap.get(type).getDisplayString();
|
||||||
|
|
||||||
list.add(new Waypoint.Property(key, value));
|
list.add(new Waypoint.Property(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.geolocation.datamodel;
|
package org.sleuthkit.autopsy.geolocation.datamodel;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
@ -29,21 +30,48 @@ import org.sleuthkit.datamodel.BlackboardAttribute;
|
|||||||
"LastKnownWaypoint_Label=Last Known Location",})
|
"LastKnownWaypoint_Label=Last Known Location",})
|
||||||
final class LastKnownWaypoint extends ArtifactWaypoint {
|
final class LastKnownWaypoint extends ArtifactWaypoint {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new waypoint.
|
||||||
|
*
|
||||||
|
* @param artifact BlackboardArtifact from which to construct the waypoint
|
||||||
|
*
|
||||||
|
* @throws GeoLocationDataException
|
||||||
|
*/
|
||||||
protected LastKnownWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
protected LastKnownWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
||||||
super(artifact, getLabelFromArtifact(artifact));
|
this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new waypoint with the given artifact and attribute map.
|
||||||
|
*
|
||||||
|
* @param artifact BlackboardArtifact from which to construct the
|
||||||
|
* waypoint
|
||||||
|
* @param attributeMap Map of artifact attributes
|
||||||
|
*
|
||||||
|
* @throws GeoLocationDataException
|
||||||
|
*/
|
||||||
|
private LastKnownWaypoint(BlackboardArtifact artifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
|
super(artifact,
|
||||||
|
getLabelFromArtifact(attributeMap),
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME).getValueLong() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE).getValueDouble() : null,
|
||||||
|
null, attributeMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the label for a TSK_LAST_KNOWN_LOCATION.
|
* Gets the label for a TSK_LAST_KNOWN_LOCATION.
|
||||||
*
|
*
|
||||||
* @param artifact BlackboardArtifact to get label from
|
* @param attributeMap Map of artifact attributes for this waypoint
|
||||||
*
|
*
|
||||||
* @return String value from attribute TSK_NAME or LastKnownWaypoint_Label
|
* @return String value from attribute TSK_NAME or LastKnownWaypoint_Label
|
||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException {
|
private static String getLabelFromArtifact(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
String label = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
|
BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
|
||||||
|
String label = attribute.getDisplayString();
|
||||||
|
|
||||||
if (label == null || label.isEmpty()) {
|
if (label == null || label.isEmpty()) {
|
||||||
label = Bundle.LastKnownWaypoint_Label();
|
label = Bundle.LastKnownWaypoint_Label();
|
||||||
|
@ -22,10 +22,12 @@ package org.sleuthkit.autopsy.geolocation.datamodel;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Route represents a TSK_GPS_ROUTE artifact which has a start and end point
|
* A Route represents a TSK_GPS_ROUTE artifact which has a start and end point
|
||||||
@ -58,9 +60,14 @@ public final class Route {
|
|||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
|
static public List<Route> getRoutes(SleuthkitCase skCase) throws GeoLocationDataException {
|
||||||
|
List<BlackboardArtifact> artifacts = null;
|
||||||
|
try {
|
||||||
|
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE);
|
||||||
|
} catch (TskCoreException ex) {
|
||||||
|
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_BOOKMARK", ex);
|
||||||
|
}
|
||||||
|
|
||||||
static public List<Route> getRoutes(SleuthkitCase skCase) throws GeoLocationDataException {
|
|
||||||
List<BlackboardArtifact> artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE);
|
|
||||||
List<Route> routes = new ArrayList<>();
|
List<Route> routes = new ArrayList<>();
|
||||||
for (BlackboardArtifact artifact : artifacts) {
|
for (BlackboardArtifact artifact : artifacts) {
|
||||||
Route route = new Route(artifact);
|
Route route = new Route(artifact);
|
||||||
@ -76,21 +83,28 @@ public final class Route {
|
|||||||
*/
|
*/
|
||||||
Route(BlackboardArtifact artifact) throws GeoLocationDataException {
|
Route(BlackboardArtifact artifact) throws GeoLocationDataException {
|
||||||
points = new ArrayList<>();
|
points = new ArrayList<>();
|
||||||
Waypoint point = getRouteStartPoint(artifact);
|
|
||||||
|
Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap = ArtifactUtils.getAttributesFromArtifactAsMap(artifact);
|
||||||
|
|
||||||
|
Waypoint point = getRouteStartPoint(attributeMap);
|
||||||
|
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
points.add(point);
|
points.add(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
point = getRouteEndPoint(artifact);
|
point = getRouteEndPoint(attributeMap);
|
||||||
|
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
points.add(point);
|
points.add(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
altitude = getRouteAltitude(artifact);
|
BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE);
|
||||||
timestamp = getRouteTimestamp(artifact);
|
altitude = attribute != null ? attribute.getValueDouble() : null;
|
||||||
immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.getOtherGeolocationProperties(artifact));
|
|
||||||
|
attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME);
|
||||||
|
timestamp = attribute != null ? attribute.getValueLong() : null;
|
||||||
|
|
||||||
|
immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.createGeolocationProperties(attributeMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -143,81 +157,41 @@ public final class Route {
|
|||||||
/**
|
/**
|
||||||
* Get the route start point.
|
* Get the route start point.
|
||||||
*
|
*
|
||||||
* @param artifact The BlackboardARtifact object from which this route is
|
* @param attributeMap Map of artifact attributes for this waypoint
|
||||||
* created
|
|
||||||
*
|
*
|
||||||
* @return Start RoutePoint or null if valid longitude and latitude are not
|
* @return Start RoutePoint
|
||||||
* found
|
|
||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException when longitude or latitude is null
|
||||||
*/
|
*/
|
||||||
private Waypoint getRouteStartPoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
private Waypoint getRouteStartPoint(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
Double latitude;
|
BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START);
|
||||||
Double longitude;
|
BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START);
|
||||||
RoutePoint point = null;
|
|
||||||
|
|
||||||
latitude = ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START);
|
|
||||||
longitude = ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START);
|
|
||||||
|
|
||||||
if (latitude != null && longitude != null) {
|
if (latitude != null && longitude != null) {
|
||||||
point = new RoutePoint(this, latitude, longitude, Bundle.Route_Start_Label());
|
return new RoutePoint(this, latitude.getValueDouble(), longitude.getValueDouble(), Bundle.Route_Start_Label());
|
||||||
|
} else {
|
||||||
|
throw new GeoLocationDataException("Unable to create route start point, invalid longitude and/or latitude");
|
||||||
}
|
}
|
||||||
|
|
||||||
return point;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the route End point.
|
* Get the route End point.
|
||||||
*
|
*
|
||||||
* @param artifact The BlackboardARtifact object from which this route is
|
* @param attributeMap Map of artifact attributes for this waypoint
|
||||||
* created
|
|
||||||
*
|
*
|
||||||
* @return End RoutePoint or null if valid longitude and latitude are not
|
* @return End RoutePoint or null if valid longitude and latitude are not
|
||||||
* found
|
* found
|
||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException when longitude or latitude is null
|
||||||
*/
|
*/
|
||||||
private Waypoint getRouteEndPoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
private Waypoint getRouteEndPoint(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
Double latitude;
|
BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END);
|
||||||
Double longitude;
|
BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END);
|
||||||
RoutePoint point = null;
|
|
||||||
|
|
||||||
latitude = ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END);
|
|
||||||
longitude = ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END);
|
|
||||||
|
|
||||||
if (latitude != null && longitude != null) {
|
if (latitude != null && longitude != null) {
|
||||||
point = new RoutePoint(this, latitude, longitude, Bundle.Route_End_Label());
|
return new RoutePoint(this, latitude.getValueDouble(), longitude.getValueDouble(), Bundle.Route_End_Label());
|
||||||
|
}else {
|
||||||
|
throw new GeoLocationDataException("Unable to create route end point, invalid longitude and/or latitude");
|
||||||
}
|
}
|
||||||
|
|
||||||
return point;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Altitude for this route.
|
|
||||||
*
|
|
||||||
* @param artifact The BlackboardARtifact object from which this route is
|
|
||||||
* created
|
|
||||||
*
|
|
||||||
* @return The Altitude, or null if none was found
|
|
||||||
*
|
|
||||||
* @throws GeoLocationDataException
|
|
||||||
*/
|
|
||||||
private Double getRouteAltitude(BlackboardArtifact artifact) throws GeoLocationDataException {
|
|
||||||
return ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the timestamp for this route.
|
|
||||||
*
|
|
||||||
* @param artifact The BlackboardARtifact object from which this route is
|
|
||||||
* created
|
|
||||||
*
|
|
||||||
* @return The timestamp attribute, or null if none was found
|
|
||||||
*
|
|
||||||
* @throws GeoLocationDataException
|
|
||||||
*/
|
|
||||||
private Long getRouteTimestamp(BlackboardArtifact artifact) throws GeoLocationDataException {
|
|
||||||
return ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.geolocation.datamodel;
|
package org.sleuthkit.autopsy.geolocation.datamodel;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
@ -31,36 +32,46 @@ final class SearchWaypoint extends ArtifactWaypoint {
|
|||||||
"SearchWaypoint_DisplayLabel=GPS Search"
|
"SearchWaypoint_DisplayLabel=GPS Search"
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a GPS Search waypoint.
|
* Construct a waypoint for TSK_GPS_SEARCH artifact.
|
||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
SearchWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
SearchWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
||||||
super(artifact, getLabelFromArtifact(artifact));
|
this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact));
|
||||||
|
}
|
||||||
|
|
||||||
|
private SearchWaypoint(BlackboardArtifact artifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
|
super(artifact,
|
||||||
|
getLabelFromArtifact(attributeMap),
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME).getValueLong() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE).getValueDouble() : null,
|
||||||
|
null, attributeMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Label for a GPS_SEARCH artifact.
|
* Returns a Label for a GPS_SEARCH artifact.
|
||||||
*
|
*
|
||||||
* @param artifact BlackboardArtifact for waypoint
|
* @param attributeMap Map of artifact attributes
|
||||||
*
|
*
|
||||||
* @return String label for the artifacts way point.
|
* @return String label for the artifacts way point.
|
||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException {
|
private static String getLabelFromArtifact(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
String typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
|
BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
|
||||||
|
if (attribute != null) {
|
||||||
if (typeLabel == null || typeLabel.isEmpty()) {
|
return attribute.getDisplayString();
|
||||||
typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeLabel == null || typeLabel.isEmpty()) {
|
attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION);
|
||||||
typeLabel = Bundle.SearchWaypoint_DisplayLabel();
|
if (attribute != null) {
|
||||||
|
return attribute.getDisplayString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return typeLabel;
|
return Bundle.SearchWaypoint_DisplayLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.geolocation.datamodel;
|
package org.sleuthkit.autopsy.geolocation.datamodel;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import org.openide.util.NbBundle.Messages;
|
import org.openide.util.NbBundle.Messages;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||||
@ -37,7 +38,17 @@ final class TrackpointWaypoint extends ArtifactWaypoint {
|
|||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
TrackpointWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
TrackpointWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException {
|
||||||
super(artifact, getLabelFromArtifact(artifact));
|
this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact));
|
||||||
|
}
|
||||||
|
|
||||||
|
private TrackpointWaypoint(BlackboardArtifact artifact, Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
|
super(artifact,
|
||||||
|
getLabelFromArtifact(attributeMap),
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME).getValueLong() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE).getValueDouble() : null,
|
||||||
|
attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE).getValueDouble() : null,
|
||||||
|
null, attributeMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,23 +61,24 @@ final class TrackpointWaypoint extends ArtifactWaypoint {
|
|||||||
*
|
*
|
||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException {
|
private static String getLabelFromArtifact(Map<BlackboardAttribute.ATTRIBUTE_TYPE, BlackboardAttribute> attributeMap) throws GeoLocationDataException {
|
||||||
|
|
||||||
String typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
|
BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME);
|
||||||
|
if (attribute != null) {
|
||||||
if (typeLabel == null || typeLabel.isEmpty()) {
|
return attribute.getDisplayString();
|
||||||
typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeLabel == null || typeLabel.isEmpty()) {
|
attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME);
|
||||||
typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG);
|
if (attribute != null) {
|
||||||
|
return attribute.getDisplayString();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeLabel == null || typeLabel.isEmpty()) {
|
attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG);
|
||||||
typeLabel = Bundle.TrackpointWaypoint_DisplayLabel();
|
if (attribute != null) {
|
||||||
|
return attribute.getDisplayString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return typeLabel;
|
return Bundle.TrackpointWaypoint_DisplayLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,19 @@ package org.sleuthkit.autopsy.geolocation.datamodel;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
|
import org.sleuthkit.datamodel.TskCoreException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The basic details of a waypoint.
|
* The basic details of a waypoint.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface Waypoint {
|
public interface Waypoint {
|
||||||
|
static final Logger logger = Logger.getLogger(Waypoint.class.getName());
|
||||||
/**
|
/**
|
||||||
* Interface to describe a waypoint. A waypoint is made up of
|
* Interface to describe a waypoint. A waypoint is made up of
|
||||||
* a longitude, latitude, label, timestamp, type, image and altitude.
|
* a longitude, latitude, label, timestamp, type, image and altitude.
|
||||||
@ -118,16 +122,21 @@ public interface Waypoint {
|
|||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
static List<Waypoint> getTrackpointWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
static List<Waypoint> getTrackpointWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
||||||
List<BlackboardArtifact> artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT);
|
List<BlackboardArtifact> artifacts = null;
|
||||||
|
try{
|
||||||
|
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT);
|
||||||
|
} catch(TskCoreException ex) {
|
||||||
|
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_TRACKPOINT", ex);
|
||||||
|
}
|
||||||
|
|
||||||
List<Waypoint> points = new ArrayList<>();
|
List<Waypoint> points = new ArrayList<>();
|
||||||
for (BlackboardArtifact artifact : artifacts) {
|
for (BlackboardArtifact artifact : artifacts) {
|
||||||
ArtifactWaypoint point = new TrackpointWaypoint(artifact);
|
try{
|
||||||
// Only add to the list if the point has a valid latitude
|
ArtifactWaypoint point = new TrackpointWaypoint(artifact);
|
||||||
// and longitude.
|
|
||||||
if (point.getLatitude() != null && point.getLongitude() != null) {
|
|
||||||
points.add(point);
|
points.add(point);
|
||||||
}
|
} catch(GeoLocationDataException ex) {
|
||||||
|
logger.log(Level.WARNING, String.format("No longitude or latitude available for TSK_GPS_TRACKPOINT artifactID: %d", artifact.getArtifactID()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
}
|
}
|
||||||
@ -142,17 +151,24 @@ public interface Waypoint {
|
|||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
static List<Waypoint> getEXIFWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
static List<Waypoint> getEXIFWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
||||||
List<BlackboardArtifact> artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF);
|
List<BlackboardArtifact> artifacts = null;
|
||||||
|
try{
|
||||||
|
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF);
|
||||||
|
} catch(TskCoreException ex) {
|
||||||
|
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_LAST_KNOWN_LOCATION", ex);
|
||||||
|
}
|
||||||
|
|
||||||
List<Waypoint> points = new ArrayList<>();
|
List<Waypoint> points = new ArrayList<>();
|
||||||
if (artifacts != null) {
|
if (artifacts != null) {
|
||||||
for (BlackboardArtifact artifact : artifacts) {
|
for (BlackboardArtifact artifact : artifacts) {
|
||||||
ArtifactWaypoint point = new EXIFWaypoint(artifact);
|
try{
|
||||||
// Only add to the list if the point has a valid latitude
|
ArtifactWaypoint point = new EXIFWaypoint(artifact);
|
||||||
// and longitude.
|
|
||||||
if (point.getLatitude() != null && point.getLongitude() != null) {
|
|
||||||
points.add(point);
|
points.add(point);
|
||||||
}
|
} catch(GeoLocationDataException ex) {
|
||||||
|
// I am a little relucant to log this error because I suspect
|
||||||
|
// this will happen more often than not. It is valid for
|
||||||
|
// METADAT_EXIF to not have longitude and latitude
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
@ -168,17 +184,22 @@ public interface Waypoint {
|
|||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
static List<Waypoint> getSearchWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
static List<Waypoint> getSearchWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
||||||
List<BlackboardArtifact> artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH);
|
List<BlackboardArtifact> artifacts = null;
|
||||||
|
try{
|
||||||
|
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH);
|
||||||
|
} catch(TskCoreException ex) {
|
||||||
|
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_SEARCH", ex);
|
||||||
|
}
|
||||||
|
|
||||||
List<Waypoint> points = new ArrayList<>();
|
List<Waypoint> points = new ArrayList<>();
|
||||||
if (artifacts != null) {
|
if (artifacts != null) {
|
||||||
for (BlackboardArtifact artifact : artifacts) {
|
for (BlackboardArtifact artifact : artifacts) {
|
||||||
ArtifactWaypoint point = new SearchWaypoint(artifact);
|
try{
|
||||||
// Only add to the list if the point has a valid latitude
|
ArtifactWaypoint point = new SearchWaypoint(artifact);
|
||||||
// and longitude.
|
|
||||||
if (point.getLatitude() != null && point.getLongitude() != null) {
|
|
||||||
points.add(point);
|
points.add(point);
|
||||||
}
|
} catch(GeoLocationDataException ex) {
|
||||||
|
logger.log(Level.WARNING, String.format("No longitude or latitude available for TSK_GPS_SEARCH artifactID: %d", artifact.getArtifactID()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
@ -194,18 +215,22 @@ public interface Waypoint {
|
|||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
static List<Waypoint> getLastKnownWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
static List<Waypoint> getLastKnownWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
||||||
List<BlackboardArtifact> artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION);
|
List<BlackboardArtifact> artifacts = null;
|
||||||
|
try{
|
||||||
|
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.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);
|
||||||
|
}
|
||||||
|
|
||||||
List<Waypoint> points = new ArrayList<>();
|
List<Waypoint> points = new ArrayList<>();
|
||||||
if (artifacts != null) {
|
if (artifacts != null) {
|
||||||
|
for (BlackboardArtifact artifact : artifacts) {
|
||||||
for (BlackboardArtifact artifact : artifacts) {
|
try{
|
||||||
ArtifactWaypoint point = new LastKnownWaypoint(artifact);
|
ArtifactWaypoint point = new LastKnownWaypoint(artifact);
|
||||||
// Only add to the list if the point has a valid latitude
|
|
||||||
// and longitude.
|
|
||||||
if (point.getLatitude() != null && point.getLongitude() != null) {
|
|
||||||
points.add(point);
|
points.add(point);
|
||||||
}
|
} catch(GeoLocationDataException ex) {
|
||||||
|
logger.log(Level.WARNING, String.format("No longitude or latitude available for TSK_GPS_LAST_KNOWN_LOCATION artifactID: %d", artifact.getArtifactID()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
@ -221,17 +246,22 @@ public interface Waypoint {
|
|||||||
* @throws GeoLocationDataException
|
* @throws GeoLocationDataException
|
||||||
*/
|
*/
|
||||||
static List<Waypoint> getBookmarkWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
static List<Waypoint> getBookmarkWaypoints(SleuthkitCase skCase) throws GeoLocationDataException {
|
||||||
List<BlackboardArtifact> artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK);
|
List<BlackboardArtifact> artifacts = null;
|
||||||
|
try{
|
||||||
|
artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK);
|
||||||
|
} catch(TskCoreException ex) {
|
||||||
|
throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_BOOKMARK", ex);
|
||||||
|
}
|
||||||
|
|
||||||
List<Waypoint> points = new ArrayList<>();
|
List<Waypoint> points = new ArrayList<>();
|
||||||
if (artifacts != null) {
|
if (artifacts != null) {
|
||||||
for (BlackboardArtifact artifact : artifacts) {
|
for (BlackboardArtifact artifact : artifacts) {
|
||||||
ArtifactWaypoint point = new ArtifactWaypoint(artifact);
|
try{
|
||||||
// Only add to the list if the point has a valid latitude
|
ArtifactWaypoint point = new ArtifactWaypoint(artifact);
|
||||||
// and longitude.
|
|
||||||
if (point.getLatitude() != null && point.getLongitude() != null) {
|
|
||||||
points.add(point);
|
points.add(point);
|
||||||
}
|
} catch(GeoLocationDataException ex) {
|
||||||
|
logger.log(Level.WARNING, String.format("No longitude or latitude available for TSK_GPS_BOOKMARK artifactID: %d", artifact.getArtifactID()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return points;
|
return points;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user