Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
GeoPath.java
Go to the documentation of this file.
1/*
2 *
3 * Autopsy Forensic Browser
4 *
5 * Copyright 2020 Basis Technology Corp.
6 * contact: carrier <at> sleuthkit <dot> org
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20package org.sleuthkit.autopsy.geolocation.datamodel;
21
22import java.util.ArrayList;
23import java.util.Collections;
24import java.util.List;
25import java.util.logging.Level;
26import org.sleuthkit.autopsy.coreutils.Logger;
27import org.sleuthkit.datamodel.BlackboardArtifact;
28import org.sleuthkit.datamodel.Content;
29import org.sleuthkit.datamodel.SleuthkitCase;
30import org.sleuthkit.datamodel.TskCoreException;
31
35public class GeoPath {
36 private static final Logger LOGGER = Logger.getLogger(GeoPath.class.getName());
37
38 private final List<Waypoint> waypointList;
39 private final String pathName;
40 private final BlackboardArtifact artifact;
41
52 static public List<Route> getRoutes(SleuthkitCase skCase) throws GeoLocationDataException {
53 List<BlackboardArtifact> artifacts = null;
54 try {
55 artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE);
56 } catch (TskCoreException ex) {
57 throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_BOOKMARK", ex);
58 }
59
60 List<Route> routes = new ArrayList<>();
61 for (BlackboardArtifact artifact : artifacts) {
62 Route route = new Route(artifact);
63 routes.add(route);
64 }
65 return routes;
66 }
67
80 public static GeoLocationParseResult<Track> getTracks(SleuthkitCase skCase, List<? extends Content> sourceList) throws GeoLocationDataException {
81 List<BlackboardArtifact> artifacts = null;
82 boolean allParsedSuccessfully = true;
83 List<Track> tracks = new ArrayList<>();
84 try {
85 artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACK);
86 for (BlackboardArtifact artifact : artifacts) {
87 if (sourceList == null || sourceList.contains(artifact.getDataSource())) {
88 try {
89 tracks.add(new Track(artifact));
90
91 } catch (GeoLocationDataException e) {
92 LOGGER.log(Level.WARNING, "Error loading track from artifact with ID " + artifact.getArtifactID(), e);
93 allParsedSuccessfully = false;
94 }
95 }
96 }
97 } catch (TskCoreException ex) {
98 throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_BOOKMARK", ex);
99 }
100 return new GeoLocationParseResult<Track>(tracks, allParsedSuccessfully);
101 }
102
115 public static GeoLocationParseResult<Area> getAreas(SleuthkitCase skCase, List<? extends Content> sourceList) throws GeoLocationDataException {
116 List<BlackboardArtifact> artifacts;
117 boolean allParsedSuccessfully = true;
118 List<Area> areas = new ArrayList<>();
119 try {
120 artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_AREA);
121 for (BlackboardArtifact artifact : artifacts) {
122 if (sourceList == null || sourceList.contains(artifact.getDataSource())) {
123 try {
124 areas.add(new Area(artifact));
125
126 } catch (GeoLocationDataException e) {
127 LOGGER.log(Level.WARNING, "Error loading track from artifact with ID " + artifact.getArtifactID(), e);
128 allParsedSuccessfully = false;
129 }
130 }
131 }
132 } catch (TskCoreException ex) {
133 throw new GeoLocationDataException("Unable to get artifacts for type: TSK_GPS_BOOKMARK", ex);
134 }
135 return new GeoLocationParseResult<>(areas, allParsedSuccessfully);
136 }
137
144 GeoPath(BlackboardArtifact artifact, String pathName) {
145 this.waypointList = new ArrayList<>();
146 this.pathName = pathName;
147 this.artifact = artifact;
148 }
149
155 final void addToPath(Waypoint point) {
156 waypointList.add(point);
157 }
158
164 final public List<Waypoint> getPath() {
165 return Collections.unmodifiableList(waypointList);
166 }
167
173 public final BlackboardArtifact getArtifact() {
174 return artifact;
175 }
176
182 public String getLabel() {
183 return pathName != null ? pathName : "";
184 }
185}
synchronized static Logger getLogger(String name)
Definition Logger.java:124
static GeoLocationParseResult< Track > getTracks(SleuthkitCase skCase, List<? extends Content > sourceList)
Definition GeoPath.java:80
static List< Route > getRoutes(SleuthkitCase skCase)
Definition GeoPath.java:52
static GeoLocationParseResult< Area > getAreas(SleuthkitCase skCase, List<? extends Content > sourceList)
Definition GeoPath.java:115

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.