From 48a04cd3a9898e04f60714b3fc14ae8401c789c1 Mon Sep 17 00:00:00 2001 From: Raman Arora Date: Fri, 4 Oct 2019 11:24:53 -0400 Subject: [PATCH 01/91] 5560: add support for FB messenger call logs. --- InternalPythonModules/android/fbmessenger.py | 343 +++++++++++++------ 1 file changed, 234 insertions(+), 109 deletions(-) diff --git a/InternalPythonModules/android/fbmessenger.py b/InternalPythonModules/android/fbmessenger.py index 3a678f16d0..e3c27d1765 100644 --- a/InternalPythonModules/android/fbmessenger.py +++ b/InternalPythonModules/android/fbmessenger.py @@ -45,6 +45,7 @@ from org.sleuthkit.datamodel import Account from org.sleuthkit.datamodel.blackboardutils import CommunicationArtifactsHelper from org.sleuthkit.datamodel.blackboardutils.CommunicationArtifactsHelper import MessageReadStatus from org.sleuthkit.datamodel.blackboardutils.CommunicationArtifactsHelper import CommunicationDirection +from org.sleuthkit.datamodel.blackboardutils.CommunicationArtifactsHelper import CallMediaType import json import traceback @@ -181,15 +182,240 @@ class FBMessengerAnalyzer(general.AndroidComponentAnalyzer): contactsDb.close() - - ## Adds a recipient to given list + ## Extracts recipeint id from 'user_key' column and adds recipient to given list. def addRecipientToList(self, user_key, recipientList): if user_key is not None: recipientId = user_key.replace('FACEBOOK:', '') recipientList.append(recipientId) + + + ## Extracts sender id from the json in 'sender' column. + def getSenderIdFromJson(self, senderJsonStr): + senderId = None; + if senderJsonStr is not None: + sender_dict = json.loads(senderJsonStr) + senderId = sender_dict['user_key'] + senderId = senderId.replace('FACEBOOK:', '') - ## Analyze messages - def analyzeMessages(self, dataSource, fileManager, context): + return senderId + + ## determines communication direction by comparing senderId with selfAccountId + def deduceDirectionFromSenderId(self, senderId): + direction = CommunicationDirection.UNKNOWN + if senderId is not None: + if senderId == self.selfAccountId: + direction = CommunicationDirection.OUTGOING + else: + direction = CommunicationDirection.INCOMING + return direction + + ## Analyzes messages + def analyzeMessages(self, threadsDb, threadsDBHelper): + try: + + ## Messages are found in the messages table. + ## This query filters messages by msg_type to only get actual user created conversation messages (msg_type 0). + ## The participant ids can be found in the thread_participants table. + ## Participant names are found in thread_users table. + ## Joining these tables produces multiple rows per message, one row for each recipient. + ## The result set is processed to collect the multiple recipients for a given message. + sqlString = """ + SELECT msg_id, text, sender, timestamp_ms, msg_type, messages.thread_key as thread_key, + snippet, thread_participants.user_key as user_key, thread_users.name as name + FROM messages + JOIN thread_participants ON messages.thread_key = thread_participants.thread_key + JOIN thread_users ON thread_participants.user_key = thread_users.user_key + WHERE msg_type = 0 + ORDER BY msg_id + """ + + messagesResultSet = threadsDb.runQuery(sqlString) + if messagesResultSet is not None: + oldMsgId = None + + direction = CommunicationDirection.UNKNOWN + fromId = None + recipientIdsList = None + timeStamp = -1 + msgText = "" + threadId = "" + + while messagesResultSet.next(): + msgId = messagesResultSet.getString("msg_id") + + # new msg begins when msgId changes + if msgId != oldMsgId: + # Create message artifact with collected attributes + if oldMsgId is not None: + messageArtifact = threadsDBHelper.addMessage( + self._MESSAGE_TYPE, + direction, + fromId, + recipientIdsList, + timeStamp, + MessageReadStatus.UNKNOWN, + "", # subject + msgText, + threadId) + + oldMsgId = msgId + + # New message - collect all attributes + recipientIdsList = [] + + ## get sender id by parsing JSON in sender column + fromId = self.getSenderIdFromJson(messagesResultSet.getString("sender")) + direction = self.deduceDirectionFromSenderId(fromId) + + # Get recipient and add to list + self.addRecipientToList(messagesResultSet.getString("user_key"), + recipientIdsList) + + timeStamp = messagesResultSet.getLong("timestamp_ms") / 1000 + + # Get msg text + # Sometimes there may not be an explict msg text, + # but an app generated snippet instead + msgText = messagesResultSet.getString("text") + if not msgText: + msgText = messagesResultSet.getString("snippet") + + # TBD: get attachment + + threadId = messagesResultSet.getString("thread_key") + + else: # same msgId as last, just collect recipient from current row + self.addRecipientToList(messagesResultSet.getString("user_key"), + recipientIdsList) + + + # at the end of the loop, add last message + messageArtifact = threadsDBHelper.addMessage( + self._MESSAGE_TYPE, + direction, + fromId, + recipientIdsList, + timeStamp, + MessageReadStatus.UNKNOWN, + "", # subject + msgText, + threadId) + + except SQLException as ex: + self._logger.log(Level.WARNING, "Error processing query result for FB Messenger messages.", ex) + self._logger.log(Level.WARNING, traceback.format_exc()) + except TskCoreException as ex: + self._logger.log(Level.SEVERE, "Failed to add FB Messenger message artifacts.", ex) + self._logger.log(Level.SEVERE, traceback.format_exc()) + except BlackboardException as ex: + self._logger.log(Level.WARNING, "Failed to post artifacts.", ex) + self._logger.log(Level.WARNING, traceback.format_exc()) + + ## Analyzes call logs + def analyzeCallLogs(self, threadsDb, threadsDBHelper): + try: + + ## Call logs are found in the messages table. + ## msg_type indicates type of call: + ## 9: one to one calls + ## 203: group call + ## 1-to-1 calls only have a call_ended record. + ## group calls have a call_started_record as well as call_ended recorded, with *different* message ids. + ## all the data we need can be found in the call_ended record. + + sqlString = """ + SELECT msg_id, text, sender, timestamp_ms, msg_type, admin_text_thread_rtc_event, + generic_admin_message_extensible_data, + messages.thread_key as thread_key, + thread_participants.user_key as user_key, + thread_users.name as name + FROM messages + JOIN thread_participants ON messages.thread_key = thread_participants.thread_key + JOIN thread_users ON thread_participants.user_key = thread_users.user_key + WHERE msg_type = 9 OR (msg_type = 203 AND admin_text_thread_rtc_event = 'group_call_ended') + ORDER BY msg_id + """ + + messagesResultSet = threadsDb.runQuery(sqlString) + if messagesResultSet is not None: + oldMsgId = None + + direction = CommunicationDirection.UNKNOWN + callerId = None + calleeIdsList = None + startTimeStamp = -1 + endTimeStamp = -1 + duration = 0 + mediaType = CallMediaType.AUDIO + + while messagesResultSet.next(): + msgId = messagesResultSet.getString("msg_id") + + # new call begins when msgId changes + if msgId != oldMsgId: + # Create call log artifact with collected attributes + if oldMsgId is not None: + messageArtifact = threadsDBHelper.addCalllog( + direction, + callerId, + calleeIdsList, + startTimeStamp, + endTimeStamp, + mediaType ) + + oldMsgId = msgId + + # New message - collect all attributes + calleeIdsList = [] + + ## get caller id by parsing JSON in sender column + callerId = self.getSenderIdFromJson(messagesResultSet.getString("sender")) + direction = self.deduceDirectionFromSenderId(callerId) + + # Get recipient and add to list + self.addRecipientToList(messagesResultSet.getString("user_key"), + calleeIdsList) + + # the timestamp from call ended msg is used as end timestamp + endTimeStamp = messagesResultSet.getLong("timestamp_ms") / 1000 + + # parse the generic_admin_message_extensible_data JSON to extract the duration and video fields + adminDataJsonStr = messagesResultSet.getString("generic_admin_message_extensible_data") + if adminDataJsonStr is not None: + adminData_dict = json.loads(adminDataJsonStr) + duration = adminData_dict['call_duration'] # call duration in seconds + isVideo = adminData_dict['video'] + if isVideo: + mediaType = CallMediaType.VIDEO + + startTimeStamp = endTimeStamp - duration + + else: # same msgId as last, just collect callee from current row + self.addRecipientToList(messagesResultSet.getString("user_key"), + calleeIdsList) + + # at the end of the loop, add last message + messageArtifact = threadsDBHelper.addCalllog( + direction, + callerId, + calleeIdsList, + startTimeStamp, + endTimeStamp, + mediaType ) + + except SQLException as ex: + self._logger.log(Level.WARNING, "Error processing query result for FB Messenger call logs.", ex) + self._logger.log(Level.WARNING, traceback.format_exc()) + except TskCoreException as ex: + self._logger.log(Level.SEVERE, "Failed to add FB Messenger call log artifacts.", ex) + self._logger.log(Level.SEVERE, traceback.format_exc()) + except BlackboardException as ex: + self._logger.log(Level.WARNING, "Failed to post FB Messenger call log artifacts.", ex) + self._logger.log(Level.WARNING, traceback.format_exc()) + + + ## Analyze messages and call log threads + def analyzeMessagesAndCallLogs(self, dataSource, fileManager, context): threadsDbs = AppSQLiteDB.findAppDatabases(dataSource, "threads_db2", True, self._FB_MESSENGER_PACKAGE_NAME) for threadsDb in threadsDbs: try: @@ -202,113 +428,12 @@ class FBMessengerAnalyzer(general.AndroidComponentAnalyzer): self._MODULE_NAME, threadsDb.getDBFile(), Account.Type.FACEBOOK) - ## Messages are found in the messages table. - ## This query filters messages by msg_type to only get actual user created conversation messages (msg_type 0). - ## The participant ids can be found in the thread_participants table. - ## Participant names are found in thread_users table. - ## Joining these tables produces multiple rows per message, one row for each recipient. - ## The result set is processed to collect the multiple recipients for a given message. - sqlString = """ - SELECT msg_id, text, sender, timestamp_ms, msg_type, messages.thread_key as thread_key, - snippet, thread_participants.user_key as user_key, thread_users.name as name - FROM messages - JOIN thread_participants ON messages.thread_key = thread_participants.thread_key - JOIN thread_users ON thread_participants.user_key = thread_users.user_key - WHERE msg_type = 0 - ORDER BY msg_id - """ - - messagesResultSet = threadsDb.runQuery(sqlString) - if messagesResultSet is not None: - oldMsgId = None - - direction = CommunicationDirection.UNKNOWN - fromId = None - recipientIdsList = None - timeStamp = -1 - msgText = "" - threadId = "" - - while messagesResultSet.next(): - msgId = messagesResultSet.getString("msg_id") - - # new msg begins when msgId changes - if msgId != oldMsgId: - # Create message artifact with collected attributes - if oldMsgId is not None: - messageArtifact = threadsDBHelper.addMessage( - self._MESSAGE_TYPE, - direction, - fromId, - recipientIdsList, - timeStamp, - MessageReadStatus.UNKNOWN, - "", # subject - msgText, - threadId) - - oldMsgId = msgId - - # New message - collect all attributes - recipientIdsList = [] - - ## get sender id by parsing JSON in sender column - senderJsonStr = messagesResultSet.getString("sender") - if senderJsonStr is not None: - sender_dict = json.loads(senderJsonStr) - senderId = sender_dict['user_key'] - senderId = senderId.replace('FACEBOOK:', '') - senderName = sender_dict['name'] - fromId = senderId - if senderId == self.selfAccountId: - direction = CommunicationDirection.OUTGOING - else: - direction = CommunicationDirection.INCOMING - - - # Get recipient and add to list - self.addRecipientToList(messagesResultSet.getString("user_key"), - recipientIdsList) - - timeStamp = messagesResultSet.getLong("timestamp_ms") / 1000 - - # Get msg text - # Sometimes there may not be an explict msg text, - # but an app generated snippet instead - msgText = messagesResultSet.getString("text") - if not msgText: - msgText = messagesResultSet.getString("snippet") - - # TBD: get attachment - - threadId = messagesResultSet.getString("thread_key") - - else: # same msgId as last, just collect recipient from current row - self.addRecipientToList(messagesResultSet.getString("user_key"), - recipientIdsList) - - - # at the end of the loop, add last message - messageArtifact = threadsDBHelper.addMessage( - self._MESSAGE_TYPE, - direction, - fromId, - recipientIdsList, - timeStamp, - MessageReadStatus.UNKNOWN, - "", # subject - msgText, - threadId) + self.analyzeMessages(threadsDb, threadsDBHelper) + self.analyzeCallLogs(threadsDb, threadsDBHelper) - except SQLException as ex: - self._logger.log(Level.WARNING, "Error processing query result for FB Messenger messages.", ex) - self._logger.log(Level.WARNING, traceback.format_exc()) except TskCoreException as ex: - self._logger.log(Level.SEVERE, "Failed to add FB Messenger message artifacts.", ex) + self._logger.log(Level.SEVERE, "Failed to to create CommunicationArtifactsHelper for FB Messenger.", ex) self._logger.log(Level.SEVERE, traceback.format_exc()) - except BlackboardException as ex: - self._logger.log(Level.WARNING, "Failed to post artifacts.", ex) - self._logger.log(Level.WARNING, traceback.format_exc()) finally: threadsDb.close() @@ -321,6 +446,6 @@ class FBMessengerAnalyzer(general.AndroidComponentAnalyzer): return self.analyzeContacts(dataSource, fileManager, context) - self.analyzeMessages(dataSource, fileManager, context) + self.analyzeMessagesAndCallLogs(dataSource, fileManager, context) From b7cc97c7696fa32759f94cef8c8b3d6e9fae604f Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 8 Oct 2019 16:14:19 -0400 Subject: [PATCH 02/91] Initial changes --- .../contentviewers/MediaPlayerPanel.java | 88 +++++++++++++------ 1 file changed, 63 insertions(+), 25 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 5e0c85e807..b25d41d1c9 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -53,6 +53,7 @@ import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; import javafx.embed.swing.JFXPanel; import javax.swing.event.ChangeListener; +import org.freedesktop.gstreamer.Clock; import org.freedesktop.gstreamer.GstException; /** @@ -179,6 +180,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie //Update progress bar and time label during video playback private final Timer timer = new Timer(75, new VideoPanelUpdater()); private static final int PROGRESS_SLIDER_SIZE = 2000; + private static final int SKIP_IN_SECONDS = 30; private ExtractMedia extractMediaWorker; @@ -307,8 +309,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie if (gstPlayBin != null) { gstPlayBin.stop(); gstPlayBin.getBus().disconnect(endOfStreamListener); - gstPlayBin.getBus().disconnect(endOfStreamListener); - gstPlayBin.getBus().disconnect(endOfStreamListener); + gstPlayBin.getBus().disconnect(stateChangeListener); + gstPlayBin.getBus().disconnect(errorListener); gstPlayBin.dispose(); fxAppSink.clear(); gstPlayBin = null; @@ -533,6 +535,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie progressLabel = new javax.swing.JLabel(); VolumeIcon = new javax.swing.JLabel(); audioSlider = new javax.swing.JSlider(); + fastForwardButton = new javax.swing.JButton(); + rewindButton = new javax.swing.JButton(); javax.swing.GroupLayout videoPanelLayout = new javax.swing.GroupLayout(videoPanel); videoPanel.setLayout(videoPanelLayout); @@ -542,7 +546,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie ); videoPanelLayout.setVerticalGroup( videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 259, Short.MAX_VALUE) + .addGap(0, 257, Short.MAX_VALUE) ); progressSlider.setValue(0); @@ -568,12 +572,20 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie audioSlider.setMajorTickSpacing(10); audioSlider.setMaximum(50); audioSlider.setMinorTickSpacing(5); - audioSlider.setPaintTicks(true); audioSlider.setToolTipText(org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.audioSlider.toolTipText")); // NOI18N audioSlider.setValue(25); audioSlider.setMinimumSize(new java.awt.Dimension(200, 21)); audioSlider.setPreferredSize(new java.awt.Dimension(200, 21)); + org.openide.awt.Mnemonics.setLocalizedText(fastForwardButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.fastForwardButton.text")); // NOI18N + fastForwardButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fastForwardButtonActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(rewindButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.rewindButton.text")); // NOI18N + javax.swing.GroupLayout controlPanelLayout = new javax.swing.GroupLayout(controlPanel); controlPanel.setLayout(controlPanelLayout); controlPanelLayout.setHorizontalGroup( @@ -582,34 +594,42 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie .addContainerGap() .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(controlPanelLayout.createSequentialGroup() + .addComponent(infoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE) + .addComponent(rewindButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(playButton, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 680, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(progressLabel)) - .addGroup(controlPanelLayout.createSequentialGroup() - .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(18, 18, 18) - .addComponent(VolumeIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(2, 2, 2) - .addComponent(audioSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 229, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fastForwardButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 191, Short.MAX_VALUE) + .addComponent(VolumeIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(audioSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) + .addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); controlPanelLayout.setVerticalGroup( controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(controlPanelLayout.createSequentialGroup() + .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)) .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(playButton)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(audioSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(VolumeIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(infoLabel))) - .addGap(13, 13, 13)) + .addGroup(controlPanelLayout.createSequentialGroup() + .addGap(17, 17, 17) + .addComponent(infoLabel)) + .addGroup(controlPanelLayout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(VolumeIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(playButton) + .addComponent(fastForwardButton) + .addComponent(rewindButton)) + .addComponent(audioSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) + .addContainerGap(13, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); @@ -636,15 +656,33 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie } }//GEN-LAST:event_playButtonActionPerformed + private void fastForwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fastForwardButtonActionPerformed + long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); + Clock playbinClock = gstPlayBin.getClock(); + long currentTime = playbinClock.getTime(); + //Skip 30 seconds. + long skipAhead = TimeUnit.SECONDS.convert(SKIP_IN_SECONDS, TimeUnit.NANOSECONDS); + //Ensure new video position is within bounds + long newTime = Math.max(currentTime + skipAhead, duration); + gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); + //0 <= newTimePercent <= 1.0 + double newTimePercent = ((double)newTime)/duration; + //0 <= newProgressSliderPos <= PROGRESS_SLIDER_SIZE + int newProgressSliderPos = (int)(PROGRESS_SLIDER_SIZE * newTimePercent); + progressSlider.setValue(newProgressSliderPos); + }//GEN-LAST:event_fastForwardButtonActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel VolumeIcon; private javax.swing.JSlider audioSlider; private javax.swing.JPanel controlPanel; + private javax.swing.JButton fastForwardButton; private javax.swing.JLabel infoLabel; private javax.swing.JButton playButton; private javax.swing.JLabel progressLabel; private javax.swing.JSlider progressSlider; + private javax.swing.JButton rewindButton; private javax.swing.JPanel videoPanel; // End of variables declaration//GEN-END:variables } From b3aaf99c72c5cd75abd9a3a0237986a3a20666f2 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Wed, 9 Oct 2019 15:22:32 -0400 Subject: [PATCH 03/91] Incremental improvements --- .../contentviewers/MediaPlayerPanel.form | 186 ++++++++++------- .../contentviewers/MediaPlayerPanel.java | 191 +++++++++++------- 2 files changed, 230 insertions(+), 147 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form index 880528e787..c1c04e24c2 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form @@ -1,6 +1,6 @@ -
+ @@ -41,7 +41,7 @@ - + @@ -51,47 +51,33 @@ - - + + - - - - - + + + + + - - - - - - - - + - - - - - - + + + + - - - - - - - - - + + + + @@ -112,8 +98,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -122,48 +202,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 2ba5548724..06ce6f785d 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -53,7 +53,6 @@ import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; import javafx.embed.swing.JFXPanel; import javax.swing.event.ChangeListener; -import org.freedesktop.gstreamer.Clock; import org.freedesktop.gstreamer.GstException; /** @@ -242,12 +241,14 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie endOfStreamListener = new Bus.EOS() { @Override public void endOfStream(GstObject go) { - gstPlayBin.seek(ClockTime.ZERO); - progressSlider.setValue(0); + playButton.setText("►"); + System.out.println(gstPlayBin.getState()); + //gstPlayBin.seek(ClockTime.ZERO); + //progressSlider.setValue(0); /** * Keep the video from automatically playing */ - Gst.getExecutor().submit(() -> gstPlayBin.pause()); + //Gst.getExecutor().submit(() -> gstPlayBin.pause()); } }; } @@ -390,19 +391,13 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie return Bundle.MediaPlayerPanel_unknownTime(); } - double millis = ns / 1000000.0; - double seconds; - if (ceiling) { - seconds = Math.ceil(millis / 1000); - } else { - seconds = millis / 1000; - } - double hours = seconds / 3600; - seconds -= (int) hours * 3600; - double minutes = seconds / 60; - seconds -= (int) minutes * 60; + long seconds = TimeUnit.SECONDS.convert(ns, TimeUnit.NANOSECONDS); + long hours = TimeUnit.HOURS.convert(seconds, TimeUnit.SECONDS); + seconds -= TimeUnit.SECONDS.convert(hours, TimeUnit.HOURS); + long minutes = TimeUnit.MINUTES.convert(seconds, TimeUnit.SECONDS); + seconds -= TimeUnit.SECONDS.convert(minutes, TimeUnit.MINUTES); - return String.format(Bundle.MediaPlayerPanel_timeFormat(), (int) hours, (int) minutes, (int) seconds); + return String.format(Bundle.MediaPlayerPanel_timeFormat(), hours, minutes, seconds); } /** @@ -526,17 +521,19 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; videoPanel = new javax.swing.JPanel(); controlPanel = new javax.swing.JPanel(); progressSlider = new javax.swing.JSlider(); - infoLabel = new javax.swing.JLabel(); - playButton = new javax.swing.JButton(); progressLabel = new javax.swing.JLabel(); - VolumeIcon = new javax.swing.JLabel(); - audioSlider = new javax.swing.JSlider(); + jPanel1 = new javax.swing.JPanel(); + playButton = new javax.swing.JButton(); fastForwardButton = new javax.swing.JButton(); rewindButton = new javax.swing.JButton(); + VolumeIcon = new javax.swing.JLabel(); + audioSlider = new javax.swing.JSlider(); + infoLabel = new javax.swing.JLabel(); javax.swing.GroupLayout videoPanelLayout = new javax.swing.GroupLayout(videoPanel); videoPanel.setLayout(videoPanelLayout); @@ -546,7 +543,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie ); videoPanelLayout.setVerticalGroup( videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 257, Short.MAX_VALUE) + .addGap(0, 124, Short.MAX_VALUE) ); progressSlider.setValue(0); @@ -555,8 +552,9 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie progressSlider.setMinimumSize(new java.awt.Dimension(36, 21)); progressSlider.setPreferredSize(new java.awt.Dimension(200, 21)); - org.openide.awt.Mnemonics.setLocalizedText(infoLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.infoLabel.text")); // NOI18N - infoLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.progressLabel.text")); // NOI18N + + jPanel1.setLayout(new java.awt.GridBagLayout()); org.openide.awt.Mnemonics.setLocalizedText(playButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.playButton.text")); // NOI18N playButton.addActionListener(new java.awt.event.ActionListener() { @@ -564,10 +562,50 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie playButtonActionPerformed(evt); } }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.ipadx = 21; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 0); + jPanel1.add(playButton, gridBagConstraints); - org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.progressLabel.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(fastForwardButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.fastForwardButton.text")); // NOI18N + fastForwardButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fastForwardButtonActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 2; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 0); + jPanel1.add(fastForwardButton, gridBagConstraints); + + org.openide.awt.Mnemonics.setLocalizedText(rewindButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.rewindButton.text")); // NOI18N + rewindButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + rewindButtonActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.insets = new java.awt.Insets(5, 0, 1, 0); + jPanel1.add(rewindButton, gridBagConstraints); org.openide.awt.Mnemonics.setLocalizedText(VolumeIcon, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.VolumeIcon.text")); // NOI18N + VolumeIcon.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 3; + gridBagConstraints.gridy = 0; + gridBagConstraints.ipadx = 8; + gridBagConstraints.ipady = 7; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0); + jPanel1.add(VolumeIcon, gridBagConstraints); audioSlider.setMajorTickSpacing(10); audioSlider.setMaximum(50); @@ -576,60 +614,45 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie audioSlider.setValue(25); audioSlider.setMinimumSize(new java.awt.Dimension(200, 21)); audioSlider.setPreferredSize(new java.awt.Dimension(200, 21)); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 4; + gridBagConstraints.gridy = 0; + gridBagConstraints.ipadx = -116; + gridBagConstraints.ipady = 7; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.insets = new java.awt.Insets(3, 1, 0, 10); + jPanel1.add(audioSlider, gridBagConstraints); - org.openide.awt.Mnemonics.setLocalizedText(fastForwardButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.fastForwardButton.text")); // NOI18N - fastForwardButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - fastForwardButtonActionPerformed(evt); - } - }); - - org.openide.awt.Mnemonics.setLocalizedText(rewindButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.rewindButton.text")); // NOI18N + infoLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); + org.openide.awt.Mnemonics.setLocalizedText(infoLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.infoLabel.text")); // NOI18N + infoLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); javax.swing.GroupLayout controlPanelLayout = new javax.swing.GroupLayout(controlPanel); controlPanel.setLayout(controlPanelLayout); controlPanelLayout.setHorizontalGroup( controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, controlPanelLayout.createSequentialGroup() + .addGroup(controlPanelLayout.createSequentialGroup() .addContainerGap() .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(controlPanelLayout.createSequentialGroup() - .addComponent(infoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 246, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE) - .addComponent(rewindButton) + .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1090, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, controlPanelLayout.createSequentialGroup() + .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(playButton, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fastForwardButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 191, Short.MAX_VALUE) - .addComponent(VolumeIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(audioSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(progressLabel))) .addContainerGap()) ); controlPanelLayout.setVerticalGroup( controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(controlPanelLayout.createSequentialGroup() + .addGap(0, 0, 0) .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)) - .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(controlPanelLayout.createSequentialGroup() - .addGap(17, 17, 17) - .addComponent(infoLabel)) - .addGroup(controlPanelLayout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(VolumeIcon, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(playButton) - .addComponent(fastForwardButton) - .addComponent(rewindButton)) - .addComponent(audioSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))) - .addContainerGap(13, Short.MAX_VALUE)) + .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); @@ -648,6 +671,28 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie ); }// //GEN-END:initComponents + private void rewindButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rewindButtonActionPerformed + long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); + long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); + //Skip 30 seconds. + long skipBehind = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); + //Ensure new video position is within bounds + long newTime = Math.max(currentTime - skipBehind, 0); + gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); + syncProgressSlider(newTime, duration); + }//GEN-LAST:event_rewindButtonActionPerformed + + private void fastForwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fastForwardButtonActionPerformed + long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); + long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); + //Skip 30 seconds. + long skipAhead = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); + //Ensure new video position is within bounds + long newTime = Math.min(currentTime + skipAhead, duration); + gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); + syncProgressSlider(newTime, duration); + }//GEN-LAST:event_fastForwardButtonActionPerformed + private void playButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_playButtonActionPerformed if (gstPlayBin.isPlaying()) { gstPlayBin.pause(); @@ -656,22 +701,21 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie } }//GEN-LAST:event_playButtonActionPerformed - private void fastForwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fastForwardButtonActionPerformed - long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); - Clock playbinClock = gstPlayBin.getClock(); - long currentTime = playbinClock.getTime(); - //Skip 30 seconds. - long skipAhead = TimeUnit.SECONDS.convert(SKIP_IN_SECONDS, TimeUnit.NANOSECONDS); - //Ensure new video position is within bounds - long newTime = Math.max(currentTime + skipAhead, duration); - gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); + /** + * Sync progress slider to the newTime position if it is not already there. + * + * @param newTime New time value that progress slider may or may not be positioned at + * @param duration Total duration of the video, used for determining slider position + */ + private void syncProgressSlider(long newTime, long duration) { //0 <= newTimePercent <= 1.0 double newTimePercent = ((double)newTime)/duration; //0 <= newProgressSliderPos <= PROGRESS_SLIDER_SIZE int newProgressSliderPos = (int)(PROGRESS_SLIDER_SIZE * newTimePercent); progressSlider.setValue(newProgressSliderPos); - }//GEN-LAST:event_fastForwardButtonActionPerformed - + updateTimeLabel(newTime, duration); + } + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel VolumeIcon; @@ -679,6 +723,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private javax.swing.JPanel controlPanel; private javax.swing.JButton fastForwardButton; private javax.swing.JLabel infoLabel; + private javax.swing.JPanel jPanel1; private javax.swing.JButton playButton; private javax.swing.JLabel progressLabel; private javax.swing.JSlider progressSlider; From 69631c809063c0196222b28eeaa67d717267cefa Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Wed, 9 Oct 2019 16:22:10 -0400 Subject: [PATCH 04/91] Initial commit of new geolocation window --- Core/ivy.xml | 4 + Core/nbproject/project.properties | 1 + Core/nbproject/project.xml | 4 + .../autopsy/geolocation/ArtifactWaypoint.java | 35 +++ .../autopsy/geolocation/Bundle.properties | 6 + .../geolocation/Bundle.properties-MERGED | 9 + .../geolocation/DefaultArtifactWaypoint.java | 89 +++++++ .../autopsy/geolocation/EXIFWaypoint.java | 76 ++++++ .../geolocation/GeolocationTopComponent.form | 28 ++ .../geolocation/GeolocationTopComponent.java | 250 ++++++++++++++++++ .../geolocation/GeolocationUtilities.java | 110 ++++++++ .../autopsy/geolocation/MapPanel.form | 89 +++++++ .../autopsy/geolocation/MapPanel.java | 239 +++++++++++++++++ .../geolocation/OpenGeolocationAction.java | 95 +++++++ .../autopsy/geolocation/RefreshPanel.form | 86 ++++++ .../autopsy/geolocation/RefreshPanel.java | 98 +++++++ .../sleuthkit/autopsy/geolocation/Route.java | 151 +++++++++++ .../geolocation/SimpleArtifactWaypoint.java | 58 ++++ .../images/arrow-circle-double-135.png | Bin 0 -> 864 bytes .../geolocation/images/cross-script.png | Bin 0 -> 623 bytes 20 files changed, 1428 insertions(+) create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/ArtifactWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/DefaultArtifactWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/EXIFWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.form create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/GeolocationUtilities.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.form create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.form create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/Route.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/SimpleArtifactWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/images/arrow-circle-double-135.png create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/images/cross-script.png diff --git a/Core/ivy.xml b/Core/ivy.xml index 9ba4a3c371..699c3e8237 100644 --- a/Core/ivy.xml +++ b/Core/ivy.xml @@ -48,6 +48,10 @@ + + + + diff --git a/Core/nbproject/project.properties b/Core/nbproject/project.properties index 2a952926ba..736428abc2 100644 --- a/Core/nbproject/project.properties +++ b/Core/nbproject/project.properties @@ -50,6 +50,7 @@ file.reference.jsoup-1.11.3.jar=release\\modules\\ext\\jsoup-1.11.3.jar file.reference.jul-to-slf4j-1.7.25.jar=release\\modules\\ext\\jul-to-slf4j-1.7.25.jar file.reference.juniversalchardet-1.0.3.jar=release\\modules\\ext\\juniversalchardet-1.0.3.jar file.reference.junrar-2.0.0.jar=release\\modules\\ext\\junrar-2.0.0.jar +file.reference.jxmapviewer2-2.4.jar=release\\modules\\ext\\jxmapviewer2-2.4.jar file.reference.jython-standalone-2.7.0.jar=release/modules/ext/jython-standalone-2.7.0.jar file.reference.mchange-commons-java-0.2.9.jar=release/modules/ext/mchange-commons-java-0.2.9.jar file.reference.metadata-extractor-2.11.0.jar=release\\modules\\ext\\metadata-extractor-2.11.0.jar diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index c33dabfbc7..3d465105fc 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -449,6 +449,10 @@ ext/commons-pool2-2.4.2.jar release/modules/ext/commons-pool2-2.4.2.jar + + ext/jxmapviewer2-2.4.jar + release/modules/ext/jxmapviewer2-2.4.jar + ext/jdom-2.0.5-contrib.jar release/modules/ext/jdom-2.0.5-contrib.jar diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/ArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/ArtifactWaypoint.java new file mode 100755 index 0000000000..3cb1fa14ea --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/ArtifactWaypoint.java @@ -0,0 +1,35 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; + +import org.jxmapviewer.viewer.Waypoint; +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * ArtifactWaypoint interface. + */ +interface ArtifactWaypoint extends Waypoint{ + + String getLabel() ; + + BlackboardArtifact getArtifact() ; + + long getTimestamp() ; +} + \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties new file mode 100755 index 0000000000..7a22608a3b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties @@ -0,0 +1,6 @@ +CTL_OpenGeolocation=Geolocation +CTL_GeolocationTopComponentAction=GeolocationTopComponent +CTL_GeolocationTopComponent=Geolocation +RefreshPanel.refreshLabel.text=The geolocation data has been updated, the visualization may be out of date. +RefreshPanel.refreshButton.text=Refresh View +RefreshPanel.closeButton.text= diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED new file mode 100755 index 0000000000..5f7a6cd2f0 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED @@ -0,0 +1,9 @@ +CTL_OpenGeolocation=Geolocation +CTL_GeolocationTopComponentAction=GeolocationTopComponent +CTL_GeolocationTopComponent=Geolocation +GLTopComponent_name=Geolocation +OpenGeolocationAction_displayName=Geolocation +OpenGeolocationAction_name=Geolocation +RefreshPanel.refreshLabel.text=The geolocation data has been updated, the visualization may be out of date. +RefreshPanel.refreshButton.text=Refresh View +RefreshPanel.closeButton.text= diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/DefaultArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/DefaultArtifactWaypoint.java new file mode 100755 index 0000000000..7bbc0a317f --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/DefaultArtifactWaypoint.java @@ -0,0 +1,89 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; + +import org.jxmapviewer.viewer.GeoPosition; +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * Basic parent class for representing a Blackboard artifact waypoint. + * + */ +class DefaultArtifactWaypoint implements ArtifactWaypoint{ + private final BlackboardArtifact artifact; + private String label; + private long timestamp; + private GeoPosition position; + + /** + * Construct a default way point object. + * + * @param artifact The artifact that the waypoint is for. + */ + DefaultArtifactWaypoint(BlackboardArtifact artifact) { + this.artifact = artifact; + } + + @Override + public String getLabel() { + return label; + } + + void setLabel(String label) { + this.label = label; + } + + @Override + public BlackboardArtifact getArtifact() { + return artifact; + } + + @Override + public long getTimestamp() { + return timestamp; + } + + void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + @Override + public GeoPosition getPosition() { + return position; + } + + /** + * Set the GeoPosition for the waypoint + * + * @param position GeoPosition for the waypoint + */ + void setPosition(GeoPosition position) { + this.position = position; + } + + /** + * Create and set the GeoPosition for the way point. + * + * @param latitude double latitude value + * @param longitude double logitude value + */ + void setPosition(double latitude, double longitude) { + position = new GeoPosition(latitude, longitude); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/EXIFWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/EXIFWaypoint.java new file mode 100755 index 0000000000..54a93a812b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/EXIFWaypoint.java @@ -0,0 +1,76 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; + +import java.util.logging.Level; +import org.jxmapviewer.viewer.GeoPosition; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * EXIF way point object + */ +final class EXIFWaypoint extends DefaultArtifactWaypoint{ + + private static final Logger logger = Logger.getLogger(EXIFWaypoint.class.getName()); + + private AbstractFile imageFile; + + /** + * Construct a EXIF way point + * @param artifact + */ + EXIFWaypoint(BlackboardArtifact artifact) { + super(artifact); + initWaypoint(); + } + + /** + * Initialize the way point. + */ + private void initWaypoint() { + BlackboardArtifact artifact = getArtifact(); + + Double longitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); + Double latitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); + + if (longitude != null && latitude != null) { + setPosition(new GeoPosition(latitude, longitude)); + } else { + setPosition(null); + // No need to bother with other attributes if there are no + // location parameters + return; + } + + Long datetime = GeolocationUtilities.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); + if (datetime != null) { + setTimestamp(datetime * 1000); + } + + try { + imageFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); + } catch (TskCoreException ex) { + logger.log(Level.WARNING, String.format("Failed to getAbstractFileByID for %d ", artifact.getObjectID()), ex); + } + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.form b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.form new file mode 100755 index 0000000000..bddebcbc0c --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.form @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java new file mode 100755 index 0000000000..7af2bae7ea --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -0,0 +1,250 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import javax.swing.SwingWorker; +import org.jxmapviewer.viewer.Waypoint; +import org.openide.util.NbBundle.Messages; +import org.openide.windows.RetainLocation; +import org.openide.windows.TopComponent; +import org.sleuthkit.autopsy.casemodule.Case; +import static org.sleuthkit.autopsy.casemodule.Case.Events.CURRENT_CASE; +import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.coreutils.ThreadConfined; +import org.sleuthkit.autopsy.ingest.IngestManager; +import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED; +import org.sleuthkit.autopsy.ingest.ModuleDataEvent; +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * Top component which displays the Geolocation Tool. + * + */ +@TopComponent.Description(preferredID = "GeolocationTopComponent", persistenceType = TopComponent.PERSISTENCE_NEVER) +@TopComponent.Registration(mode = "geolocation", openAtStartup = false) +@RetainLocation("geolocation") +@SuppressWarnings("PMD.SingularField") +public final class GeolocationTopComponent extends TopComponent { + + private static final Logger logger = Logger.getLogger(GeolocationTopComponent.class.getName()); + + private static final Set INGEST_MODULE_EVENTS_OF_INTEREST = EnumSet.of(DATA_ADDED); + + private final PropertyChangeListener ingestListener; + + final RefreshPanel refreshPanel = new RefreshPanel(); + + @Messages({ + "GLTopComponent_name=Geolocation" + }) + + /** + * Creates new form GeoLocationTopComponent + */ + @ThreadConfined(type = ThreadConfined.ThreadType.AWT) + public GeolocationTopComponent() { + initComponents(); + initWaypoints(); + setName(Bundle.GLTopComponent_name()); + + this.ingestListener = pce -> { + String eventType = pce.getPropertyName(); + if (eventType.equals(DATA_ADDED.toString())) { + // Indicate that a refresh may be needed, unless the data added is Keyword or Hashset hits + ModuleDataEvent eventData = (ModuleDataEvent) pce.getOldValue(); + if (null != eventData + && (eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID() + || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID() + || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID() + || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE.getTypeID() + || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID() + || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK.getTypeID())) { + + showRefreshPanel(true); + } + } + }; + + + + refreshPanel.addCloseActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + showRefreshPanel(false); + } + }); + + refreshPanel.addRefreshActionListner(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + mapPanel.clearWaypoints(); + initWaypoints(); + showRefreshPanel(false); + } + }); + } + + @Override + public void addNotify() { + super.addNotify(); + IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener); + Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> { + mapPanel.clearWaypoints(); + if(evt.getNewValue() != null) { + initWaypoints(); + } + }); + } + + @Override + public void removeNotify() { + super.removeNotify(); + IngestManager.getInstance().removeIngestModuleEventListener(ingestListener); + } + + /** + * Set the state of the refresh panel at the top of the mapPanel. + * + * @param show Whether to show or hide the panel. + */ + private void showRefreshPanel(boolean show) { + if(show) { + mapPanel.add(refreshPanel, BorderLayout.NORTH); + } else { + mapPanel.remove(refreshPanel); + } + mapPanel.revalidate(); + } + + /** + * Use a SwingWorker thread to find all of the artifacts that have GPS + * coordinates. + * + */ + private void initWaypoints() { + SwingWorker, Waypoint> worker = new SwingWorker, Waypoint>() { + @Override + protected List doInBackground() throws Exception { + List waypoints = new ArrayList<>(); + + Case currentCase; + try { + currentCase = Case.getCurrentCaseThrows(); + } catch (NoCurrentCaseException ex) { + logger.log(Level.WARNING, "Unable to get artifacts for geolocation window, no current open", ex); + // Popup a message or something? + return waypoints; + } + + // TSK_GPS_TRACKPOINT, TSK_GPS_SEARCH, TSK_GPS_LAST_KNOWN_LOCATION + // and TSK_GPS_BOOKMARK have similar attributes and can be processed + // similarly + List artifacts = new ArrayList<>(); + artifacts.addAll(currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)); + artifacts.addAll(currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH)); + artifacts.addAll(currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION)); + artifacts.addAll(currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK)); + + for (BlackboardArtifact artifact : artifacts) { + Waypoint point = new SimpleArtifactWaypoint(artifact); + + if (point.getPosition() != null) { + waypoints.add(new SimpleArtifactWaypoint(artifact)); + } + } + + // Handle the TSK_GPS_ROUTE artifacts + List routes = currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); + for (BlackboardArtifact artifact : routes) { + Route route = new Route(artifact); + for (ArtifactWaypoint point : route.getRoute()) { + waypoints.add(point); + } + } + + artifacts = currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); + for (BlackboardArtifact artifact : artifacts) { + Waypoint point = new EXIFWaypoint(artifact); + + if (point.getPosition() != null) { + waypoints.add(new SimpleArtifactWaypoint(artifact)); + } + } + + return waypoints; + } + + @Override + protected void done() { + if(isDone() && !isCancelled()) { + try { + List waypoints = get(); + if(waypoints == null || waypoints.isEmpty()) { + return; + } + + for(Waypoint point: waypoints) { + mapPanel.addWaypoint(point); + } + + // There might be a better way to decide how to center + // but for now just use the first way point. + mapPanel.setCenterLocation(waypoints.get(0)); + + } catch (InterruptedException | ExecutionException ex) { + logger.log(Level.WARNING, "Unable to add points to geolocation.", ex); + } + } + } + }; + + worker.execute(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + mapPanel = new org.sleuthkit.autopsy.geolocation.MapPanel(); + + setLayout(new java.awt.BorderLayout()); + add(mapPanel, java.awt.BorderLayout.CENTER); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private org.sleuthkit.autopsy.geolocation.MapPanel mapPanel; + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationUtilities.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationUtilities.java new file mode 100755 index 0000000000..13514820d3 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationUtilities.java @@ -0,0 +1,110 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.geolocation; + +import java.util.logging.Level; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * Helper function for managing the getting artifact information. These functions + * were grabbed from KMLReport. + * + */ +class GeolocationUtilities { + private static final Logger logger = Logger.getLogger(GeolocationUtilities.class.getName()); + /** + * Get a Double from an artifact if it exists, return null otherwise. + * + * @param artifact The artifact to query + * @param type The attribute type we're looking for + * + * @return The Double if it exists, or null if not + */ + static Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { + Double returnValue = null; + try { + BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); + if (bba != null) { + Double value = bba.getValueDouble(); + returnValue = value; + } + } catch (TskCoreException ex) { + logger.log(Level.WARNING, "Error getting Double value: " + type.toString(), ex); //NON-NLS + } + return returnValue; + } + + /** + * Get a Long from an artifact if it exists, return null otherwise. + * + * @param artifact The artifact to query + * @param type The attribute type we're looking for + * + * @return The Long if it exists, or null if not + */ + static Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { + Long returnValue = null; + try { + BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); + if (bba != null) { + Long value = bba.getValueLong(); + returnValue = value; + } + } catch (TskCoreException ex) { + logger.log(Level.WARNING, "Error getting Long value: " + type.toString(), ex); //NON-NLS + } + return returnValue; + } + + /** + * Get an Integer from an artifact if it exists, return null otherwise. + * + * @param artifact The artifact to query + * @param type The attribute type we're looking for + * + * @return The Integer if it exists, or null if not + */ + static Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { + Integer returnValue = null; + try { + BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); + if (bba != null) { + Integer value = bba.getValueInt(); + returnValue = value; + } + } catch (TskCoreException ex) { + logger.log(Level.WARNING, "Error getting Integer value: " + type.toString(), ex); //NON-NLS + } + return returnValue; + } + + /** + * Get a String from an artifact if it exists, return null otherwise. + * + * @param artifact The artifact to query + * @param type The attribute type we're looking for + * + * @return The String if it exists, or null if not + */ + static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { + String returnValue = null; + try { + BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); + if (bba != null) { + String value = bba.getValueString(); + if (value != null && !value.isEmpty()) { + returnValue = value; + } + } + } catch (TskCoreException ex) { + logger.log(Level.WARNING, "Error getting String value: " + type.toString(), ex); //NON-NLS + } + return returnValue; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.form b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.form new file mode 100755 index 0000000000..ad0de45d6e --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.form @@ -0,0 +1,89 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java new file mode 100755 index 0000000000..8b22c16938 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java @@ -0,0 +1,239 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.HashSet; +import java.util.Set; +import javax.swing.DefaultListModel; +import javax.swing.event.ListDataEvent; +import javax.swing.event.ListDataListener; +import javax.swing.event.MouseInputListener; +import org.jxmapviewer.OSMTileFactoryInfo; +import org.jxmapviewer.input.CenterMapListener; +import org.jxmapviewer.input.PanMouseInputListener; +import org.jxmapviewer.input.ZoomMouseWheelListenerCursor; +import org.jxmapviewer.viewer.DefaultTileFactory; +import org.jxmapviewer.viewer.GeoPosition; +import org.jxmapviewer.viewer.TileFactoryInfo; +import org.jxmapviewer.viewer.Waypoint; +import org.jxmapviewer.viewer.WaypointPainter; + +/** + * Main panel with the JJXMapViewer object and its basic controls. + */ +public class MapPanel extends javax.swing.JPanel { + + private boolean zoomChanging = false; + private final boolean sliderReversed = false; + + // Using a DefaultListModel to store the way points because we get + // a lot of functionality for free, like listeners. + private final DefaultListModel waypointListModel; + + /** + * Creates new form MapPanel + */ + public MapPanel() { + waypointListModel = new DefaultListModel<>(); + initComponents(); + initMap(); + } + + /** + * Initialize the map. + */ + private void initMap() { + + TileFactoryInfo info = new OSMTileFactoryInfo(); + DefaultTileFactory tileFactory = new DefaultTileFactory(info); + mapViewer.setTileFactory(tileFactory); + + // Add Mouse interactions + MouseInputListener mia = new PanMouseInputListener(mapViewer); + mapViewer.addMouseListener(mia); + mapViewer.addMouseMotionListener(mia); + + mapViewer.addMouseListener(new CenterMapListener(mapViewer)); + mapViewer.addMouseWheelListener(new ZoomMouseWheelListenerCursor(mapViewer)); + + // Listen to the map for a change in zoom so that we can update the slider. + mapViewer.addPropertyChangeListener("zoom", new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + zoomSlider.setValue(mapViewer.getZoom()); + } + }); + + zoomSlider.setMinimum(tileFactory.getInfo().getMinimumZoomLevel()); + zoomSlider.setMaximum(tileFactory.getInfo().getMaximumZoomLevel()); + + + mapViewer.setZoom(tileFactory.getInfo().getMaximumZoomLevel()- 1); + mapViewer.setAddressLocation(new GeoPosition(0, 0)); + + // Listener for new way points being added to the map. + waypointListModel.addListDataListener(new ListDataListener() { + @Override + public void intervalAdded(ListDataEvent e) { + mapViewer.repaint(); + } + + @Override + public void intervalRemoved(ListDataEvent e) { + mapViewer.repaint(); + } + + @Override + public void contentsChanged(ListDataEvent e) { + mapViewer.repaint(); + } + + }); + + // Basic painters for the way points. + WaypointPainter waypointPainter = new WaypointPainter() { + @Override + public Set getWaypoints() { + Set set = new HashSet<>(); + for (int index = 0; index < waypointListModel.getSize(); index++) { + set.add(waypointListModel.get(index)); + } + return set; + } + }; + + mapViewer.setOverlayPainter(waypointPainter); + } + + /** + * Add a way point to the map. + * + * @param waypoint + */ + void addWaypoint(Waypoint waypoint) { + waypointListModel.addElement(waypoint); + } + + void setCenterLocation(Waypoint waypoint) { + mapViewer.setCenterPosition(waypoint.getPosition()); + } + + /** + * Set the current zoom level. + * + * @param zoom + */ + void setZoom(int zoom) { + zoomChanging = true; + mapViewer.setZoom(zoom); + if (sliderReversed) { + zoomSlider.setValue(zoomSlider.getMaximum() - zoom); + } else { + zoomSlider.setValue(zoom); + } + zoomChanging = false; + } + + /** + * Remove all of the way points from the map. + */ + void clearWaypoints() { + waypointListModel.removeAllElements(); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + mapViewer = new org.jxmapviewer.JXMapViewer(); + zoomPanel = new javax.swing.JPanel(); + zoomSlider = new javax.swing.JSlider(); + + setFocusable(false); + setLayout(new java.awt.BorderLayout()); + + mapViewer.setLayout(new java.awt.GridBagLayout()); + + zoomPanel.setFocusable(false); + zoomPanel.setOpaque(false); + zoomPanel.setRequestFocusEnabled(false); + + zoomSlider.setMaximum(15); + zoomSlider.setMinimum(10); + zoomSlider.setMinorTickSpacing(1); + zoomSlider.setOrientation(javax.swing.JSlider.VERTICAL); + zoomSlider.setPaintTicks(true); + zoomSlider.setSnapToTicks(true); + zoomSlider.setMinimumSize(new java.awt.Dimension(35, 100)); + zoomSlider.setOpaque(false); + zoomSlider.setPreferredSize(new java.awt.Dimension(35, 190)); + zoomSlider.addChangeListener(new javax.swing.event.ChangeListener() { + public void stateChanged(javax.swing.event.ChangeEvent evt) { + zoomSliderStateChanged(evt); + } + }); + + javax.swing.GroupLayout zoomPanelLayout = new javax.swing.GroupLayout(zoomPanel); + zoomPanel.setLayout(zoomPanelLayout); + zoomPanelLayout.setHorizontalGroup( + zoomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(zoomPanelLayout.createSequentialGroup() + .addGap(0, 0, 0) + .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + zoomPanelLayout.setVerticalGroup( + zoomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, zoomPanelLayout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, 0)) + ); + + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.weighty = 1.0; + gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4); + mapViewer.add(zoomPanel, gridBagConstraints); + + add(mapViewer, java.awt.BorderLayout.CENTER); + }// //GEN-END:initComponents + + private void zoomSliderStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_zoomSliderStateChanged + if (!zoomChanging) { + setZoom(zoomSlider.getValue()); + } + }//GEN-LAST:event_zoomSliderStateChanged + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private org.jxmapviewer.JXMapViewer mapViewer; + private javax.swing.JPanel zoomPanel; + private javax.swing.JSlider zoomSlider; + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java b/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java new file mode 100755 index 0000000000..2e9ffa0f76 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java @@ -0,0 +1,95 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import org.openide.awt.ActionID; +import org.openide.awt.ActionReference; +import org.openide.awt.ActionReferences; +import org.openide.awt.ActionRegistration; +import org.openide.util.HelpCtx; +import org.openide.util.NbBundle.Messages; +import org.openide.util.actions.CallableSystemAction; +import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.core.RuntimeProperties; + +/** + * Action that opens the Geolocation window. Available through the Tools menu. + * + */ +@ActionID(category = "Tools", + id = "org.sleuthkit.autopsy.geolocation.OpenGeolocationAction") +@ActionRegistration(displayName = "#CTL_OpenGeolocation", lazy = false) +@ActionReferences(value = { + @ActionReference(path = "Menu/Tools", position = 102)}) +public class OpenGeolocationAction extends CallableSystemAction { + + private final PropertyChangeListener caseChangeListener; + + @Messages({ + "OpenGeolocationAction_name=Geolocation", + "OpenGeolocationAction_displayName=Geolocation" + }) + + /** + * Constructs the new action of opening the Geolocation window. + */ + public OpenGeolocationAction() { + setEnabled(false); //disabled by default. Will be enabled in Case.java when a case is opened. + + caseChangeListener = (PropertyChangeEvent evt) -> { + if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) { + setEnabled(RuntimeProperties.runningWithGUI() && evt.getNewValue() != null); + } + }; + + Case.addPropertyChangeListener(caseChangeListener); + } + + @Override + public void performAction() { + final TopComponent topComponent = WindowManager.getDefault().findTopComponent("GeolocationTopComponent"); + if (topComponent != null) { + if (topComponent.isOpened() == false) { + topComponent.open(); + } + topComponent.toFront(); + topComponent.requestActive(); + } + } + + @Override + public String getName() { + return Bundle.OpenGeolocationAction_displayName(); + } + + @Override + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + public boolean asynchronous() { + return false; // run on edt + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.form b/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.form new file mode 100755 index 0000000000..400c788d42 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.form @@ -0,0 +1,86 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java new file mode 100755 index 0000000000..29db4fb2bd --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java @@ -0,0 +1,98 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.geolocation; + +import java.awt.event.ActionListener; + +/** + * + * + */ +public class RefreshPanel extends javax.swing.JPanel { + + /** + * Creates new form RefreshPanel + */ + public RefreshPanel() { + initComponents(); + } + + void addCloseActionListener(ActionListener listener) { + closeButton.addActionListener(listener); + } + + void addRefreshActionListner(ActionListener listener) { + refreshButton.addActionListener(listener); + } + + void removeCloseActionListner(ActionListener listener) { + closeButton.removeActionListener(listener); + } + + void removeRefreshActionListner(ActionListener listener) { + refreshButton.removeActionListener(listener); + } + + /** + * This method is called from within the constructor to initialize the form. + * WARNING: Do NOT modify this code. The content of this method is always + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + java.awt.GridBagConstraints gridBagConstraints; + + refreshLabel = new javax.swing.JLabel(); + refreshButton = new javax.swing.JButton(); + closeButton = new javax.swing.JButton(); + + setBackground(new java.awt.Color(0, 51, 51)); + setLayout(new java.awt.GridBagLayout()); + + refreshLabel.setForeground(new java.awt.Color(255, 255, 255)); + refreshLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/warning16.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(refreshLabel, org.openide.util.NbBundle.getMessage(RefreshPanel.class, "RefreshPanel.refreshLabel.text")); // NOI18N + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(15, 10, 15, 10); + add(refreshLabel, gridBagConstraints); + + refreshButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/geolocation/images/arrow-circle-double-135.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(refreshButton, org.openide.util.NbBundle.getMessage(RefreshPanel.class, "RefreshPanel.refreshButton.text")); // NOI18N + refreshButton.setMargin(new java.awt.Insets(2, 5, 2, 5)); + add(refreshButton, new java.awt.GridBagConstraints()); + + closeButton.setBackground(new java.awt.Color(0, 0, 0)); + closeButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/geolocation/images/cross-script.png"))); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(closeButton, org.openide.util.NbBundle.getMessage(RefreshPanel.class, "RefreshPanel.closeButton.text")); // NOI18N + closeButton.setMargin(new java.awt.Insets(0, 0, 0, 0)); + closeButton.setOpaque(false); + closeButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + closeButtonActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5); + add(closeButton, gridBagConstraints); + }// //GEN-END:initComponents + + private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed + + }//GEN-LAST:event_closeButtonActionPerformed + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton closeButton; + private javax.swing.JButton refreshButton; + private javax.swing.JLabel refreshLabel; + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/Route.java new file mode 100755 index 0000000000..55b1af4586 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/Route.java @@ -0,0 +1,151 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; + +import java.util.ArrayList; +import java.util.List; +import org.jxmapviewer.viewer.GeoPosition; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; + +/** + * A route is a set of Geolocations with a common parent artifact; + * + */ +class Route { + + private final BlackboardArtifact artifact; + private final List waypoints; + private long timestamp; + + /** + * Construct a route for the given artifact. + * + * @param artifact TSK_GPS_ROUTE artifact object + */ + Route(BlackboardArtifact artifact) { + this.artifact = artifact; + waypoints = new ArrayList<>(); + initRoute(); + } + + /** + * Construct a route with the given artifact and list of way points. + * + * @param artifact TSK_GPS_ROUTE artifact object + * @param waypoints List of waypoints for this route + */ + Route(BlackboardArtifact artifact, List waypoints) { + this.artifact = artifact; + this.waypoints = waypoints; + } + + /** + * Add a way point to the route. + * + * @param point Waypoint to add to the route. + */ + void addWaypoint(ArtifactWaypoint point) { + waypoints.add(point); + } + + /** + * Get the list of way points for this route; + * + * @return List of ArtifactWaypoints for this route + */ + List getRoute() { + return waypoints; + } + + /** + * Initialize the route. + */ + private void initRoute() { + if (artifact == null) { + return; + } + + // Get the start logitude and latitude + Double latitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START); + Double longitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START); + + if (latitude != null && longitude != null) { + addWaypoint(new RouteWaypoint(this, latitude, longitude, "Start")); + } + + // Get the end logitude and latitude + latitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END); + longitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END); + + if (latitude != null && longitude != null) { + addWaypoint(new RouteWaypoint(this, latitude, longitude, "End")); + } + + // Get the creation date + Long dateTime = GeolocationUtilities.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); + if (dateTime != null) { + timestamp = dateTime * 1000; + } + } + + /** + * Waypoint object for routes. + */ + class RouteWaypoint implements ArtifactWaypoint { + + private final Route parent; + private final GeoPosition position; + private final String label; + + /** + * Construct a route way point. + * + * @param parent The parent route object. + * @param latitude Latitude for waypoint + * @param longitude Longitude for waypoint + * @param label Way point label. + */ + RouteWaypoint(Route parent, double latitude, double longitude, String label) { + this.parent = parent; + this.position = new GeoPosition(latitude, longitude); + this.label = label; + } + + @Override + public String getLabel() { + return label; + } + + @Override + public BlackboardArtifact getArtifact() { + return parent.artifact; + } + + @Override + public long getTimestamp() { + return parent.timestamp; + } + + @Override + public GeoPosition getPosition() { + return position; + } + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/SimpleArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/SimpleArtifactWaypoint.java new file mode 100755 index 0000000000..5c06b75e31 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/SimpleArtifactWaypoint.java @@ -0,0 +1,58 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; + +import org.jxmapviewer.viewer.GeoPosition; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; + +/** + * This is a wrapper for artifacts with the basic set of geolocation attributes. + */ +class SimpleArtifactWaypoint extends DefaultArtifactWaypoint { + + SimpleArtifactWaypoint(BlackboardArtifact artifact) { + super(artifact); + initWaypoint(); + } + + /** + * Initialize the waypoint basic information. + */ + private void initWaypoint() { + BlackboardArtifact artifact = getArtifact(); + + Double longitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); + Double latitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); + + if (longitude != null && latitude != null) { + setPosition(new GeoPosition(latitude, longitude)); + } else { + setPosition(null); + // No need to bother with other attributes if there are no + // location parameters + return; + } + + Long datetime = GeolocationUtilities.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); + if (datetime != null) { + setTimestamp(datetime * 1000); + } + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/images/arrow-circle-double-135.png b/Core/src/org/sleuthkit/autopsy/geolocation/images/arrow-circle-double-135.png new file mode 100755 index 0000000000000000000000000000000000000000..4f40ba52062c62295a89856c8459052c0b78eadb GIT binary patch literal 864 zcmV-m1E2hfP)RAm^3ulMxKna&KIw$o|t$6$e0ZEG|phiWCMQ9(+YsAv#fxHYh-3}{$6em-`;9HZz2|fwY>x$fOC!yjt+&+xw*ON{ObqusX{`jv^6o- z!~{wu4-TZV^RM;~2ENQ9GW53!))*Q!&B@uP!kq_gGMNO|O4Zek?N$wFK0TP$6QkYn zZVQed&S$^9v^gblToDoD130bG+E6KLasz43U05vwS48AEV=a zYexDKnbJnP54h_A7_C8sMBve=?Q-haXlS&aFwXa6 zdET;!gzuf22`f7qfOMzN`R}einbB(faC56_DkN0j*#04F%xMvsZ#SFlwpt5T>nn?2 zFBNSv$!bH`)(WdNR_n(AV=C*VJI&6X3|oFi#@?El>K@5|A#uFqti9GfoIml*yGO&H zcc7=gi<%c;wB|2~aTFP6%+2EB`NH@|Z?oA-dR{nP7Nzwc4_)Yt=t~DcusSF9UM` z(T`sp_8&{_h|4RvxV+LC^&Y%*@7D1$`N{kEoedyEWY?&cZphk&WhvjRdEqA&lG&Hy q`zwXL1RjtA(m>)rd~pOg!2St{?uz8+#hTgx0000uz-;<4aiE#*F2T#| zt;WP8_2kp17jJ+5TnKdXT%g9FN8i3}lmYYqfHOcjj~~!Ph-`p^4LiH!rC-0^KL7i72TcG6TZ`7-bKTQXvCc;3)#dB$oaEf1Gi^b0a{20RY5Z;(@&ISGfQH002ov JPDHLkV1iqyA&vk5 literal 0 HcmV?d00001 From baa80cd85985d1c60c596db768b50688f0fe9f13 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Wed, 9 Oct 2019 16:41:35 -0400 Subject: [PATCH 05/91] updated layer.xml for geolocation window --- .../org/sleuthkit/autopsy/core/geolocationWsmode.xml | 11 +++++++++++ Core/src/org/sleuthkit/autopsy/core/layer.xml | 1 + 2 files changed, 12 insertions(+) create mode 100755 Core/src/org/sleuthkit/autopsy/core/geolocationWsmode.xml diff --git a/Core/src/org/sleuthkit/autopsy/core/geolocationWsmode.xml b/Core/src/org/sleuthkit/autopsy/core/geolocationWsmode.xml new file mode 100755 index 0000000000..4e29bb3e2d --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/core/geolocationWsmode.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/core/layer.xml b/Core/src/org/sleuthkit/autopsy/core/layer.xml index 6a9673a6d3..630af198a2 100644 --- a/Core/src/org/sleuthkit/autopsy/core/layer.xml +++ b/Core/src/org/sleuthkit/autopsy/core/layer.xml @@ -448,6 +448,7 @@ + From b2d4e220301f7606e1a2f158a00c6ee93173eed3 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 10 Oct 2019 15:09:52 -0400 Subject: [PATCH 06/91] Finished implementing and testing fast forward/rewind buttons --- .../contentviewers/MediaPlayerPanel.form | 2 +- .../contentviewers/MediaPlayerPanel.java | 37 +++---------------- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form index c1c04e24c2..449e3c09ea 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form @@ -55,7 +55,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 06ce6f785d..98f3350e87 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -37,7 +37,6 @@ import javax.swing.SwingWorker; import javax.swing.Timer; import javax.swing.event.ChangeEvent; import org.freedesktop.gstreamer.Bus; -import org.freedesktop.gstreamer.ClockTime; import org.freedesktop.gstreamer.Gst; import org.freedesktop.gstreamer.GstObject; import org.freedesktop.gstreamer.State; @@ -53,6 +52,7 @@ import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; import javafx.embed.swing.JFXPanel; import javax.swing.event.ChangeListener; +import org.freedesktop.gstreamer.ClockTime; import org.freedesktop.gstreamer.GstException; /** @@ -241,14 +241,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie endOfStreamListener = new Bus.EOS() { @Override public void endOfStream(GstObject go) { - playButton.setText("►"); - System.out.println(gstPlayBin.getState()); - //gstPlayBin.seek(ClockTime.ZERO); - //progressSlider.setValue(0); - /** - * Keep the video from automatically playing - */ - //Gst.getExecutor().submit(() -> gstPlayBin.pause()); + Gst.getExecutor().submit(() -> gstPlayBin.pause()); + gstPlayBin.seek(ClockTime.ZERO); } }; } @@ -376,7 +370,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * @param total */ private void updateTimeLabel(long start, long total) { - progressLabel.setText(formatTime(start, false) + "/" + formatTime(total, true)); + progressLabel.setText(formatTime(start) + "/" + formatTime(total)); } /** @@ -386,7 +380,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie "MediaPlayerPanel.unknownTime=Unknown", "MediaPlayerPanel.timeFormat=%02d:%02d:%02d" }) - private String formatTime(long ns, boolean ceiling) { + private String formatTime(long ns) { if (ns == -1) { return Bundle.MediaPlayerPanel_unknownTime(); } @@ -635,7 +629,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie .addContainerGap() .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 1090, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 738, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, controlPanelLayout.createSequentialGroup() .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -672,14 +666,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie }// //GEN-END:initComponents private void rewindButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rewindButtonActionPerformed - long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); //Skip 30 seconds. long skipBehind = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); //Ensure new video position is within bounds long newTime = Math.max(currentTime - skipBehind, 0); gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); - syncProgressSlider(newTime, duration); }//GEN-LAST:event_rewindButtonActionPerformed private void fastForwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fastForwardButtonActionPerformed @@ -690,7 +682,6 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie //Ensure new video position is within bounds long newTime = Math.min(currentTime + skipAhead, duration); gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); - syncProgressSlider(newTime, duration); }//GEN-LAST:event_fastForwardButtonActionPerformed private void playButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_playButtonActionPerformed @@ -701,22 +692,6 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie } }//GEN-LAST:event_playButtonActionPerformed - /** - * Sync progress slider to the newTime position if it is not already there. - * - * @param newTime New time value that progress slider may or may not be positioned at - * @param duration Total duration of the video, used for determining slider position - */ - private void syncProgressSlider(long newTime, long duration) { - //0 <= newTimePercent <= 1.0 - double newTimePercent = ((double)newTime)/duration; - //0 <= newProgressSliderPos <= PROGRESS_SLIDER_SIZE - int newProgressSliderPos = (int)(PROGRESS_SLIDER_SIZE * newTimePercent); - progressSlider.setValue(newProgressSliderPos); - updateTimeLabel(newTime, duration); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel VolumeIcon; private javax.swing.JSlider audioSlider; From 2b946af86966db1504da71ad5225e23f6176faa4 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 10 Oct 2019 16:07:23 -0400 Subject: [PATCH 07/91] Disallow seeking to immediate end (buggy when doing so), add budnle files --- .../autopsy/contentviewers/Bundle.properties | 8 ++-- .../contentviewers/Bundle.properties-MERGED | 8 ++-- .../contentviewers/MediaPlayerPanel.form | 6 +-- .../contentviewers/MediaPlayerPanel.java | 48 +++++++++++-------- 4 files changed, 40 insertions(+), 30 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties index c799a17d61..5734df98d9 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties @@ -84,9 +84,11 @@ MediaViewImagePanel.zoomTextField.text= MediaViewImagePanel.rotationTextField.text= MediaViewImagePanel.rotateLeftButton.toolTipText= HtmlPanel.showImagesToggleButton.text=Download Images -MediaPlayerPanel.audioSlider.toolTipText= -MediaPlayerPanel.VolumeIcon.text=\ \ \ \ \ Volume +MediaViewImagePanel.tagsMenu.text_1=Tags Menu MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00 +MediaPlayerPanel.audioSlider.toolTipText= +MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 +MediaPlayerPanel.fastForwardButton.text=\u25ba\u25ba MediaPlayerPanel.playButton.text=\u25ba MediaPlayerPanel.infoLabel.text=No Errors -MediaViewImagePanel.tagsMenu.text_1=Tags Menu +MediaPlayerPanel.VolumeIcon.text=\ \ \ \ \ Volume diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED index ff3341b60f..1209c49953 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED @@ -154,12 +154,14 @@ MediaViewImagePanel.zoomTextField.text= MediaViewImagePanel.rotationTextField.text= MediaViewImagePanel.rotateLeftButton.toolTipText= HtmlPanel.showImagesToggleButton.text=Download Images -MediaPlayerPanel.audioSlider.toolTipText= -MediaPlayerPanel.VolumeIcon.text=\ \ \ \ \ Volume +MediaViewImagePanel.tagsMenu.text_1=Tags Menu MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00 +MediaPlayerPanel.audioSlider.toolTipText= +MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 +MediaPlayerPanel.fastForwardButton.text=\u25ba\u25ba MediaPlayerPanel.playButton.text=\u25ba MediaPlayerPanel.infoLabel.text=No Errors -MediaViewImagePanel.tagsMenu.text_1=Tags Menu +MediaPlayerPanel.VolumeIcon.text=\ \ \ \ \ Volume # {0} - tableName SQLiteViewer.readTable.errorText=Error getting rows for table: {0} # {0} - tableName diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form index 449e3c09ea..230254020d 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form @@ -55,7 +55,7 @@ - + @@ -75,7 +75,7 @@ - + @@ -105,7 +105,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 98f3350e87..1d02dfcd2b 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -241,8 +241,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie endOfStreamListener = new Bus.EOS() { @Override public void endOfStream(GstObject go) { + gstPlayBin.seek(ClockTime.ZERO); + progressSlider.setValue(0); + /** + * Keep the video from automatically playing + */ Gst.getExecutor().submit(() -> gstPlayBin.pause()); - gstPlayBin.seek(ClockTime.ZERO); } }; } @@ -265,7 +269,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie try { //Pushing off initialization to the background extractMediaWorker = new ExtractMedia(file, VideoUtils.getVideoFileInTempDir(file)); - extractMediaWorker.execute(); + extractMediaWorker.execute(); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS infoLabel.setText(String.format("%s", Bundle.GstVideoPanel_noOpenCase_errMsg())); @@ -314,6 +318,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie progressSlider.setEnabled(isEnabled); videoPanel.setEnabled(isEnabled); audioSlider.setEnabled(isEnabled); + rewindButton.setEnabled(isEnabled); + fastForwardButton.setEnabled(isEnabled); } @Override @@ -434,8 +440,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie protected void done() { try { super.get(); - - if(this.isCancelled()) { + + if (this.isCancelled()) { return; } @@ -451,8 +457,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie playBinBus.connect(endOfStreamListener); playBinBus.connect(stateChangeListener); playBinBus.connect(errorListener); - - if(this.isCancelled()) { + + if (this.isCancelled()) { return; } @@ -462,14 +468,14 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie videoPanel.add(fxPanel); fxAppSink = new JavaFxAppSink("JavaFxAppSink", fxPanel); gstPlayBin.setVideoSink(fxAppSink); - - if(this.isCancelled()) { + + if (this.isCancelled()) { return; } gstPlayBin.setVolume((audioSlider.getValue() * 2.0) / 100.0); gstPlayBin.pause(); - + timer.start(); enableComponents(true); } catch (CancellationException ex) { @@ -497,7 +503,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * pipeline. We start this updater when data-flow has just been * initiated so buffering may still be in progress. */ - if (duration != -1) { + if (duration > 0 && position > 0) { double relativePosition = (double) position / duration; progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE)); } @@ -521,7 +527,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie controlPanel = new javax.swing.JPanel(); progressSlider = new javax.swing.JSlider(); progressLabel = new javax.swing.JLabel(); - jPanel1 = new javax.swing.JPanel(); + buttonPanel = new javax.swing.JPanel(); playButton = new javax.swing.JButton(); fastForwardButton = new javax.swing.JButton(); rewindButton = new javax.swing.JButton(); @@ -548,7 +554,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.progressLabel.text")); // NOI18N - jPanel1.setLayout(new java.awt.GridBagLayout()); + buttonPanel.setLayout(new java.awt.GridBagLayout()); org.openide.awt.Mnemonics.setLocalizedText(playButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.playButton.text")); // NOI18N playButton.addActionListener(new java.awt.event.ActionListener() { @@ -562,7 +568,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie gridBagConstraints.ipadx = 21; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 0); - jPanel1.add(playButton, gridBagConstraints); + buttonPanel.add(playButton, gridBagConstraints); org.openide.awt.Mnemonics.setLocalizedText(fastForwardButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.fastForwardButton.text")); // NOI18N fastForwardButton.addActionListener(new java.awt.event.ActionListener() { @@ -575,7 +581,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 0); - jPanel1.add(fastForwardButton, gridBagConstraints); + buttonPanel.add(fastForwardButton, gridBagConstraints); org.openide.awt.Mnemonics.setLocalizedText(rewindButton, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.rewindButton.text")); // NOI18N rewindButton.addActionListener(new java.awt.event.ActionListener() { @@ -588,7 +594,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie gridBagConstraints.gridy = 0; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 0, 1, 0); - jPanel1.add(rewindButton, gridBagConstraints); + buttonPanel.add(rewindButton, gridBagConstraints); org.openide.awt.Mnemonics.setLocalizedText(VolumeIcon, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.VolumeIcon.text")); // NOI18N VolumeIcon.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); @@ -599,7 +605,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie gridBagConstraints.ipady = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0); - jPanel1.add(VolumeIcon, gridBagConstraints); + buttonPanel.add(VolumeIcon, gridBagConstraints); audioSlider.setMajorTickSpacing(10); audioSlider.setMaximum(50); @@ -615,7 +621,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie gridBagConstraints.ipady = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(3, 1, 0, 10); - jPanel1.add(audioSlider, gridBagConstraints); + buttonPanel.add(audioSlider, gridBagConstraints); infoLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); org.openide.awt.Mnemonics.setLocalizedText(infoLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.infoLabel.text")); // NOI18N @@ -629,7 +635,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie .addContainerGap() .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 738, Short.MAX_VALUE) + .addComponent(buttonPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 738, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, controlPanelLayout.createSequentialGroup() .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -644,7 +650,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie .addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)) ); @@ -680,7 +686,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie //Skip 30 seconds. long skipAhead = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); //Ensure new video position is within bounds - long newTime = Math.min(currentTime + skipAhead, duration); + long newTime = Math.min(currentTime + skipAhead, duration - 1); gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); }//GEN-LAST:event_fastForwardButtonActionPerformed @@ -695,10 +701,10 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel VolumeIcon; private javax.swing.JSlider audioSlider; + private javax.swing.JPanel buttonPanel; private javax.swing.JPanel controlPanel; private javax.swing.JButton fastForwardButton; private javax.swing.JLabel infoLabel; - private javax.swing.JPanel jPanel1; private javax.swing.JButton playButton; private javax.swing.JLabel progressLabel; private javax.swing.JSlider progressSlider; From d9dea468f394addbf6bb946b9046763307d1d00f Mon Sep 17 00:00:00 2001 From: Ann Priestman Date: Fri, 11 Oct 2019 12:14:13 -0400 Subject: [PATCH 08/91] Added tutorial one to docs --- docs/doxygen/Doxyfile | 4 +- docs/doxygen/images/bigAndRoundFiles.png | Bin 0 -> 31278 bytes docs/doxygen/images/demoScript_folder.png | Bin 0 -> 7417 bytes docs/doxygen/images/ingest-modules.PNG | Bin 0 -> 43805 bytes docs/doxygen/{ => images}/viewer_image.JPG | Bin docs/doxygen/main.dox | 4 +- docs/doxygen/modDSIngestTutorial.dox | 5 + docs/doxygen/modFileIngestTutorial.dox | 154 +++++++++++++++++++++ 8 files changed, 164 insertions(+), 3 deletions(-) create mode 100644 docs/doxygen/images/bigAndRoundFiles.png create mode 100644 docs/doxygen/images/demoScript_folder.png create mode 100644 docs/doxygen/images/ingest-modules.PNG rename docs/doxygen/{ => images}/viewer_image.JPG (100%) mode change 100755 => 100644 create mode 100644 docs/doxygen/modDSIngestTutorial.dox create mode 100644 docs/doxygen/modFileIngestTutorial.dox diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index b640c41549..0037b15063 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -772,6 +772,8 @@ INPUT = main.dox \ regressionTesting.dox \ native_libs.dox \ modDevPython.dox \ + modFileIngestTutorial.dox \ + modDSIngestTutorial.dox \ debugTsk.dox \ ../../Core/src \ ../../CoreLibs/src \ @@ -867,7 +869,7 @@ EXAMPLE_RECURSIVE = NO # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = . +IMAGE_PATH = images/ # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program diff --git a/docs/doxygen/images/bigAndRoundFiles.png b/docs/doxygen/images/bigAndRoundFiles.png new file mode 100644 index 0000000000000000000000000000000000000000..fa6430e7d8f9e9d59f73d60bf63a4e07710912bc GIT binary patch literal 31278 zcmZs@1ymeO)GgY$1Pd++9)d&A;FbY`ySuvtcY-qnx8M%JgS$HfcMqYTmLF2WV$B+yZbQ2_uz|19}Q2>@W30RToG85TUVV=;9I{y}k& z)N}%XS2+KEVSvatqI?nL$R#v@#$?}@^ z$zckvwztI@#!kvLh+wCmu#!Sz5HojnE^K^vVoa~^{1+n+BP!3gO3@_6q(Ana#HBW@ zuQ<{Mx?k&GZGj*fmsGDp8$88id*kKnw?f^fnU?S6u~ylB-^_E%$bFl+GVU|RbL;VA zZca@Y3tl9qE3jYLpByl_G&r);uV250p+lwUHLCh9Qy3Ey zLw+JLsL*M^+B+~1O~g(!5kM1P+}76C)WkzahayiEprfxev$)9Pa;QQYErEE`zYJursxELqan8ohq#mL+|LdpFJV&D4}#T@!=09#;k@ zrg2An$_*v+T`;P0AKC5b`hJx@8HTg4SnHwB(*OL`Z6_u+|?)Aq# zp_k&yN+ck)5WEbNOz?45T^|n*k1kQl&r`)#fWtDM(wb)U51s);k^AO?*mH!m+QH&;|l%!M~Yu81ng*~LY- z)xBzfboRY?oa@mAVbYE^=Qr21?WR15ENv{3mgBpEhJy#p~(*`f_g^69omv zzgW3w&G+HY6FsC}P_s?;V&!=C?OWaqyW3-@z2by{ok~W{i{av^sKAc5)+5eWO->#A z69>+3TTcDB1if(QO)W5NG*4-`(HegJbsz0%6i^ zcD_EGJ&xnDcaNuxK2R%lx!4~1{P{D7EZ@xFJ9eo_hh$3pz%GZo3)7p`>H_Ix!HYqv z8naQ#pfmT@Z{NOkcX!`i?!ozY8CY0Yuo6eMd#RAc{K`TK z6hP#A0Hn-f4Y~cL^Nre)ocma`uqEBm+K?n^4;WwlBV)|R5y^$ zdePE9FlE@iTD(=UIksx_a~nv?d{=nCqWC?09#;ghn|?Fu+w9DYOeQ}M4NXX)C22GP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F~YBckL0SRf~ni>ee-+Sk(D_Zc?P`2Hs~~7U#`(~$K4$F z_WOsW6~8LpZrAtR`kpk#A0>QU%ecw|^Lnt%tt9`-zj?aXhZdaJ<=!!!e8m;OZ$ClO zy@joEe|(0ncxl}KyY||{Ox@-ih-5o=a3CwGy zt??8l{&P09cq_e$wzf+C9lSfkrg0{vAtX|GwMq>fyfvN6K3*idj%$x+Jf4-OAXr$S zozTT<0s6>)_bax=#p-2na?}yh>40@q6=e7`xC-57uLN*|XFU*^06N*5-3!(f!`Hi+ zqVj=pmB5Sq{YAAxm5iuU??d??3S5esrM&LjgvDxk$truoIKU%vozMhOIlT#%m_o~t zlzhHEBVg(b2w+4f%2Vjc55tm=8cE@OfDJTKJ`)#UvskJaGR;LdYr0_wHk?&#B(#Ytgbu zyRK)q_K3I9=r4o^RB8ae`4I913dvYN*GC1;<#sgI*C$>z170YK%a_WJq6f)kaoPfQ zcHhxcWMDynpY&g=24G7i^Res9p``mHQ>FpQ0k(huc9b~NrvRD+QyK{p5}ywH z;HRqdde+uYtO{Y@057I78Q9s_09*gLczb)7kEl=-Txp}Rpi*cP0JBOohPs$q(bSqY z^Px`8i$(!-gEk5X*wOV8NY9ig<}&h@k--J)Er(`#0bzXeC?{}}Lkm_R4;*>b9mHW$Ndh3}jSy{; zGkV;(kHEr%U+?oa0=CPgkR@0ANYK+8{#9uqbt0^nxoo`3IL@dMAnw9|nuo5y7vXB! zyJye=ZJiEHdrMYjtZ82;XRGwRJG7z|?6Q7*SJAeF%W-X5G5qOGTS;FfJ`6mV_yoMj zA}HF0SC$0$f34&1K|Z@Ui>}*Wb#8alcrx5_3xu{B_r(Wm8~*B;&p?5IbPHXbhl;&( z8$Sv<2Me@n1ndF-W8rL7>xK$IZexKqM)V7fkr)gB=bccBR}wwA@t8YnXj~9*NQ*0o JRf!k|{SU*u6|?{V literal 0 HcmV?d00001 diff --git a/docs/doxygen/images/demoScript_folder.png b/docs/doxygen/images/demoScript_folder.png new file mode 100644 index 0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images/viewer_image.JPG old mode 100755 new mode 100644 similarity index 100% rename from docs/doxygen/viewer_image.JPG rename to docs/doxygen/images/viewer_image.JPG diff --git a/docs/doxygen/main.dox b/docs/doxygen/main.dox index 22bcd097ad..094c61f612 100644 --- a/docs/doxygen/main.dox +++ b/docs/doxygen/main.dox @@ -9,8 +9,8 @@ If these pages don't answer your question, then send the question to the Writing Python or Java Modules If you want to write Java or Python modules, then there are some tutorials and detailed pages in this document. The Python tutorials include: -- File Ingest Modules: http://www.basistech.com/python-autopsy-module-tutorial-1-the-file-ingest-module/ -- Data Source Ingest Modules: http://www.basistech.com/python-autopsy-module-tutorial-2-the-data-source-ingest-module/ +- File Ingest Modules: \subpage mod_python_file_ingest_tutorial_page +- Data Source Ingest Modules: \subpage mod_python_ds_ingest_tutorial_page - Report Modules: http://www.basistech.com/python-autopsy-module-tutorial-3-the-report-module/ This document contains the following pages: diff --git a/docs/doxygen/modDSIngestTutorial.dox b/docs/doxygen/modDSIngestTutorial.dox new file mode 100644 index 0000000000..e457cbd7d0 --- /dev/null +++ b/docs/doxygen/modDSIngestTutorial.dox @@ -0,0 +1,5 @@ +/*! \page mod_python_ds_ingest_tutorial_page Python Tutorial #2: Writing a Data Source Ingest Module + + + +*/ \ No newline at end of file diff --git a/docs/doxygen/modFileIngestTutorial.dox b/docs/doxygen/modFileIngestTutorial.dox new file mode 100644 index 0000000000..def7e91c2a --- /dev/null +++ b/docs/doxygen/modFileIngestTutorial.dox @@ -0,0 +1,154 @@ +/*! \page mod_python_file_ingest_tutorial_page Python Tutorial #1: Writing a File Ingest Module + + +\section python_tutorial1_why Why Write a File Ingest Module? +
    +
  • Autopsy hides the fact that a file is coming from a file system, was carved, was from inside of a ZIP file, or was part of a local file. So, you don’t need to spend time supporting all of the ways that your user may want to get data to you. You just need to worry about analyzing the content.
  • +
  • Autopsy displays files automatically and can include them in reports if you use standard blackboard artifacts (described later). That means you don’t need to worry about UIs and reports.
  • +
  • Autopsy gives you access to results from other modules. So, you can build on top of their results instead of duplicating them.
  • +
+ +\section python_tutorial1_ingest_modules Ingest Modules + +For our first example, we’re going to write an ingest module. Ingest modules in Autopsy run on the data sources that are added to a case. When you add a disk image (or local drive or logical folder) in Autopsy, you’ll be presented with a list of modules to run (such as hash lookup and keyword search). + +\image html ingest-modules.PNG + +Those are all ingest modules. We’re going to write one of those. There are two types of ingest modules that we can build: +
    +
  • File Ingest Modules are the easiest to write. During their lifetime, they will get passed in each file in the data source. This includes files that are found via carving or inside of ZIP files (if those modules are also enabled).
  • +
  • Data Source Ingest Modules require slightly more work because you have to query the database for the files of interest. If you only care about a small number of files, know their name, and know they won’t be inside of ZIP files, then these are your best bet.
  • +
+ +For this first tutorial, we’re going to write a file ingest module. The \ref mod_python_ds_ingest_tutorial_page "second tutorial" will focus on data source ingest modules. Regardless of the type of ingest module you are writing, you will need to work with two classes: +
    +
  • The factory class provides Autopsy with module information such as display name and version. It also creates instances of ingest modules as needed.
  • +
  • The ingest module class will do the actual analysis. One of these will be created per thread. For file ingest modules, Autopsy will typically create two or more of these at a time so that it can analyze files in parallel. If you keep things simple, and don’t use static variables, then you don’t have to think about anything multithreaded.
  • +
+ +\section python_tutorial1_getting_started Getting Started + +To write your first file ingest module, you’ll need: +
+ +Some other general notes are that you will be writing in Jython, which converts Python-looking code into Java. It has some limitations, including: +
    +
  • You can’t use Python 3 (you are limited to Python 2.7)
  • +
  • You can’t use libraries that use native code
  • +
+ +But, Jython will give you access to all of the Java classes and services that Autopsy provides. So, if you want to stray from this example, then refer to the Developer docs on what classes and methods you have access to. The comments in the sample file will identify what type of object is being passed in along with a URL to its documentation. + +\subsection python_tutorial1_folder Making Your Module Folder + +Every Python module in Autopsy gets its own folder. This reduces naming collisions between modules. To find out where you should put your Python module, launch Autopsy and choose the Tools -> Python Plugins menu item. That will open a folder in your AppData folder, such as "C:\Users\JDoe\AppData\Roaming\Autopsy\python_modules". + +

Make a folder inside of there to store your module. Call it "DemoScript". Copy the fileIngestModule.py sample file listed above into the this new folder and rename it to FindBigRoundFiles.py. Your folder should look like this: + +\image html demoScript_folder.png + +\subsection python_tutorial1_writing Writing the Script + +We are going to write a script that flags any file that is larger than 10MB and whose size is a multiple of 4096. We’ll call these big and round files. This kind of technique could be useful for finding encrypted files. An additional check would be for entropy of the file, but we’ll keep the example simple. + +Open the FindBigRoundFiles.py file in your favorite python text editor. The sample Autopsy Python modules all have TODO entries in them to let you know what you should change. The below steps jump from one TODO to the next. +

    +
  1. Factory Class Name: The first thing to do is rename the sample class name from “SampleJythonFileIngestModuleFactory” to “FindBigRoundFilesIngestModuleFactory”. In the sample module, there are several uses of this class name, so you should search and replace for these strings.
  2. +
  3. Name and Description: The next TODO entries are for names and descriptions. These are shown to users. For this example, we’ll name it “Big and Round File Finder”. The description can be anything you want. Note that Autopsy requires that modules have unique names, so don’t make it too generic.
  4. +
  5. Ingest Module Class Name: The next thing to do is rename the ingest module class from “SampleJythonFileIngestModule” to “FindBigRoundFilesIngestModule”. Our usual naming convention is that this class is the same as the factory class with “Factory” removed from the end.
  6. +
  7. startUp() method: The startUp() method is where each module initializes. For our example, we don’t need to do anything special in here. Typically though, this is where you want to do stuff that could fail because throwing an exception here causes the entire ingest to stop.
  8. +
  9. process() method: This is where we do our analysis. The sample module is well documented with what it does. It ignores non-files, looks at the file name, and makes a blackboard artifact for “.txt” files. There are also a bunch of other things that it does to show examples for easy copy and pasting, but we don’t need them in our module. We’ll cover what goes into this method in the next section.
  10. +
  11. shutdown() method: The shutDown() method either frees resources that were allocated or sends summary messages. For our module, it will do nothing.
  12. +
+ +\subsection python_tutorial1_process The process() Method + +The process() method is passed in a reference to an AbstractFile Object. With this, you have access to all of a file’s contents and metadata. We want to flag files that are larger than 10MB and that are a multiple of 4096 bytes. The following code does that: + +\verbatim if ((file.getSize() > 10485760) and ((file.getSize() % 4096) == 0)): +\endverbatim + +Now that we have found the files, we want to do something with them. In our situation, we just want to alert the user to them. We do this by making an "Interesting Item" blackboard artifact. The Blackboard is where ingest modules can communicate with each other and with the Autopsy GUI. The blackboard has a set of artifacts on it and each artifact:

+
    +
  • Has a type
  • +
  • Is associated with a file
  • +
  • Has one or more attributes. Attributes are simply name and value pairs.
  • +
+ +For our example, we are going to make an artifact of type "TSK_INTERESTING_FILE" whenever we find a big and round file. These are one of the most generic artifact types and are simply a way of alerting the user that a file is interesting for some reason. Once you make the artifact, it will be shown in the UI. The below code makes an artifact for the file and puts it into the set of "Big and Round Files". You can create whatever set names you want. The Autopsy GUI organizes Interesting Files by their set name. +\verbatim + art = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT) + att = BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), + FindBigRoundFilesIngestModuleFactory.moduleName, "Big and Round Files") + art.addAttribute(att)\endverbatim + +The above code adds the artifact and a single attribute to the blackboard in the embedded database, but it does not notify other modules or the UI. The UI will eventually refresh, but it is faster to fire an event with this: +\verbatim + IngestServices.getInstance().fireModuleDataEvent( + ModuleDataEvent(FindBigRoundFilesIngestModuleFactory.moduleName, + BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, None))\endverbatim + +That’s it. Your process() method should look something like this: +\verbatim + def process(self, file): + + # Skip non-files + + if ((file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) or + + (file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS) or + + (file.isFile() == False)): + + return IngestModule.ProcessResult.OK + + + + # Look for files bigger than 10MB that are a multiple of 4096 + + if ((file.getSize() > 10485760) and ((file.getSize() % 4096) == 0)): + + + + # Make an artifact on the blackboard. TSK_INTERESTING_FILE_HIT is a generic type of + + # artifact. Refer to the developer docs for other examples. + + art = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT) + + att = BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), + + FindBigRoundFilesIngestModuleFactory.moduleName, "Big and Round Files") + + art.addAttribute(att) + + + + # Fire an event to notify the UI and others that there is a new artifact + + IngestServices.getInstance().fireModuleDataEvent( + + ModuleDataEvent(FindBigRoundFilesIngestModuleFactory.moduleName, + + BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, None)) + + + + return IngestModule.ProcessResult.OK\endverbatim + +Save this file and run the module on some of your data. If you have any big and round files, you should see an entry under the “Interesting Items” node in the tree. + +\image html bigAndRoundFiles.png + +\subsection python_tutorial1_debug Debugging and Development Tips + +Whenever you have syntax errors or other errors in your script, you will get some form of dialog from Autopsy when you try to run ingest modules. If that happens, fix the problem and run ingest modules again. You don’t need to restart Autopsy each time! + +The sample module has some log statements in there to help debug what is going on since we don’t know of better ways to debug the scripts while running in Autopsy. + + +*/ From 7b21f7a938cef46e347ca93c4f8b899256118680 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 15 Oct 2019 11:46:51 -0400 Subject: [PATCH 09/91] start of refactor --- .../autopsy/geolocation/ArtifactWaypoint.java | 35 ---- .../geolocation/DefaultArtifactWaypoint.java | 89 ----------- .../autopsy/geolocation/EXIFWaypoint.java | 76 --------- .../geolocation/GeolocationTopComponent.java | 97 ++++------- .../geolocation/GeolocationUtilities.java | 110 ------------- .../autopsy/geolocation/MapPanel.java | 4 +- .../geolocation/OpenGeolocationAction.java | 4 +- .../autopsy/geolocation/RefreshPanel.java | 25 ++- .../sleuthkit/autopsy/geolocation/Route.java | 151 ------------------ .../geolocation/SimpleArtifactWaypoint.java | 58 ------- 10 files changed, 56 insertions(+), 593 deletions(-) delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/ArtifactWaypoint.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/DefaultArtifactWaypoint.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/EXIFWaypoint.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/GeolocationUtilities.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/Route.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/SimpleArtifactWaypoint.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/ArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/ArtifactWaypoint.java deleted file mode 100755 index 3cb1fa14ea..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/ArtifactWaypoint.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * Contact: carrier sleuthkit 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; - -import org.jxmapviewer.viewer.Waypoint; -import org.sleuthkit.datamodel.BlackboardArtifact; - -/** - * ArtifactWaypoint interface. - */ -interface ArtifactWaypoint extends Waypoint{ - - String getLabel() ; - - BlackboardArtifact getArtifact() ; - - long getTimestamp() ; -} - \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/DefaultArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/DefaultArtifactWaypoint.java deleted file mode 100755 index 7bbc0a317f..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/DefaultArtifactWaypoint.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * Contact: carrier sleuthkit 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; - -import org.jxmapviewer.viewer.GeoPosition; -import org.sleuthkit.datamodel.BlackboardArtifact; - -/** - * Basic parent class for representing a Blackboard artifact waypoint. - * - */ -class DefaultArtifactWaypoint implements ArtifactWaypoint{ - private final BlackboardArtifact artifact; - private String label; - private long timestamp; - private GeoPosition position; - - /** - * Construct a default way point object. - * - * @param artifact The artifact that the waypoint is for. - */ - DefaultArtifactWaypoint(BlackboardArtifact artifact) { - this.artifact = artifact; - } - - @Override - public String getLabel() { - return label; - } - - void setLabel(String label) { - this.label = label; - } - - @Override - public BlackboardArtifact getArtifact() { - return artifact; - } - - @Override - public long getTimestamp() { - return timestamp; - } - - void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - @Override - public GeoPosition getPosition() { - return position; - } - - /** - * Set the GeoPosition for the waypoint - * - * @param position GeoPosition for the waypoint - */ - void setPosition(GeoPosition position) { - this.position = position; - } - - /** - * Create and set the GeoPosition for the way point. - * - * @param latitude double latitude value - * @param longitude double logitude value - */ - void setPosition(double latitude, double longitude) { - position = new GeoPosition(latitude, longitude); - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/EXIFWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/EXIFWaypoint.java deleted file mode 100755 index 54a93a812b..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/EXIFWaypoint.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * Contact: carrier sleuthkit 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; - -import java.util.logging.Level; -import org.jxmapviewer.viewer.GeoPosition; -import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * EXIF way point object - */ -final class EXIFWaypoint extends DefaultArtifactWaypoint{ - - private static final Logger logger = Logger.getLogger(EXIFWaypoint.class.getName()); - - private AbstractFile imageFile; - - /** - * Construct a EXIF way point - * @param artifact - */ - EXIFWaypoint(BlackboardArtifact artifact) { - super(artifact); - initWaypoint(); - } - - /** - * Initialize the way point. - */ - private void initWaypoint() { - BlackboardArtifact artifact = getArtifact(); - - Double longitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - Double latitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - - if (longitude != null && latitude != null) { - setPosition(new GeoPosition(latitude, longitude)); - } else { - setPosition(null); - // No need to bother with other attributes if there are no - // location parameters - return; - } - - Long datetime = GeolocationUtilities.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); - if (datetime != null) { - setTimestamp(datetime * 1000); - } - - try { - imageFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); - } catch (TskCoreException ex) { - logger.log(Level.WARNING, String.format("Failed to getAbstractFileByID for %d ", artifact.getObjectID()), ex); - } - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java index 7af2bae7ea..3678f562e8 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -35,13 +35,15 @@ import org.openide.windows.RetainLocation; import org.openide.windows.TopComponent; import org.sleuthkit.autopsy.casemodule.Case; import static org.sleuthkit.autopsy.casemodule.Case.Events.CURRENT_CASE; -import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.ingest.IngestManager; import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED; import org.sleuthkit.autopsy.ingest.ModuleDataEvent; import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.SleuthkitCase; +import org.sleuthkit.datamodel.TskCoreException; /** * Top component which displays the Geolocation Tool. @@ -54,15 +56,16 @@ import org.sleuthkit.datamodel.BlackboardArtifact; public final class GeolocationTopComponent extends TopComponent { private static final Logger logger = Logger.getLogger(GeolocationTopComponent.class.getName()); - + private static final Set INGEST_MODULE_EVENTS_OF_INTEREST = EnumSet.of(DATA_ADDED); - + private final PropertyChangeListener ingestListener; - + final RefreshPanel refreshPanel = new RefreshPanel(); @Messages({ - "GLTopComponent_name=Geolocation" + "GLTopComponent_name=Geolocation", + "GLTopComponent_initilzation_error=An error occurred during waypoint initilization. Geolocation data maybe incomplete." }) /** @@ -73,7 +76,7 @@ public final class GeolocationTopComponent extends TopComponent { initComponents(); initWaypoints(); setName(Bundle.GLTopComponent_name()); - + this.ingestListener = pce -> { String eventType = pce.getPropertyName(); if (eventType.equals(DATA_ADDED.toString())) { @@ -86,13 +89,11 @@ public final class GeolocationTopComponent extends TopComponent { || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE.getTypeID() || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID() || eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK.getTypeID())) { - - showRefreshPanel(true); + + showRefreshPanel(true); } } }; - - refreshPanel.addCloseActionListener(new ActionListener() { @Override @@ -110,14 +111,14 @@ public final class GeolocationTopComponent extends TopComponent { } }); } - + @Override public void addNotify() { super.addNotify(); IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener); Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> { mapPanel.clearWaypoints(); - if(evt.getNewValue() != null) { + if (evt.getNewValue() != null) { initWaypoints(); } }); @@ -128,14 +129,14 @@ public final class GeolocationTopComponent extends TopComponent { super.removeNotify(); IngestManager.getInstance().removeIngestModuleEventListener(ingestListener); } - + /** * Set the state of the refresh panel at the top of the mapPanel. - * + * * @param show Whether to show or hide the panel. */ private void showRefreshPanel(boolean show) { - if(show) { + if (show) { mapPanel.add(refreshPanel, BorderLayout.NORTH); } else { mapPanel.remove(refreshPanel); @@ -154,72 +155,37 @@ public final class GeolocationTopComponent extends TopComponent { protected List doInBackground() throws Exception { List waypoints = new ArrayList<>(); - Case currentCase; - try { - currentCase = Case.getCurrentCaseThrows(); - } catch (NoCurrentCaseException ex) { - logger.log(Level.WARNING, "Unable to get artifacts for geolocation window, no current open", ex); - // Popup a message or something? - return waypoints; - } + Case currentCase = Case.getCurrentCaseThrows(); - // TSK_GPS_TRACKPOINT, TSK_GPS_SEARCH, TSK_GPS_LAST_KNOWN_LOCATION - // and TSK_GPS_BOOKMARK have similar attributes and can be processed - // similarly - List artifacts = new ArrayList<>(); - artifacts.addAll(currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)); - artifacts.addAll(currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH)); - artifacts.addAll(currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION)); - artifacts.addAll(currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK)); - - for (BlackboardArtifact artifact : artifacts) { - Waypoint point = new SimpleArtifactWaypoint(artifact); - - if (point.getPosition() != null) { - waypoints.add(new SimpleArtifactWaypoint(artifact)); - } - } - - // Handle the TSK_GPS_ROUTE artifacts - List routes = currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); - for (BlackboardArtifact artifact : routes) { - Route route = new Route(artifact); - for (ArtifactWaypoint point : route.getRoute()) { - waypoints.add(point); - } - } - - artifacts = currentCase.getSleuthkitCase().getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); - for (BlackboardArtifact artifact : artifacts) { - Waypoint point = new EXIFWaypoint(artifact); - - if (point.getPosition() != null) { - waypoints.add(new SimpleArtifactWaypoint(artifact)); - } - } +// waypoints.addAll(getGPSRouteWaypoints(currentCase.getSleuthkitCase())); +// waypoints.addAll(getEXIFWaypoints(currentCase.getSleuthkitCase())); +// waypoints.addAll(getSimpleWaypoints(currentCase.getSleuthkitCase())); return waypoints; } @Override protected void done() { - if(isDone() && !isCancelled()) { + if (isDone() && !isCancelled()) { try { List waypoints = get(); - if(waypoints == null || waypoints.isEmpty()) { + if (waypoints == null || waypoints.isEmpty()) { return; } - - for(Waypoint point: waypoints) { + + for (Waypoint point : waypoints) { mapPanel.addWaypoint(point); } - + // There might be a better way to decide how to center // but for now just use the first way point. mapPanel.setCenterLocation(waypoints.get(0)); - - } catch (InterruptedException | ExecutionException ex) { - logger.log(Level.WARNING, "Unable to add points to geolocation.", ex); + + } catch (ExecutionException ex) { + logger.log(Level.WARNING, "An exception occured while initalizing waypoints for geolocation window.", ex); + MessageNotifyUtil.Message.error(Bundle.GLTopComponent_initilzation_error()); + } catch (InterruptedException ex) { + logger.log(Level.WARNING, "The initilization thread for geolocation window was interrupted.", ex); } } } @@ -228,6 +194,7 @@ public final class GeolocationTopComponent extends TopComponent { worker.execute(); } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationUtilities.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationUtilities.java deleted file mode 100755 index 13514820d3..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationUtilities.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package org.sleuthkit.autopsy.geolocation; - -import java.util.logging.Level; -import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Helper function for managing the getting artifact information. These functions - * were grabbed from KMLReport. - * - */ -class GeolocationUtilities { - private static final Logger logger = Logger.getLogger(GeolocationUtilities.class.getName()); - /** - * Get a Double from an artifact if it exists, return null otherwise. - * - * @param artifact The artifact to query - * @param type The attribute type we're looking for - * - * @return The Double if it exists, or null if not - */ - static Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { - Double returnValue = null; - try { - BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); - if (bba != null) { - Double value = bba.getValueDouble(); - returnValue = value; - } - } catch (TskCoreException ex) { - logger.log(Level.WARNING, "Error getting Double value: " + type.toString(), ex); //NON-NLS - } - return returnValue; - } - - /** - * Get a Long from an artifact if it exists, return null otherwise. - * - * @param artifact The artifact to query - * @param type The attribute type we're looking for - * - * @return The Long if it exists, or null if not - */ - static Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { - Long returnValue = null; - try { - BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); - if (bba != null) { - Long value = bba.getValueLong(); - returnValue = value; - } - } catch (TskCoreException ex) { - logger.log(Level.WARNING, "Error getting Long value: " + type.toString(), ex); //NON-NLS - } - return returnValue; - } - - /** - * Get an Integer from an artifact if it exists, return null otherwise. - * - * @param artifact The artifact to query - * @param type The attribute type we're looking for - * - * @return The Integer if it exists, or null if not - */ - static Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { - Integer returnValue = null; - try { - BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); - if (bba != null) { - Integer value = bba.getValueInt(); - returnValue = value; - } - } catch (TskCoreException ex) { - logger.log(Level.WARNING, "Error getting Integer value: " + type.toString(), ex); //NON-NLS - } - return returnValue; - } - - /** - * Get a String from an artifact if it exists, return null otherwise. - * - * @param artifact The artifact to query - * @param type The attribute type we're looking for - * - * @return The String if it exists, or null if not - */ - static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { - String returnValue = null; - try { - BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); - if (bba != null) { - String value = bba.getValueString(); - if (value != null && !value.isEmpty()) { - returnValue = value; - } - } - } catch (TskCoreException ex) { - logger.log(Level.WARNING, "Error getting String value: " + type.toString(), ex); //NON-NLS - } - return returnValue; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java index 8b22c16938..7abc1ff5be 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java @@ -40,9 +40,11 @@ import org.jxmapviewer.viewer.WaypointPainter; * Main panel with the JJXMapViewer object and its basic controls. */ public class MapPanel extends javax.swing.JPanel { + + private static final long serialVersionUID = 1L; private boolean zoomChanging = false; - private final boolean sliderReversed = false; + private boolean sliderReversed = false; // Using a DefaultListModel to store the way points because we get // a lot of functionality for free, like listeners. diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java b/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java index 2e9ffa0f76..e13031cd6e 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java @@ -43,8 +43,6 @@ import org.sleuthkit.autopsy.core.RuntimeProperties; @ActionReference(path = "Menu/Tools", position = 102)}) public class OpenGeolocationAction extends CallableSystemAction { - private final PropertyChangeListener caseChangeListener; - @Messages({ "OpenGeolocationAction_name=Geolocation", "OpenGeolocationAction_displayName=Geolocation" @@ -56,7 +54,7 @@ public class OpenGeolocationAction extends CallableSystemAction { public OpenGeolocationAction() { setEnabled(false); //disabled by default. Will be enabled in Case.java when a case is opened. - caseChangeListener = (PropertyChangeEvent evt) -> { + PropertyChangeListener caseChangeListener = (PropertyChangeEvent evt) -> { if (evt.getPropertyName().equals(Case.Events.CURRENT_CASE.toString())) { setEnabled(RuntimeProperties.runningWithGUI() && evt.getNewValue() != null); } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java index 29db4fb2bd..d53dd26b70 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java @@ -1,17 +1,32 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; import java.awt.event.ActionListener; +import javax.swing.JPanel; /** - * + * Message panel to info user that the MapPanel may need to be refreshed + * due to new artifacts. * */ -public class RefreshPanel extends javax.swing.JPanel { +class RefreshPanel extends JPanel { /** * Creates new form RefreshPanel diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/Route.java deleted file mode 100755 index 55b1af4586..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/Route.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * Contact: carrier sleuthkit 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; - -import java.util.ArrayList; -import java.util.List; -import org.jxmapviewer.viewer.GeoPosition; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; - -/** - * A route is a set of Geolocations with a common parent artifact; - * - */ -class Route { - - private final BlackboardArtifact artifact; - private final List waypoints; - private long timestamp; - - /** - * Construct a route for the given artifact. - * - * @param artifact TSK_GPS_ROUTE artifact object - */ - Route(BlackboardArtifact artifact) { - this.artifact = artifact; - waypoints = new ArrayList<>(); - initRoute(); - } - - /** - * Construct a route with the given artifact and list of way points. - * - * @param artifact TSK_GPS_ROUTE artifact object - * @param waypoints List of waypoints for this route - */ - Route(BlackboardArtifact artifact, List waypoints) { - this.artifact = artifact; - this.waypoints = waypoints; - } - - /** - * Add a way point to the route. - * - * @param point Waypoint to add to the route. - */ - void addWaypoint(ArtifactWaypoint point) { - waypoints.add(point); - } - - /** - * Get the list of way points for this route; - * - * @return List of ArtifactWaypoints for this route - */ - List getRoute() { - return waypoints; - } - - /** - * Initialize the route. - */ - private void initRoute() { - if (artifact == null) { - return; - } - - // Get the start logitude and latitude - Double latitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START); - Double longitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START); - - if (latitude != null && longitude != null) { - addWaypoint(new RouteWaypoint(this, latitude, longitude, "Start")); - } - - // Get the end logitude and latitude - latitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END); - longitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END); - - if (latitude != null && longitude != null) { - addWaypoint(new RouteWaypoint(this, latitude, longitude, "End")); - } - - // Get the creation date - Long dateTime = GeolocationUtilities.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - if (dateTime != null) { - timestamp = dateTime * 1000; - } - } - - /** - * Waypoint object for routes. - */ - class RouteWaypoint implements ArtifactWaypoint { - - private final Route parent; - private final GeoPosition position; - private final String label; - - /** - * Construct a route way point. - * - * @param parent The parent route object. - * @param latitude Latitude for waypoint - * @param longitude Longitude for waypoint - * @param label Way point label. - */ - RouteWaypoint(Route parent, double latitude, double longitude, String label) { - this.parent = parent; - this.position = new GeoPosition(latitude, longitude); - this.label = label; - } - - @Override - public String getLabel() { - return label; - } - - @Override - public BlackboardArtifact getArtifact() { - return parent.artifact; - } - - @Override - public long getTimestamp() { - return parent.timestamp; - } - - @Override - public GeoPosition getPosition() { - return position; - } - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/SimpleArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/SimpleArtifactWaypoint.java deleted file mode 100755 index 5c06b75e31..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/SimpleArtifactWaypoint.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * Contact: carrier sleuthkit 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; - -import org.jxmapviewer.viewer.GeoPosition; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; - -/** - * This is a wrapper for artifacts with the basic set of geolocation attributes. - */ -class SimpleArtifactWaypoint extends DefaultArtifactWaypoint { - - SimpleArtifactWaypoint(BlackboardArtifact artifact) { - super(artifact); - initWaypoint(); - } - - /** - * Initialize the waypoint basic information. - */ - private void initWaypoint() { - BlackboardArtifact artifact = getArtifact(); - - Double longitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - Double latitude = GeolocationUtilities.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - - if (longitude != null && latitude != null) { - setPosition(new GeoPosition(latitude, longitude)); - } else { - setPosition(null); - // No need to bother with other attributes if there are no - // location parameters - return; - } - - Long datetime = GeolocationUtilities.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - if (datetime != null) { - setTimestamp(datetime * 1000); - } - } -} From 2a170a735f8a62e461c95509f9a0c69d2a79a22a Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Wed, 16 Oct 2019 14:14:43 -0400 Subject: [PATCH 10/91] inital commit --- .../datamodel/BlackboardArtifactPoint.java | 49 ++ .../geolocation/datamodel/DefaultPoint.java | 263 +++++++ .../datamodel/EXIFMetadataPoint.java | 59 ++ .../datamodel/GeolocationManager.java | 133 ++++ .../autopsy/geolocation/datamodel/Route.java | 116 ++++ .../geolocation/datamodel/RoutePoint.java | 61 ++ .../geolocation/datamodel/SimplePoint.java | 72 ++ .../autopsy/report/modules/kml/KMLReport.java | 650 +++++------------- 8 files changed, 921 insertions(+), 482 deletions(-) create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java new file mode 100755 index 0000000000..a93cb49f89 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java @@ -0,0 +1,49 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * + * + */ +public interface BlackboardArtifactPoint { + BlackboardArtifact getArtifact() ; + + Long getTimestamp() ; + + String getLabel() ; + + Double getLatitude(); + + Double getLongitude(); + + Double getAltitude(); + + String getDetails(); + + void initPosition() throws TskCoreException; + + String getFormattedCoordinates(); + + String getFormattedCoordinates(String format); +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java new file mode 100755 index 0000000000..3bf1e56a82 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java @@ -0,0 +1,263 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import java.text.SimpleDateFormat; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * + * + */ +public abstract class DefaultPoint implements BlackboardArtifactPoint{ + final private BlackboardArtifact artifact; + + private String label = null; + private Long timestamp = null; + private String details = null; + private Double longitude = null; + private Double latitude = null; + private Double altitude = null; + + private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); + private static final String DEFAULT_COORD_FORMAT = "%.2f, %.2f"; + + public DefaultPoint(BlackboardArtifact artifact) { + this.artifact = artifact; + } + + @Override + public BlackboardArtifact getArtifact() { + return artifact; + } + + @Override + public Long getTimestamp() { + return timestamp; + } + + protected void setTimestamp(Long timestamp) { + this.timestamp = timestamp; + } + + @Override + public String getLabel() { + return label; + } + + protected void setLabel(String label) { + this.label = label; + } + + @Override + public String getDetails() { + return details; + } + + protected void setDetails(String details) { + this.details = details; + } + + @Override + public Double getLatitude() { + return latitude; + } + + protected void setLatitude(Double latitude) { + this.latitude = latitude; + } + + @Override + public Double getLongitude() { + return longitude; + } + + protected void setLongitude(Double longitude) { + this.longitude = longitude; + } + + @Override + public Double getAltitude() { + return altitude; + } + + protected void setAltitude(Double altitude) { + this.altitude = altitude; + } + + @Override + public String getFormattedCoordinates() { + return getFormattedCoordinates(DEFAULT_COORD_FORMAT); + } + + @Override + public String getFormattedCoordinates(String format) { + return String.format(format, getLatitude(), getLongitude()); + } + + /** + * This method creates a text description for a map feature using all the + * geospatial and time data we can for the Artifact. It queries the + * following attributes: + * + * TSK_GEO_LATITUDE 54; TSK_GEO_LONGITUDE 55; TSK_GEO_LATITUDE_START 98; + * TSK_GEO_LATITUDE_END 99; TSK_GEO_LONGITUDE_START 100; + * TSK_GEO_LONGITUDE_END 101; TSK_GEO_VELOCITY 56; TSK_GEO_ALTITUDE 57; + * TSK_GEO_BEARING 58; TSK_GEO_HPRECISION 59; TSK_GEO_VPRECISION 60; + * TSK_GEO_MAPDATUM 61; TSK_DATETIME_START 83; TSK_DATETIME_END 84; + * TSK_LOCATION 86; TSK_PATH_SOURCE 94; + * + * @param artifact the artifact to query. + * @param featureType the type of Artifact we're working on. + * + * @return a String with the information we have available + */ + String getDetailsFromArtifact() throws TskCoreException{ + final String SEP = "
"; + StringBuilder result = new StringBuilder(); //NON-NLS + + result.append("

"); + result.append(getArtifact().getArtifactTypeName()); + result.append("

"); + + String name = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + if (name != null && !name.isEmpty()) { + result.append("Name: ").append(name).append(SEP); //NON-NLS + } + + String location = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); + if (location != null && !location.isEmpty()) { + result.append("Location: ").append(location).append(SEP); //NON-NLS + } + + if (timestamp != null) { + result.append("Timestamp: ").append(getTimeStamp(timestamp)).append(SEP); //NON-NLS + result.append("Unix timestamp: ").append(timestamp).append(SEP); //NON-NLS + } + + Long startingTimestamp = getLong( BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START); + if (startingTimestamp != null) { + result.append("Starting Timestamp: ").append(getTimeStamp(startingTimestamp)).append(SEP); //NON-NLS + result.append("Starting Unix timestamp: ").append(startingTimestamp).append(SEP); //NON-NLS + } + + Long endingTimestamp = getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END); + if (endingTimestamp != null) { + result.append("Ending Timestamp: ").append(getTimeStamp(endingTimestamp)).append(SEP); //NON-NLS + result.append("Ending Unix timestamp: ").append(endingTimestamp).append(SEP); //NON-NLS + } + + Long createdTimestamp = getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); + if (createdTimestamp != null) { + result.append("Created Timestamp: ").append(getTimeStamp(createdTimestamp)).append(SEP); //NON-NLS + result.append("Created Unix timestamp: ").append(createdTimestamp).append(SEP); //NON-NLS + } + + if (latitude != null) { + result.append("Latitude: ").append(latitude).append(SEP); //NON-NLS + } + + if (longitude != null) { + result.append("Longitude: ").append(longitude).append(SEP); //NON-NLS + } + + Double velocity = getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VELOCITY); + if (velocity != null) { + result.append("Velocity: ").append(velocity).append(SEP); //NON-NLS + } + + if (altitude != null) { + result.append("Altitude: ").append(altitude).append(SEP); //NON-NLS + } + + Double bearing = getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_BEARING); + if (bearing != null) { + result.append("Bearing: ").append(bearing).append(SEP); //NON-NLS + } + + Integer hPrecision = getInteger(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_HPRECISION); + if (hPrecision != null) { + result.append("Horizontal Precision Figure of Merit: ").append(hPrecision).append(SEP); //NON-NLS + } + + Integer vPrecision = getInteger(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VPRECISION); + if (vPrecision != null) { + result.append("Vertical Precision Figure of Merit: ").append(vPrecision).append(SEP); //NON-NLS + } + + String mapDatum = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_MAPDATUM); + if (mapDatum != null && !mapDatum.isEmpty()) { + result.append("Map Datum: ").append(mapDatum).append(SEP); //NON-NLS + } + + String programName = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + if (programName != null && !programName.isEmpty()) { + result.append("Reported by: ").append(programName).append(SEP); //NON-NLS + } + + String flag = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + if (flag != null && !flag.isEmpty()) { + result.append("Flag: ").append(flag).append(SEP); //NON-NLS + } + + String pathSource = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_SOURCE); + if (pathSource != null && !pathSource.isEmpty()) { + result.append("Source: ").append(pathSource).append(SEP); //NON-NLS + } + + String deviceMake = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MAKE); + if (deviceMake != null && !deviceMake.isEmpty()) { + result.append("Device Make: ").append(deviceMake).append(SEP); //NON-NLS + } + + String deviceModel = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MODEL); + if (deviceModel != null && !deviceModel.isEmpty()) { + result.append("Device Model: ").append(deviceModel).append(SEP); //NON-NLS + } + + return result.toString(); + } + + String getString(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); + return (attribute != null ? attribute.getValueString() : null); + } + + Double getDouble(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); + return (attribute != null ? attribute.getValueDouble() : null); + } + + Long getLong(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); + return (attribute != null ? attribute.getValueLong() : null); + } + + Integer getInteger(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); + return (attribute != null ? attribute.getValueInt() : null); + } + + String getTimeStamp(long timeStamp) { + return DATE_FORMAT.format(new java.util.Date(getTimestamp() * 1000)); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java new file mode 100755 index 0000000000..ea444a9d06 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java @@ -0,0 +1,59 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * + * + */ +public class EXIFMetadataPoint extends SimplePoint{ + private AbstractFile imageFile; + + /** + * Construct a EXIF way point + * @param artifact + */ + EXIFMetadataPoint(BlackboardArtifact artifact) { + super(artifact); + } + + @Override + public void initPosition() throws TskCoreException{ + super.initPosition(); + + setTimestamp(getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED)); + + BlackboardArtifact artifact = getArtifact(); + if(artifact != null) { + imageFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); + } + + setLabel(imageFile.getName()); + } + + public AbstractFile getImage() { + return imageFile; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java new file mode 100755 index 0000000000..651ea22748 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java @@ -0,0 +1,133 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import java.util.ArrayList; +import java.util.List; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.SleuthkitCase; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * + * + */ +public class GeolocationManager { + + static public List getPoints(SleuthkitCase skCase, boolean includeRoute) throws TskCoreException { + List points = new ArrayList<>(); + + points.addAll(getSimplePoints(skCase)); + points.addAll(getEXIFPoints(skCase)); + + if(includeRoute) { + points.addAll(getGPSRouteWaypoints(skCase)); + } + + + return points; + } + + static public List getGPSRoutes(SleuthkitCase skCase) throws TskCoreException{ + List routes = new ArrayList<>(); + List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); + for (BlackboardArtifact artifact : artifacts) { + Route route = new Route(artifact); + route.initRoute(); + routes.add(route); + } + return routes; + } + + /** + * + * @param skCase + * + * @return + * + * @throws TskCoreException + */ + static private List getSimplePoints(SleuthkitCase skCase) throws TskCoreException { + + List points = new ArrayList<>(); + + // TSK_GPS_TRACKPOINT, TSK_GPS_SEARCH, TSK_GPS_LAST_KNOWN_LOCATION + // and TSK_GPS_BOOKMARK have similar attributes and can be processed + // similarly + List artifacts = new ArrayList<>(); + artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)); + artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH)); + artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION)); + artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK)); + + for (BlackboardArtifact artifact : artifacts) { + BlackboardArtifactPoint point = new SimplePoint(artifact); + point.initPosition(); + // Good point only if it has the location + if(point.getLatitude() != null && point.getLongitude() != null) { + points.add(point); + } + } + + return points; + } + + /** + * + * @param skCase + * + * @return + * + * @throws TskCoreException + */ + static private List getEXIFPoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); + List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); + for (BlackboardArtifact artifact : artifacts) { + BlackboardArtifactPoint point = new EXIFMetadataPoint(artifact); + + point.initPosition(); + if(point.getLatitude() != null && point.getLongitude() != null) { + points.add(point); + } + } + + return points; + } + + /** + * + * @param skCase + * + * @return + * + * @throws TskCoreException + */ + static private List getGPSRouteWaypoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); + + for (Route route : getGPSRoutes(skCase)) { + points.addAll(route.getRoute()); + } + + return points; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java new file mode 100755 index 0000000000..fc17096570 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -0,0 +1,116 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import java.util.ArrayList; +import java.util.List; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * + * + */ +public class Route { + private final BlackboardArtifact artifact; + private final List waypoints; + private long timestamp; + private String details; + private Double altitude = null; + + /** + * Construct a route for the given artifact. + * + * @param artifact TSK_GPS_ROUTE artifact object + */ + protected Route(BlackboardArtifact artifact) { + this.artifact = artifact; + waypoints = new ArrayList<>(); + } + + /** + * Get the list of way points for this route; + * + * @return List of ArtifactWaypoints for this route + */ + public List getRoute() { + return waypoints; + } + + public String getDetails() { + return details; + } + + public BlackboardArtifact getArtifact() { + return artifact; + } + + public Long getTimestamp() { + return timestamp; + } + + public Double getAltitude() { + return altitude; + } + + /** + * Initialize the route. + */ + protected void initRoute() throws TskCoreException { + if (artifact == null) { + return; + } + + Double latitude; + Double longitude; + + latitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START); + longitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START); + + if (latitude != null && longitude != null) { + waypoints.add(new RoutePoint(this, latitude, longitude, "Start")); + } + + latitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END); + longitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END); + + if (latitude != null && longitude != null) { + waypoints.add(new RoutePoint(this, latitude, longitude, "End")); + } + + altitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); + + // Get the creation date + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); + Long dateTime = attribute != null ? attribute.getValueLong() : null; + if (dateTime != null) { + timestamp = dateTime * 1000; + } + } + + private Double getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ + BlackboardAttribute attribute; + + attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); + return attribute != null ? attribute.getValueDouble() : null; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java new file mode 100755 index 0000000000..784b0ea4f1 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java @@ -0,0 +1,61 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +public class RoutePoint extends DefaultPoint { + + private final Route parent; + + /** + * Construct a route way point. + * + * @param parent The parent route object. + * @param latitude Latitude for waypoint + * @param longitude Longitude for waypoint + * @param label Way point label. + */ + protected RoutePoint(Route parent, double latitude, double longitude, String label) { + super(parent.getArtifact()); + + this.parent = parent; + setLabel(label); + setLongitude(longitude); + setLatitude(latitude); + } + + @Override + public void initPosition() { + } + + @Override + public Long getTimestamp() { + return parent.getTimestamp(); + } + + @Override + public String getDetails() { + return parent.getDetails(); + } + + @Override + public Double getAltitude() { + return parent.getAltitude(); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java new file mode 100755 index 0000000000..e75443af51 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java @@ -0,0 +1,72 @@ +/* + * + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * + * + */ +public class SimplePoint extends DefaultPoint{ + + SimplePoint(BlackboardArtifact artifact) { + super(artifact); + } + + @Override + public void initPosition() throws TskCoreException{ + setLongitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE)); + setLatitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE)); + setAltitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); + setTimestamp(getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); + + setDetails(getDetailsFromArtifact()); + setLabel(getLabelBasedOnType()); + } + + String getLabelBasedOnType() throws TskCoreException{ + String label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + + if(label == null || label.isEmpty()) { + if (getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID()) { + label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); + if(label == null || label.isEmpty()) { + label = "GPS Search"; + } + } else if (getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()) { + label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + if(label == null || label.isEmpty()) { + label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + } + + if(label == null || label.isEmpty()) { + label = "GPS Trackpoint"; + } + } else if (getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID()) { + label = "Last Known Location"; + } + } + + return label; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index c1a8ec4046..fe5ab34556 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -36,6 +36,7 @@ import java.io.OutputStream; import java.nio.file.Path; import java.nio.file.Paths; import java.text.SimpleDateFormat; +import java.util.List; import java.util.logging.Level; import org.jdom2.Document; import org.jdom2.Element; @@ -45,9 +46,13 @@ import org.jdom2.output.XMLOutputter; import org.jdom2.CDATA; import org.openide.filesystems.FileUtil; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.geolocation.datamodel.EXIFMetadataPoint; +import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationManager; +import org.sleuthkit.autopsy.geolocation.datamodel.Route; import org.sleuthkit.autopsy.report.ReportBranding; import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; +import org.sleuthkit.autopsy.geolocation.datamodel.BlackboardArtifactPoint; /** * Generates a KML file based on geospatial information from the BlackBoard. @@ -64,6 +69,13 @@ class KMLReport implements GeneralReportModule { private final SimpleDateFormat kmlDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); private Namespace ns; private final String SEP = "
"; + + private Element gpsExifMetadataFolder; + private Element gpsBookmarksFolder; + private Element gpsLastKnownLocationFolder; + private Element gpsRouteFolder; + private Element gpsSearchesFolder; + private Element gpsTrackpointsFolder; private enum FeatureColor { RED("style.kml#redFeature"), @@ -138,270 +150,18 @@ class KMLReport implements GeneralReportModule { progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.loading")); - ns = Namespace.getNamespace("", "http://www.opengis.net/kml/2.2"); //NON-NLS - - Element kml = new Element("kml", ns); //NON-NLS - kml.addNamespaceDeclaration(Namespace.getNamespace("gx", "http://www.google.com/kml/ext/2.2")); //NON-NLS - kml.addNamespaceDeclaration(Namespace.getNamespace("kml", "http://www.opengis.net/kml/2.2")); //NON-NLS - kml.addNamespaceDeclaration(Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom")); //NON-NLS - Document kmlDocument = new Document(kml); - - Element document = new Element("Document", ns); //NON-NLS - kml.addContent(document); - - Element name = new Element("name", ns); //NON-NLS - ReportBranding rb = new ReportBranding(); - name.setText(rb.getReportTitle() + " KML"); //NON-NLS - document.addContent(name); - - // Check if ingest has finished - if (IngestManager.getInstance().isIngestRunning()) { - Element ingestwarning = new Element("snippet", ns); //NON-NLS - ingestwarning.addContent(NbBundle.getMessage(this.getClass(), "ReportBodyFile.ingestWarning.text")); //NON-NLS - document.addContent(ingestwarning); - } - - // Create folder structure - Element gpsExifMetadataFolder = new Element("Folder", ns); //NON-NLS - CDATA cdataExifMetadataFolder = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/camera-icon-16.png"); //NON-NLS - Element hrefExifMetadata = new Element("href", ns).addContent(cdataExifMetadataFolder); //NON-NLS - gpsExifMetadataFolder.addContent(new Element("Icon", ns).addContent(hrefExifMetadata)); //NON-NLS - - Element gpsBookmarksFolder = new Element("Folder", ns); //NON-NLS - CDATA cdataBookmarks = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gpsfav.png"); //NON-NLS - Element hrefBookmarks = new Element("href", ns).addContent(cdataBookmarks); //NON-NLS - gpsBookmarksFolder.addContent(new Element("Icon", ns).addContent(hrefBookmarks)); //NON-NLS - - Element gpsLastKnownLocationFolder = new Element("Folder", ns); //NON-NLS - CDATA cdataLastKnownLocation = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gps-lastlocation.png"); //NON-NLS - Element hrefLastKnownLocation = new Element("href", ns).addContent(cdataLastKnownLocation); //NON-NLS - gpsLastKnownLocationFolder.addContent(new Element("Icon", ns).addContent(hrefLastKnownLocation)); //NON-NLS - - Element gpsRouteFolder = new Element("Folder", ns); //NON-NLS - CDATA cdataRoute = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gps-trackpoint.png"); //NON-NLS - Element hrefRoute = new Element("href", ns).addContent(cdataRoute); //NON-NLS - gpsRouteFolder.addContent(new Element("Icon", ns).addContent(hrefRoute)); //NON-NLS - - Element gpsSearchesFolder = new Element("Folder", ns); //NON-NLS - CDATA cdataSearches = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gps-search.png"); //NON-NLS - Element hrefSearches = new Element("href", ns).addContent(cdataSearches); //NON-NLS - gpsSearchesFolder.addContent(new Element("Icon", ns).addContent(hrefSearches)); //NON-NLS - - Element gpsTrackpointsFolder = new Element("Folder", ns); //NON-NLS - CDATA cdataTrackpoints = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gps-trackpoint.png"); //NON-NLS - Element hrefTrackpoints = new Element("href", ns).addContent(cdataTrackpoints); //NON-NLS - gpsTrackpointsFolder.addContent(new Element("Icon", ns).addContent(hrefTrackpoints)); //NON-NLS - - gpsExifMetadataFolder.addContent(new Element("name", ns).addContent("EXIF Metadata")); //NON-NLS - gpsBookmarksFolder.addContent(new Element("name", ns).addContent("GPS Bookmarks")); //NON-NLS - gpsLastKnownLocationFolder.addContent(new Element("name", ns).addContent("GPS Last Known Location")); //NON-NLS - gpsRouteFolder.addContent(new Element("name", ns).addContent("GPS Routes")); //NON-NLS - gpsSearchesFolder.addContent(new Element("name", ns).addContent("GPS Searches")); //NON-NLS - gpsTrackpointsFolder.addContent(new Element("name", ns).addContent("GPS Trackpoints")); //NON-NLS - - document.addContent(gpsExifMetadataFolder); - document.addContent(gpsBookmarksFolder); - document.addContent(gpsLastKnownLocationFolder); - document.addContent(gpsRouteFolder); - document.addContent(gpsSearchesFolder); - document.addContent(gpsTrackpointsFolder); + Document kmlDocument = setupReportDocument(); ReportProgressPanel.ReportStatus result = ReportProgressPanel.ReportStatus.COMPLETE; - - /** - * In the following code, nulls are okay, and are handled when we go to - * write out the KML feature. Nulls are expected to be returned from any - * method where the artifact is not found and is handled in the - * individual feature creation methods. This is done because we don't - * know beforehand which attributes will be included for which artifact, - * as anyone could write a module that adds additional attributes to an - * artifact. - * - * If there are any issues reading the database getting artifacts and - * attributes, or any exceptions thrown during this process, a severe - * error is logged, the report is marked as "Incomplete KML Report", and - * we use a best-effort method to generate KML information on everything - * we can successfully pull out of the database. - */ - try { - for (BlackboardArtifact artifact : skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF)) { - String fileName = ""; - long fileId = 0; - try { - Long timestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); - String desc = getDescriptionFromArtifact(artifact, "EXIF Metadata With Locations"); //NON-NLS - Double lat = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - Double lon = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - Element point = makePoint(lat, lon, getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); - - if (lat != null && lat != 0.0 && lon != null && lon != 0.0) { - AbstractFile abstractFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); - fileName = abstractFile.getName(); - fileId = abstractFile.getId(); - Path path; - copyFileUsingStream(abstractFile, Paths.get(baseReportDir, abstractFile.getName()).toFile()); - try { - path = Paths.get(removeLeadingImgAndVol(abstractFile.getUniquePath())); - } catch (TskCoreException ex) { - path = Paths.get(abstractFile.getParentPath(), abstractFile.getName()); - } - String formattedCoordinates = String.format("%.2f, %.2f", lat, lon); - if (path == null) { - path = Paths.get(abstractFile.getName()); - } - gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, desc, timestamp, point, path, formattedCoordinates)); - } - } catch (ReadContentInputStreamException ex) { - logger.log(Level.WARNING, String.format("Error reading file '%s' (id=%d).", fileName, fileId), ex); - } catch (Exception ex) { - errorMessage = Bundle.KMLReport_unableToExtractPhotos(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - } - } catch (TskCoreException ex) { - errorMessage = Bundle.KMLReport_exifPhotoError(); + + try { + makeRoutes(skCase); + addLocationsToReport(skCase, baseReportDir); + } catch(TskCoreException | IOException ex) { + errorMessage = "Failed to complete report."; logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS result = ReportProgressPanel.ReportStatus.ERROR; - } - - try { - for (BlackboardArtifact artifact : skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK)) { - try { - Long timestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - String desc = getDescriptionFromArtifact(artifact, "GPS Bookmark"); //NON-NLS - Double lat = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - Double lon = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - Element point = makePoint(lat, lon, getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); - String bookmarkName = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - String formattedCoordinates = String.format("%.2f, %.2f", lat, lon); - gpsBookmarksFolder.addContent(makePlacemark(bookmarkName, FeatureColor.BLUE, desc, timestamp, point, formattedCoordinates)); - } catch (Exception ex) { - errorMessage = Bundle.KMLReport_bookmarkError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - } - } catch (TskCoreException ex) { - errorMessage = Bundle.KMLReport_gpsBookmarkError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - - try { - for (BlackboardArtifact artifact : skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION)) { - try { - Long timestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - String desc = getDescriptionFromArtifact(artifact, "GPS Last Known Location"); //NON-NLS - Double lat = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - Double lon = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - Double alt = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); - Element point = makePoint(lat, lon, alt); - String formattedCoordinates = String.format("%.2f, %.2f", lat, lon); - gpsLastKnownLocationFolder.addContent(makePlacemark("Last Known Location", FeatureColor.PURPLE, desc, timestamp, point, formattedCoordinates)); //NON-NLS - } catch (Exception ex) { - errorMessage = Bundle.KMLReport_locationError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - } - } catch (TskCoreException ex) { - errorMessage = Bundle.KMLReport_locationDatabaseError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - - try { - for (BlackboardArtifact artifact : skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE)) { - try { - Long timestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - String desc = getDescriptionFromArtifact(artifact, "GPS Route"); - Double latitudeStart = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START); - Double longitudeStart = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START); - Double latitudeEnd = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END); - Double longitudeEnd = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END); - Double altitude = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); - - Element route = makeLineString(latitudeStart, longitudeStart, altitude, latitudeEnd, longitudeEnd, altitude); - Element startingPoint = makePoint(latitudeStart, longitudeStart, altitude); - Element endingPoint = makePoint(latitudeEnd, longitudeEnd, altitude); - - String formattedCoordinates = String.format("%.2f, %.2f to %.2f, %.2f", latitudeStart, longitudeStart, latitudeEnd, longitudeEnd); - gpsRouteFolder.addContent(makePlacemark("As-the-crow-flies Route", FeatureColor.GREEN, desc, timestamp, route, formattedCoordinates)); //NON-NLS - - formattedCoordinates = String.format("%.2f, %.2f", latitudeStart, longitudeStart); - gpsRouteFolder.addContent(makePlacemark("Start", FeatureColor.GREEN, desc, timestamp, startingPoint, formattedCoordinates)); //NON-NLS - - formattedCoordinates = String.format("%.2f, %.2f", latitudeEnd, longitudeEnd); - gpsRouteFolder.addContent(makePlacemark("End", FeatureColor.GREEN, desc, timestamp, endingPoint, formattedCoordinates)); //NON-NLS - } catch (Exception ex) { - errorMessage = Bundle.KMLReport_gpsRouteError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - } - } catch (TskCoreException ex) { - errorMessage = Bundle.KMLReport_gpsRouteDatabaseError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - - try { - for (BlackboardArtifact artifact : skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH)) { - Long timestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - String desc = getDescriptionFromArtifact(artifact, "GPS Search"); //NON-NLS - Double lat = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - Double lon = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - Double alt = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); - Element point = makePoint(lat, lon, alt); - String formattedCoordinates = String.format("%.2f, %.2f", lat, lon); - String searchName = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - if (searchName == null || searchName.isEmpty()) { - searchName = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); - } - if (searchName == null || searchName.isEmpty()) { - searchName = "GPS Search"; - } - gpsSearchesFolder.addContent(makePlacemark(searchName, FeatureColor.WHITE, desc, timestamp, point, formattedCoordinates)); //NON-NLS - } - } catch (TskCoreException ex) { - errorMessage = Bundle.KMLReport_gpsSearchDatabaseError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - - try { - for (BlackboardArtifact artifact : skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)) { - try { - Long timestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - String desc = getDescriptionFromArtifact(artifact, "GPS Trackpoint"); //NON-NLS - Double lat = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - Double lon = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - Double alt = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); - Element point = makePoint(lat, lon, alt); - String formattedCoordinates = String.format("%.2f, %.2f, %.2f", lat, lon, alt); - String trackName = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - if (trackName == null || trackName.isEmpty()) { - trackName = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); - } - if (trackName == null || trackName.isEmpty()) { - trackName = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); - } - if (trackName == null || trackName.isEmpty()) { - trackName = "GPS Trackpoint"; - } - gpsTrackpointsFolder.addContent(makePlacemark(trackName, FeatureColor.YELLOW, desc, timestamp, point, formattedCoordinates)); - } catch (Exception ex) { - errorMessage = Bundle.KMLReport_trackpointError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } - } - } catch (TskCoreException ex) { - errorMessage = Bundle.KMLReport_trackpointDatabaseError(); - logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS - result = ReportProgressPanel.ReportStatus.ERROR; - } + } // Copy the style sheet try { @@ -440,242 +200,170 @@ class KMLReport implements GeneralReportModule { progressPanel.complete(result, errorMessage); } + + + private Document setupReportDocument() { + ns = Namespace.getNamespace("", "http://www.opengis.net/kml/2.2"); //NON-NLS - /** - * Get a Double from an artifact if it exists, return null otherwise. - * - * @param artifact The artifact to query - * @param type The attribute type we're looking for - * - * @return The Double if it exists, or null if not - */ - private Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { - Double returnValue = null; - try { - BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); - if (bba != null) { - Double value = bba.getValueDouble(); - returnValue = value; - } - } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Error getting Double value: " + type.toString(), ex); //NON-NLS + Element kml = new Element("kml", ns); //NON-NLS + kml.addNamespaceDeclaration(Namespace.getNamespace("gx", "http://www.google.com/kml/ext/2.2")); //NON-NLS + kml.addNamespaceDeclaration(Namespace.getNamespace("kml", "http://www.opengis.net/kml/2.2")); //NON-NLS + kml.addNamespaceDeclaration(Namespace.getNamespace("atom", "http://www.w3.org/2005/Atom")); //NON-NLS + Document kmlDocument = new Document(kml); + + Element document = new Element("Document", ns); //NON-NLS + kml.addContent(document); + + Element name = new Element("name", ns); //NON-NLS + ReportBranding rb = new ReportBranding(); + name.setText(rb.getReportTitle() + " KML"); //NON-NLS + document.addContent(name); + + // Check if ingest has finished + if (IngestManager.getInstance().isIngestRunning()) { + Element ingestwarning = new Element("snippet", ns); //NON-NLS + ingestwarning.addContent(NbBundle.getMessage(this.getClass(), "ReportBodyFile.ingestWarning.text")); //NON-NLS + document.addContent(ingestwarning); } - return returnValue; - } - /** - * Get a Long from an artifact if it exists, return null otherwise. - * - * @param artifact The artifact to query - * @param type The attribute type we're looking for - * - * @return The Long if it exists, or null if not - */ - private Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { - Long returnValue = null; - try { - BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); - if (bba != null) { - Long value = bba.getValueLong(); - returnValue = value; - } - } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Error getting Long value: " + type.toString(), ex); //NON-NLS + // Create folder structure + gpsExifMetadataFolder = new Element("Folder", ns); //NON-NLS + CDATA cdataExifMetadataFolder = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/camera-icon-16.png"); //NON-NLS + Element hrefExifMetadata = new Element("href", ns).addContent(cdataExifMetadataFolder); //NON-NLS + gpsExifMetadataFolder.addContent(new Element("Icon", ns).addContent(hrefExifMetadata)); //NON-NLS + + gpsBookmarksFolder = new Element("Folder", ns); //NON-NLS + CDATA cdataBookmarks = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gpsfav.png"); //NON-NLS + Element hrefBookmarks = new Element("href", ns).addContent(cdataBookmarks); //NON-NLS + gpsBookmarksFolder.addContent(new Element("Icon", ns).addContent(hrefBookmarks)); //NON-NLS + + gpsLastKnownLocationFolder = new Element("Folder", ns); //NON-NLS + CDATA cdataLastKnownLocation = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gps-lastlocation.png"); //NON-NLS + Element hrefLastKnownLocation = new Element("href", ns).addContent(cdataLastKnownLocation); //NON-NLS + gpsLastKnownLocationFolder.addContent(new Element("Icon", ns).addContent(hrefLastKnownLocation)); //NON-NLS + + gpsRouteFolder = new Element("Folder", ns); //NON-NLS + CDATA cdataRoute = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gps-trackpoint.png"); //NON-NLS + Element hrefRoute = new Element("href", ns).addContent(cdataRoute); //NON-NLS + gpsRouteFolder.addContent(new Element("Icon", ns).addContent(hrefRoute)); //NON-NLS + + gpsSearchesFolder = new Element("Folder", ns); //NON-NLS + CDATA cdataSearches = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gps-search.png"); //NON-NLS + Element hrefSearches = new Element("href", ns).addContent(cdataSearches); //NON-NLS + gpsSearchesFolder.addContent(new Element("Icon", ns).addContent(hrefSearches)); //NON-NLS + + gpsTrackpointsFolder = new Element("Folder", ns); //NON-NLS + CDATA cdataTrackpoints = new CDATA("https://raw.githubusercontent.com/sleuthkit/autopsy/develop/Core/src/org/sleuthkit/autopsy/images/gps-trackpoint.png"); //NON-NLS + Element hrefTrackpoints = new Element("href", ns).addContent(cdataTrackpoints); //NON-NLS + gpsTrackpointsFolder.addContent(new Element("Icon", ns).addContent(hrefTrackpoints)); //NON-NLS + + gpsExifMetadataFolder.addContent(new Element("name", ns).addContent("EXIF Metadata")); //NON-NLS + gpsBookmarksFolder.addContent(new Element("name", ns).addContent("GPS Bookmarks")); //NON-NLS + gpsLastKnownLocationFolder.addContent(new Element("name", ns).addContent("GPS Last Known Location")); //NON-NLS + gpsRouteFolder.addContent(new Element("name", ns).addContent("GPS Routes")); //NON-NLS + gpsSearchesFolder.addContent(new Element("name", ns).addContent("GPS Searches")); //NON-NLS + gpsTrackpointsFolder.addContent(new Element("name", ns).addContent("GPS Trackpoints")); //NON-NLS + + document.addContent(gpsExifMetadataFolder); + document.addContent(gpsBookmarksFolder); + document.addContent(gpsLastKnownLocationFolder); + document.addContent(gpsRouteFolder); + document.addContent(gpsSearchesFolder); + document.addContent(gpsTrackpointsFolder); + + return kmlDocument; + } + + + void addExifMetadataContent(EXIFMetadataPoint location, String baseReportDirectory) throws IOException{ + Element point = makePoint(location); + if(point == null) { + return; } - return returnValue; - } + + AbstractFile abstractFile = location.getImage(); + String details = "

EXIF Metadata With Locations

" + location.getDetails(); - /** - * Get an Integer from an artifact if it exists, return null otherwise. - * - * @param artifact The artifact to query - * @param type The attribute type we're looking for - * - * @return The Integer if it exists, or null if not - */ - private Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { - Integer returnValue = null; + Path path; + copyFileUsingStream(abstractFile, Paths.get(baseReportDirectory, abstractFile.getName()).toFile()); try { - BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); - if (bba != null) { - Integer value = bba.getValueInt(); - returnValue = value; - } + path = Paths.get(removeLeadingImgAndVol(abstractFile.getUniquePath())); } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Error getting Integer value: " + type.toString(), ex); //NON-NLS + path = Paths.get(abstractFile.getParentPath(), abstractFile.getName()); } - return returnValue; + if (path == null) { + path = Paths.get(abstractFile.getName()); + } + + gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, location.getTimestamp(), point, path, location.getFormattedCoordinates())); } + + void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws TskCoreException, IOException { + List points = GeolocationManager.getPoints(skCase, false); - /** - * Get a String from an artifact if it exists, return null otherwise. - * - * @param artifact The artifact to query - * @param type The attribute type we're looking for - * - * @return The String if it exists, or null if not - */ - private String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE type) { - String returnValue = null; - try { - BlackboardAttribute bba = artifact.getAttribute(new BlackboardAttribute.Type(type)); - if (bba != null) { - String value = bba.getValueString(); - if (value != null && !value.isEmpty()) { - returnValue = value; + for (BlackboardArtifactPoint point : points) { + Element reportPoint = makePoint(point); + if (reportPoint == null) { + continue; + } + if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) { + addExifMetadataContent((EXIFMetadataPoint) point, baseReportDir); + + } else if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK.getTypeID()) { + gpsBookmarksFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.BLUE, point.getDetails(), point.getTimestamp(), reportPoint, point.getFormattedCoordinates())); + } else if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID()) { + gpsLastKnownLocationFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.PURPLE, point.getDetails(), point.getTimestamp(), reportPoint, point.getFormattedCoordinates())); + } else if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID()) { + gpsSearchesFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, point.getDetails(), point.getTimestamp(), reportPoint, point.getFormattedCoordinates())); + } else if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()) { + gpsTrackpointsFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, point.getDetails(), point.getTimestamp(), reportPoint, point.getFormattedCoordinates())); + } + } + } + + void makeRoutes(SleuthkitCase skCase) throws TskCoreException { + List routes = GeolocationManager.getGPSRoutes(skCase); + + if (routes != null) { + for (Route route : routes) { + List routePoints = route.getRoute(); + BlackboardArtifactPoint start = null; + BlackboardArtifactPoint end = null; + // This is hardcoded knowledge that there is only two points + // a start and end. In the long run it would be nice to + // support the idea of a route with multiple points. The Route + // class supports that idea. Would be nice to figure out how to support + // for report. + if (routePoints != null && routePoints.size() > 1) { + start = routePoints.get(0); + end = routePoints.get(1); } + + if (start == null || end == null) { + continue; + } + + Element reportRoute = makeLineString(start.getLatitude(), start.getLongitude(), start.getAltitude(), end.getLatitude(), end.getLongitude(), end.getAltitude()); + Element startingPoint = makePoint(start.getLatitude(), start.getLongitude(), start.getAltitude()); + Element endingPoint = makePoint(end.getLatitude(), end.getLongitude(), end.getAltitude()); + + String formattedCoordinates = String.format("%s to %s", start.getFormattedCoordinates(), end.getFormattedCoordinates()); + + gpsRouteFolder.addContent(makePlacemark("As-the-crow-flies Route", FeatureColor.GREEN, route.getDetails(), route.getTimestamp(), reportRoute, formattedCoordinates)); //NON-NLS + gpsRouteFolder.addContent(makePlacemark(start.getLabel(), FeatureColor.GREEN, start.getDetails(), start.getTimestamp(), startingPoint, start.getFormattedCoordinates())); //NON-NLS + gpsRouteFolder.addContent(makePlacemark(end.getLabel(), FeatureColor.GREEN, end.getDetails(), end.getTimestamp(), endingPoint, end.getFormattedCoordinates())); //NON-NLS } - } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Error getting String value: " + type.toString(), ex); //NON-NLS } - return returnValue; } - /** - * This method creates a text description for a map feature using all the - * geospatial and time data we can for the Artifact. It queries the - * following attributes: - * - * TSK_GEO_LATITUDE 54; TSK_GEO_LONGITUDE 55; TSK_GEO_LATITUDE_START 98; - * TSK_GEO_LATITUDE_END 99; TSK_GEO_LONGITUDE_START 100; - * TSK_GEO_LONGITUDE_END 101; TSK_GEO_VELOCITY 56; TSK_GEO_ALTITUDE 57; - * TSK_GEO_BEARING 58; TSK_GEO_HPRECISION 59; TSK_GEO_VPRECISION 60; - * TSK_GEO_MAPDATUM 61; TSK_DATETIME_START 83; TSK_DATETIME_END 84; - * TSK_LOCATION 86; TSK_PATH_SOURCE 94; - * - * @param artifact the artifact to query. - * @param featureType the type of Artifact we're working on. - * - * @return a String with the information we have available - */ - private String getDescriptionFromArtifact(BlackboardArtifact artifact, String featureType) { - StringBuilder result = new StringBuilder("

" + featureType + "

"); //NON-NLS - - String name = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - if (name != null && !name.isEmpty()) { - result.append("Name: ").append(name).append(SEP); //NON-NLS - } - - String location = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); - if (location != null && !location.isEmpty()) { - result.append("Location: ").append(location).append(SEP); //NON-NLS - } - - Long timestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - if (timestamp != null) { - result.append("Timestamp: ").append(getTimeStamp(timestamp)).append(SEP); //NON-NLS - result.append("Unix timestamp: ").append(timestamp).append(SEP); //NON-NLS - } - - Long startingTimestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START); - if (startingTimestamp != null) { - result.append("Starting Timestamp: ").append(getTimeStamp(startingTimestamp)).append(SEP); //NON-NLS - result.append("Starting Unix timestamp: ").append(startingTimestamp).append(SEP); //NON-NLS - } - - Long endingTimestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END); - if (endingTimestamp != null) { - result.append("Ending Timestamp: ").append(getTimeStamp(endingTimestamp)).append(SEP); //NON-NLS - result.append("Ending Unix timestamp: ").append(endingTimestamp).append(SEP); //NON-NLS - } - - Long createdTimestamp = getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); - if (createdTimestamp != null) { - result.append("Created Timestamp: ").append(getTimeStamp(createdTimestamp)).append(SEP); //NON-NLS - result.append("Created Unix timestamp: ").append(createdTimestamp).append(SEP); //NON-NLS - } - - Double latitude = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - if (latitude != null) { - result.append("Latitude: ").append(latitude).append(SEP); //NON-NLS - } - - Double longitude = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - if (longitude != null) { - result.append("Longitude: ").append(longitude).append(SEP); //NON-NLS - } - - Double latitudeStart = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START); - if (latitudeStart != null) { - result.append("Latitude Start: ").append(latitudeStart).append(SEP); //NON-NLS - } - - Double longitudeStart = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START); - if (longitudeStart != null) { - result.append("Longitude Start: ").append(longitudeStart).append(SEP); //NON-NLS - } - - Double latitudeEnd = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END); - if (latitudeEnd != null) { - result.append("Latitude End: ").append(latitudeEnd).append(SEP); //NON-NLS - } - - Double longitudeEnd = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END); - if (longitudeEnd != null) { - result.append("Longitude End: ").append(longitudeEnd).append(SEP); //NON-NLS - } - - Double velocity = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VELOCITY); - if (velocity != null) { - result.append("Velocity: ").append(velocity).append(SEP); //NON-NLS - } - - Double altitude = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); - if (altitude != null) { - result.append("Altitude: ").append(altitude).append(SEP); //NON-NLS - } - - Double bearing = getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_BEARING); - if (bearing != null) { - result.append("Bearing: ").append(bearing).append(SEP); //NON-NLS - } - - Integer hPrecision = getInteger(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_HPRECISION); - if (hPrecision != null) { - result.append("Horizontal Precision Figure of Merit: ").append(hPrecision).append(SEP); //NON-NLS - } - - Integer vPrecision = getInteger(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VPRECISION); - if (vPrecision != null) { - result.append("Vertical Precision Figure of Merit: ").append(vPrecision).append(SEP); //NON-NLS - } - - String mapDatum = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_MAPDATUM); - if (mapDatum != null && !mapDatum.isEmpty()) { - result.append("Map Datum: ").append(mapDatum).append(SEP); //NON-NLS - } - - String programName = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); - if (programName != null && !programName.isEmpty()) { - result.append("Reported by: ").append(programName).append(SEP); //NON-NLS - } - - String flag = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); - if (flag != null && !flag.isEmpty()) { - result.append("Flag: ").append(flag).append(SEP); //NON-NLS - } - - String pathSource = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_SOURCE); - if (pathSource != null && !pathSource.isEmpty()) { - result.append("Source: ").append(pathSource).append(SEP); //NON-NLS - } - - String deviceMake = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MAKE); - if (deviceMake != null && !deviceMake.isEmpty()) { - result.append("Device Make: ").append(deviceMake).append(SEP); //NON-NLS - } - - String deviceModel = getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MODEL); - if (deviceModel != null && !deviceModel.isEmpty()) { - result.append("Device Model: ").append(deviceModel).append(SEP); //NON-NLS - } - - return result.toString(); - } private String getTimeStamp(long timeStamp) { return kmlDateFormat.format(new java.util.Date(timeStamp * 1000)); } + + private Element makePoint(BlackboardArtifactPoint location) { + return makePoint(location.getLatitude(), location.getLongitude(), location.getAltitude()); + } /** * Create a Point for use in a Placemark. Note in this method altitude is @@ -691,12 +379,10 @@ class KMLReport implements GeneralReportModule { * @return the Point as an Element */ private Element makePoint(Double latitude, Double longitude, Double altitude) { - if (latitude == null) { - latitude = 0.0; - } - if (longitude == null) { - longitude = 0.0; + if (latitude == null || longitude == null) { + return null; } + if (altitude == null) { altitude = 0.0; } From ba9e8c2b8ac179951b648d6cbb4c9fb3fd76c03d Mon Sep 17 00:00:00 2001 From: Eammon Date: Wed, 16 Oct 2019 16:42:33 -0400 Subject: [PATCH 11/91] Workarounds to ensure that dialogs are not hidden on macOS. --- .../casemodule/CaseInformationPanel.java | 2 ++ .../autopsy/casemodule/CaseOpenAction.java | 17 +++++++++++++++-- .../autopsy/casemodule/CueBannerPanel.java | 2 ++ .../autopsy/casemodule/NewCaseWizardAction.java | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.java index a6494fe22b..76b56138d7 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseInformationPanel.java @@ -162,6 +162,8 @@ class CaseInformationPanel extends javax.swing.JPanel { editCasePropertiesDialog.setResizable(true); editCasePropertiesDialog.pack(); editCasePropertiesDialog.setLocationRelativeTo(this); + // Workaround to ensure dialog is not hidden on macOS + editCasePropertiesDialog.setAlwaysOnTop(true); editCasePropertiesDialog.setVisible(true); editCasePropertiesDialog.toFront(); caseDetailsPanel.updateCaseInfo(); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseOpenAction.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseOpenAction.java index cc07148ba0..b68d1a49f6 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseOpenAction.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseOpenAction.java @@ -84,10 +84,16 @@ public final class CaseOpenAction extends CallableSystemAction implements Action fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); fileChooser.setFileFilter(caseMetadataFileFilter); + if (null != ModuleSettings.getConfigSetting(ModuleSettings.MAIN_SETTINGS, PROP_BASECASE)) { fileChooser.setCurrentDirectory(new File(ModuleSettings.getConfigSetting("Case", PROP_BASECASE))); //NON-NLS } - + + /** + * If the open multi user case dialog is open make sure it's not set + * to always be on top as this hides the file chooser on macOS. + */ + OpenMultiUserCaseDialog.getInstance().setAlwaysOnTop(false); String optionsDlgTitle = NbBundle.getMessage(Case.class, "CloseCaseWhileIngesting.Warning.title"); String optionsDlgMessage = NbBundle.getMessage(Case.class, "CloseCaseWhileIngesting.Warning"); if (IngestRunningCheck.checkAndConfirmProceed(optionsDlgTitle, optionsDlgMessage)) { @@ -95,7 +101,12 @@ public final class CaseOpenAction extends CallableSystemAction implements Action * Pop up a file chooser to allow the user to select a case metadata * file (.aut file). */ - int retval = fileChooser.showOpenDialog(WindowManager.getDefault().getMainWindow()); + /** + * Passing the fileChooser as its own parent gets around an issue + * where the fileChooser was hidden behind the CueBannerPanel ("Welcome" dialog) + * on macOS. + */ + int retval = fileChooser.showOpenDialog(fileChooser); if (retval == JFileChooser.APPROVE_OPTION) { /* * Close the startup window, if it is open. @@ -159,6 +170,8 @@ public final class CaseOpenAction extends CallableSystemAction implements Action OpenMultiUserCaseDialog multiUserCaseWindow = OpenMultiUserCaseDialog.getInstance(); multiUserCaseWindow.setLocationRelativeTo(WindowManager.getDefault().getMainWindow()); + // Workaround to ensure that dialog is not hidden on macOS. + multiUserCaseWindow.setAlwaysOnTop(true); multiUserCaseWindow.setVisible(true); WindowManager.getDefault().getMainWindow().setCursor(null); diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.java index 3ddb97fcfd..37c6c7c8b8 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CueBannerPanel.java @@ -249,6 +249,8 @@ public class CueBannerPanel extends javax.swing.JPanel { private void openRecentCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openRecentCaseButtonActionPerformed recentCasesWindow.setLocationRelativeTo(this); OpenRecentCasePanel.getInstance(); //refreshes the recent cases table + // Workaround to ensure that dialog is not hidden on macOS. + recentCasesWindow.setAlwaysOnTop(true); recentCasesWindow.setVisible(true); }//GEN-LAST:event_openRecentCaseButtonActionPerformed diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java index 50688b1ac1..c5e6ece78d 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/NewCaseWizardAction.java @@ -71,6 +71,8 @@ final class NewCaseWizardAction extends CallableSystemAction { wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); wizardDescriptor.setTitle(NbBundle.getMessage(this.getClass(), "NewCaseWizardAction.newCase.windowTitle.text")); Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor); + // Workaround to ensure new case dialog is not hidden on macOS + dialog.setAlwaysOnTop(true); dialog.setVisible(true); dialog.toFront(); if (wizardDescriptor.getValue() == WizardDescriptor.FINISH_OPTION) { From f73eb23ad966d49d42e87f9030e369243f5ed1e8 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Wed, 16 Oct 2019 23:18:24 -0400 Subject: [PATCH 12/91] Update ThunderbirdMboxFileIngestModule.java Check threaded messageId if null and skip it if it is. Format code also. --- .../ThunderbirdMboxFileIngestModule.java | 161 +++++++++--------- 1 file changed, 81 insertions(+), 80 deletions(-) diff --git a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java index 5c42269a8a..b27f045398 100644 --- a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java +++ b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java @@ -65,12 +65,13 @@ import org.sleuthkit.datamodel.TskException; * structure and metadata. */ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { + private static final Logger logger = Logger.getLogger(ThunderbirdMboxFileIngestModule.class.getName()); private final IngestServices services = IngestServices.getInstance(); private FileManager fileManager; private IngestJobContext context; private Blackboard blackboard; - + private Case currentCase; /** @@ -80,7 +81,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } @Override - @Messages ({"ThunderbirdMboxFileIngestModule.noOpenCase.errMsg=Exception while getting open case."}) + @Messages({"ThunderbirdMboxFileIngestModule.noOpenCase.errMsg=Exception while getting open case."}) public void startUp(IngestJobContext context) throws IngestModuleException { this.context = context; try { @@ -103,8 +104,8 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } //skip unalloc - if ((abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) || - (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK))) { + if ((abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) + || (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK))) { return ProcessResult.OK; } @@ -115,7 +116,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { // check its signature boolean isMbox = false; boolean isEMLFile = false; - + try { byte[] t = new byte[64]; if (abstractFile.getSize() > 64) { @@ -132,7 +133,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { if (isMbox) { return processMBox(abstractFile); } - + if (isEMLFile) { return processEMLFile(abstractFile); } @@ -140,7 +141,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { if (PstParser.isPstFile(abstractFile)) { return processPst(abstractFile); } - + if (VcardParser.isVcardFile(abstractFile)) { return processVcard(abstractFile); } @@ -160,7 +161,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { String fileName; try { fileName = getTempPath() + File.separator + abstractFile.getName() - + "-" + String.valueOf(abstractFile.getId()); + + "-" + String.valueOf(abstractFile.getId()); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS return ProcessResult.ERROR; @@ -188,11 +189,11 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { PstParser parser = new PstParser(services); PstParser.ParseResult result = parser.open(file, abstractFile.getId()); - switch( result) { + switch (result) { case OK: Iterator pstMsgIterator = parser.getEmailMessageIterator(); if (pstMsgIterator != null) { - processEmails(parser.getPartialEmailMessages(), pstMsgIterator , abstractFile); + processEmails(parser.getPartialEmailMessages(), pstMsgIterator, abstractFile); } else { // sometimes parser returns ParseResult=OK but there are no messages postErrorMessage( @@ -273,7 +274,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { String fileName; try { fileName = getTempPath() + File.separator + abstractFile.getName() - + "-" + String.valueOf(abstractFile.getId()); + + "-" + String.valueOf(abstractFile.getId()); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS return ProcessResult.ERROR; @@ -298,16 +299,16 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { return ProcessResult.OK; } - MboxParser emailIterator = MboxParser.getEmailIterator( emailFolder, file, abstractFile.getId()); + MboxParser emailIterator = MboxParser.getEmailIterator(emailFolder, file, abstractFile.getId()); List emails = new ArrayList<>(); - if(emailIterator != null) { - while(emailIterator.hasNext()) { + if (emailIterator != null) { + while (emailIterator.hasNext()) { EmailMessage emailMessage = emailIterator.next(); - if(emailMessage != null) { + if (emailMessage != null) { emails.add(emailMessage); } } - + String errors = emailIterator.getErrors(); if (!errors.isEmpty()) { postErrorMessage( @@ -315,7 +316,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { abstractFile.getName()), errors); } } - processEmails(emails, MboxParser.getEmailIterator( emailFolder, file, abstractFile.getId()), abstractFile); + processEmails(emails, MboxParser.getEmailIterator(emailFolder, file, abstractFile.getId()), abstractFile); if (file.delete() == false) { logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName()); //NON-NLS @@ -323,7 +324,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { return ProcessResult.OK; } - + /** * Parse and extract data from a vCard file. * @@ -347,8 +348,8 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } return ProcessResult.OK; } - - private ProcessResult processEMLFile(AbstractFile abstractFile) { + + private ProcessResult processEMLFile(AbstractFile abstractFile) { try { EmailMessage message = EMLParser.parse(abstractFile); @@ -400,7 +401,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { /** * Get a module output folder. - * + * * @throws NoCurrentCaseException if there is no open case. * * @return the module output folder @@ -435,38 +436,40 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { * @param abstractFile */ private void processEmails(List partialEmailsForThreading, Iterator fullMessageIterator, AbstractFile abstractFile) { - + // Putting try/catch around this to catch any exception and still allow // the creation of the artifacts to continue. - try{ + try { EmailMessageThreader.threadMessages(partialEmailsForThreading); - } catch(Exception ex) { + } catch (Exception ex) { logger.log(Level.WARNING, String.format("Exception thrown parsing emails from %s", abstractFile.getName()), ex); } - + List derivedFiles = new ArrayList<>(); int msgCnt = 0; - while(fullMessageIterator.hasNext()) { + while (fullMessageIterator.hasNext()) { EmailMessage current = fullMessageIterator.next(); - - if(current == null) { + + if (current == null) { continue; } - if(partialEmailsForThreading.size() > msgCnt) { + if (partialEmailsForThreading.size() > msgCnt) { EmailMessage threaded = partialEmailsForThreading.get(msgCnt++); - - if(threaded.getMessageID().equals(current.getMessageID()) && - threaded.getSubject().equals(current.getSubject())) { - current.setMessageThreadID(threaded.getMessageThreadID()); + + if (threaded.getMessageID() != null) { + if (threaded.getMessageID().equals(current.getMessageID()) + && threaded.getSubject().equals(current.getSubject())) { + current.setMessageThreadID(threaded.getMessageThreadID()); + } } } - + BlackboardArtifact msgArtifact = addEmailArtifact(current, abstractFile); - - if ((msgArtifact != null) && (current.hasAttachment())) { - derivedFiles.addAll(handleAttachments(current.getAttachments(), abstractFile, msgArtifact )); + + if ((msgArtifact != null) && (current.hasAttachment())) { + derivedFiles.addAll(handleAttachments(current.getAttachments(), abstractFile, msgArtifact)); } } @@ -477,6 +480,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } context.addFilesToJob(derivedFiles); } + /** * Add the given attachments as derived files and reschedule them for * ingest. @@ -517,29 +521,30 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } /** - * Finds and returns a set of unique email addresses found in the input string + * Finds and returns a set of unique email addresses found in the input + * string * * @param input - input string, like the To/CC line from an email header - * + * * @return Set: set of email addresses found in the input string */ private Set findEmailAddresess(String input) { Pattern p = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", - Pattern.CASE_INSENSITIVE); + Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(input); Set emailAddresses = new HashSet<>(); while (m.find()) { - emailAddresses.add( m.group()); + emailAddresses.add(m.group()); } return emailAddresses; } - + /** * Add a blackboard artifact for the given e-mail message. * * @param email The e-mail message. * @param abstractFile The associated file. - * + * * @return The generated e-mail message artifact. */ @Messages({"ThunderbirdMboxFileIngestModule.addArtifact.indexError.message=Failed to index email message detected artifact for keyword search."}) @@ -563,73 +568,69 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { List senderAddressList = new ArrayList<>(); String senderAddress; senderAddressList.addAll(findEmailAddresess(from)); - + AccountFileInstance senderAccountInstance = null; if (senderAddressList.size() == 1) { senderAddress = senderAddressList.get(0); try { senderAccountInstance = currentCase.getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.EMAIL, senderAddress, EmailParserModuleFactory.getModuleName(), abstractFile); + } catch (TskCoreException ex) { + logger.log(Level.WARNING, "Failed to create account for email address " + senderAddress, ex); //NON-NLS } - catch(TskCoreException ex) { - logger.log(Level.WARNING, "Failed to create account for email address " + senderAddress, ex); //NON-NLS - } + } else { + logger.log(Level.WARNING, "Failed to find sender address, from = {0}", from); //NON-NLS } - else { - logger.log(Level.WARNING, "Failed to find sender address, from = {0}", from); //NON-NLS - } - + List recipientAddresses = new ArrayList<>(); recipientAddresses.addAll(findEmailAddresess(to)); recipientAddresses.addAll(findEmailAddresess(cc)); recipientAddresses.addAll(findEmailAddresess(bcc)); - + List recipientAccountInstances = new ArrayList<>(); recipientAddresses.forEach((addr) -> { try { - AccountFileInstance recipientAccountInstance = - currentCase.getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.EMAIL, addr, - EmailParserModuleFactory.getModuleName(), abstractFile); + AccountFileInstance recipientAccountInstance + = currentCase.getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.EMAIL, addr, + EmailParserModuleFactory.getModuleName(), abstractFile); recipientAccountInstances.add(recipientAccountInstance); - } - catch(TskCoreException ex) { + } catch (TskCoreException ex) { logger.log(Level.WARNING, "Failed to create account for email address " + addr, ex); //NON-NLS } }); - + addArtifactAttribute(headers, ATTRIBUTE_TYPE.TSK_HEADERS, bbattributes); addArtifactAttribute(from, ATTRIBUTE_TYPE.TSK_EMAIL_FROM, bbattributes); addArtifactAttribute(to, ATTRIBUTE_TYPE.TSK_EMAIL_TO, bbattributes); addArtifactAttribute(subject, ATTRIBUTE_TYPE.TSK_SUBJECT, bbattributes); - + addArtifactAttribute(dateL, ATTRIBUTE_TYPE.TSK_DATETIME_RCVD, bbattributes); addArtifactAttribute(dateL, ATTRIBUTE_TYPE.TSK_DATETIME_SENT, bbattributes); - + addArtifactAttribute(body, ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN, bbattributes); - - addArtifactAttribute(((id < 0L) ? NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.notAvail") : String.valueOf(id)), + + addArtifactAttribute(((id < 0L) ? NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.notAvail") : String.valueOf(id)), ATTRIBUTE_TYPE.TSK_MSG_ID, bbattributes); - - addArtifactAttribute(((localPath.isEmpty() == false) ? localPath : ""), + + addArtifactAttribute(((localPath.isEmpty() == false) ? localPath : ""), ATTRIBUTE_TYPE.TSK_PATH, bbattributes); - + addArtifactAttribute(cc, ATTRIBUTE_TYPE.TSK_EMAIL_CC, bbattributes); addArtifactAttribute(bodyHTML, ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML, bbattributes); addArtifactAttribute(rtf, ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF, bbattributes); addArtifactAttribute(threadID, ATTRIBUTE_TYPE.TSK_THREAD_ID, bbattributes); - - + try { - + bbart = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG); bbart.addAttributes(bbattributes); // Add account relationships - currentCase.getSleuthkitCase().getCommunicationsManager().addRelationships(senderAccountInstance, recipientAccountInstances, bbart,Relationship.Type.MESSAGE, dateL); - + currentCase.getSleuthkitCase().getCommunicationsManager().addRelationships(senderAccountInstance, recipientAccountInstances, bbart, Relationship.Type.MESSAGE, dateL); + try { // index the artifact for keyword search - blackboard.postArtifact(bbart, EmailParserModuleFactory.getModuleName()); + blackboard.postArtifact(bbart, EmailParserModuleFactory.getModuleName()); } catch (Blackboard.BlackboardException ex) { logger.log(Level.SEVERE, "Unable to index blackboard artifact " + bbart.getArtifactID(), ex); //NON-NLS MessageNotifyUtil.Notify.error(Bundle.ThunderbirdMboxFileIngestModule_addArtifact_indexError_message(), bbart.getDisplayName()); @@ -640,11 +641,11 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { return bbart; } - + /** * Add an attribute of a specified type to a supplied Collection. - * - * @param stringVal The attribute value. + * + * @param stringVal The attribute value. * @param attrType The type of attribute to be added. * @param bbattributes The Collection to which the attribute will be added. */ @@ -656,7 +657,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { /** * Add an attribute of a specified type to a supplied Collection. - * + * * @param stringVal The attribute value. * @param attrType The type of attribute to be added. * @param bbattributes The Collection to which the attribute will be added. @@ -666,10 +667,10 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { bbattributes.add(new BlackboardAttribute(attrType, EmailParserModuleFactory.getModuleName(), stringVal)); } } - + /** * Add an attribute of a specified type to a supplied Collection. - * + * * @param longVal The attribute value. * @param attrType The type of attribute to be added. * @param bbattributes The Collection to which the attribute will be added. @@ -679,10 +680,10 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { bbattributes.add(new BlackboardAttribute(attrType, EmailParserModuleFactory.getModuleName(), longVal)); } } - + /** * Post an error message for the user. - * + * * @param subj The error subject. * @param details The error details. */ @@ -693,7 +694,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { /** * Get the IngestServices object. - * + * * @return The IngestServices object. */ IngestServices getServices() { From 9f3e258837e9826fb8e14cea95049dd93d01c9e7 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Thu, 17 Oct 2019 02:13:46 -0400 Subject: [PATCH 13/91] Update ThunderbirdMboxFileIngestModule.java Make codacy happy. --- .../thunderbirdparser/ThunderbirdMboxFileIngestModule.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java index b27f045398..91bf391e63 100644 --- a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java +++ b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java @@ -458,12 +458,11 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { if (partialEmailsForThreading.size() > msgCnt) { EmailMessage threaded = partialEmailsForThreading.get(msgCnt++); - if (threaded.getMessageID() != null) { - if (threaded.getMessageID().equals(current.getMessageID()) - && threaded.getSubject().equals(current.getSubject())) { + if ((threaded.getMessageID() != null) && + (threaded.getMessageID().equals(current.getMessageID()) + && threaded.getSubject().equals(current.getSubject()))) { current.setMessageThreadID(threaded.getMessageThreadID()); } - } } BlackboardArtifact msgArtifact = addEmailArtifact(current, abstractFile); From a1477dc45e5ee966c8b83c1c04472b4b81940c7a Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 17 Oct 2019 10:30:12 -0400 Subject: [PATCH 14/91] Updated the seek to be more accurate --- .../contentviewers/MediaPlayerPanel.java | 58 ++++++++++++++----- 1 file changed, 44 insertions(+), 14 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 1d02dfcd2b..b9a14df207 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -24,6 +24,7 @@ import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import java.util.Arrays; +import java.util.EnumSet; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; @@ -53,7 +54,10 @@ import org.sleuthkit.datamodel.TskData; import javafx.embed.swing.JFXPanel; import javax.swing.event.ChangeListener; import org.freedesktop.gstreamer.ClockTime; +import org.freedesktop.gstreamer.Format; import org.freedesktop.gstreamer.GstException; +import org.freedesktop.gstreamer.event.SeekFlags; +import org.freedesktop.gstreamer.event.SeekType; /** * This is a video player that is part of the Media View layered pane. It uses @@ -175,6 +179,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private Bus.ERROR errorListener; private Bus.STATE_CHANGED stateChangeListener; private Bus.EOS endOfStreamListener; + private double playBackRate; //Update progress bar and time label during video playback private final Timer timer = new Timer(75, new VideoPanelUpdater()); @@ -196,6 +201,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie progressSlider.setMinimum(0); progressSlider.setMaximum(PROGRESS_SLIDER_SIZE); progressSlider.setValue(0); + playBackRate = 1.0; //Manage the gstreamer video position when a user is dragging the slider in the panel. progressSlider.addChangeListener(new ChangeListener() { @Override @@ -203,11 +209,19 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie if (progressSlider.getValueIsAdjusting()) { long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); double relativePosition = progressSlider.getValue() * 1.0 / PROGRESS_SLIDER_SIZE; - long newPos = (long) (relativePosition * duration); - gstPlayBin.seek(newPos, TimeUnit.NANOSECONDS); + long newStartTime = (long) (relativePosition * duration); + gstPlayBin.seek(playBackRate, + Format.TIME, + //FLUSH - flushes the pipeline + //ACCURATE - video will seek exactly to the position requested + EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), + //Set the start position to newTime + SeekType.SET, newStartTime, + //Do nothing for the end position + SeekType.NONE, -1); //Keep constantly updating the time label so users have a sense of //where the slider they are dragging is in relation to the video time - updateTimeLabel(newPos, duration); + updateTimeLabel(newStartTime, duration); } } }); @@ -241,11 +255,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie endOfStreamListener = new Bus.EOS() { @Override public void endOfStream(GstObject go) { - gstPlayBin.seek(ClockTime.ZERO); - progressSlider.setValue(0); - /** - * Keep the video from automatically playing - */ + gstPlayBin.seek(ClockTime.ZERO); + progressSlider.setValue(0); + /** + * Keep the video from automatically playing + */ Gst.getExecutor().submit(() -> gstPlayBin.pause()); } }; @@ -674,20 +688,36 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private void rewindButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rewindButtonActionPerformed long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); //Skip 30 seconds. - long skipBehind = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); + long rewindDelta = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); //Ensure new video position is within bounds - long newTime = Math.max(currentTime - skipBehind, 0); - gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); + long newTime = Math.max(currentTime - rewindDelta, 0); + gstPlayBin.seek(playBackRate, + Format.TIME, + //FLUSH - flushes the pipeline + //ACCURATE - video will seek exactly to the position requested + EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), + //Set the start position to newTime + SeekType.SET, newTime, + //Do nothing for the end position + SeekType.NONE, -1); }//GEN-LAST:event_rewindButtonActionPerformed private void fastForwardButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fastForwardButtonActionPerformed long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); //Skip 30 seconds. - long skipAhead = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); + long fastForwardDelta = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); //Ensure new video position is within bounds - long newTime = Math.min(currentTime + skipAhead, duration - 1); - gstPlayBin.seek(newTime, TimeUnit.NANOSECONDS); + long newTime = Math.min(currentTime + fastForwardDelta, duration); + gstPlayBin.seek(playBackRate, + Format.TIME, + //FLUSH - flushes the pipeline + //ACCURATE - video will seek exactly to the position requested + EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), + //Set the start position to newTime + SeekType.SET, newTime, + //Do nothing for the end position + SeekType.NONE, -1); }//GEN-LAST:event_fastForwardButtonActionPerformed private void playButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_playButtonActionPerformed From 134f2946103bf55c8e6d78c69df8be0c1412563f Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Thu, 17 Oct 2019 11:08:27 -0400 Subject: [PATCH 15/91] Cleaned up kmlreport.java to use new classes --- .../datamodel/BlackboardArtifactPoint.java | 82 ++++++++++--- .../geolocation/datamodel/DefaultPoint.java | 113 +++++++++++++++++- .../datamodel/EXIFMetadataPoint.java | 14 ++- .../datamodel/GeolocationManager.java | 98 ++++++++++----- .../autopsy/geolocation/datamodel/Route.java | 50 ++++---- .../geolocation/datamodel/RoutePoint.java | 25 ++-- .../geolocation/datamodel/SimplePoint.java | 26 +++- .../autopsy/report/modules/kml/KMLReport.java | 100 +++++++++++----- 8 files changed, 381 insertions(+), 127 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java index a93cb49f89..10549cef92 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java @@ -1,5 +1,4 @@ /* - * * Autopsy Forensic Browser * * Copyright 2019 Basis Technology Corp. @@ -23,27 +22,82 @@ import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.TskCoreException; /** + * Interface to be implemented by all ArtifactPoint objects. * - * */ public interface BlackboardArtifactPoint { - BlackboardArtifact getArtifact() ; - - Long getTimestamp() ; - - String getLabel() ; - + + /** + * Get the BlackboardArtifact for which this point represents. + * + * @return BlackboardArtifact for this point. + */ + BlackboardArtifact getArtifact(); + + /** + * Get the timestamp for this BlackboardArtifact. + * + * @return Timestamp in epoch seconds or null if none was set. + */ + Long getTimestamp(); + + /** + * Get the label for this point object. + * + * @return String label for the point or null if none was set + */ + String getLabel(); + + /** + * Get the latitude for this point. + * + * @return Returns the latitude for the point or null if none was set + */ Double getLatitude(); - + + /** + * Get the longitude for this point. + * + * @return Returns the longitude for the point or null if none was set + */ Double getLongitude(); - + + /** + * Get the Altitude for this point. + * + * @return Returns the Altitude for the point or null if none was set + */ Double getAltitude(); + /** + * Get the details of this point as an HTML formated string. + * + * @return The details string or empty string if none was set. + */ String getDetails(); - - void initPosition() throws TskCoreException; - + + /** + * initPoint is the function where the work of setting the attributes the + * point. + * + * @throws TskCoreException + */ + void initPoint() throws TskCoreException; + + /** + * Get the latitude and longitude as a formatted string. + * + * @return Formatted String. + */ String getFormattedCoordinates(); - + + /** + * Get the latitude and longitude formatted as given. + * + * @param format The format String should assume that latitude will be + * passed first and that both are number values. + * + * @return Formatted string. + */ String getFormattedCoordinates(String format); } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java index 3bf1e56a82..8fdf463363 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java @@ -25,13 +25,12 @@ import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; /** - * - * + * Abstract class representing the basics of a BlackboardARtifacrPoint. */ public abstract class DefaultPoint implements BlackboardArtifactPoint{ final private BlackboardArtifact artifact; - private String label = null; + private String label = ""; private Long timestamp = null; private String details = null; private Double longitude = null; @@ -40,11 +39,31 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); private static final String DEFAULT_COORD_FORMAT = "%.2f, %.2f"; - + + /** + * Construct a new point with the given artifact. + * + * @param artifact + */ public DefaultPoint(BlackboardArtifact artifact) { this.artifact = artifact; } + /** + * Construct a new point with the given parameters. + * + * @param artifact The BlackboardArtifact object that this point represents + * @param latitude The latitude for the given artifact + * @param longitude The longitude for the given artifact + * @param label A label for the point + */ + public DefaultPoint(BlackboardArtifact artifact, Double latitude, Double longitude, String label) { + this.artifact = artifact; + this.latitude = latitude; + this.longitude = longitude; + this.label = label; + } + @Override public BlackboardArtifact getArtifact() { return artifact; @@ -55,6 +74,11 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ return timestamp; } + /** + * Set the timestamp for this point. + * + * @param timestamp Epoch seconds + */ protected void setTimestamp(Long timestamp) { this.timestamp = timestamp; } @@ -64,6 +88,11 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ return label; } + /** + * Set the label for this point. + * + * @param label String label for the point. + */ protected void setLabel(String label) { this.label = label; } @@ -73,6 +102,11 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ return details; } + /** + * Set the details information for the point. + * + * @param details Formatted detail information for display. + */ protected void setDetails(String details) { this.details = details; } @@ -82,6 +116,11 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ return latitude; } + /** + * Set the latitude for this point. + * + * @param latitude Double latitude value + */ protected void setLatitude(Double latitude) { this.latitude = latitude; } @@ -91,6 +130,11 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ return longitude; } + /** + * Set the longitude for this point. + * + * @param longitude Double longitude value + */ protected void setLongitude(Double longitude) { this.longitude = longitude; } @@ -100,6 +144,11 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ return altitude; } + /** + * Set the altitude for the point. + * + * @param altitude Double altitude value + */ protected void setAltitude(Double altitude) { this.altitude = altitude; } @@ -115,6 +164,8 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ } /** + * This function with its formatting is from the original KMLReport. + * * This method creates a text description for a map feature using all the * geospatial and time data we can for the Artifact. It queries the * following attributes: @@ -136,7 +187,7 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ StringBuilder result = new StringBuilder(); //NON-NLS result.append("

"); - result.append(getArtifact().getArtifactTypeName()); + result.append(BlackboardArtifact.ARTIFACT_TYPE.fromLabel(getArtifact().getArtifactTypeName()).getDisplayName()); result.append("

"); String name = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); @@ -237,27 +288,77 @@ public abstract class DefaultPoint implements BlackboardArtifactPoint{ return result.toString(); } + /** + * Helper function for getting a String attribute from an artifact. + * + * @param type BlackboardAttribute type + * + * @return String value for the given attribute. + * + * @throws TskCoreException + */ String getString(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); return (attribute != null ? attribute.getValueString() : null); } + /** + * Helper function for getting a Double attribute from an artifact. + * + * @param type BlackboardAttribute type + * + * @return Double value for the given attribute. + * + * @throws TskCoreException + */ Double getDouble(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); return (attribute != null ? attribute.getValueDouble() : null); } + /** + * Helper function for getting a Long attribute from an artifact. + * + * @param type BlackboardAttribute type + * + * @return Long value for the given attribute. + * + * @throws TskCoreException + */ Long getLong(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); return (attribute != null ? attribute.getValueLong() : null); } + /** + * Helper function for getting a Integer attribute from an artifact. + * + * @param type BlackboardAttribute type + * + * @return Integer value for the given attribute. + * + * @throws TskCoreException + */ Integer getInteger(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); return (attribute != null ? attribute.getValueInt() : null); } + /** + * Helper function for consistently formatting the timestamp. + * + * @param type BlackboardAttribute type + * + * @return The timestamp value formatted as string, or empty string if no + * timestamp is available. + * + * @throws TskCoreException + */ String getTimeStamp(long timeStamp) { - return DATE_FORMAT.format(new java.util.Date(getTimestamp() * 1000)); + if(getTimestamp() != null) { + return DATE_FORMAT.format(new java.util.Date(getTimestamp() * 1000)); + } else { + return ""; + } } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java index ea444a9d06..67056fa2b3 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java @@ -25,14 +25,15 @@ import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; /** - * + * Extends SimplePoint for TSK_EXIF_METADATA artifacts. * */ public class EXIFMetadataPoint extends SimplePoint{ private AbstractFile imageFile; /** - * Construct a EXIF way point + * Construct a EXIF point + * * @param artifact */ EXIFMetadataPoint(BlackboardArtifact artifact) { @@ -40,8 +41,8 @@ public class EXIFMetadataPoint extends SimplePoint{ } @Override - public void initPosition() throws TskCoreException{ - super.initPosition(); + public void initPoint() throws TskCoreException{ + super.initPoint(); setTimestamp(getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED)); @@ -53,6 +54,11 @@ public class EXIFMetadataPoint extends SimplePoint{ setLabel(imageFile.getName()); } + /** + * Get the image for this point. + * + * @return Return the AbstractFile image for the EXIF_METADATA artifact. + */ public AbstractFile getImage() { return imageFile; } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java index 651ea22748..05334473ea 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java @@ -26,41 +26,73 @@ import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; /** + * Static functions for the creations of geolocation points for artifacts. * - * */ public class GeolocationManager { - - static public List getPoints(SleuthkitCase skCase, boolean includeRoute) throws TskCoreException { + + /** + * Returns a list of points for the artifacts with geolocation information. + * + * List will include artifacts of type: TSK_GPS_TRACKPOINT TSK_GPS_SEARCH + * TSK_GPS_LAST_KNOWN_LOCATION TSK_GPS_BOOKMARK TSK_METADATA_EXIF + * + * Optionally TSK_GPS_ROUTE points can also be added to the list. + * + * @param skCase Currently open SleuthkitCase + * @param includeRoutes True to include the points at are in TSK_GPS_ROUTE + * objects + * + * @return List of BlackboardArtifactPoints + * + * @throws TskCoreException + */ + static public List getPoints(SleuthkitCase skCase, boolean includeRoutes) throws TskCoreException { List points = new ArrayList<>(); - + points.addAll(getSimplePoints(skCase)); points.addAll(getEXIFPoints(skCase)); - - if(includeRoute) { - points.addAll(getGPSRouteWaypoints(skCase)); + + if (includeRoutes) { + points.addAll(getGPSRoutePoints(skCase)); } - - + return points; } - - static public List getGPSRoutes(SleuthkitCase skCase) throws TskCoreException{ + + /** + * Gets the list of Routes from the TSK_GPS_ROUTE artifacts. + * + * @param skCase Currently open SleuthkitCase + * + * @return List of Route objects, empty list will be returned if no Routes + * where found + * + * @throws TskCoreException + */ + static public List getGPSRoutes(SleuthkitCase skCase) throws TskCoreException { List routes = new ArrayList<>(); List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); - for (BlackboardArtifact artifact : artifacts) { + for (BlackboardArtifact artifact : artifacts) { Route route = new Route(artifact); route.initRoute(); routes.add(route); - } + } return routes; } /** + * Get a list of BlackboardArtifactPoints for the "simple" GPS artifacts. + * Artifacts that will be included: TSK_GPS_TRACKPOINT TSK_GPS_SEARCH + * TSK_GPS_LAST_KNOWN_LOCATION TSK_GPS_BOOKMARK * - * @param skCase + * BlackboardArtifactPoint objects will be created and added to the list + * only for artifacts with TSK_GEO_LONGITUDE and TSK_LATITUDE attributes. * - * @return + * @param skCase Currently open SleuthkitCase + * + * @return List of BlackboardArtifactPoints for above artifacts or empty + * list if none where found. * * @throws TskCoreException */ @@ -68,9 +100,6 @@ public class GeolocationManager { List points = new ArrayList<>(); - // TSK_GPS_TRACKPOINT, TSK_GPS_SEARCH, TSK_GPS_LAST_KNOWN_LOCATION - // and TSK_GPS_BOOKMARK have similar attributes and can be processed - // similarly List artifacts = new ArrayList<>(); artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)); artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH)); @@ -79,9 +108,10 @@ public class GeolocationManager { for (BlackboardArtifact artifact : artifacts) { BlackboardArtifactPoint point = new SimplePoint(artifact); - point.initPosition(); - // Good point only if it has the location - if(point.getLatitude() != null && point.getLongitude() != null) { + point.initPoint(); + // Only add to the list if the point has a valid latitude + // and longitude. + if (point.getLatitude() != null && point.getLongitude() != null) { points.add(point); } } @@ -90,10 +120,15 @@ public class GeolocationManager { } /** + * Get a list of BlackboardArtifactPoints for TSK_METADATA_EXIF artifacts. * - * @param skCase + * BlackboardArtifactPoint objects will be created and added to the list + * only for artifacts with TSK_GEO_LONGITUDE and TSK_LATITUDE attributes. * - * @return + * @param skCase Currently open SleuthkitCase + * + * @return List of BlackboardArtifactPoints for above artifacts or empty + * list if none where found. * * @throws TskCoreException */ @@ -103,24 +138,25 @@ public class GeolocationManager { for (BlackboardArtifact artifact : artifacts) { BlackboardArtifactPoint point = new EXIFMetadataPoint(artifact); - point.initPosition(); - if(point.getLatitude() != null && point.getLongitude() != null) { + point.initPoint(); + if (point.getLatitude() != null && point.getLongitude() != null) { points.add(point); } } return points; } - - /** + + /** + * Get a list of BlackboardArtifactPoints from the list of routes. * - * @param skCase + * @param skCase Currently open SleuthkitCase * - * @return + * @return A list of route points, or empty list if none were found. * * @throws TskCoreException */ - static private List getGPSRouteWaypoints(SleuthkitCase skCase) throws TskCoreException { + static private List getGPSRoutePoints(SleuthkitCase skCase) throws TskCoreException { List points = new ArrayList<>(); for (Route route : getGPSRoutes(skCase)) { @@ -129,5 +165,5 @@ public class GeolocationManager { return points; } - + } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index fc17096570..47e5ccbea3 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -26,12 +26,14 @@ import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; /** - * + * A Route represents a TSK_GPS_ROUTE artifact which has a start and end point + * however the class was written with the assumption that some routes may have + * more that two points. * */ public class Route { private final BlackboardArtifact artifact; - private final List waypoints; + private final List points; private long timestamp; private String details; private Double altitude = null; @@ -43,7 +45,7 @@ public class Route { */ protected Route(BlackboardArtifact artifact) { this.artifact = artifact; - waypoints = new ArrayList<>(); + points = new ArrayList<>(); } /** @@ -52,7 +54,7 @@ public class Route { * @return List of ArtifactWaypoints for this route */ public List getRoute() { - return waypoints; + return points; } public String getDetails() { @@ -81,36 +83,38 @@ public class Route { Double latitude; Double longitude; + BlackboardAttribute attribute; + + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START)); + latitude = attribute != null ? attribute.getValueDouble() : null; - latitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START); - longitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START); + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START)); + longitude = attribute != null ? attribute.getValueDouble() : null; if (latitude != null && longitude != null) { - waypoints.add(new RoutePoint(this, latitude, longitude, "Start")); + RoutePoint point = new RoutePoint(artifact, this, latitude, longitude, "Start"); + point.initPoint(); + points.add(point); } - latitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END); - longitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END); + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END)); + latitude = attribute != null ? attribute.getValueDouble() : null; + + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END)); + longitude = attribute != null ? attribute.getValueDouble() : null; if (latitude != null && longitude != null) { - waypoints.add(new RoutePoint(this, latitude, longitude, "End")); + RoutePoint point = new RoutePoint(artifact, this, latitude, longitude, "End"); + point.initPoint(); + points.add(point); } - altitude = getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); + altitude = attribute != null ? attribute.getValueDouble() : null; // Get the creation date - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); - Long dateTime = attribute != null ? attribute.getValueLong() : null; - if (dateTime != null) { - timestamp = dateTime * 1000; - } - } - - private Double getDoubleAttribute(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ - BlackboardAttribute attribute; - - attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); - return attribute != null ? attribute.getValueDouble() : null; + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); + timestamp = attribute != null ? attribute.getValueLong() : null; } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java index 784b0ea4f1..aa830a2581 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java @@ -19,40 +19,35 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.TskCoreException; + public class RoutePoint extends DefaultPoint { private final Route parent; /** - * Construct a route way point. + * Construct a route for a route. * * @param parent The parent route object. - * @param latitude Latitude for waypoint - * @param longitude Longitude for waypoint + * @param latitude Latitude for point + * @param longitude Longitude for point * @param label Way point label. */ - protected RoutePoint(Route parent, double latitude, double longitude, String label) { - super(parent.getArtifact()); - + protected RoutePoint(BlackboardArtifact artifact, Route parent, double latitude, double longitude, String label) { + super(artifact, latitude, longitude, label); this.parent = parent; - setLabel(label); - setLongitude(longitude); - setLatitude(latitude); } @Override - public void initPosition() { + public void initPoint() throws TskCoreException{ + setDetails(getDetailsFromArtifact()); } @Override public Long getTimestamp() { return parent.getTimestamp(); } - - @Override - public String getDetails() { - return parent.getDetails(); - } @Override public Double getAltitude() { diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java index e75443af51..db091b37f0 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java @@ -25,18 +25,28 @@ import org.sleuthkit.datamodel.TskCoreException; /** * + * A basic Artifact point for artifacts that use the following attributes: + * TSK_GEO_LONGITUDE + * TSK_GEO_LATITUDE + * TSK_GEO_ALTITUDE + * TSK_DATETIME * */ public class SimplePoint extends DefaultPoint{ + /** + * Construct a simple point object. + * + * @param artifact + */ SimplePoint(BlackboardArtifact artifact) { super(artifact); } @Override - public void initPosition() throws TskCoreException{ - setLongitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE)); - setLatitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE)); + public void initPoint() throws TskCoreException{ + setLongitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE)); + setLatitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE)); setAltitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); setTimestamp(getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); @@ -44,6 +54,16 @@ public class SimplePoint extends DefaultPoint{ setLabel(getLabelBasedOnType()); } + /** + * Create the point label based on the artifact type. + * + * This code needs to be revisited to make sure these back up labels make + * sense. + * + * @return A label for the point. + * + * @throws TskCoreException + */ String getLabelBasedOnType() throws TskCoreException{ String label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index fe5ab34556..c494ab612b 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -201,7 +201,11 @@ class KMLReport implements GeneralReportModule { progressPanel.complete(result, errorMessage); } - + /** + * Do all of the setting up of elements needed for the report. + * + * @return The report document object. + */ private Document setupReportDocument() { ns = Namespace.getNamespace("", "http://www.opengis.net/kml/2.2"); //NON-NLS @@ -274,15 +278,22 @@ class KMLReport implements GeneralReportModule { return kmlDocument; } - - void addExifMetadataContent(EXIFMetadataPoint location, String baseReportDirectory) throws IOException{ - Element point = makePoint(location); - if(point == null) { + /** + * For the given point, create the data needed for the EXIF_METADATA + * + * @param location The geolocation of the data + * @param baseReportDirectory The report directory where the image will be created. + * + * @throws IOException + */ + void addExifMetadataContent(EXIFMetadataPoint point, String baseReportDirectory) throws IOException{ + Element mapPoint = makePoint(point); + if(mapPoint == null) { return; } - AbstractFile abstractFile = location.getImage(); - String details = "

EXIF Metadata With Locations

" + location.getDetails(); + AbstractFile abstractFile = point.getImage(); + String details = point.getDetails(); Path path; copyFileUsingStream(abstractFile, Paths.get(baseReportDirectory, abstractFile.getName()).toFile()); @@ -295,9 +306,17 @@ class KMLReport implements GeneralReportModule { path = Paths.get(abstractFile.getName()); } - gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, location.getTimestamp(), point, path, location.getFormattedCoordinates())); + gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, point.getFormattedCoordinates())); } + /** + * Add the new location to the correct folder based on artifact type. + * @param skCase Currently open case + * @param baseReportDir Output directory for the report. + * + * @throws TskCoreException + * @throws IOException + */ void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws TskCoreException, IOException { List points = GeolocationManager.getPoints(skCase, false); @@ -321,6 +340,13 @@ class KMLReport implements GeneralReportModule { } } + /** + * Add the route to the route folder in the document. + * + * @param skCase Currently open case. + * + * @throws TskCoreException + */ void makeRoutes(SleuthkitCase skCase) throws TskCoreException { List routes = GeolocationManager.getGPSRoutes(skCase); @@ -349,28 +375,47 @@ class KMLReport implements GeneralReportModule { String formattedCoordinates = String.format("%s to %s", start.getFormattedCoordinates(), end.getFormattedCoordinates()); - gpsRouteFolder.addContent(makePlacemark("As-the-crow-flies Route", FeatureColor.GREEN, route.getDetails(), route.getTimestamp(), reportRoute, formattedCoordinates)); //NON-NLS - gpsRouteFolder.addContent(makePlacemark(start.getLabel(), FeatureColor.GREEN, start.getDetails(), start.getTimestamp(), startingPoint, start.getFormattedCoordinates())); //NON-NLS - gpsRouteFolder.addContent(makePlacemark(end.getLabel(), FeatureColor.GREEN, end.getDetails(), end.getTimestamp(), endingPoint, end.getFormattedCoordinates())); //NON-NLS + if(reportRoute != null) { + gpsRouteFolder.addContent(makePlacemark("As-the-crow-flies Route", FeatureColor.GREEN, "", route.getTimestamp(), reportRoute, formattedCoordinates)); //NON-NLS + } + + if(startingPoint != null) { + gpsRouteFolder.addContent(makePlacemark(start.getLabel(), FeatureColor.GREEN, start.getDetails(), start.getTimestamp(), startingPoint, start.getFormattedCoordinates())); //NON-NLS + } + + if(endingPoint != null) { + gpsRouteFolder.addContent(makePlacemark(end.getLabel(), FeatureColor.GREEN, end.getDetails(), end.getTimestamp(), endingPoint, end.getFormattedCoordinates())); //NON-NLS + } } } } - + /** + * Format a point time stamp (in seconds) to the report format. + * + * @param timeStamp The timestamp in epoch seconds. + * + * @return The formatted timestamp + */ private String getTimeStamp(long timeStamp) { return kmlDateFormat.format(new java.util.Date(timeStamp * 1000)); } - private Element makePoint(BlackboardArtifactPoint location) { - return makePoint(location.getLatitude(), location.getLongitude(), location.getAltitude()); + /** + * Create the point for the given artifact. + * + * @param point Artifact point. + * + * @return point element. + */ + private Element makePoint(BlackboardArtifactPoint point) { + return makePoint(point.getLatitude(), point.getLongitude(), point.getAltitude()); } /** * Create a Point for use in a Placemark. Note in this method altitude is * ignored, as Google Earth apparently has trouble using altitudes for - * LineStrings, though the parameters are still in the call. Also note that - * any null value passed in will be set to 0.0, under the idea that it is - * better to show some data with gaps, than to show nothing at all. + * LineStrings, though the parameters are still in the call. * * @param latitude point latitude * @param longitude point longitude @@ -411,9 +456,10 @@ class KMLReport implements GeneralReportModule { * Create a LineString for use in a Placemark. Note in this method, start * and stop altitudes get ignored, as Google Earth apparently has trouble * using altitudes for LineStrings, though the parameters are still in the - * call. Also note that any null value passed in will be set to 0.0, under - * the idea that it is better to show some data with gaps, than to show - * nothing at all. + * call. + * + * If null values are pass for the latitudes or longitudes a line will not be + * drawn. * * @param startLatitude Starting latitude * @param startLongitude Starting longitude @@ -425,21 +471,13 @@ class KMLReport implements GeneralReportModule { * @return the Line as an Element */ private Element makeLineString(Double startLatitude, Double startLongitude, Double startAltitude, Double stopLatitude, Double stopLongitude, Double stopAltitude) { - if (startLatitude == null) { - startLatitude = 0.0; - } - if (startLongitude == null) { - startLongitude = 0.0; + if(startLatitude == null || startLongitude == null || stopLatitude == null || stopLongitude == null) { + return null; } + if (startAltitude == null) { startAltitude = 0.0; } - if (stopLatitude == null) { - stopLatitude = 0.0; - } - if (stopLongitude == null) { - stopLongitude = 0.0; - } if (stopAltitude == null) { stopAltitude = 0.0; } From 7833596424b34167fb6290ee1d25f21851f2c262 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Thu, 17 Oct 2019 17:08:39 -0400 Subject: [PATCH 16/91] Implemented seeks with configurable playback rates --- .../autopsy/contentviewers/Bundle.properties | 3 +- .../contentviewers/Bundle.properties-MERGED | 3 +- .../contentviewers/MediaPlayerPanel.form | 95 +++++++++- .../contentviewers/MediaPlayerPanel.java | 162 +++++++++++++++--- 4 files changed, 228 insertions(+), 35 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties index 5734df98d9..facc16426f 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties @@ -91,4 +91,5 @@ MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 MediaPlayerPanel.fastForwardButton.text=\u25ba\u25ba MediaPlayerPanel.playButton.text=\u25ba MediaPlayerPanel.infoLabel.text=No Errors -MediaPlayerPanel.VolumeIcon.text=\ \ \ \ \ Volume +MediaPlayerPanel.VolumeIcon.text=Volume +MediaPlayerPanel.playBackSpeedLabel.text=Speed: diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED index 1209c49953..b90b0d5d61 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED @@ -161,7 +161,8 @@ MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 MediaPlayerPanel.fastForwardButton.text=\u25ba\u25ba MediaPlayerPanel.playButton.text=\u25ba MediaPlayerPanel.infoLabel.text=No Errors -MediaPlayerPanel.VolumeIcon.text=\ \ \ \ \ Volume +MediaPlayerPanel.VolumeIcon.text=Volume +MediaPlayerPanel.playBackSpeedLabel.text=Speed: # {0} - tableName SQLiteViewer.readTable.errorText=Error getting rows for table: {0} # {0} - tableName diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form index 230254020d..8fc346b491 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form @@ -41,7 +41,7 @@ - +
@@ -55,14 +55,20 @@ - - - - + + + + + + + + + + - +
@@ -74,9 +80,12 @@ - - - + + + + + + @@ -202,6 +211,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index b9a14df207..369fa19fec 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -52,8 +52,8 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; import javafx.embed.swing.JFXPanel; +import javax.swing.SwingUtilities; import javax.swing.event.ChangeListener; -import org.freedesktop.gstreamer.ClockTime; import org.freedesktop.gstreamer.Format; import org.freedesktop.gstreamer.GstException; import org.freedesktop.gstreamer.event.SeekFlags; @@ -179,7 +179,6 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private Bus.ERROR errorListener; private Bus.STATE_CHANGED stateChangeListener; private Bus.EOS endOfStreamListener; - private double playBackRate; //Update progress bar and time label during video playback private final Timer timer = new Timer(75, new VideoPanelUpdater()); @@ -201,7 +200,6 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie progressSlider.setMinimum(0); progressSlider.setMaximum(PROGRESS_SLIDER_SIZE); progressSlider.setValue(0); - playBackRate = 1.0; //Manage the gstreamer video position when a user is dragging the slider in the panel. progressSlider.addChangeListener(new ChangeListener() { @Override @@ -210,6 +208,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); double relativePosition = progressSlider.getValue() * 1.0 / PROGRESS_SLIDER_SIZE; long newStartTime = (long) (relativePosition * duration); + double playBackRate = getPlayBackRate(); gstPlayBin.seek(playBackRate, Format.TIME, //FLUSH - flushes the pipeline @@ -235,10 +234,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie errorListener = new Bus.ERROR() { @Override public void errorMessage(GstObject go, int i, String string) { - enableComponents(false); - infoLabel.setText(String.format( - "%s", - MEDIA_PLAYER_ERROR_STRING)); + SwingUtilities.invokeLater(() -> { + enableComponents(false); + infoLabel.setText(String.format( + "%s", + MEDIA_PLAYER_ERROR_STRING)); + }); timer.stop(); } }; @@ -246,17 +247,34 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie @Override public void stateChanged(GstObject go, State oldState, State currentState, State pendingState) { if (State.PLAYING.equals(currentState)) { - playButton.setText("||"); + SwingUtilities.invokeLater(() -> { + playButton.setText("||"); + }); } else { - playButton.setText("►"); + SwingUtilities.invokeLater(() -> { + playButton.setText("►"); + }); } } }; endOfStreamListener = new Bus.EOS() { @Override public void endOfStream(GstObject go) { - gstPlayBin.seek(ClockTime.ZERO); - progressSlider.setValue(0); + double playBackRate = getPlayBackRate(); + gstPlayBin.seek(playBackRate, + Format.TIME, + //FLUSH - flushes the pipeline + //ACCURATE - video will seek exactly to the position requested + EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), + //Set the start position to newTime + SeekType.SET, 0, + //Do nothing for the end position + SeekType.NONE, -1); + + SwingUtilities.invokeLater(() -> { + progressSlider.setValue(0); + }); + /** * Keep the video from automatically playing */ @@ -334,6 +352,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie audioSlider.setEnabled(isEnabled); rewindButton.setEnabled(isEnabled); fastForwardButton.setEnabled(isEnabled); + playBackSpeedComboBox.setEnabled(isEnabled); } @Override @@ -392,6 +411,17 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private void updateTimeLabel(long start, long total) { progressLabel.setText(formatTime(start) + "/" + formatTime(total)); } + + /** + * Reads the current selected playback rate from the speed combo box. + * + * @return The selected rate. + */ + private double getPlayBackRate() { + int selectIndex = playBackSpeedComboBox.getSelectedIndex(); + String selectText = playBackSpeedComboBox.getItemAt(selectIndex); + return Double.valueOf(selectText.substring(0, selectText.length()-1)); + } /** * Convert nanoseconds into an HH:MM:SS format. @@ -433,7 +463,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie protected Void doInBackground() throws Exception { if (!tempFile.exists() || tempFile.length() < sourceFile.getSize()) { progress = ProgressHandle.createHandle(NbBundle.getMessage(MediaPlayerPanel.class, "GstVideoPanel.ExtractMedia.progress.buffering", sourceFile.getName()), () -> this.cancel(true)); - progressLabel.setText(NbBundle.getMessage(this.getClass(), "GstVideoPanel.progress.buffering")); + + SwingUtilities.invokeLater(() -> { + progressLabel.setText(NbBundle.getMessage(this.getClass(), "GstVideoPanel.progress.buffering")); + }); + progress.start(100); try { Files.createParentDirs(tempFile); @@ -517,12 +551,14 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * pipeline. We start this updater when data-flow has just been * initiated so buffering may still be in progress. */ - if (duration > 0 && position > 0) { + if (duration >= 0 && position >= 0) { double relativePosition = (double) position / duration; progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE)); } - updateTimeLabel(position, duration); + SwingUtilities.invokeLater(()-> { + updateTimeLabel(position, duration); + }); } } } @@ -548,6 +584,9 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie VolumeIcon = new javax.swing.JLabel(); audioSlider = new javax.swing.JSlider(); infoLabel = new javax.swing.JLabel(); + playBackPanel = new javax.swing.JPanel(); + playBackSpeedComboBox = new javax.swing.JComboBox<>(); + playBackSpeedLabel = new javax.swing.JLabel(); javax.swing.GroupLayout videoPanelLayout = new javax.swing.GroupLayout(videoPanel); videoPanel.setLayout(videoPanelLayout); @@ -557,7 +596,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie ); videoPanelLayout.setVerticalGroup( videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 124, Short.MAX_VALUE) + .addGap(0, 125, Short.MAX_VALUE) ); progressSlider.setValue(0); @@ -641,6 +680,39 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie org.openide.awt.Mnemonics.setLocalizedText(infoLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.infoLabel.text")); // NOI18N infoLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); + playBackSpeedComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "0.25x", "0.50x", "0.75x", "1x", "1.25x", "1.50x", "1.75x", "2x" })); + playBackSpeedComboBox.setSelectedIndex(3); + playBackSpeedComboBox.setMaximumSize(new java.awt.Dimension(53, 23)); + playBackSpeedComboBox.setMinimumSize(new java.awt.Dimension(53, 23)); + playBackSpeedComboBox.setPreferredSize(new java.awt.Dimension(53, 23)); + playBackSpeedComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + playBackSpeedComboBoxActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(playBackSpeedLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.playBackSpeedLabel.text")); // NOI18N + + javax.swing.GroupLayout playBackPanelLayout = new javax.swing.GroupLayout(playBackPanel); + playBackPanel.setLayout(playBackPanelLayout); + playBackPanelLayout.setHorizontalGroup( + playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(playBackPanelLayout.createSequentialGroup() + .addComponent(playBackSpeedLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(playBackSpeedComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(13, 13, 13)) + ); + playBackPanelLayout.setVerticalGroup( + playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(playBackPanelLayout.createSequentialGroup() + .addGap(6, 6, 6) + .addGroup(playBackPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(playBackSpeedComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(playBackSpeedLabel)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + javax.swing.GroupLayout controlPanelLayout = new javax.swing.GroupLayout(controlPanel); controlPanel.setLayout(controlPanelLayout); controlPanelLayout.setHorizontalGroup( @@ -649,12 +721,16 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie .addContainerGap() .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 738, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, controlPanelLayout.createSequentialGroup() - .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(buttonPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, 623, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(progressLabel))) - .addContainerGap()) + .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(playBackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) + .addGap(10, 10, 10))) + .addGap(0, 0, 0)) ); controlPanelLayout.setVerticalGroup( controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -663,8 +739,10 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(progressLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(progressSlider, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(5, 5, 5) + .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(playBackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)) ); @@ -691,6 +769,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie long rewindDelta = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); //Ensure new video position is within bounds long newTime = Math.max(currentTime - rewindDelta, 0); + double playBackRate = getPlayBackRate(); gstPlayBin.seek(playBackRate, Format.TIME, //FLUSH - flushes the pipeline @@ -707,8 +786,14 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); //Skip 30 seconds. long fastForwardDelta = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); - //Ensure new video position is within bounds - long newTime = Math.min(currentTime + fastForwardDelta, duration); + + //Ignore any fast forward requests if we are nearing the end. + if(currentTime + fastForwardDelta >= duration) { + return; + } + + long newTime = currentTime + fastForwardDelta; + double playBackRate = getPlayBackRate(); gstPlayBin.seek(playBackRate, Format.TIME, //FLUSH - flushes the pipeline @@ -724,10 +809,36 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie if (gstPlayBin.isPlaying()) { gstPlayBin.pause(); } else { + double playBackRate = getPlayBackRate(); + long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); + //Set playback rate before play. + gstPlayBin.seek(playBackRate, + Format.TIME, + //FLUSH - flushes the pipeline + //ACCURATE - video will seek exactly to the position requested + EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), + //Set the start position to newTime + SeekType.SET, currentTime, + //Do nothing for the end position + SeekType.NONE, -1); gstPlayBin.play(); - } + } }//GEN-LAST:event_playButtonActionPerformed + private void playBackSpeedComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_playBackSpeedComboBoxActionPerformed + double playBackRate = getPlayBackRate(); + long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); + gstPlayBin.seek(playBackRate, + Format.TIME, + //FLUSH - flushes the pipeline + //ACCURATE - video will seek exactly to the position requested + EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), + //Set the position to the currentTime, we are only adjusting the + //playback rate. + SeekType.SET, currentTime, + SeekType.NONE, 0); + }//GEN-LAST:event_playBackSpeedComboBoxActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel VolumeIcon; private javax.swing.JSlider audioSlider; @@ -735,6 +846,9 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private javax.swing.JPanel controlPanel; private javax.swing.JButton fastForwardButton; private javax.swing.JLabel infoLabel; + private javax.swing.JPanel playBackPanel; + private javax.swing.JComboBox playBackSpeedComboBox; + private javax.swing.JLabel playBackSpeedLabel; private javax.swing.JButton playButton; private javax.swing.JLabel progressLabel; private javax.swing.JSlider progressSlider; From 8be5b01e0c2f8dfdac398b3db1a48a270d8e7f8d Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Fri, 18 Oct 2019 09:48:46 -0400 Subject: [PATCH 17/91] ignored ffw requests with less than 30s left, fixed bug with progress updating --- .../autopsy/contentviewers/MediaPlayerPanel.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index b9a14df207..cce6d3687f 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -517,7 +517,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * pipeline. We start this updater when data-flow has just been * initiated so buffering may still be in progress. */ - if (duration > 0 && position > 0) { + if (duration >= 0 && position >= 0) { double relativePosition = (double) position / duration; progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE)); } @@ -707,8 +707,13 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); //Skip 30 seconds. long fastForwardDelta = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); - //Ensure new video position is within bounds - long newTime = Math.min(currentTime + fastForwardDelta, duration); + + //Ignore fast forward requests if there are less than 30 seconds left. + if(currentTime + fastForwardDelta >= duration) { + return; + } + + long newTime = currentTime + fastForwardDelta; gstPlayBin.seek(playBackRate, Format.TIME, //FLUSH - flushes the pipeline From e4299efff1116c279921fb8098df871c276441ff Mon Sep 17 00:00:00 2001 From: Ann Priestman Date: Fri, 18 Oct 2019 11:24:36 -0400 Subject: [PATCH 18/91] Finished second and third tutorials. --- docs/doxygen/Doxyfile | 5 +- docs/doxygen/images/reports_select.png | Bin 0 -> 23486 bytes docs/doxygen/main.dox | 2 +- docs/doxygen/modDSIngestTutorial.dox | 166 +++++++++++++++++++++++ docs/doxygen/modFileIngestTutorial.dox | 42 +++--- docs/doxygen/modReportModuleTutorial.dox | 123 +++++++++++++++++ 6 files changed, 314 insertions(+), 24 deletions(-) create mode 100644 docs/doxygen/images/reports_select.png create mode 100644 docs/doxygen/modReportModuleTutorial.dox diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile index 0037b15063..d73868792a 100644 --- a/docs/doxygen/Doxyfile +++ b/docs/doxygen/Doxyfile @@ -772,8 +772,9 @@ INPUT = main.dox \ regressionTesting.dox \ native_libs.dox \ modDevPython.dox \ - modFileIngestTutorial.dox \ - modDSIngestTutorial.dox \ + modFileIngestTutorial.dox \ + modDSIngestTutorial.dox \ + modReportModuleTutorial.dox \ debugTsk.dox \ ../../Core/src \ ../../CoreLibs/src \ diff --git a/docs/doxygen/images/reports_select.png b/docs/doxygen/images/reports_select.png new file mode 100644 index 0000000000000000000000000000000000000000..fe4f1f10bd7f8622ca31f334fba3c323488db5d7 GIT binary patch literal 23486 zcmc$`2UHZ_moADTqGTmYQW21hAUUZhISE3ObIv(Ki%3qAGpHoVG)R+k&N((Y$A%_n zZZ$eH|KGefcjmoy*Saj|>aIF{s?Mpizy0lR?;=oMRty{C2?h!Z3bus!dj%AfyATwV zJ1r0H1AACz?3#ehLmP2bdlVE*eB|F9l*D8bU?;kRgv6l+Pf;Y^ zzy0JgwLJs&NHX@^y&1PuchaNFS$@G{tNuhPa5yL?v_r}JYTjS-tXh$-9X5T(r#+#{ zwl8c3-zc0JtFdoFwCqt^pqTPm^^Qe_1wZVUF73l5aoe`j*tdD2cr{t$X4#ARfWX%GxSKzo7PZPp~ z0EIe1I?>Y7vgV|AcV$qFYGr;9^jaO+T0wdCToLAiSQ!?$cH(YNA9SE`nyGRWIA2fq z*jOjU!s?9-0DhultUZ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{P^L-( zN&@nXV+=kBd`F4?sKtgEB1R#FAn+| zZufPcXPnSNy1qE=lpv75C>jaWI|l-B@J);TN?S{b0I_W1wzyEKRNy>)kY>(`1xQ3N z^5UzDDDJwHYRvSu`1ttmd!pdvkpg~dzPw)Juff8tvooj@S%`TcsCfCpYH;{FSax(w_9 literal 0 HcmV?d00001 diff --git a/docs/doxygen/main.dox b/docs/doxygen/main.dox index 094c61f612..230be1fd03 100644 --- a/docs/doxygen/main.dox +++ b/docs/doxygen/main.dox @@ -11,7 +11,7 @@ If these pages don't answer your question, then send the question to the Python Plugins menu item. That will open a subfolder in your AppData folder, such as "C:\Users\JDoe\AppData\Roaming\Autopsy\python_modules". + +Make a folder inside of there to store your module. Call it "DemoScript2". Copy the dataSourcengestModule.py sample file from github into the this new folder and rename it to FindContactsDb.py. + +\subsection python_tutorial2_script Writing The Script + +We are going to write a script that: +
    +
  • Queries the backend database for files of a given name
  • +
  • Opens the database
  • +
  • Queries data from the database and makes an artifact for each row
  • +
+ +Open the FindContactsDb.py script in your favorite text editor. The sample Autopsy Python modules all have TODO entries in them to let you know what you should change. The below steps jump from one TODO to the next. +
    +
  1. Factory Class Name: The first thing to do is rename the sample class name from "SampleJythonDataSourceIngestModuleFactory" to "ContactsDbIngestModuleFactory". In the sample module, there are several uses of this class name, so you should search and replace for these strings.
  2. +
  3. Name and Description: The next TODO entries are for names and descriptions. These are shown to users. For this example, we'll name it "Contacts Db Analyzer". The description can be anything you want. Note that Autopsy requires that modules have unique names, so don't make it too generic.
  4. +
  5. Ingest Module Class Name: The next thing to do is rename the ingest module class from "SampleJythonDataSourceIngestModule" to "ContactsDbIngestModule". Our usual naming convention is that this class is the same as the factory class with "Factory" removed from the end. There are a couple of places where this name is used, so do a search and replace in your code.
  6. +
  7. startUp() method: The startUp() method is where each module initializes. For our example, we don't need to do anything special in here except save a reference to the passed in context object. This is used later on to see if the module has been cancelled.
  8. +
  9. process() method: This is where we do our analysis and we'll focus on this more in the next section.
  10. +
+ +That's it. In the file-level ingest module, we had a shutdown() method, but we do not need that with data source-level ingest modules. When their process method is finished, it can shut itself down. The process() method will be called only once. + +\subsection python_tutorial2_process The process() Method + +The process method in a data source-level ingest module is passed in reference to the data source as a Content object and a Progress Bar class to update our progress.

+

For this tutorial, you can start by deleting the contents of the existing process() method in the sample module. The full source code is linked to at the end of this blog and shows more detail about a fully fledged module. We'll just cover the analytics in the blog.

+ +\subsubsection python_tutorial2_getting_files Getting Files +Because data source-level ingest modules are not passed in specific files to analyze, nearly all of these types of modules will need to use the org.sleuthkit.autopsy.casemodule.services.FileManager service to find relevant files. Check out the methods on that class to see the different ways that you can find files. + +NOTE: See the \ref python_tutorial2_running_exes section for an example of when you simply want to run a command line tool on a disk image instead of querying for files to analyze. + +For our example, we want to find all files named "contacts.db". The org.sleuthkit.autopsy.casemodule.services.FileManager class contains several findFiles() methods to help. You can search for all files with a given name or files with a given name in a particular folder. You can also use SQL syntax to match file patterns, such as "%.jpg" to find all files with a JPEG extension. + +Our example needs these two lines to get the FileManager for the current case and to find the files. +\verbatim +fileManager = Case.getCurrentCase().getServices().getFileManager() +files = fileManager.findFiles(dataSource, "contacts.db")\endverbatim + +findFiles() returns a list of AbstractFile objects. This gives you access to the file's metadata and content. + +For our example, we are going to open these SQLite files. That means that we need to save them to disk. This is less than ideal because it wastes time writing the data to disk and then reading it back in, but it is the only option with many libraries. If you are doing some other type analysis on the content, then you do not need to write it to disk. You can read directly from the AbstractFile (see the sample modules for specific code to do this). + +The org.sleuthkit.autopsy.datamodel.ContentUtils class provides a utility to save file content to disk. We'll make a path in the temp folder of our case directory. To prevent naming collisions, we'll name the file based on its unique ID. The following two lines save the file to lclDbPath. + +\verbatim +lclDbPath = os.path.join(Case.getCurrentCase().getTempDirectory(), str(file.getId()) + ".db") +ContentUtils.writeToFile(file, File(lclDbPath))\endverbatim + +\subsubsection python_tutorial2_analyzing_sqlite Analyzing SQLite +Next, we need to open the SQLite database. We are going to use the Java JDBC infrastructure for this. JDBC is Java's generic way of dealing with different types of databases. To open the database, we do this: +\verbatim +Class.forName("org.sqlite.JDBC").newInstance() +dbConn = DriverManager.getConnection("jdbc:sqlite:%s" % lclDbPath)\endverbatim + +With our connection in hand, we can do some queries. In our sample database, we have a single table named "contacts", which has columns for name, email, and phone. We first start by querying for all rows in our simple table: +\verbatim +stmt = dbConn.createStatement() +resultSet = stmt.executeQuery("SELECT * FROM contacts")\endverbatim + +For each row, we are going to get the values for the name, e-mail, and phone number and make a TSK_CONTACT artifact. Recall from the first tutorial that posting artifacts to the blackboard allows modules to communicate with each other and also allows you to easily display data to the user. The TSK_CONTACT artifact is for storing contact information. + +The basic approach in our example is to make an artifact of a given type (TSK_CONTACT) and have it be associated with the database it came from. We then make attributes for the name, email, and phone. The following code does this for each row in the database: +\verbatim +while resultSet.next(): + + # Make an artifact on the blackboard and give it attributes + art = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT) + + name = resultSet.getString("name") + art.addAttribute(BlackboardAttribute( + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME_PERSON.getTypeID(), + ContactsDbIngestModuleFactory.moduleName, name)) + + email = resultSet.getString("email") + art.addAttribute(BlackboardAttribute( + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL.getTypeID(), + ContactsDbIngestModuleFactory.moduleName, email)) + + phone = resultSet.getString("phone") + art.addAttribute(BlackboardAttribute( + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER.getTypeID(), + ContactsDbIngestModuleFactory.moduleName, phone))\endverbatim + +That's it. We've just found the databases, queried them, and made artifacts for the user to see. There are some final things though. First, we should fire off an event so that the UI updates and refreshes with the new artifacts. We can fire just one event after each database is parsed (or you could fire one for each artifact - it's up to you). + +\verbatim +IngestServices.getInstance().fireModuleDataEvent( + ModuleDataEvent(ContactsDbIngestModuleFactory.moduleName, + BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT, None))\endverbatim + +And the final thing is to clean up. We should close the database connections and delete our temporary file. +\verbatim +stmt.close() +dbConn.close() +os.remove(lclDbPath)\endverbatim + +\subsection python_tutorial2_niceties Niceties + +Data source-level ingest modules can run for quite some time. Therefore, data source-level ingest modules should do some additional things that file-level ingest modules do not need to. +
    +
  • Progress bars: Each data source-level ingest module will have its own progress bar in the lower right. A reference to it is passed into the process() method. You should update it to provide user feedback.
  • +
  • Cancellation: A user could cancel ingest while your module is running. You should periodically check if that occurred so that you can bail out as soon as possible. You can do that with a check of: +\verbatim if self.context.isJobCancelled():\endverbatim
  • +
+ +\subsection python_tutorial2_tips Debugging and Development Tips + +You can find the full file along with a small sample database on github. To use the database, add it as a logical file and run your module on it. + +Whenever you have syntax errors or other errors in your script, you will get some form of dialog from Autopsy when you try to run ingest modules. If that happens, fix the problem and run ingest modules again. You don't need to restart Autopsy each time! + +The sample module has some log statements in there to help debug what is going on since we don't know of better ways to debug the scripts while running in Autopsy. + +\section python_tutorial2_running_exes Running Executables +While the above example outlined using the FileManager to find files to analyze, the other common use of data source-level ingest modules is to wrap a command line tool that takes a disk image as input. A sample program (RunExe.py) that does that can be found on github. I'll cover the big topics of that program in this section. There are more details in the script about error checking and such. + +\subsection python_tutorial2_finding_exe Finding The Executable + +To write this kind of data source-level ingest module, put the executable in your module's folder (the DemoScript2 folder we previously made). Use "__file__" to get the path to where your script is and then use some os.path methods to get to the executable in the same folder. +\verbatim +path_to_exe = os.path.join(os.path.dirname(os.path.abspath(__file__)), "img_stat.exe")\endverbatim + +In our sample program, we do this and verify we can find it in the startup() method so that if we don't, then ingest never starts. + +\subsection python_tutorial2_running_the_exe Running The Executable + +Data sources can be disk images, but they can also be a folder of files. We only want to run our executable on a disk image. So, verify that: +\verbatim +if not isinstance(dataSource, Image): + self.log(Level.INFO, "Ignoring data source. Not an image") + return IngestModule.ProcessResult.OK \endverbatim + +You can get the path to the disk image using dataSource.getPaths(). + +Once you have the EXE and the disk image, you can use the various subprocess methods to run them. + +\subsection python_tutorial2_showing_results Showing the User Results + +After the command line tool runs, you have the option of either showing the user the raw output of the tool or parsing it into individual artifacts. Refer to previous sections of this tutorial and the previous tutorial for making artifacts. If you want to simply show the user the output of the tool, then save the output to the Reports folder in the Case directory: +\verbatim +reportPath = os.path.join(Case.getCurrentCase().getCaseDirectory(), + "Reports", "img_stat-" + str(dataSource.getId()) + ".txt") \endverbatim + +Then you can add the report to the case so that it shows up in the tree in the main UI panel. +\verbatim Case.getCurrentCase().addReport(reportPath, "Run EXE", "img_stat output")\endverbatim + +\section python_tutorial2_conclusion Conclusion + +Data source-level ingest modules allow you to query for a subset of files by name or to run on an entire disk image. This tutorial has shown an example of both use cases and shown how to use SQLite in Jython. + */ \ No newline at end of file diff --git a/docs/doxygen/modFileIngestTutorial.dox b/docs/doxygen/modFileIngestTutorial.dox index def7e91c2a..7873513a4f 100644 --- a/docs/doxygen/modFileIngestTutorial.dox +++ b/docs/doxygen/modFileIngestTutorial.dox @@ -3,32 +3,32 @@ \section python_tutorial1_why Why Write a File Ingest Module?
    -
  • Autopsy hides the fact that a file is coming from a file system, was carved, was from inside of a ZIP file, or was part of a local file. So, you don’t need to spend time supporting all of the ways that your user may want to get data to you. You just need to worry about analyzing the content.
  • -
  • Autopsy displays files automatically and can include them in reports if you use standard blackboard artifacts (described later). That means you don’t need to worry about UIs and reports.
  • +
  • Autopsy hides the fact that a file is coming from a file system, was carved, was from inside of a ZIP file, or was part of a local file. So, you don't need to spend time supporting all of the ways that your user may want to get data to you. You just need to worry about analyzing the content.
  • +
  • Autopsy displays files automatically and can include them in reports if you use standard blackboard artifacts (described later). That means you don't need to worry about UIs and reports.
  • Autopsy gives you access to results from other modules. So, you can build on top of their results instead of duplicating them.
\section python_tutorial1_ingest_modules Ingest Modules -For our first example, we’re going to write an ingest module. Ingest modules in Autopsy run on the data sources that are added to a case. When you add a disk image (or local drive or logical folder) in Autopsy, you’ll be presented with a list of modules to run (such as hash lookup and keyword search). +For our first example, we're going to write an ingest module. Ingest modules in Autopsy run on the data sources that are added to a case. When you add a disk image (or local drive or logical folder) in Autopsy, you'll be presented with a list of modules to run (such as hash lookup and keyword search). \image html ingest-modules.PNG -Those are all ingest modules. We’re going to write one of those. There are two types of ingest modules that we can build: +Those are all ingest modules. We're going to write one of those. There are two types of ingest modules that we can build:
  • File Ingest Modules are the easiest to write. During their lifetime, they will get passed in each file in the data source. This includes files that are found via carving or inside of ZIP files (if those modules are also enabled).
  • -
  • Data Source Ingest Modules require slightly more work because you have to query the database for the files of interest. If you only care about a small number of files, know their name, and know they won’t be inside of ZIP files, then these are your best bet.
  • +
  • Data Source Ingest Modules require slightly more work because you have to query the database for the files of interest. If you only care about a small number of files, know their name, and know they won't be inside of ZIP files, then these are your best bet.
-For this first tutorial, we’re going to write a file ingest module. The \ref mod_python_ds_ingest_tutorial_page "second tutorial" will focus on data source ingest modules. Regardless of the type of ingest module you are writing, you will need to work with two classes: +For this first tutorial, we're going to write a file ingest module. The \ref mod_python_ds_ingest_tutorial_page "second tutorial" will focus on data source ingest modules. Regardless of the type of ingest module you are writing, you will need to work with two classes:
  • The factory class provides Autopsy with module information such as display name and version. It also creates instances of ingest modules as needed.
  • -
  • The ingest module class will do the actual analysis. One of these will be created per thread. For file ingest modules, Autopsy will typically create two or more of these at a time so that it can analyze files in parallel. If you keep things simple, and don’t use static variables, then you don’t have to think about anything multithreaded.
  • +
  • The ingest module class will do the actual analysis. One of these will be created per thread. For file ingest modules, Autopsy will typically create two or more of these at a time so that it can analyze files in parallel. If you keep things simple, and don't use static variables, then you don't have to think about anything multithreaded.
\section python_tutorial1_getting_started Getting Started -To write your first file ingest module, you’ll need: +To write your first file ingest module, you'll need:
  • An installed copy of Autopsy available from SleuthKit
  • A text editor.
  • @@ -37,8 +37,8 @@ To write your first file ingest module, you’ll need: Some other general notes are that you will be writing in Jython, which converts Python-looking code into Java. It has some limitations, including:
      -
    • You can’t use Python 3 (you are limited to Python 2.7)
    • -
    • You can’t use libraries that use native code
    • +
    • You can't use Python 3 (you are limited to Python 2.7)
    • +
    • You can't use libraries that use native code
    But, Jython will give you access to all of the Java classes and services that Autopsy provides. So, if you want to stray from this example, then refer to the Developer docs on what classes and methods you have access to. The comments in the sample file will identify what type of object is being passed in along with a URL to its documentation. @@ -53,21 +53,21 @@ Every Python module in Autopsy gets its own folder. This reduces naming collisio \subsection python_tutorial1_writing Writing the Script -We are going to write a script that flags any file that is larger than 10MB and whose size is a multiple of 4096. We’ll call these big and round files. This kind of technique could be useful for finding encrypted files. An additional check would be for entropy of the file, but we’ll keep the example simple. +We are going to write a script that flags any file that is larger than 10MB and whose size is a multiple of 4096. We'll call these big and round files. This kind of technique could be useful for finding encrypted files. An additional check would be for entropy of the file, but we'll keep the example simple. Open the FindBigRoundFiles.py file in your favorite python text editor. The sample Autopsy Python modules all have TODO entries in them to let you know what you should change. The below steps jump from one TODO to the next.
      -
    1. Factory Class Name: The first thing to do is rename the sample class name from “SampleJythonFileIngestModuleFactory” to “FindBigRoundFilesIngestModuleFactory”. In the sample module, there are several uses of this class name, so you should search and replace for these strings.
    2. -
    3. Name and Description: The next TODO entries are for names and descriptions. These are shown to users. For this example, we’ll name it “Big and Round File Finder”. The description can be anything you want. Note that Autopsy requires that modules have unique names, so don’t make it too generic.
    4. -
    5. Ingest Module Class Name: The next thing to do is rename the ingest module class from “SampleJythonFileIngestModule” to “FindBigRoundFilesIngestModule”. Our usual naming convention is that this class is the same as the factory class with “Factory” removed from the end.
    6. -
    7. startUp() method: The startUp() method is where each module initializes. For our example, we don’t need to do anything special in here. Typically though, this is where you want to do stuff that could fail because throwing an exception here causes the entire ingest to stop.
    8. -
    9. process() method: This is where we do our analysis. The sample module is well documented with what it does. It ignores non-files, looks at the file name, and makes a blackboard artifact for “.txt” files. There are also a bunch of other things that it does to show examples for easy copy and pasting, but we don’t need them in our module. We’ll cover what goes into this method in the next section.
    10. +
    11. Factory Class Name: The first thing to do is rename the sample class name from "SampleJythonFileIngestModuleFactory" to "FindBigRoundFilesIngestModuleFactory". In the sample module, there are several uses of this class name, so you should search and replace for these strings.
    12. +
    13. Name and Description: The next TODO entries are for names and descriptions. These are shown to users. For this example, we'll name it "Big and Round File Finder". The description can be anything you want. Note that Autopsy requires that modules have unique names, so don't make it too generic.
    14. +
    15. Ingest Module Class Name: The next thing to do is rename the ingest module class from "SampleJythonFileIngestModule" to "FindBigRoundFilesIngestModule". Our usual naming convention is that this class is the same as the factory class with "Factory" removed from the end.
    16. +
    17. startUp() method: The startUp() method is where each module initializes. For our example, we don't need to do anything special in here. Typically though, this is where you want to do stuff that could fail because throwing an exception here causes the entire ingest to stop.
    18. +
    19. process() method: This is where we do our analysis. The sample module is well documented with what it does. It ignores non-files, looks at the file name, and makes a blackboard artifact for ".txt" files. There are also a bunch of other things that it does to show examples for easy copy and pasting, but we don't need them in our module. We'll cover what goes into this method in the next section.
    20. shutdown() method: The shutDown() method either frees resources that were allocated or sends summary messages. For our module, it will do nothing.
    \subsection python_tutorial1_process The process() Method -The process() method is passed in a reference to an AbstractFile Object. With this, you have access to all of a file’s contents and metadata. We want to flag files that are larger than 10MB and that are a multiple of 4096 bytes. The following code does that: +The process() method is passed in a reference to an AbstractFile Object. With this, you have access to all of a file's contents and metadata. We want to flag files that are larger than 10MB and that are a multiple of 4096 bytes. The following code does that: \verbatim if ((file.getSize() > 10485760) and ((file.getSize() % 4096) == 0)): \endverbatim @@ -92,7 +92,7 @@ The above code adds the artifact and a single attribute to the blackboard in the ModuleDataEvent(FindBigRoundFilesIngestModuleFactory.moduleName, BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, None))\endverbatim -That’s it. Your process() method should look something like this: +That's it. Your process() method should look something like this: \verbatim def process(self, file): @@ -140,15 +140,15 @@ That’s it. Your process() method should look something like this: return IngestModule.ProcessResult.OK\endverbatim -Save this file and run the module on some of your data. If you have any big and round files, you should see an entry under the “Interesting Items” node in the tree. +Save this file and run the module on some of your data. If you have any big and round files, you should see an entry under the "Interesting Items" node in the tree. \image html bigAndRoundFiles.png \subsection python_tutorial1_debug Debugging and Development Tips -Whenever you have syntax errors or other errors in your script, you will get some form of dialog from Autopsy when you try to run ingest modules. If that happens, fix the problem and run ingest modules again. You don’t need to restart Autopsy each time! +Whenever you have syntax errors or other errors in your script, you will get some form of dialog from Autopsy when you try to run ingest modules. If that happens, fix the problem and run ingest modules again. You don't need to restart Autopsy each time! -The sample module has some log statements in there to help debug what is going on since we don’t know of better ways to debug the scripts while running in Autopsy. +The sample module has some log statements in there to help debug what is going on since we don't know of better ways to debug the scripts while running in Autopsy. */ diff --git a/docs/doxygen/modReportModuleTutorial.dox b/docs/doxygen/modReportModuleTutorial.dox new file mode 100644 index 0000000000..26cb14564e --- /dev/null +++ b/docs/doxygen/modReportModuleTutorial.dox @@ -0,0 +1,123 @@ +/*! \page mod_python_report_tutorial_page Python Tutorial #3: Writing a Report Module + +In our last two tutorials, we built a Python Autopsy \ref mod_python_file_ingest_tutorial_page "file ingest modules" and \ref mod_python_ds_ingest_tutorial_page "data source ingest modules" that analyzed the data sources as they were added to cases. In our third post, we're going to make an entirely different kind of module, a report module. + +Report modules are typically run after the user has completed their analysis. Autopsy comes with report modules to generate HTML, Excel, KML, and other types of reports. We're going to make a report module that outputs data in CSV. + +Like in the second tutorial, we are going to assume that you've read at least the \ref mod_python_file_ingest_tutorial_page "first tutorial" to know how to get your environment set up. As a reminder, Python modules in Autopsy are written in Jython and have access to all of the Java classes (which is why we have links to Java documentation below). + +\section python_tutorial3_report_modules Report Modules + +Autopsy report modules are often run after the user has run some ingest modules, reviewed the results, and tagged some files of interest. The user will be given a list of report modules to choose from. + +\image html reports_select.png + +The main reasons for writing an Autopsy report module are: +
      +
    • You need the results in a custom output format, such as XML or JSON.
    • +
    • You want to upload results to a central location.
    • +
    • You want to perform additional analysis after all ingest modules have run. While the modules have the word "report" in them, there is no actual requirement that they produce a report or export data. The module can simply perform data analysis and post artifacts to the blackboard like ingest modules do.
    • +
    + +As we dive into the details, you will notice that the report module API is fairly generic. This is because reports are created at a case level, not a data source level. So, when a user chooses to run a report module, all Autopsy does is tell it to run and gives it a path to a directory to store its results in. The report module can store whatever it wants in the directory. + +Note that if you look at the \ref mod_report_page "full developer docs", there are other report module types that are supported in Java. These are not supported though in Python. + +\subsection python_tutorial3_getting_content Getting Content + +With report modules, it is up to you to find the content that you want to include in your report or analysis. Generally, you will want to access some or all of the files, tagged files, or blackboard artifacts. As you may recall from the previous tutorials, blackboard artifacts are how ingest modules in Autopsy store their results so that they can be shown in the UI, used by other modules, and included in the final report. In this tutorial, we will introduce the SleuthkitCase class, which we generally don't introduce to module writers because it has lots of methods, many of which are low-level, and there are other classes, such as FileManager, that are more focused and easier to use. + +\subsubsection python_tutorial3_getting_files Getting Files + +You have three choices for getting files to report on. You can use the FileManager, which we used in \ref mod_python_ds_ingest_tutorial_page "the last Data Source-level Ingest Module tutorial". The only change is that you will need to call it multiple times, one for each data source in the case. You will have code that looks something like this: +\verbatim +dataSources = Case.getCurrentCase().getDataSources() +fileManager = Case.getCurrentCase().getServices().getFileManager() + +for dataSource in dataSources: + files = fileManager.findFiles(dataSource, "%.txt")\endverbatim + +Another approach is to use the SleuthkitCase.findAllFilesWhere() method that allows you to specify a SQL query. To use this method, you must know the schema of the database (which makes this a bit more challenging, but more powerful). The schema is defined on the wiki. + +Usually, you just need to focus on the tsk_files table. You may run into memory problems and you can also use SleuthkitCase.findAllFileIdsWhere() to get just the IDs and then call SleuthkitCase.getAbstractFileById() to get files as needed. + +A third approach is to call org.sleuthkit.autopsy.casemodule.Case.getDataSources(), and then recursively call getChildren() on each Content object. This will traverse all of the folders and files in the case. This is the most memory efficient, but also more complex to code. + +\subsubsection python_tutorial3_getting_artifacts Getting Blackboard Artifacts + +The blackboard is where modules store their analysis results. If you want to include them in your report, then there are several methods that you could use. If you want all artifacts of a given type, then you can use SleuthkitCase.getBlackboardArtifacts(). There are many variations of this method that take different arguments. Look at them to find the one that is most convenient for you. + +\subsubsection python_tutorial3_getting_tags Getting Tagged Files or Artifacts + +If you want to find files or artifacts that are tagged, then you can use the org.sleuthkit.autopsy.casemodule.services.TagsManager. It has methods to get all tags of a given name, such as org.sleuthkit.autopsy.casemodule.services.TagsManager.getContentTagsByTagName(). + +\section python_tutorial3_getting_started Getting Started + +\subsection python_tutorial3_making_the_folder Making the Folder + +We'll start by making our module folder. As we learned in \ref mod_python_file_ingest_tutorial_page "the first tutorial", every Python module in Autopsy gets its own folder. To find out where you should put your Python module, launch Autopsy and choose the Tools->Python Plugins menu item. That will open a subfolder in your AppData folder, such as "C:\Users\JDoe\AppData\Roaming\Autopsy\python_modules". + +Make a folder inside of there to store your module. Call it "DemoScript3". Copy the reportmodule.py sample file into the this new folder and rename it to CSVReport.py. + +\subsection python_tutorial3_writing_script Writing the Script + +We are going to write a script that makes some basic CSV output: file name and MD5 hash. Open the CSVReport.py file in your favorite Python text editor. The sample Autopsy Python modules all have TODO entries in them to let you know what you should change. The below steps jump from one TODO to the next. + +
      +
    1. Factory Class Name: The first thing to do is rename the sample class name from "SampleGeneralReportModule" to "CSVReportModule". In the sample module, there are several uses of this class name, so you should search and replace for these strings.
    2. +
    3. Name and Description: The next TODO entries are for names and descriptions. These are shown to users. For this example, we'll name it "CSV Hash Report Module". The description can be anything you want. Note that Autopsy requires that modules have unique names, so don't make it too generic.
    4. +
    5. Relative File Path: The next step is to specify the filename that your module is going to use for the report. Autopsy will later provide you with a folder name to save your report in. If you have multiple file names, then pick the main one. This path will be shown to the user after the report has been generated so that they can open it. For this example, we'll call it "hashes.csv" in the getRelativeFilePath() method.
    6. +
    7. generateReport() Method: This method is what is called when the user wants to run the module. It gets passed in the base directory to store the results in and a progress bar. It is responsible for making the report and calling Case.addReport() so that it will be shown in the tree. We'll cover the details of this method in a later section.
    8. +
    + +\subsection python_tutorial3_generate_report The generateReport() method + +The generateReport() method is where the work is done. The baseReportDir argument is a string for the base directory to store results in. The progressBar argument is a org.sleuthkit.autopsy.report.ReportProgressPanel +that shows the user progress while making long reports and to make the progress bar red if an error occurs. + +We'll use one of the basic ideas from the sample, so you can copy and paste from that as you see fit to make this method. Our general approach is going to be this: +
      +
    1. Open the CSV file.
    2. +
    3. Query for all files.
    4. +
    5. Cycle through each of the files and print a line of text.
    6. +
    7. Add the report to the Case database.
    8. +
    + +To focus on the essential code, we'll skip the progress bar details. However, the final solution that we'll link to at the end contains the progress bar code. + +To open the report file in the right folder, we'll need a line such as this: +\verbatim +fileName = os.path.join(baseReportDir, self.getRelativeFilePath()) +report = open(fileName, 'w')\endverbatim + +Next we need to query for the files. In our case, we want all of the files, but can skip the directories. We'll use lines such as this to get the current case and then call the SleuthkitCase.findAllFilesWhere() method. +\verbatim +sleuthkitCase = Case.getCurrentCase().getSleuthkitCase() +files = sleuthkitCase.findAllFilesWhere("NOT meta_type = " + + str(TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR.getValue()))\endverbatim + +Now, we want to print a line for each file. To do this, you'll need something like: +\verbatim +for file in files: + md5 = file.getMd5Hash() + + if md5 is None: + md5 = "" + + report.write(file.getParentPath() + file.getName() + "," + md5 + "n")\endverbatim + +Note that the file will only have an MD5 value if the Hash Lookup ingest module was run on the data source. + +Lastly, we want to add the report to the case database so that the user can later find it from the tree and we want to report that we completed successfully. +\verbatim +Case.getCurrentCase().addReport(fileName, self.moduleName, "Hashes CSV") +progressBar.complete(ReportStatus.COMPLETE)\endverbatim + +That's it. The final code can be found on github. + +\subsection python_tutorial3_conclusions Conclusions + +In this tutorial, we made a basic report module that creates a custom CSV file. The most challenging part of writing a report module is knowing how to get all of the data that you need. Hopefully, the \ref python_tutorial3_getting_content section above covered what you need, but if not, then go on the Sleuthkit forum and we'll try to point you in the right direction.

    + + +*/ \ No newline at end of file From e21a620a0dc66a6ba27e89db952c0b61f717a024 Mon Sep 17 00:00:00 2001 From: Ann Priestman Date: Fri, 18 Oct 2019 11:29:04 -0400 Subject: [PATCH 19/91] Update links on Python page --- docs/doxygen/modDevPython.dox | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/docs/doxygen/modDevPython.dox b/docs/doxygen/modDevPython.dox index 8878d97cdb..85b420a4be 100644 --- a/docs/doxygen/modDevPython.dox +++ b/docs/doxygen/modDevPython.dox @@ -15,11 +15,10 @@ Using it is very easy though in Autopsy and it allows you to access all of the J To develop a module, you should follow this section to get your environment setup and then read the later sections on the different types of modules. -There are also a set of tutorials that Basis Technology published on their blog. While not as thorough as this documentation, they are an easy introduction to the general ideas. - -- File Ingest Modules: http://www.basistech.com/python-autopsy-module-tutorial-1-the-file-ingest-module/ -- Data Source Ingest Modules: http://www.basistech.com/python-autopsy-module-tutorial-2-the-data-source-ingest-module/ -- Report Modules: http://www.basistech.com/python-autopsy-module-tutorial-3-the-report-module/ +There are also a set of tutorials that provide an easy introduction to the general ideas. +- File Ingest Modules: \subpage mod_python_file_ingest_tutorial_page +- Data Source Ingest Modules: \subpage mod_python_ds_ingest_tutorial_page +- Report Modules: \subpage mod_python_report_tutorial_page \section mod_dev_py_setup Basic Setup From bb2335ec0ee72ca7766d62e1b3b53b7d19a9d7c4 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Fri, 18 Oct 2019 14:17:33 -0400 Subject: [PATCH 20/91] Made progress bar refresh at 60FPS, fixed button text sizes --- .../autopsy/contentviewers/Bundle.properties | 4 +- .../contentviewers/Bundle.properties-MERGED | 4 +- .../contentviewers/MediaPlayerPanel.form | 6 +- .../contentviewers/MediaPlayerPanel.java | 66 ++++++++----------- 4 files changed, 34 insertions(+), 46 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties index facc16426f..b3a384ce48 100644 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties @@ -87,8 +87,8 @@ HtmlPanel.showImagesToggleButton.text=Download Images MediaViewImagePanel.tagsMenu.text_1=Tags Menu MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00 MediaPlayerPanel.audioSlider.toolTipText= -MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 -MediaPlayerPanel.fastForwardButton.text=\u25ba\u25ba +MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 +MediaPlayerPanel.fastForwardButton.text=\u2bc8\u2bc8 MediaPlayerPanel.playButton.text=\u25ba MediaPlayerPanel.infoLabel.text=No Errors MediaPlayerPanel.VolumeIcon.text=Volume diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED index b90b0d5d61..ba39d1d419 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED @@ -157,8 +157,8 @@ HtmlPanel.showImagesToggleButton.text=Download Images MediaViewImagePanel.tagsMenu.text_1=Tags Menu MediaPlayerPanel.progressLabel.text=00:00:00/00:00:00 MediaPlayerPanel.audioSlider.toolTipText= -MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 -MediaPlayerPanel.fastForwardButton.text=\u25ba\u25ba +MediaPlayerPanel.rewindButton.text=\u2bc7\u2bc7 +MediaPlayerPanel.fastForwardButton.text=\u2bc8\u2bc8 MediaPlayerPanel.playButton.text=\u25ba MediaPlayerPanel.infoLabel.text=No Errors MediaPlayerPanel.VolumeIcon.text=Volume diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form index 8fc346b491..605ed93697 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form @@ -41,7 +41,7 @@ - + @@ -85,8 +85,8 @@ - - + + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index ec5b90b79e..dec8bf55b4 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -54,6 +54,7 @@ import org.sleuthkit.datamodel.TskData; import javafx.embed.swing.JFXPanel; import javax.swing.SwingUtilities; import javax.swing.event.ChangeListener; +import org.freedesktop.gstreamer.ClockTime; import org.freedesktop.gstreamer.Format; import org.freedesktop.gstreamer.GstException; import org.freedesktop.gstreamer.event.SeekFlags; @@ -181,7 +182,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private Bus.EOS endOfStreamListener; //Update progress bar and time label during video playback - private final Timer timer = new Timer(75, new VideoPanelUpdater()); + //Updating every 16 MS = 62.5 FPS. + private final Timer timer = new Timer(16, new VideoPanelUpdater()); private static final int PROGRESS_SLIDER_SIZE = 2000; private static final int SKIP_IN_SECONDS = 30; @@ -260,21 +262,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie endOfStreamListener = new Bus.EOS() { @Override public void endOfStream(GstObject go) { - double playBackRate = getPlayBackRate(); - gstPlayBin.seek(playBackRate, - Format.TIME, - //FLUSH - flushes the pipeline - //ACCURATE - video will seek exactly to the position requested - EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), - //Set the start position to newTime - SeekType.SET, 0, - //Do nothing for the end position - SeekType.NONE, -1); - - SwingUtilities.invokeLater(() -> { - progressSlider.setValue(0); - }); - + gstPlayBin.seek(ClockTime.ZERO); /** * Keep the video from automatically playing */ @@ -411,16 +399,16 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private void updateTimeLabel(long start, long total) { progressLabel.setText(formatTime(start) + "/" + formatTime(total)); } - + /** * Reads the current selected playback rate from the speed combo box. - * + * * @return The selected rate. */ private double getPlayBackRate() { int selectIndex = playBackSpeedComboBox.getSelectedIndex(); String selectText = playBackSpeedComboBox.getItemAt(selectIndex); - return Double.valueOf(selectText.substring(0, selectText.length()-1)); + return Double.valueOf(selectText.substring(0, selectText.length() - 1)); } /** @@ -463,11 +451,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie protected Void doInBackground() throws Exception { if (!tempFile.exists() || tempFile.length() < sourceFile.getSize()) { progress = ProgressHandle.createHandle(NbBundle.getMessage(MediaPlayerPanel.class, "GstVideoPanel.ExtractMedia.progress.buffering", sourceFile.getName()), () -> this.cancel(true)); - + SwingUtilities.invokeLater(() -> { progressLabel.setText(NbBundle.getMessage(this.getClass(), "GstVideoPanel.progress.buffering")); }); - + progress.start(100); try { Files.createParentDirs(tempFile); @@ -556,7 +544,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE)); } - SwingUtilities.invokeLater(()-> { + SwingUtilities.invokeLater(() -> { updateTimeLabel(position, duration); }); } @@ -596,7 +584,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie ); videoPanelLayout.setVerticalGroup( videoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 125, Short.MAX_VALUE) + .addGap(0, 131, Short.MAX_VALUE) ); progressSlider.setValue(0); @@ -743,8 +731,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie .addGroup(controlPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(buttonPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(playBackPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(infoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE)) + .addGap(14, 14, 14) + .addComponent(infoLabel)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); @@ -786,12 +774,12 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); //Skip 30 seconds. long fastForwardDelta = TimeUnit.NANOSECONDS.convert(SKIP_IN_SECONDS, TimeUnit.SECONDS); - + //Ignore fast forward requests if there are less than 30 seconds left. - if(currentTime + fastForwardDelta >= duration) { + if (currentTime + fastForwardDelta >= duration) { return; } - + long newTime = currentTime + fastForwardDelta; double playBackRate = getPlayBackRate(); gstPlayBin.seek(playBackRate, @@ -813,29 +801,29 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); //Set playback rate before play. gstPlayBin.seek(playBackRate, - Format.TIME, - //FLUSH - flushes the pipeline - //ACCURATE - video will seek exactly to the position requested - EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), - //Set the start position to newTime - SeekType.SET, currentTime, - //Do nothing for the end position - SeekType.NONE, -1); + Format.TIME, + //FLUSH - flushes the pipeline + //ACCURATE - video will seek exactly to the position requested + EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), + //Set the start position to newTime + SeekType.SET, currentTime, + //Do nothing for the end position + SeekType.NONE, -1); gstPlayBin.play(); - } + } }//GEN-LAST:event_playButtonActionPerformed private void playBackSpeedComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_playBackSpeedComboBoxActionPerformed double playBackRate = getPlayBackRate(); long currentTime = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); - gstPlayBin.seek(playBackRate, + gstPlayBin.seek(playBackRate, Format.TIME, //FLUSH - flushes the pipeline //ACCURATE - video will seek exactly to the position requested EnumSet.of(SeekFlags.FLUSH, SeekFlags.ACCURATE), //Set the position to the currentTime, we are only adjusting the //playback rate. - SeekType.SET, currentTime, + SeekType.SET, currentTime, SeekType.NONE, 0); }//GEN-LAST:event_playBackSpeedComboBoxActionPerformed From c41b8a83f6ebdeb0998f6e0f8c9d02c250aaf396 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 21 Oct 2019 14:11:15 -0400 Subject: [PATCH 21/91] Simplified the model --- .../datamodel/BlackboardArtifactPoint.java | 103 ----- .../datamodel/BlackboardArtifactWaypoint.java | 238 ++++++++++++ .../datamodel/Bundle.properties-MERGED | 7 + .../geolocation/datamodel/DefaultPoint.java | 364 ------------------ .../datamodel/EXIFMetadataPoint.java | 65 ---- .../datamodel/GeolocationManager.java | 92 ++--- .../datamodel/GeolocationUtils.java | 192 +++++++++ .../autopsy/geolocation/datamodel/Route.java | 201 +++++++--- .../geolocation/datamodel/RoutePoint.java | 56 ++- .../geolocation/datamodel/SimplePoint.java | 92 ----- .../geolocation/datamodel/Waypoint.java | 134 +++++++ .../autopsy/report/modules/kml/KMLReport.java | 259 +++++++++---- 12 files changed, 972 insertions(+), 831 deletions(-) delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java deleted file mode 100755 index 10549cef92..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactPoint.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Interface to be implemented by all ArtifactPoint objects. - * - */ -public interface BlackboardArtifactPoint { - - /** - * Get the BlackboardArtifact for which this point represents. - * - * @return BlackboardArtifact for this point. - */ - BlackboardArtifact getArtifact(); - - /** - * Get the timestamp for this BlackboardArtifact. - * - * @return Timestamp in epoch seconds or null if none was set. - */ - Long getTimestamp(); - - /** - * Get the label for this point object. - * - * @return String label for the point or null if none was set - */ - String getLabel(); - - /** - * Get the latitude for this point. - * - * @return Returns the latitude for the point or null if none was set - */ - Double getLatitude(); - - /** - * Get the longitude for this point. - * - * @return Returns the longitude for the point or null if none was set - */ - Double getLongitude(); - - /** - * Get the Altitude for this point. - * - * @return Returns the Altitude for the point or null if none was set - */ - Double getAltitude(); - - /** - * Get the details of this point as an HTML formated string. - * - * @return The details string or empty string if none was set. - */ - String getDetails(); - - /** - * initPoint is the function where the work of setting the attributes the - * point. - * - * @throws TskCoreException - */ - void initPoint() throws TskCoreException; - - /** - * Get the latitude and longitude as a formatted string. - * - * @return Formatted String. - */ - String getFormattedCoordinates(); - - /** - * Get the latitude and longitude formatted as given. - * - * @param format The format String should assume that latitude will be - * passed first and that both are number values. - * - * @return Formatted string. - */ - String getFormattedCoordinates(String format); -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java new file mode 100755 index 0000000000..e46509cf80 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java @@ -0,0 +1,238 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import java.util.Map; +import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * Representation of a Waypoint created from a BlackboardArtifact. + * + */ +public class BlackboardArtifactWaypoint implements Waypoint { + + final private Long timestamp; + final private Double longitude; + final private Double latitude; + final private Double altitude; + final private String label; + final private AbstractFile image; + final private BlackboardArtifact artifact; + final private Waypoint.Type type; + final private Map otherAttributesMap; + + /** + * Constructs a Waypoint from a BlackboardArtifact + * + * @param artifact BlackboardArtifact with which to create the waypoint + * + * @throws TskCoreException + */ + protected BlackboardArtifactWaypoint(BlackboardArtifact artifact) throws TskCoreException { + this.artifact = artifact; + timestamp = getTimestampFromArtifact(artifact); + longitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); + latitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); + altitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); + image = getImageFromArtifact(artifact); + label = getLabelFromArtifact(artifact); + type = getTypeFromArtifact(artifact); + otherAttributesMap = GeolocationUtils.getOtherGeolocationAttributes(artifact); + } + + /** + * Get the BlackboardArtifact that this waypoint represents. + * + * @return BlackboardArtifact for this waypoint. + */ + BlackboardArtifact getArtifact() { + return artifact; + } + + @Override + public Long getTimestamp() { + return timestamp; + } + + @Override + public String getLabel() { + return label; + } + + @Override + public Double getLatitude() { + return latitude; + } + + @Override + public Double getLongitude() { + return longitude; + } + + @Override + public Double getAltitude() { + return altitude; + } + + @Override + public AbstractFile getImage() { + return image; + } + + @Override + public Waypoint.Type getType() { + return type; + } + + @Override + public Map getOtherProperties() { + return otherAttributesMap; + } + + /** + * Get the timestamp attribute based on type for the given artifact. + * + * @param artifact BlackboardArtifact for waypoint + * + * @return Long timestamp or null if a value was not found. + * + * @throws TskCoreException + */ + private Long getTimestampFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + if (artifact == null) { + return null; + } + + BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); + + switch (artifactType) { + case TSK_METADATA_EXIF: + return GeolocationUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); + default: + return GeolocationUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); + + } + } + + /** + * Gets the image from the given artifact, this is really only applicable to + * the artifact type TSK_METADATA_EXIF + * + * @param artifact BlackboardArtifact for waypoint + * + * @return AbstractFile image for this waypoint or null if one is not + * available + * + * @throws TskCoreException + */ + private AbstractFile getImageFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + if (artifact == null) { + return null; + } + + BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); + + switch (artifactType) { + case TSK_METADATA_EXIF: + return artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); + default: + return null; + } + } + + /** + * 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 TskCoreException + */ + private String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); + + if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { + if (getImage() != null) { + return getImage().getName(); + } + } + + String typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + if (typeLabel == null || typeLabel.isEmpty()) { + switch (artifactType) { + case TSK_GPS_SEARCH: + typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = "GPS Search"; + } + break; + case TSK_GPS_TRACKPOINT: + typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + } + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = "GPS Trackpoint"; + } + break; + case TSK_GPS_LAST_KNOWN_LOCATION: + typeLabel = "Last Known Location"; + break; + default: + typeLabel = ""; + break; + } + } + return typeLabel; + } + + /** + * Gets the type of waypoint based on the artifact. + * + * @param artifact BlackboardArtifact for waypoint + * + * @return A waypoint type. + */ + private Waypoint.Type getTypeFromArtifact(BlackboardArtifact artifact) { + BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); + + switch (artifactType) { + case TSK_GPS_LAST_KNOWN_LOCATION: + return Waypoint.Type.LAST_KNOWN_LOCATION; + case TSK_GPS_TRACKPOINT: + return Waypoint.Type.TRACKPOINT; + case TSK_GPS_SEARCH: + return Waypoint.Type.SEARCH; + case TSK_GPS_BOOKMARK: + return Waypoint.Type.BOOKMARK; + case TSK_METADATA_EXIF: + return Waypoint.Type.METADATA_EXIF; + default: + return Waypoint.Type.UNKNOWN; + } + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED new file mode 100755 index 0000000000..512dd5f416 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED @@ -0,0 +1,7 @@ +Route_Label=As-the-crow-flies Route +Waypoint_Bookmark_Display_String=GPS Bookmark +Waypoint_EXIF_Display_String=EXIF Metadata With Location +Waypoint_Last_Known_Display_String=GPS Last Known Location +Waypoint_Route_Point_Display_String=GPS Individual Route Point +Waypoint_Search_Display_String=GPS Search +Waypoint_Trackpoint_Display_String=GPS Trackpoint diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java deleted file mode 100755 index 8fdf463363..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/DefaultPoint.java +++ /dev/null @@ -1,364 +0,0 @@ -/* - * - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import java.text.SimpleDateFormat; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Abstract class representing the basics of a BlackboardARtifacrPoint. - */ -public abstract class DefaultPoint implements BlackboardArtifactPoint{ - final private BlackboardArtifact artifact; - - private String label = ""; - private Long timestamp = null; - private String details = null; - private Double longitude = null; - private Double latitude = null; - private Double altitude = null; - - private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); - private static final String DEFAULT_COORD_FORMAT = "%.2f, %.2f"; - - /** - * Construct a new point with the given artifact. - * - * @param artifact - */ - public DefaultPoint(BlackboardArtifact artifact) { - this.artifact = artifact; - } - - /** - * Construct a new point with the given parameters. - * - * @param artifact The BlackboardArtifact object that this point represents - * @param latitude The latitude for the given artifact - * @param longitude The longitude for the given artifact - * @param label A label for the point - */ - public DefaultPoint(BlackboardArtifact artifact, Double latitude, Double longitude, String label) { - this.artifact = artifact; - this.latitude = latitude; - this.longitude = longitude; - this.label = label; - } - - @Override - public BlackboardArtifact getArtifact() { - return artifact; - } - - @Override - public Long getTimestamp() { - return timestamp; - } - - /** - * Set the timestamp for this point. - * - * @param timestamp Epoch seconds - */ - protected void setTimestamp(Long timestamp) { - this.timestamp = timestamp; - } - - @Override - public String getLabel() { - return label; - } - - /** - * Set the label for this point. - * - * @param label String label for the point. - */ - protected void setLabel(String label) { - this.label = label; - } - - @Override - public String getDetails() { - return details; - } - - /** - * Set the details information for the point. - * - * @param details Formatted detail information for display. - */ - protected void setDetails(String details) { - this.details = details; - } - - @Override - public Double getLatitude() { - return latitude; - } - - /** - * Set the latitude for this point. - * - * @param latitude Double latitude value - */ - protected void setLatitude(Double latitude) { - this.latitude = latitude; - } - - @Override - public Double getLongitude() { - return longitude; - } - - /** - * Set the longitude for this point. - * - * @param longitude Double longitude value - */ - protected void setLongitude(Double longitude) { - this.longitude = longitude; - } - - @Override - public Double getAltitude() { - return altitude; - } - - /** - * Set the altitude for the point. - * - * @param altitude Double altitude value - */ - protected void setAltitude(Double altitude) { - this.altitude = altitude; - } - - @Override - public String getFormattedCoordinates() { - return getFormattedCoordinates(DEFAULT_COORD_FORMAT); - } - - @Override - public String getFormattedCoordinates(String format) { - return String.format(format, getLatitude(), getLongitude()); - } - - /** - * This function with its formatting is from the original KMLReport. - * - * This method creates a text description for a map feature using all the - * geospatial and time data we can for the Artifact. It queries the - * following attributes: - * - * TSK_GEO_LATITUDE 54; TSK_GEO_LONGITUDE 55; TSK_GEO_LATITUDE_START 98; - * TSK_GEO_LATITUDE_END 99; TSK_GEO_LONGITUDE_START 100; - * TSK_GEO_LONGITUDE_END 101; TSK_GEO_VELOCITY 56; TSK_GEO_ALTITUDE 57; - * TSK_GEO_BEARING 58; TSK_GEO_HPRECISION 59; TSK_GEO_VPRECISION 60; - * TSK_GEO_MAPDATUM 61; TSK_DATETIME_START 83; TSK_DATETIME_END 84; - * TSK_LOCATION 86; TSK_PATH_SOURCE 94; - * - * @param artifact the artifact to query. - * @param featureType the type of Artifact we're working on. - * - * @return a String with the information we have available - */ - String getDetailsFromArtifact() throws TskCoreException{ - final String SEP = "
    "; - StringBuilder result = new StringBuilder(); //NON-NLS - - result.append("

    "); - result.append(BlackboardArtifact.ARTIFACT_TYPE.fromLabel(getArtifact().getArtifactTypeName()).getDisplayName()); - result.append("

    "); - - String name = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - if (name != null && !name.isEmpty()) { - result.append("Name: ").append(name).append(SEP); //NON-NLS - } - - String location = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); - if (location != null && !location.isEmpty()) { - result.append("Location: ").append(location).append(SEP); //NON-NLS - } - - if (timestamp != null) { - result.append("Timestamp: ").append(getTimeStamp(timestamp)).append(SEP); //NON-NLS - result.append("Unix timestamp: ").append(timestamp).append(SEP); //NON-NLS - } - - Long startingTimestamp = getLong( BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START); - if (startingTimestamp != null) { - result.append("Starting Timestamp: ").append(getTimeStamp(startingTimestamp)).append(SEP); //NON-NLS - result.append("Starting Unix timestamp: ").append(startingTimestamp).append(SEP); //NON-NLS - } - - Long endingTimestamp = getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END); - if (endingTimestamp != null) { - result.append("Ending Timestamp: ").append(getTimeStamp(endingTimestamp)).append(SEP); //NON-NLS - result.append("Ending Unix timestamp: ").append(endingTimestamp).append(SEP); //NON-NLS - } - - Long createdTimestamp = getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); - if (createdTimestamp != null) { - result.append("Created Timestamp: ").append(getTimeStamp(createdTimestamp)).append(SEP); //NON-NLS - result.append("Created Unix timestamp: ").append(createdTimestamp).append(SEP); //NON-NLS - } - - if (latitude != null) { - result.append("Latitude: ").append(latitude).append(SEP); //NON-NLS - } - - if (longitude != null) { - result.append("Longitude: ").append(longitude).append(SEP); //NON-NLS - } - - Double velocity = getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VELOCITY); - if (velocity != null) { - result.append("Velocity: ").append(velocity).append(SEP); //NON-NLS - } - - if (altitude != null) { - result.append("Altitude: ").append(altitude).append(SEP); //NON-NLS - } - - Double bearing = getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_BEARING); - if (bearing != null) { - result.append("Bearing: ").append(bearing).append(SEP); //NON-NLS - } - - Integer hPrecision = getInteger(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_HPRECISION); - if (hPrecision != null) { - result.append("Horizontal Precision Figure of Merit: ").append(hPrecision).append(SEP); //NON-NLS - } - - Integer vPrecision = getInteger(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VPRECISION); - if (vPrecision != null) { - result.append("Vertical Precision Figure of Merit: ").append(vPrecision).append(SEP); //NON-NLS - } - - String mapDatum = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_MAPDATUM); - if (mapDatum != null && !mapDatum.isEmpty()) { - result.append("Map Datum: ").append(mapDatum).append(SEP); //NON-NLS - } - - String programName = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); - if (programName != null && !programName.isEmpty()) { - result.append("Reported by: ").append(programName).append(SEP); //NON-NLS - } - - String flag = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); - if (flag != null && !flag.isEmpty()) { - result.append("Flag: ").append(flag).append(SEP); //NON-NLS - } - - String pathSource = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_SOURCE); - if (pathSource != null && !pathSource.isEmpty()) { - result.append("Source: ").append(pathSource).append(SEP); //NON-NLS - } - - String deviceMake = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MAKE); - if (deviceMake != null && !deviceMake.isEmpty()) { - result.append("Device Make: ").append(deviceMake).append(SEP); //NON-NLS - } - - String deviceModel = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MODEL); - if (deviceModel != null && !deviceModel.isEmpty()) { - result.append("Device Model: ").append(deviceModel).append(SEP); //NON-NLS - } - - return result.toString(); - } - - /** - * Helper function for getting a String attribute from an artifact. - * - * @param type BlackboardAttribute type - * - * @return String value for the given attribute. - * - * @throws TskCoreException - */ - String getString(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); - return (attribute != null ? attribute.getValueString() : null); - } - - /** - * Helper function for getting a Double attribute from an artifact. - * - * @param type BlackboardAttribute type - * - * @return Double value for the given attribute. - * - * @throws TskCoreException - */ - Double getDouble(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); - return (attribute != null ? attribute.getValueDouble() : null); - } - - /** - * Helper function for getting a Long attribute from an artifact. - * - * @param type BlackboardAttribute type - * - * @return Long value for the given attribute. - * - * @throws TskCoreException - */ - Long getLong(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); - return (attribute != null ? attribute.getValueLong() : null); - } - - /** - * Helper function for getting a Integer attribute from an artifact. - * - * @param type BlackboardAttribute type - * - * @return Integer value for the given attribute. - * - * @throws TskCoreException - */ - Integer getInteger(BlackboardAttribute.ATTRIBUTE_TYPE type) throws TskCoreException{ - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(type)); - return (attribute != null ? attribute.getValueInt() : null); - } - - /** - * Helper function for consistently formatting the timestamp. - * - * @param type BlackboardAttribute type - * - * @return The timestamp value formatted as string, or empty string if no - * timestamp is available. - * - * @throws TskCoreException - */ - String getTimeStamp(long timeStamp) { - if(getTimestamp() != null) { - return DATE_FORMAT.format(new java.util.Date(getTimestamp() * 1000)); - } else { - return ""; - } - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java deleted file mode 100755 index 67056fa2b3..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFMetadataPoint.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Extends SimplePoint for TSK_EXIF_METADATA artifacts. - * - */ -public class EXIFMetadataPoint extends SimplePoint{ - private AbstractFile imageFile; - - /** - * Construct a EXIF point - * - * @param artifact - */ - EXIFMetadataPoint(BlackboardArtifact artifact) { - super(artifact); - } - - @Override - public void initPoint() throws TskCoreException{ - super.initPoint(); - - setTimestamp(getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED)); - - BlackboardArtifact artifact = getArtifact(); - if(artifact != null) { - imageFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); - } - - setLabel(imageFile.getName()); - } - - /** - * Get the image for this point. - * - * @return Return the AbstractFile image for the EXIF_METADATA artifact. - */ - public AbstractFile getImage() { - return imageFile; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java index 05334473ea..fe5cdd1884 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java @@ -32,13 +32,21 @@ import org.sleuthkit.datamodel.TskCoreException; public class GeolocationManager { /** - * Returns a list of points for the artifacts with geolocation information. + * Add a private constructor to silence codacy warning about making this + * class a utility class as I suspect this class may grow when filtering is + * added. + */ + private GeolocationManager() { + + } + + /** + * Returns a list of Waypoints for the artifacts with geolocation + * information. * * List will include artifacts of type: TSK_GPS_TRACKPOINT TSK_GPS_SEARCH * TSK_GPS_LAST_KNOWN_LOCATION TSK_GPS_BOOKMARK TSK_METADATA_EXIF * - * Optionally TSK_GPS_ROUTE points can also be added to the list. - * * @param skCase Currently open SleuthkitCase * @param includeRoutes True to include the points at are in TSK_GPS_ROUTE * objects @@ -47,15 +55,10 @@ public class GeolocationManager { * * @throws TskCoreException */ - static public List getPoints(SleuthkitCase skCase, boolean includeRoutes) throws TskCoreException { - List points = new ArrayList<>(); + static public List getWaypoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); - points.addAll(getSimplePoints(skCase)); - points.addAll(getEXIFPoints(skCase)); - - if (includeRoutes) { - points.addAll(getGPSRoutePoints(skCase)); - } + points.addAll(getBasicPoints(skCase)); return points; } @@ -75,19 +78,18 @@ public class GeolocationManager { List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); for (BlackboardArtifact artifact : artifacts) { Route route = new Route(artifact); - route.initRoute(); routes.add(route); } return routes; } /** - * Get a list of BlackboardArtifactPoints for the "simple" GPS artifacts. - * Artifacts that will be included: TSK_GPS_TRACKPOINT TSK_GPS_SEARCH - * TSK_GPS_LAST_KNOWN_LOCATION TSK_GPS_BOOKMARK + * Get a list of Waypoints for the GPS artifacts. Artifacts that will be + * included: TSK_GPS_TRACKPOINT TSK_GPS_SEARCH TSK_GPS_LAST_KNOWN_LOCATION + * TSK_GPS_BOOKMARK * - * BlackboardArtifactPoint objects will be created and added to the list - * only for artifacts with TSK_GEO_LONGITUDE and TSK_LATITUDE attributes. + * Waypoint objects will be created and added to the list only for artifacts + * with TSK_GEO_LONGITUDE and TSK_LATITUDE attributes. * * @param skCase Currently open SleuthkitCase * @@ -96,19 +98,19 @@ public class GeolocationManager { * * @throws TskCoreException */ - static private List getSimplePoints(SleuthkitCase skCase) throws TskCoreException { + static private List getBasicPoints(SleuthkitCase skCase) throws TskCoreException { - List points = new ArrayList<>(); + List points = new ArrayList<>(); List artifacts = new ArrayList<>(); artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)); artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH)); artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION)); artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK)); + artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF)); for (BlackboardArtifact artifact : artifacts) { - BlackboardArtifactPoint point = new SimplePoint(artifact); - point.initPoint(); + BlackboardArtifactWaypoint point = new BlackboardArtifactWaypoint(artifact); // Only add to the list if the point has a valid latitude // and longitude. if (point.getLatitude() != null && point.getLongitude() != null) { @@ -118,52 +120,4 @@ public class GeolocationManager { return points; } - - /** - * Get a list of BlackboardArtifactPoints for TSK_METADATA_EXIF artifacts. - * - * BlackboardArtifactPoint objects will be created and added to the list - * only for artifacts with TSK_GEO_LONGITUDE and TSK_LATITUDE attributes. - * - * @param skCase Currently open SleuthkitCase - * - * @return List of BlackboardArtifactPoints for above artifacts or empty - * list if none where found. - * - * @throws TskCoreException - */ - static private List getEXIFPoints(SleuthkitCase skCase) throws TskCoreException { - List points = new ArrayList<>(); - List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); - for (BlackboardArtifact artifact : artifacts) { - BlackboardArtifactPoint point = new EXIFMetadataPoint(artifact); - - point.initPoint(); - if (point.getLatitude() != null && point.getLongitude() != null) { - points.add(point); - } - } - - return points; - } - - /** - * Get a list of BlackboardArtifactPoints from the list of routes. - * - * @param skCase Currently open SleuthkitCase - * - * @return A list of route points, or empty list if none were found. - * - * @throws TskCoreException - */ - static private List getGPSRoutePoints(SleuthkitCase skCase) throws TskCoreException { - List points = new ArrayList<>(); - - for (Route route : getGPSRoutes(skCase)) { - points.addAll(route.getRoute()); - } - - return points; - } - } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java new file mode 100755 index 0000000000..20e8b6ab7b --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java @@ -0,0 +1,192 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.geolocation.datamodel; + +import java.util.HashMap; +import java.util.Map; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * + * + */ +public class GeolocationUtils { + + private static final String DEFAULT_COORD_FORMAT = "%.2f, %.2f"; + + /** + * This is a list of attributes that are related to a geolocation waypoint + * but are for information\artifact properties purpose. They are not needed + * for the placement of a point on a map; + */ + private static final BlackboardAttribute.ATTRIBUTE_TYPE[] OTHER_GEO_ATTRIBUTES = { + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VELOCITY, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_BEARING, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_HPRECISION, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VPRECISION, + 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 + }; + + static public String getFormattedCoordinates(Double latitude, Double longitude) { + if (latitude == null || longitude == null) { + return ""; + } + + return String.format(DEFAULT_COORD_FORMAT, latitude, longitude); + } + + /** + * Helper function for getting a String attribute from an artifact. This + * will work for all attributes + * + * @param artifact The BlackboardArtifact to get the attributeType + * @param attributeType BlackboardAttribute attributeType + * + * @return String value for the given attribute or null if attribute was not + * set for the given artifact + * + * @throws TskCoreException + */ + static protected String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + if (artifact == null) { + return null; + } + + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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 protected Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + if (artifact == null) { + return null; + } + + if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE) { + return null; + } + + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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 protected Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + 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 = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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 protected Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + if (artifact == null) { + return null; + } + + if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER) { + return null; + } + + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + return (attribute != null ? attribute.getValueInt() : null); + } + + /** + * Helper function for consistently formatting the timestamp. + * + * @param type BlackboardAttribute type + * + * @return The timestamp value formatted as string, or empty string if no + * timestamp is available. + * + * @throws TskCoreException + */ + static protected String getFormattedTimestamp(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + if (artifact == null) { + return null; + } + + if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) { + return null; + } + + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + return (attribute != null ? attribute.getDisplayString() : null); + } + + /** + * Returns a Map of formatted artifact attributes for geolocation artifacts. + * The map key will be the display string off the attribute, the value will + * be either a formatted value or a an empty string. + * + * @param artifact + * + * @return + */ + static protected Map getOtherGeolocationAttributes(BlackboardArtifact artifact) throws TskCoreException { + Map map = new HashMap<>(); + + for (BlackboardAttribute.ATTRIBUTE_TYPE type : OTHER_GEO_ATTRIBUTES) { + String key = type.getDisplayName(); + String value = getString(artifact, type); + + if (value == null) { + value = ""; + } + + map.put(key, value); + } + + return map; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index 47e5ccbea3..68d93509d5 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -21,31 +21,52 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; /** * A Route represents a TSK_GPS_ROUTE artifact which has a start and end point - * however the class was written with the assumption that some routes may have + * however the class was written with the assumption that some routes may have * more that two points. - * + * */ +@Messages({ + "Route_Label=As-the-crow-flies Route", + "Route_Start_Label=Start", + "Route_End_Label=End" +}) public class Route { - private final BlackboardArtifact artifact; - private final List points; - private long timestamp; - private String details; - private Double altitude = null; + + private final List points; + private final Long timestamp; + private final Double altitude; + private final Map otherAttributesMap; /** * Construct a route for the given artifact. * * @param artifact TSK_GPS_ROUTE artifact object */ - protected Route(BlackboardArtifact artifact) { - this.artifact = artifact; + protected Route(BlackboardArtifact artifact) throws TskCoreException { points = new ArrayList<>(); + Waypoint point = getRouteStartPoint(artifact); + + if (point != null) { + points.add(point); + } + + point = getRouteEndPoint(artifact); + + if (point != null) { + points.add(point); + } + + altitude = getRouteAltitude(artifact); + timestamp = getRouteTimestamp(artifact); + otherAttributesMap = initalizeOtherAttributes(artifact); } /** @@ -53,68 +74,150 @@ public class Route { * * @return List of ArtifactWaypoints for this route */ - public List getRoute() { + public List getRoute() { return points; } - - public String getDetails() { - return details; - } - - public BlackboardArtifact getArtifact() { - return artifact; - } - + + /** + * Get the timestamp for this Route + * + * @return The timestamp (epoch seconds) or null if none was set. + */ public Long getTimestamp() { return timestamp; } - + + /** + * Get the altitude for this route. + * + * @return The Double altitude value or null if none was set. + */ public Double getAltitude() { return altitude; } /** - * Initialize the route. + * Get the "Other attributes" for this route. The map will contain display + * name, formatted value pairs. + * + * @return Map of key, value pairs. */ - protected void initRoute() throws TskCoreException { - if (artifact == null) { - return; - } - + public Map getOtherProperties() { + return otherAttributesMap; + } + + /** + * Get the route label. + * + * This will return the original hard coded label from the KML report: + * As-the-crow-flies Route + */ + public String getLabel() { + return Bundle.Route_Label(); + } + + /** + * Get the route start point. + * + * @param artifact The BlackboardARtifact object from which this route is + * created + * + * @return Start RoutePoint or null if valid longitude and latitude are not + * found + * + * @throws TskCoreException + */ + private Waypoint getRouteStartPoint(BlackboardArtifact artifact) throws TskCoreException { Double latitude; Double longitude; BlackboardAttribute attribute; + RoutePoint point = null; attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START)); latitude = attribute != null ? attribute.getValueDouble() : null; - + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START)); longitude = attribute != null ? attribute.getValueDouble() : null; - + if (latitude != null && longitude != null) { - RoutePoint point = new RoutePoint(artifact, this, latitude, longitude, "Start"); - point.initPoint(); - points.add(point); - } - - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END)); - latitude = attribute != null ? attribute.getValueDouble() : null; - - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END)); - longitude = attribute != null ? attribute.getValueDouble() : null; - - if (latitude != null && longitude != null) { - RoutePoint point = new RoutePoint(artifact, this, latitude, longitude, "End"); - point.initPoint(); - points.add(point); + point = new RoutePoint(this, latitude, longitude, Bundle.Route_Start_Label()); } - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); - altitude = attribute != null ? attribute.getValueDouble() : null; - - // Get the creation date - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); - timestamp = attribute != null ? attribute.getValueLong() : null; + return point; } + /** + * Get the route End point. + * + * @param artifact The BlackboardARtifact object from which this route is + * created + * + * @return End RoutePoint or null if valid longitude and latitude are not + * found + * + * @throws TskCoreException + */ + private Waypoint getRouteEndPoint(BlackboardArtifact artifact) throws TskCoreException { + Double latitude; + Double longitude; + BlackboardAttribute attribute; + RoutePoint point = null; + + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END)); + latitude = attribute != null ? attribute.getValueDouble() : null; + + attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END)); + longitude = attribute != null ? attribute.getValueDouble() : null; + + if (latitude != null && longitude != null) { + point = new RoutePoint(this, latitude, longitude, Bundle.Route_End_Label()); + } + + 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 TskCoreException + */ + private Double getRouteAltitude(BlackboardArtifact artifact) throws TskCoreException { + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); + return attribute != null ? attribute.getValueDouble() : null; + } + + /** + * 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 TskCoreException + */ + private Long getRouteTimestamp(BlackboardArtifact artifact) throws TskCoreException { + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); + return attribute != null ? attribute.getValueLong() : null; + } + + /** + * Retrieve the "Other attributes" for this route. The map will contain + * display name, formatted value pairs. + * + * @param artifact The BlackboardARtifact object from which this route is + * created + * + * @return A Map of other attributes for this route. + * + * @throws TskCoreException + */ + private Map initalizeOtherAttributes(BlackboardArtifact artifact) throws TskCoreException { + return GeolocationUtils.getOtherGeolocationAttributes(artifact); + } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java index aa830a2581..23cc4b8198 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java @@ -19,12 +19,19 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.TskCoreException; +import java.util.Map; +import org.sleuthkit.datamodel.AbstractFile; -public class RoutePoint extends DefaultPoint { +/** + * A point in a Route. For future use this point will have a pointer to its + * parent route. + */ +public class RoutePoint implements Waypoint { private final Route parent; + private final Double longitude; + private final Double latitude; + private final String label; /** * Construct a route for a route. @@ -34,23 +41,50 @@ public class RoutePoint extends DefaultPoint { * @param longitude Longitude for point * @param label Way point label. */ - protected RoutePoint(BlackboardArtifact artifact, Route parent, double latitude, double longitude, String label) { - super(artifact, latitude, longitude, label); + protected RoutePoint(Route parent, double latitude, double longitude, String label) { + this.longitude = longitude; + this.latitude = latitude; + this.label = label; this.parent = parent; } - @Override - public void initPoint() throws TskCoreException{ - setDetails(getDetailsFromArtifact()); - } - @Override public Long getTimestamp() { return parent.getTimestamp(); } - + + @Override + public String getLabel() { + return label; + } + + @Override + public Double getLatitude() { + return latitude; + } + + @Override + public Double getLongitude() { + return longitude; + } + @Override public Double getAltitude() { return parent.getAltitude(); } + + @Override + public Map getOtherProperties() { + return parent.getOtherProperties(); + } + + @Override + public AbstractFile getImage() { + return null; + } + + @Override + public Waypoint.Type getType() { + return Waypoint.Type.ROUTE_POINT; + } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java deleted file mode 100755 index db091b37f0..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SimplePoint.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * - * A basic Artifact point for artifacts that use the following attributes: - * TSK_GEO_LONGITUDE - * TSK_GEO_LATITUDE - * TSK_GEO_ALTITUDE - * TSK_DATETIME - * - */ -public class SimplePoint extends DefaultPoint{ - - /** - * Construct a simple point object. - * - * @param artifact - */ - SimplePoint(BlackboardArtifact artifact) { - super(artifact); - } - - @Override - public void initPoint() throws TskCoreException{ - setLongitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE)); - setLatitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE)); - setAltitude(getDouble(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); - setTimestamp(getLong(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); - - setDetails(getDetailsFromArtifact()); - setLabel(getLabelBasedOnType()); - } - - /** - * Create the point label based on the artifact type. - * - * This code needs to be revisited to make sure these back up labels make - * sense. - * - * @return A label for the point. - * - * @throws TskCoreException - */ - String getLabelBasedOnType() throws TskCoreException{ - String label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - - if(label == null || label.isEmpty()) { - if (getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID()) { - label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); - if(label == null || label.isEmpty()) { - label = "GPS Search"; - } - } else if (getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()) { - label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); - if(label == null || label.isEmpty()) { - label = getString(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); - } - - if(label == null || label.isEmpty()) { - label = "GPS Trackpoint"; - } - } else if (getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID()) { - label = "Last Known Location"; - } - } - - return label; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java new file mode 100755 index 0000000000..736d0726a1 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java @@ -0,0 +1,134 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import java.util.Map; +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.datamodel.AbstractFile; + +/** + * The basic details of a waypoint. + * + */ +public interface Waypoint { + + /** + * Get the timestamp for this BlackboardArtifact. + * + * @return Timestamp in epoch seconds or null if none was set. + */ + Long getTimestamp(); + + /** + * Get the label for this point object. + * + * @return String label for the point or null if none was set + */ + String getLabel(); + + /** + * Get the latitude for this point. + * + * @return Returns the latitude for the point or null if none was set + */ + Double getLatitude(); + + /** + * Get the longitude for this point. + * + * @return Returns the longitude for the point or null if none was set + */ + Double getLongitude(); + + /** + * Get the Altitude for this point. + * + * @return Returns the Altitude for the point or null if none was set + */ + Double getAltitude(); + + /** + * Gets a Map of other properties that may be interesting to this way point. + * This map will not include properties for which there are getter functions + * for. + * + * The key is a "Display String", the value will be either an empty string + * or the formatted value. + * + * @return A Map of waypoint properties + */ + Map getOtherProperties(); + + /** + * Get the image for this waypoint. + * + * @return AbstractFile image + */ + AbstractFile getImage(); + + /** + * Get the type of waypoint + * + * @return WaypointType value + */ + Type getType(); + + // Display names are from the original KML Report + @Messages({ + "Waypoint_Bookmark_Display_String=GPS Bookmark", + "Waypoint_Last_Known_Display_String=GPS Last Known Location", + "Waypoint_EXIF_Display_String=EXIF Metadata With Location", + "Waypoint_Route_Point_Display_String=GPS Individual Route Point", + "Waypoint_Search_Display_String=GPS Search", + "Waypoint_Trackpoint_Display_String=GPS Trackpoint" + }) + + /** + * An enum to keep track of the type of a way point. + */ + enum Type { + BOOKMARK(Bundle.Waypoint_Bookmark_Display_String()), + LAST_KNOWN_LOCATION(Bundle.Waypoint_Last_Known_Display_String()), + METADATA_EXIF(Bundle.Waypoint_EXIF_Display_String()), + ROUTE_POINT(Bundle.Waypoint_Route_Point_Display_String()), + SEARCH(Bundle.Waypoint_Search_Display_String()), + TRACKPOINT(Bundle.Waypoint_Trackpoint_Display_String()), + UNKNOWN("Unknown"); + + private final String displayName; + + /** + * Constructs a Waypoint.Type enum value + * + * @param displayName String value title for enum + */ + private Type(String displayName) { + this.displayName = displayName; + } + + /** + * Returns the display name for the type + * + * @return String display name + */ + public String getDisplayName() { + return displayName; + } + } +} diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index c494ab612b..311a652335 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -27,7 +27,6 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.*; import org.sleuthkit.autopsy.ingest.IngestManager; -import org.sleuthkit.datamodel.BlackboardArtifact; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -37,6 +36,9 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.List; +import java.util.Map; +import java.util.Iterator; +import java.util.Map.Entry; import java.util.logging.Level; import org.jdom2.Document; import org.jdom2.Element; @@ -46,13 +48,13 @@ import org.jdom2.output.XMLOutputter; import org.jdom2.CDATA; import org.openide.filesystems.FileUtil; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; -import org.sleuthkit.autopsy.geolocation.datamodel.EXIFMetadataPoint; +import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationManager; +import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationUtils; import org.sleuthkit.autopsy.geolocation.datamodel.Route; import org.sleuthkit.autopsy.report.ReportBranding; import org.sleuthkit.autopsy.report.ReportProgressPanel; import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; -import org.sleuthkit.autopsy.geolocation.datamodel.BlackboardArtifactPoint; /** * Generates a KML file based on geospatial information from the BlackBoard. @@ -68,8 +70,8 @@ class KMLReport implements GeneralReportModule { private SleuthkitCase skCase; private final SimpleDateFormat kmlDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); private Namespace ns; - private final String SEP = "
    "; - + String HTML_PROP_FORMAT = "%s: %s
    "; + private Element gpsExifMetadataFolder; private Element gpsBookmarksFolder; private Element gpsLastKnownLocationFolder; @@ -123,8 +125,8 @@ class KMLReport implements GeneralReportModule { "KMLReport.gpsRouteError=Could not extract GPS Route information.", "KMLReport.gpsRouteDatabaseError=Could not get GPS Routes from database.", "KMLReport.gpsSearchDatabaseError=Could not get GPS Searches from database.", - "KMLReport.trackpointError=Could not extract Trackpoint information.", - "KMLReport.trackpointDatabaseError=Could not get GPS Trackpoints from database.", + "KMLReport.trackpointError=Could not extract Trackpoint information.", + "KMLReport.trackpointDatabaseError=Could not get GPS Trackpoints from database.", "KMLReport.stylesheetError=Error placing KML stylesheet. The .KML file will not function properly.", "KMLReport.kmlFileWriteError=Could not write the KML file.", "# {0} - filePath", @@ -145,7 +147,7 @@ class KMLReport implements GeneralReportModule { progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.querying")); String kmlFileFullPath = baseReportDir + REPORT_KML; //NON-NLS String errorMessage = ""; - + skCase = currentCase.getSleuthkitCase(); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.loading")); @@ -153,15 +155,15 @@ class KMLReport implements GeneralReportModule { Document kmlDocument = setupReportDocument(); ReportProgressPanel.ReportStatus result = ReportProgressPanel.ReportStatus.COMPLETE; - - try { - makeRoutes(skCase); - addLocationsToReport(skCase, baseReportDir); - } catch(TskCoreException | IOException ex) { - errorMessage = "Failed to complete report."; + + try { + makeRoutes(skCase); + addLocationsToReport(skCase, baseReportDir); + } catch (TskCoreException | IOException ex) { + errorMessage = "Failed to complete report."; logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS result = ReportProgressPanel.ReportStatus.ERROR; - } + } // Copy the style sheet try { @@ -200,10 +202,10 @@ class KMLReport implements GeneralReportModule { progressPanel.complete(result, errorMessage); } - + /** * Do all of the setting up of elements needed for the report. - * + * * @return The report document object. */ private Document setupReportDocument() { @@ -274,26 +276,27 @@ class KMLReport implements GeneralReportModule { document.addContent(gpsRouteFolder); document.addContent(gpsSearchesFolder); document.addContent(gpsTrackpointsFolder); - + return kmlDocument; } - + /** * For the given point, create the data needed for the EXIF_METADATA - * - * @param location The geolocation of the data - * @param baseReportDirectory The report directory where the image will be created. - * - * @throws IOException + * + * @param location The geolocation of the data + * @param baseReportDirectory The report directory where the image will be + * created. + * + * @throws IOException */ - void addExifMetadataContent(EXIFMetadataPoint point, String baseReportDirectory) throws IOException{ + void addExifMetadataContent(Waypoint point, String baseReportDirectory) throws IOException { Element mapPoint = makePoint(point); - if(mapPoint == null) { + if (mapPoint == null) { return; } - + AbstractFile abstractFile = point.getImage(); - String details = point.getDetails(); + String details = getFormattedDetails(point); Path path; copyFileUsingStream(abstractFile, Paths.get(baseReportDirectory, abstractFile.getName()).toFile()); @@ -304,57 +307,66 @@ class KMLReport implements GeneralReportModule { } if (path == null) { path = Paths.get(abstractFile.getName()); - } - - gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, point.getFormattedCoordinates())); + } + + gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, GeolocationUtils.getFormattedCoordinates(point.getLatitude(), point.getLongitude()))); } - + /** * Add the new location to the correct folder based on artifact type. - * @param skCase Currently open case + * + * @param skCase Currently open case * @param baseReportDir Output directory for the report. - * + * * @throws TskCoreException - * @throws IOException + * @throws IOException */ void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws TskCoreException, IOException { - List points = GeolocationManager.getPoints(skCase, false); + List points = GeolocationManager.getWaypoints(skCase); - for (BlackboardArtifactPoint point : points) { + for (Waypoint point : points) { Element reportPoint = makePoint(point); if (reportPoint == null) { continue; } - if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF.getTypeID()) { - addExifMetadataContent((EXIFMetadataPoint) point, baseReportDir); - } else if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK.getTypeID()) { - gpsBookmarksFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.BLUE, point.getDetails(), point.getTimestamp(), reportPoint, point.getFormattedCoordinates())); - } else if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION.getTypeID()) { - gpsLastKnownLocationFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.PURPLE, point.getDetails(), point.getTimestamp(), reportPoint, point.getFormattedCoordinates())); - } else if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH.getTypeID()) { - gpsSearchesFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, point.getDetails(), point.getTimestamp(), reportPoint, point.getFormattedCoordinates())); - } else if (point.getArtifact().getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID()) { - gpsTrackpointsFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, point.getDetails(), point.getTimestamp(), reportPoint, point.getFormattedCoordinates())); + String formattedCords = GeolocationUtils.getFormattedCoordinates(point.getLatitude(), point.getLongitude()); + + switch (point.getType()) { + case METADATA_EXIF: + addExifMetadataContent(point, baseReportDir); + break; + case BOOKMARK: + gpsBookmarksFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.BLUE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); + break; + case LAST_KNOWN_LOCATION: + gpsLastKnownLocationFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.PURPLE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); + break; + case SEARCH: + gpsSearchesFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); + break; + case TRACKPOINT: + gpsTrackpointsFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); + break; } } } - + /** * Add the route to the route folder in the document. - * + * * @param skCase Currently open case. - * - * @throws TskCoreException + * + * @throws TskCoreException */ void makeRoutes(SleuthkitCase skCase) throws TskCoreException { List routes = GeolocationManager.getGPSRoutes(skCase); if (routes != null) { for (Route route : routes) { - List routePoints = route.getRoute(); - BlackboardArtifactPoint start = null; - BlackboardArtifactPoint end = null; + List routePoints = route.getRoute(); + Waypoint start = null; + Waypoint end = null; // This is hardcoded knowledge that there is only two points // a start and end. In the long run it would be nice to // support the idea of a route with multiple points. The Route @@ -373,18 +385,21 @@ class KMLReport implements GeneralReportModule { Element startingPoint = makePoint(start.getLatitude(), start.getLongitude(), start.getAltitude()); Element endingPoint = makePoint(end.getLatitude(), end.getLongitude(), end.getAltitude()); - String formattedCoordinates = String.format("%s to %s", start.getFormattedCoordinates(), end.getFormattedCoordinates()); + String formattedEnd = GeolocationUtils.getFormattedCoordinates(end.getLatitude(), end.getLongitude()); + String formattedStart = GeolocationUtils.getFormattedCoordinates(start.getLatitude(), start.getLongitude()); - if(reportRoute != null) { - gpsRouteFolder.addContent(makePlacemark("As-the-crow-flies Route", FeatureColor.GREEN, "", route.getTimestamp(), reportRoute, formattedCoordinates)); //NON-NLS + String formattedCoordinates = String.format("%s to %s", formattedStart, formattedEnd); + + if (reportRoute != null) { + gpsRouteFolder.addContent(makePlacemark(route.getLabel(), FeatureColor.GREEN, getFormattedDetails(route), route.getTimestamp(), reportRoute, formattedCoordinates)); //NON-NLS } - - if(startingPoint != null) { - gpsRouteFolder.addContent(makePlacemark(start.getLabel(), FeatureColor.GREEN, start.getDetails(), start.getTimestamp(), startingPoint, start.getFormattedCoordinates())); //NON-NLS + + if (startingPoint != null) { + gpsRouteFolder.addContent(makePlacemark(start.getLabel(), FeatureColor.GREEN, getFormattedDetails(start), start.getTimestamp(), startingPoint, formattedStart)); //NON-NLS } - - if(endingPoint != null) { - gpsRouteFolder.addContent(makePlacemark(end.getLabel(), FeatureColor.GREEN, end.getDetails(), end.getTimestamp(), endingPoint, end.getFormattedCoordinates())); //NON-NLS + + if (endingPoint != null) { + gpsRouteFolder.addContent(makePlacemark(end.getLabel(), FeatureColor.GREEN, getFormattedDetails(end), end.getTimestamp(), endingPoint, formattedEnd)); //NON-NLS } } } @@ -392,23 +407,23 @@ class KMLReport implements GeneralReportModule { /** * Format a point time stamp (in seconds) to the report format. - * + * * @param timeStamp The timestamp in epoch seconds. - * + * * @return The formatted timestamp */ private String getTimeStamp(long timeStamp) { return kmlDateFormat.format(new java.util.Date(timeStamp * 1000)); } - + /** * Create the point for the given artifact. - * + * * @param point Artifact point. - * - * @return point element. + * + * @return point element. */ - private Element makePoint(BlackboardArtifactPoint point) { + private Element makePoint(Waypoint point) { return makePoint(point.getLatitude(), point.getLongitude(), point.getAltitude()); } @@ -425,9 +440,9 @@ class KMLReport implements GeneralReportModule { */ private Element makePoint(Double latitude, Double longitude, Double altitude) { if (latitude == null || longitude == null) { - return null; + return null; } - + if (altitude == null) { altitude = 0.0; } @@ -456,10 +471,10 @@ class KMLReport implements GeneralReportModule { * Create a LineString for use in a Placemark. Note in this method, start * and stop altitudes get ignored, as Google Earth apparently has trouble * using altitudes for LineStrings, though the parameters are still in the - * call. - * - * If null values are pass for the latitudes or longitudes a line will not be - * drawn. + * call. + * + * If null values are pass for the latitudes or longitudes a line will not + * be drawn. * * @param startLatitude Starting latitude * @param startLongitude Starting longitude @@ -471,10 +486,10 @@ class KMLReport implements GeneralReportModule { * @return the Line as an Element */ private Element makeLineString(Double startLatitude, Double startLongitude, Double startAltitude, Double stopLatitude, Double stopLongitude, Double stopAltitude) { - if(startLatitude == null || startLongitude == null || stopLatitude == null || stopLongitude == null) { + if (startLatitude == null || startLongitude == null || stopLatitude == null || stopLongitude == null) { return null; } - + if (startAltitude == null) { startAltitude = 0.0; } @@ -649,4 +664,92 @@ class KMLReport implements GeneralReportModule { } return strbuf.toString(); } + + private String getFormattedDetails(Waypoint point) { + StringBuilder result = new StringBuilder(); //NON-NLS + result.append(getDetailsHeader(point)); + result.append(formatAttribute("Name", point.getLabel())); + + Long timestamp = point.getTimestamp(); + if (timestamp != null) { + result.append(formatAttribute("Timestamp", getTimeStamp(timestamp))); + } + + result.append(formatAttribute("Latitude", point.getLatitude().toString())); + result.append(formatAttribute("Longitude", point.getLongitude().toString())); + if (point.getAltitude() != null) { + result.append(formatAttribute("Altitude", point.getAltitude().toString())); + } + + Map otherProps = point.getOtherProperties(); + Iterator> iterator = otherProps.entrySet().iterator(); + while (iterator.hasNext()) { + Entry entry = iterator.next(); + String value = entry.getValue(); + if (value != null && !value.isEmpty()) { + result.append(formatAttribute(entry.getKey(), value)); + } + } + + return result.toString(); + } + + private String formatAttribute(String title, String value) { + return String.format(HTML_PROP_FORMAT, title, value); + } + + /* + * This current retains the headers from the original report. There is + * probably a better way to do this using the display value of the + * blackboard artifact. + */ + private String getDetailsHeader(Waypoint point) { + return String.format("

    %s

    ", point.getType().getDisplayName()); + } + + /** + * Returns an HTML formatted string of all the + * + * @param route + * + * @return + */ + private String getFormattedDetails(Route route) { + List points = route.getRoute(); + StringBuilder result = new StringBuilder(); //NON-NLS + + result.append(String.format("

    %s

    ", "GPS Route")); + result.append(formatAttribute("Name", route.getLabel())); + + Long timestamp = route.getTimestamp(); + if (timestamp != null) { + result.append(formatAttribute("Timestamp", getTimeStamp(timestamp))); + } + + if (points.size() > 1) { + Waypoint start = points.get(0); + Waypoint end = points.get(1); + + result.append(formatAttribute("Start Latitude", start.getLatitude().toString())); + result.append(formatAttribute("Start Longitude", start.getLongitude().toString())); + result.append(formatAttribute("End Latitude", end.getLatitude().toString())); + result.append(formatAttribute("End Longitude", end.getLongitude().toString())); + } + + if (route.getAltitude() != null) { + result.append(formatAttribute("Altitude", route.getAltitude().toString())); + } + + Map otherProps = route.getOtherProperties(); + Iterator> iterator = otherProps.entrySet().iterator(); + while (iterator.hasNext()) { + Entry entry = iterator.next(); + String value = entry.getValue(); + if (value != null && !value.isEmpty()) { + result.append(formatAttribute(entry.getKey(), value)); + } + } + + return result.toString(); + } } From 8da92b21356f8cb21340d2b4c7a8ea247ee88388 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 21 Oct 2019 14:49:21 -0400 Subject: [PATCH 22/91] Updated after codacy changes --- .../datamodel/BlackboardArtifactWaypoint.java | 107 +++++++++++++----- .../datamodel/Bundle.properties-MERGED | 5 + .../datamodel/GeolocationManager.java | 2 +- ...tionUtils.java => GeolocationUtility.java} | 2 +- .../autopsy/geolocation/datamodel/Route.java | 2 +- .../geolocation/datamodel/Waypoint.java | 2 +- .../autopsy/report/modules/kml/KMLReport.java | 102 +++++++++-------- 7 files changed, 143 insertions(+), 79 deletions(-) rename Core/src/org/sleuthkit/autopsy/geolocation/datamodel/{GeolocationUtils.java => GeolocationUtility.java} (99%) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java index e46509cf80..761e085b32 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java @@ -19,6 +19,7 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.Map; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; @@ -39,6 +40,12 @@ public class BlackboardArtifactWaypoint implements Waypoint { final private BlackboardArtifact artifact; final private Waypoint.Type type; final private Map otherAttributesMap; + + @Messages({ + "BlackboardArtifactWaypoint_Last_Known_Label=Last Known Location", + "BlackboardArtifactWaypoint_GPS_Trackpoint=GPS Trackpoint", + "BlackboardArtifactWaypoint_GPS_Search=GPS Search" + }) /** * Constructs a Waypoint from a BlackboardArtifact @@ -50,13 +57,13 @@ public class BlackboardArtifactWaypoint implements Waypoint { protected BlackboardArtifactWaypoint(BlackboardArtifact artifact) throws TskCoreException { this.artifact = artifact; timestamp = getTimestampFromArtifact(artifact); - longitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - latitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - altitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); + longitude = GeolocationUtility.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); + latitude = GeolocationUtility.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); + altitude = GeolocationUtility.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); image = getImageFromArtifact(artifact); label = getLabelFromArtifact(artifact); type = getTypeFromArtifact(artifact); - otherAttributesMap = GeolocationUtils.getOtherGeolocationAttributes(artifact); + otherAttributesMap = GeolocationUtility.getOtherGeolocationAttributes(artifact); } /** @@ -124,13 +131,11 @@ public class BlackboardArtifactWaypoint implements Waypoint { BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - switch (artifactType) { - case TSK_METADATA_EXIF: - return GeolocationUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); - default: - return GeolocationUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - + if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { + return GeolocationUtility.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); } + + return GeolocationUtility.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); } /** @@ -173,34 +178,23 @@ public class BlackboardArtifactWaypoint implements Waypoint { * @throws TskCoreException */ private String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { - BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - - if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { - if (getImage() != null) { - return getImage().getName(); - } + String typeLabel = getLabelFromImage(); + if (typeLabel != null && !typeLabel.isEmpty()) { + return typeLabel; } - String typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); + typeLabel = GeolocationUtility.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); if (typeLabel == null || typeLabel.isEmpty()) { switch (artifactType) { case TSK_GPS_SEARCH: - typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = "GPS Search"; - } + typeLabel = getLabelForSearch(artifact); break; case TSK_GPS_TRACKPOINT: - typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); - } - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = "GPS Trackpoint"; - } + typeLabel = getLabelforTrackpoint(artifact); break; case TSK_GPS_LAST_KNOWN_LOCATION: - typeLabel = "Last Known Location"; + typeLabel = Bundle.BlackboardArtifactWaypoint_Last_Known_Label(); break; default: typeLabel = ""; @@ -210,6 +204,61 @@ public class BlackboardArtifactWaypoint implements Waypoint { return typeLabel; } + /** + * Returns a Label for a GPS_Trackpoint artifact. This function assumes the + * calling function has already checked TSK_NAME. + * + * @param artifact BlackboardArtifact for waypoint + * + * @return String label for the artifacts way point. + * + * @throws TskCoreException + */ + private String getLabelforTrackpoint(BlackboardArtifact artifact) throws TskCoreException { + String typeLabel = GeolocationUtility.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = GeolocationUtility.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + } + + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = Bundle.BlackboardArtifactWaypoint_GPS_Trackpoint(); + } + + return typeLabel; + } + + /** + * Returns a Label for a GPS_SEARCH artifact. This function assumes the + * calling function has already checked TSK_NAME. + * + * @param artifact BlackboardArtifact for waypoint + * + * @return String label for the artifacts way point. + * + * @throws TskCoreException + */ + private String getLabelForSearch(BlackboardArtifact artifact) throws TskCoreException { + String typeLabel = GeolocationUtility.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = Bundle.BlackboardArtifactWaypoint_GPS_Search(); + } + + return typeLabel; + } + + /** + * Returns a Label from an image. + * + * @return String label for waypoint with image or null. + */ + private String getLabelFromImage() { + if (getImage() != null) { + return getImage().getName(); + } else { + return null; + } + } + /** * Gets the type of waypoint based on the artifact. * diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED index 512dd5f416..33e0ff3247 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED @@ -1,4 +1,9 @@ +BlackboardArtifactWaypoint_GPS_Search=GPS Search +BlackboardArtifactWaypoint_GPS_Trackpoint=GPS Trackpoint +BlackboardArtifactWaypoint_Last_Known_Label=Last Known Location +Route_End_Label=End Route_Label=As-the-crow-flies Route +Route_Start_Label=Start Waypoint_Bookmark_Display_String=GPS Bookmark Waypoint_EXIF_Display_String=EXIF Metadata With Location Waypoint_Last_Known_Display_String=GPS Last Known Location diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java index fe5cdd1884..a6a882caa9 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java @@ -29,7 +29,7 @@ import org.sleuthkit.datamodel.TskCoreException; * Static functions for the creations of geolocation points for artifacts. * */ -public class GeolocationManager { +public final class GeolocationManager { /** * Add a private constructor to silence codacy warning about making this diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtility.java similarity index 99% rename from Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java rename to Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtility.java index 20e8b6ab7b..f8a543af5c 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtility.java @@ -15,7 +15,7 @@ import org.sleuthkit.datamodel.TskCoreException; * * */ -public class GeolocationUtils { +public class GeolocationUtility { private static final String DEFAULT_COORD_FORMAT = "%.2f, %.2f"; diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index 68d93509d5..7e9acaf38c 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -218,6 +218,6 @@ public class Route { * @throws TskCoreException */ private Map initalizeOtherAttributes(BlackboardArtifact artifact) throws TskCoreException { - return GeolocationUtils.getOtherGeolocationAttributes(artifact); + return GeolocationUtility.getOtherGeolocationAttributes(artifact); } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java index 736d0726a1..edd3257391 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java @@ -118,7 +118,7 @@ public interface Waypoint { * * @param displayName String value title for enum */ - private Type(String displayName) { + Type(String displayName) { this.displayName = displayName; } diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index 311a652335..105132770b 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -50,7 +50,7 @@ import org.openide.filesystems.FileUtil; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationManager; -import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationUtils; +import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationUtility; import org.sleuthkit.autopsy.geolocation.datamodel.Route; import org.sleuthkit.autopsy.report.ReportBranding; import org.sleuthkit.autopsy.report.ReportProgressPanel; @@ -309,7 +309,7 @@ class KMLReport implements GeneralReportModule { path = Paths.get(abstractFile.getName()); } - gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, GeolocationUtils.getFormattedCoordinates(point.getLatitude(), point.getLongitude()))); + gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, GeolocationUtility.getFormattedCoordinates(point.getLatitude(), point.getLongitude()))); } /** @@ -330,7 +330,7 @@ class KMLReport implements GeneralReportModule { continue; } - String formattedCords = GeolocationUtils.getFormattedCoordinates(point.getLatitude(), point.getLongitude()); + String formattedCords = GeolocationUtility.getFormattedCoordinates(point.getLatitude(), point.getLongitude()); switch (point.getType()) { case METADATA_EXIF: @@ -348,6 +348,9 @@ class KMLReport implements GeneralReportModule { case TRACKPOINT: gpsTrackpointsFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); break; + default: + // default is here to make codacy happy. + break; } } } @@ -361,47 +364,53 @@ class KMLReport implements GeneralReportModule { */ void makeRoutes(SleuthkitCase skCase) throws TskCoreException { List routes = GeolocationManager.getGPSRoutes(skCase); + + if(routes == null) { + return; + } - if (routes != null) { - for (Route route : routes) { - List routePoints = route.getRoute(); - Waypoint start = null; - Waypoint end = null; - // This is hardcoded knowledge that there is only two points - // a start and end. In the long run it would be nice to - // support the idea of a route with multiple points. The Route - // class supports that idea. Would be nice to figure out how to support - // for report. - if (routePoints != null && routePoints.size() > 1) { - start = routePoints.get(0); - end = routePoints.get(1); - } + for (Route route : routes) { + addRouteToReport(route); + } + } + + void addRouteToReport(Route route) { + List routePoints = route.getRoute(); + Waypoint start = null; + Waypoint end = null; + // This is hardcoded knowledge that there is only two points + // a start and end. In the long run it would be nice to + // support the idea of a route with multiple points. The Route + // class supports that idea. Would be nice to figure out how to support + // for report. + if (routePoints != null && routePoints.size() > 1) { + start = routePoints.get(0); + end = routePoints.get(1); + } - if (start == null || end == null) { - continue; - } + if (start == null || end == null) { + return; + } - Element reportRoute = makeLineString(start.getLatitude(), start.getLongitude(), start.getAltitude(), end.getLatitude(), end.getLongitude(), end.getAltitude()); - Element startingPoint = makePoint(start.getLatitude(), start.getLongitude(), start.getAltitude()); - Element endingPoint = makePoint(end.getLatitude(), end.getLongitude(), end.getAltitude()); + Element reportRoute = makeLineString(start.getLatitude(), start.getLongitude(), start.getAltitude(), end.getLatitude(), end.getLongitude(), end.getAltitude()); + Element startingPoint = makePoint(start.getLatitude(), start.getLongitude(), start.getAltitude()); + Element endingPoint = makePoint(end.getLatitude(), end.getLongitude(), end.getAltitude()); - String formattedEnd = GeolocationUtils.getFormattedCoordinates(end.getLatitude(), end.getLongitude()); - String formattedStart = GeolocationUtils.getFormattedCoordinates(start.getLatitude(), start.getLongitude()); + String formattedEnd = GeolocationUtility.getFormattedCoordinates(end.getLatitude(), end.getLongitude()); + String formattedStart = GeolocationUtility.getFormattedCoordinates(start.getLatitude(), start.getLongitude()); - String formattedCoordinates = String.format("%s to %s", formattedStart, formattedEnd); + String formattedCoordinates = String.format("%s to %s", formattedStart, formattedEnd); - if (reportRoute != null) { - gpsRouteFolder.addContent(makePlacemark(route.getLabel(), FeatureColor.GREEN, getFormattedDetails(route), route.getTimestamp(), reportRoute, formattedCoordinates)); //NON-NLS - } + if (reportRoute != null) { + gpsRouteFolder.addContent(makePlacemark(route.getLabel(), FeatureColor.GREEN, getFormattedDetails(route), route.getTimestamp(), reportRoute, formattedCoordinates)); //NON-NLS + } - if (startingPoint != null) { - gpsRouteFolder.addContent(makePlacemark(start.getLabel(), FeatureColor.GREEN, getFormattedDetails(start), start.getTimestamp(), startingPoint, formattedStart)); //NON-NLS - } + if (startingPoint != null) { + gpsRouteFolder.addContent(makePlacemark(start.getLabel(), FeatureColor.GREEN, getFormattedDetails(start), start.getTimestamp(), startingPoint, formattedStart)); //NON-NLS + } - if (endingPoint != null) { - gpsRouteFolder.addContent(makePlacemark(end.getLabel(), FeatureColor.GREEN, getFormattedDetails(end), end.getTimestamp(), endingPoint, formattedEnd)); //NON-NLS - } - } + if (endingPoint != null) { + gpsRouteFolder.addContent(makePlacemark(end.getLabel(), FeatureColor.GREEN, getFormattedDetails(end), end.getTimestamp(), endingPoint, formattedEnd)); //NON-NLS } } @@ -667,16 +676,17 @@ class KMLReport implements GeneralReportModule { private String getFormattedDetails(Waypoint point) { StringBuilder result = new StringBuilder(); //NON-NLS - result.append(getDetailsHeader(point)); - result.append(formatAttribute("Name", point.getLabel())); + result.append(getDetailsHeader(point)) + .append(formatAttribute("Name", point.getLabel())); Long timestamp = point.getTimestamp(); if (timestamp != null) { result.append(formatAttribute("Timestamp", getTimeStamp(timestamp))); } - result.append(formatAttribute("Latitude", point.getLatitude().toString())); - result.append(formatAttribute("Longitude", point.getLongitude().toString())); + result.append(formatAttribute("Latitude", point.getLatitude().toString())) + .append(formatAttribute("Longitude", point.getLongitude().toString())); + if (point.getAltitude() != null) { result.append(formatAttribute("Altitude", point.getAltitude().toString())); } @@ -718,8 +728,8 @@ class KMLReport implements GeneralReportModule { List points = route.getRoute(); StringBuilder result = new StringBuilder(); //NON-NLS - result.append(String.format("

    %s

    ", "GPS Route")); - result.append(formatAttribute("Name", route.getLabel())); + result.append(String.format("

    %s

    ", "GPS Route")) + .append(formatAttribute("Name", route.getLabel())); Long timestamp = route.getTimestamp(); if (timestamp != null) { @@ -730,10 +740,10 @@ class KMLReport implements GeneralReportModule { Waypoint start = points.get(0); Waypoint end = points.get(1); - result.append(formatAttribute("Start Latitude", start.getLatitude().toString())); - result.append(formatAttribute("Start Longitude", start.getLongitude().toString())); - result.append(formatAttribute("End Latitude", end.getLatitude().toString())); - result.append(formatAttribute("End Longitude", end.getLongitude().toString())); + result.append(formatAttribute("Start Latitude", start.getLatitude().toString())) + .append(formatAttribute("Start Longitude", start.getLongitude().toString())) + .append(formatAttribute("End Latitude", end.getLatitude().toString())) + .append(formatAttribute("End Longitude", end.getLongitude().toString())); } if (route.getAltitude() != null) { From 7be1c9758f5567327242676046819845dc53290d Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 21 Oct 2019 15:01:10 -0400 Subject: [PATCH 23/91] More codacy related fixes --- .../datamodel/BlackboardArtifactWaypoint.java | 37 ++++++++----------- ...tionUtility.java => GeolocationUtils.java} | 9 ++++- .../autopsy/geolocation/datamodel/Route.java | 2 +- .../autopsy/report/modules/kml/KMLReport.java | 10 ++--- 4 files changed, 30 insertions(+), 28 deletions(-) rename Core/src/org/sleuthkit/autopsy/geolocation/datamodel/{GeolocationUtility.java => GeolocationUtils.java} (97%) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java index 761e085b32..3487c61aba 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java @@ -57,13 +57,13 @@ public class BlackboardArtifactWaypoint implements Waypoint { protected BlackboardArtifactWaypoint(BlackboardArtifact artifact) throws TskCoreException { this.artifact = artifact; timestamp = getTimestampFromArtifact(artifact); - longitude = GeolocationUtility.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - latitude = GeolocationUtility.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - altitude = GeolocationUtility.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); + longitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); + latitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); + altitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); image = getImageFromArtifact(artifact); label = getLabelFromArtifact(artifact); type = getTypeFromArtifact(artifact); - otherAttributesMap = GeolocationUtility.getOtherGeolocationAttributes(artifact); + otherAttributesMap = GeolocationUtils.getOtherGeolocationAttributes(artifact); } /** @@ -132,10 +132,10 @@ public class BlackboardArtifactWaypoint implements Waypoint { BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { - return GeolocationUtility.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); + return GeolocationUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); } - return GeolocationUtility.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); + return GeolocationUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); } /** @@ -150,18 +150,13 @@ public class BlackboardArtifactWaypoint implements Waypoint { * @throws TskCoreException */ private AbstractFile getImageFromArtifact(BlackboardArtifact artifact) throws TskCoreException { - if (artifact == null) { - return null; - } - BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - switch (artifactType) { - case TSK_METADATA_EXIF: + if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { return artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); - default: - return null; } + + return null; } /** @@ -178,13 +173,13 @@ public class BlackboardArtifactWaypoint implements Waypoint { * @throws TskCoreException */ private String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { - String typeLabel = getLabelFromImage(); + String typeLabel = getLabelFromImage(artifact); if (typeLabel != null && !typeLabel.isEmpty()) { return typeLabel; } BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - typeLabel = GeolocationUtility.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); if (typeLabel == null || typeLabel.isEmpty()) { switch (artifactType) { case TSK_GPS_SEARCH: @@ -215,9 +210,9 @@ public class BlackboardArtifactWaypoint implements Waypoint { * @throws TskCoreException */ private String getLabelforTrackpoint(BlackboardArtifact artifact) throws TskCoreException { - String typeLabel = GeolocationUtility.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + String typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = GeolocationUtility.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); } if (typeLabel == null || typeLabel.isEmpty()) { @@ -238,7 +233,7 @@ public class BlackboardArtifactWaypoint implements Waypoint { * @throws TskCoreException */ private String getLabelForSearch(BlackboardArtifact artifact) throws TskCoreException { - String typeLabel = GeolocationUtility.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); + String typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); if (typeLabel == null || typeLabel.isEmpty()) { typeLabel = Bundle.BlackboardArtifactWaypoint_GPS_Search(); } @@ -251,8 +246,8 @@ public class BlackboardArtifactWaypoint implements Waypoint { * * @return String label for waypoint with image or null. */ - private String getLabelFromImage() { - if (getImage() != null) { + private String getLabelFromImage(BlackboardArtifact artifact) throws TskCoreException{ + if (getImageFromArtifact(artifact) != null) { return getImage().getName(); } else { return null; diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtility.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java similarity index 97% rename from Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtility.java rename to Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java index f8a543af5c..cd24b8631d 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtility.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java @@ -15,7 +15,7 @@ import org.sleuthkit.datamodel.TskCoreException; * * */ -public class GeolocationUtility { +public class GeolocationUtils { private static final String DEFAULT_COORD_FORMAT = "%.2f, %.2f"; @@ -40,6 +40,13 @@ public class GeolocationUtility { BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MAKE, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MODEL }; + + /** + * This is a Utility class that should not be constructed. + */ + private GeolocationUtils() { + + } static public String getFormattedCoordinates(Double latitude, Double longitude) { if (latitude == null || longitude == null) { diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index 7e9acaf38c..68d93509d5 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -218,6 +218,6 @@ public class Route { * @throws TskCoreException */ private Map initalizeOtherAttributes(BlackboardArtifact artifact) throws TskCoreException { - return GeolocationUtility.getOtherGeolocationAttributes(artifact); + return GeolocationUtils.getOtherGeolocationAttributes(artifact); } } diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index 105132770b..175819610f 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -50,7 +50,7 @@ import org.openide.filesystems.FileUtil; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationManager; -import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationUtility; +import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationUtils; import org.sleuthkit.autopsy.geolocation.datamodel.Route; import org.sleuthkit.autopsy.report.ReportBranding; import org.sleuthkit.autopsy.report.ReportProgressPanel; @@ -309,7 +309,7 @@ class KMLReport implements GeneralReportModule { path = Paths.get(abstractFile.getName()); } - gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, GeolocationUtility.getFormattedCoordinates(point.getLatitude(), point.getLongitude()))); + gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, GeolocationUtils.getFormattedCoordinates(point.getLatitude(), point.getLongitude()))); } /** @@ -330,7 +330,7 @@ class KMLReport implements GeneralReportModule { continue; } - String formattedCords = GeolocationUtility.getFormattedCoordinates(point.getLatitude(), point.getLongitude()); + String formattedCords = GeolocationUtils.getFormattedCoordinates(point.getLatitude(), point.getLongitude()); switch (point.getType()) { case METADATA_EXIF: @@ -396,8 +396,8 @@ class KMLReport implements GeneralReportModule { Element startingPoint = makePoint(start.getLatitude(), start.getLongitude(), start.getAltitude()); Element endingPoint = makePoint(end.getLatitude(), end.getLongitude(), end.getAltitude()); - String formattedEnd = GeolocationUtility.getFormattedCoordinates(end.getLatitude(), end.getLongitude()); - String formattedStart = GeolocationUtility.getFormattedCoordinates(start.getLatitude(), start.getLongitude()); + String formattedEnd = GeolocationUtils.getFormattedCoordinates(end.getLatitude(), end.getLongitude()); + String formattedStart = GeolocationUtils.getFormattedCoordinates(start.getLatitude(), start.getLongitude()); String formattedCoordinates = String.format("%s to %s", formattedStart, formattedEnd); From 339de01305c05f1db82b8f0fad129a68b2a7a880 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 21 Oct 2019 15:09:05 -0400 Subject: [PATCH 24/91] winning at codacy --- .../autopsy/geolocation/datamodel/GeolocationUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java index cd24b8631d..411774b987 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java @@ -15,7 +15,7 @@ import org.sleuthkit.datamodel.TskCoreException; * * */ -public class GeolocationUtils { +public final class GeolocationUtils { private static final String DEFAULT_COORD_FORMAT = "%.2f, %.2f"; From f9c838755e4b4666be229c86b38c5b604f553d14 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 21 Oct 2019 15:16:11 -0400 Subject: [PATCH 25/91] Fixing more issues from codacy --- .../geolocation/datamodel/GeolocationUtils.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java index 411774b987..ee8d917fce 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java @@ -68,7 +68,7 @@ public final class GeolocationUtils { * * @throws TskCoreException */ - static protected String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { if (artifact == null) { return null; } @@ -87,7 +87,7 @@ public final class GeolocationUtils { * * @throws TskCoreException */ - static protected Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { if (artifact == null) { return null; } @@ -110,7 +110,7 @@ public final class GeolocationUtils { * * @throws TskCoreException */ - static protected Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { if (artifact == null) { return null; } @@ -134,7 +134,7 @@ public final class GeolocationUtils { * * @throws TskCoreException */ - static protected Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { if (artifact == null) { return null; } @@ -157,7 +157,7 @@ public final class GeolocationUtils { * * @throws TskCoreException */ - static protected String getFormattedTimestamp(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static String getFormattedTimestamp(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { if (artifact == null) { return null; } @@ -179,7 +179,7 @@ public final class GeolocationUtils { * * @return */ - static protected Map getOtherGeolocationAttributes(BlackboardArtifact artifact) throws TskCoreException { + static Map getOtherGeolocationAttributes(BlackboardArtifact artifact) throws TskCoreException { Map map = new HashMap<>(); for (BlackboardAttribute.ATTRIBUTE_TYPE type : OTHER_GEO_ATTRIBUTES) { From d39dc4232920963ecb8dc4ff5199eed964b8cd45 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Mon, 21 Oct 2019 17:19:26 -0400 Subject: [PATCH 26/91] Created a new View for the JSlider. Made the slider thumb easier to drag. Added track highlighting. Adding thread safety to the progress slider. --- .../contentviewers/MediaPlayerPanel.form | 10 +- .../contentviewers/MediaPlayerPanel.java | 249 ++++++++++++++++-- 2 files changed, 240 insertions(+), 19 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form index 605ed93697..d8433a907b 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.form @@ -16,8 +16,8 @@ - + @@ -106,6 +106,9 @@ + + +
    @@ -172,7 +175,7 @@ - + @@ -192,6 +195,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index dec8bf55b4..be600a0ea6 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -19,8 +19,16 @@ package org.sleuthkit.autopsy.contentviewers; import com.google.common.io.Files; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; import java.io.File; import java.io.IOException; import java.util.Arrays; @@ -30,6 +38,7 @@ import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.CancellationException; import java.util.concurrent.ExecutionException; +import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import javax.swing.BoxLayout; @@ -52,13 +61,17 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; import javafx.embed.swing.JFXPanel; +import javax.swing.JComponent; +import javax.swing.JSlider; import javax.swing.SwingUtilities; import javax.swing.event.ChangeListener; +import javax.swing.plaf.basic.BasicSliderUI; import org.freedesktop.gstreamer.ClockTime; import org.freedesktop.gstreamer.Format; import org.freedesktop.gstreamer.GstException; import org.freedesktop.gstreamer.event.SeekFlags; import org.freedesktop.gstreamer.event.SeekType; +import org.openide.util.Exceptions; /** * This is a video player that is part of the Media View layered pane. It uses @@ -188,6 +201,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private static final int SKIP_IN_SECONDS = 30; private ExtractMedia extractMediaWorker; + + //Serialize setting the value of the Video progress slider. + //The slider is a shared resource between the VideoPanelUpdater + //and the TrackListener of the JSliderUI. + private final Semaphore sliderLock; /** * Creates new form MediaViewVideoPanel @@ -195,6 +213,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie public MediaPlayerPanel() throws GstException, UnsatisfiedLinkError { initComponents(); customizeComponents(); + sliderLock = new Semaphore(1); } private void customizeComponents() { @@ -531,26 +550,220 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie @Override public void actionPerformed(ActionEvent e) { - if (!progressSlider.getValueIsAdjusting()) { - long position = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); - long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); - /** - * Duration may not be known until there is video data in the - * pipeline. We start this updater when data-flow has just been - * initiated so buffering may still be in progress. - */ - if (duration >= 0 && position >= 0) { - double relativePosition = (double) position / duration; - progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE)); - } + try { + if (!progressSlider.getValueIsAdjusting()) { + sliderLock.acquire(); + long position = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); + long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); + /** + * Duration may not be known until there is video data in the + * pipeline. We start this updater when data-flow has just been + * initiated so buffering may still be in progress. + */ + if (duration >= 0 && position >= 0) { + double relativePosition = (double) position / duration; + progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE)); + } - SwingUtilities.invokeLater(() -> { - updateTimeLabel(position, duration); - }); + SwingUtilities.invokeLater(() -> { + updateTimeLabel(position, duration); + }); + sliderLock.release(); + } + } catch (InterruptedException ex) { + } } } + /** + * Represents the default configuration for the circular JSliderUI. + */ + private class CircularJSliderConfiguration { + + //Thumb configurations + private final Color thumbColor; + private final Dimension thumbDimension; + + //Track configurations + //Progress bar can be bisected into a seen group + //and an unseen group. + private final Color unseen; + private final Color seen; + + /** + * Default configuration + * + * JSlider is light blue RGB(0,130,255). Seen track is light blue + * RGB(0,130,255). Unseen track is light grey RGB(192, 192, 192). + * + * @param thumbDimension Size of the oval thumb. + */ + public CircularJSliderConfiguration(Dimension thumbDimension) { + Color lightBlue = new Color(0, 130, 255); + + seen = lightBlue; + unseen = Color.LIGHT_GRAY; + + thumbColor = lightBlue; + + this.thumbDimension = new Dimension(thumbDimension); + } + + public Color getThumbColor() { + return thumbColor; + } + + public Color getUnseenTrackColor() { + return unseen; + } + + public Color getSeenTrackColor() { + return seen; + } + + public Dimension getThumbDimension() { + return new Dimension(thumbDimension); + } + } + + /** + * Custom view for the JSlider. + */ + private class CircularJSliderUI extends BasicSliderUI { + + private final CircularJSliderConfiguration config; + + /** + * Creates a custom view for the JSlider. This view draws a blue oval + * thumb at the given width and height. It also paints the track blue as + * the thumb progresses. + * + * @param b JSlider component + * @param width Width of the oval + * @param height Height of the oval. + */ + public CircularJSliderUI(JSlider b, CircularJSliderConfiguration config) { + super(b); + this.config = config; + } + + @Override + protected Dimension getThumbSize() { + return config.getThumbDimension(); + } + + /** + * Modifies the View to be an oval rather than the + * rectangle Controller. + */ + @Override + public void paintThumb(Graphics g) { + Rectangle thumb = this.thumbRect; + + Color original = g.getColor(); + + //Change the thumb view from the rectangle + //controller to an oval. + g.setColor(config.getThumbColor()); + Dimension thumbDimension = config.getThumbDimension(); + g.fillOval(thumb.x, thumb.y, thumbDimension.width, thumbDimension.height); + + //Preserve the graphics original color + g.setColor(original); + } + + @Override + public void paintTrack(Graphics g) { + //This rectangle is the bounding box for the progress bar + //portion of the slider. The track is painted in the middle + //of this rectangle and the thumb laid overtop. + Rectangle track = this.trackRect; + + //Get the location of the thumb, this point splits the + //progress bar into 2 line segments, seen and unseen. + Rectangle thumb = this.thumbRect; + int thumbX = thumb.x; + int thumbY = thumb.y; + + Color original = g.getColor(); + + //Paint the seen side + g.setColor(config.getSeenTrackColor()); + g.drawLine(track.x, track.y + track.height / 2, + thumbX, thumbY + track.height / 2); + + //Paint the unseen side + g.setColor(config.getUnseenTrackColor()); + g.drawLine(thumbX, thumbY + track.height / 2, + track.x + track.width, track.y + track.height / 2); + + //Preserve the graphics color. + g.setColor(original); + } + + @Override + protected TrackListener createTrackListener(JSlider slider) { + return new CustomTrackListener(); + } + + @Override + protected void scrollDueToClickInTrack(int direction) { + try { + //Set the thumb position to the mouse press location, as opposed + //to the closest "block" which is the default behavior. + Point mousePosition = slider.getMousePosition(); + if (mousePosition == null) { + return; + } + int value = this.valueForXPosition(mousePosition.x); + + //Lock the slider down, which is a shared resource. + //The VideoPanelUpdater (dedicated thread) keeps the + //slider in sync with the video position, so without + //proper locking our change could be overwritten. + sliderLock.acquire(); + slider.setValueIsAdjusting(true); + slider.setValue(value); + slider.setValueIsAdjusting(false); + sliderLock.release(); + } catch (InterruptedException ex) { + } + } + + /** + * Applies anti-aliasing if available. + */ + @Override + public void update(Graphics g, JComponent c) { + if (g instanceof Graphics2D) { + Graphics2D g2 = (Graphics2D) g; + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + } + + super.update(g, c); + } + + /** + * This track listener will force the thumb to be snapped to the + * mouse location. This makes grabbing and dragging the JSlider much + * easier. Using the default track listener, the user would have to + * click exactly on the slider thumb to drag it. Now the thumb positions + * itself under the mouse so that it can always be dragged. + */ + private class CustomTrackListener extends CircularJSliderUI.TrackListener { + @Override + public void mousePressed(MouseEvent e) { + //Snap the thumb to position of the mouse + scrollDueToClickInTrack(0); + + //Handle the event as normal. + super.mousePressed(e); + } + } + } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -592,6 +805,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie progressSlider.setDoubleBuffered(true); progressSlider.setMinimumSize(new java.awt.Dimension(36, 21)); progressSlider.setPreferredSize(new java.awt.Dimension(200, 21)); + progressSlider.setUI(new CircularJSliderUI(progressSlider, new CircularJSliderConfiguration(new Dimension(18,18)))); org.openide.awt.Mnemonics.setLocalizedText(progressLabel, org.openide.util.NbBundle.getMessage(MediaPlayerPanel.class, "MediaPlayerPanel.progressLabel.text")); // NOI18N @@ -645,7 +859,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie gridBagConstraints.ipadx = 8; gridBagConstraints.ipady = 7; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; - gridBagConstraints.insets = new java.awt.Insets(6, 6, 0, 0); + gridBagConstraints.insets = new java.awt.Insets(6, 14, 0, 0); buttonPanel.add(VolumeIcon, gridBagConstraints); audioSlider.setMajorTickSpacing(10); @@ -655,6 +869,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie audioSlider.setValue(25); audioSlider.setMinimumSize(new java.awt.Dimension(200, 21)); audioSlider.setPreferredSize(new java.awt.Dimension(200, 21)); + audioSlider.setUI(new CircularJSliderUI(audioSlider, new CircularJSliderConfiguration(new Dimension(15,15)))); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 4; gridBagConstraints.gridy = 0; @@ -739,8 +954,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(videoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(controlPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(videoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) From 0573fc4a15292f80a081dced2cdc6cc1e4dd0003 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Mon, 21 Oct 2019 17:32:13 -0400 Subject: [PATCH 27/91] Updated javadoc and cleared out all 1 letter variable names --- .../contentviewers/MediaPlayerPanel.java | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index be600a0ea6..95634f0435 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -71,7 +71,6 @@ import org.freedesktop.gstreamer.Format; import org.freedesktop.gstreamer.GstException; import org.freedesktop.gstreamer.event.SeekFlags; import org.freedesktop.gstreamer.event.SeekType; -import org.openide.util.Exceptions; /** * This is a video player that is part of the Media View layered pane. It uses @@ -571,7 +570,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie sliderLock.release(); } } catch (InterruptedException ex) { - + //Video panel thread interrupted while waiting on lock. } } } @@ -640,11 +639,11 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * the thumb progresses. * * @param b JSlider component - * @param width Width of the oval - * @param height Height of the oval. + * @param config Configuration object. Contains info about thumb dimensions + * and colors. */ - public CircularJSliderUI(JSlider b, CircularJSliderConfiguration config) { - super(b); + public CircularJSliderUI(JSlider slider, CircularJSliderConfiguration config) { + super(slider); this.config = config; } @@ -658,23 +657,23 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * rectangle Controller. */ @Override - public void paintThumb(Graphics g) { + public void paintThumb(Graphics graphic) { Rectangle thumb = this.thumbRect; - Color original = g.getColor(); + Color original = graphic.getColor(); //Change the thumb view from the rectangle //controller to an oval. - g.setColor(config.getThumbColor()); + graphic.setColor(config.getThumbColor()); Dimension thumbDimension = config.getThumbDimension(); - g.fillOval(thumb.x, thumb.y, thumbDimension.width, thumbDimension.height); + graphic.fillOval(thumb.x, thumb.y, thumbDimension.width, thumbDimension.height); //Preserve the graphics original color - g.setColor(original); + graphic.setColor(original); } @Override - public void paintTrack(Graphics g) { + public void paintTrack(Graphics graphic) { //This rectangle is the bounding box for the progress bar //portion of the slider. The track is painted in the middle //of this rectangle and the thumb laid overtop. @@ -686,20 +685,20 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie int thumbX = thumb.x; int thumbY = thumb.y; - Color original = g.getColor(); + Color original = graphic.getColor(); //Paint the seen side - g.setColor(config.getSeenTrackColor()); - g.drawLine(track.x, track.y + track.height / 2, + graphic.setColor(config.getSeenTrackColor()); + graphic.drawLine(track.x, track.y + track.height / 2, thumbX, thumbY + track.height / 2); //Paint the unseen side - g.setColor(config.getUnseenTrackColor()); - g.drawLine(thumbX, thumbY + track.height / 2, + graphic.setColor(config.getUnseenTrackColor()); + graphic.drawLine(thumbX, thumbY + track.height / 2, track.x + track.width, track.y + track.height / 2); //Preserve the graphics color. - g.setColor(original); + graphic.setColor(original); } @Override @@ -728,6 +727,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie slider.setValueIsAdjusting(false); sliderLock.release(); } catch (InterruptedException ex) { + //Thread (EDT) interrupted while waiting on lock. } } @@ -735,14 +735,14 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * Applies anti-aliasing if available. */ @Override - public void update(Graphics g, JComponent c) { - if (g instanceof Graphics2D) { - Graphics2D g2 = (Graphics2D) g; - g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + public void update(Graphics graphic, JComponent component) { + if (graphic instanceof Graphics2D) { + Graphics2D graphic2 = (Graphics2D) graphic; + graphic2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); } - super.update(g, c); + super.update(graphic, component); } /** From 756c82256f904996e7021d98359efa1ebb9892c5 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 22 Oct 2019 10:57:16 -0400 Subject: [PATCH 28/91] Paused the video when users click in the track. Unpause when mouse is released. This is the behavior of YouTube. It also keeps the video from ending during a drag. --- .../autopsy/contentviewers/MediaPlayerPanel.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 95634f0435..56feadbb82 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -757,10 +757,21 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie public void mousePressed(MouseEvent e) { //Snap the thumb to position of the mouse scrollDueToClickInTrack(0); + + //Pause the video for convenience + gstPlayBin.pause(); //Handle the event as normal. super.mousePressed(e); - } + } + + @Override + public void mouseReleased(MouseEvent e) { + super.mouseReleased(e); + + //Unpause once the mouse has been released. + gstPlayBin.play(); + } } } From f1b9d2ab85419a49379c572c564e05d07893086a Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 22 Oct 2019 11:08:10 -0400 Subject: [PATCH 29/91] Ran source formatting and disable track listening when the slider is not enabled. --- .../contentviewers/MediaPlayerPanel.java | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 56feadbb82..966d5829e6 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -200,7 +200,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie private static final int SKIP_IN_SECONDS = 30; private ExtractMedia extractMediaWorker; - + //Serialize setting the value of the Video progress slider. //The slider is a shared resource between the VideoPanelUpdater //and the TrackListener of the JSliderUI. @@ -555,9 +555,10 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie long position = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); /** - * Duration may not be known until there is video data in the - * pipeline. We start this updater when data-flow has just been - * initiated so buffering may still be in progress. + * Duration may not be known until there is video data in + * the pipeline. We start this updater when data-flow has + * just been initiated so buffering may still be in + * progress. */ if (duration >= 0 && position >= 0) { double relativePosition = (double) position / duration; @@ -639,8 +640,8 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * the thumb progresses. * * @param b JSlider component - * @param config Configuration object. Contains info about thumb dimensions - * and colors. + * @param config Configuration object. Contains info about thumb + * dimensions and colors. */ public CircularJSliderUI(JSlider slider, CircularJSliderConfiguration config) { super(slider); @@ -653,8 +654,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie } /** - * Modifies the View to be an oval rather than the - * rectangle Controller. + * Modifies the View to be an oval rather than the rectangle Controller. */ @Override public void paintThumb(Graphics graphic) { @@ -700,7 +700,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie //Preserve the graphics color. graphic.setColor(original); } - + @Override protected TrackListener createTrackListener(JSlider slider) { return new CustomTrackListener(); @@ -716,7 +716,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie return; } int value = this.valueForXPosition(mousePosition.x); - + //Lock the slider down, which is a shared resource. //The VideoPanelUpdater (dedicated thread) keeps the //slider in sync with the video position, so without @@ -744,31 +744,39 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie super.update(graphic, component); } - + /** - * This track listener will force the thumb to be snapped to the - * mouse location. This makes grabbing and dragging the JSlider much - * easier. Using the default track listener, the user would have to - * click exactly on the slider thumb to drag it. Now the thumb positions + * This track listener will force the thumb to be snapped to the mouse + * location. This makes grabbing and dragging the JSlider much easier. + * Using the default track listener, the user would have to click + * exactly on the slider thumb to drag it. Now the thumb positions * itself under the mouse so that it can always be dragged. */ private class CustomTrackListener extends CircularJSliderUI.TrackListener { - @Override + + @Override public void mousePressed(MouseEvent e) { + if (!slider.isEnabled()) { + return; + } //Snap the thumb to position of the mouse scrollDueToClickInTrack(0); - + //Pause the video for convenience gstPlayBin.pause(); //Handle the event as normal. super.mousePressed(e); } - + @Override public void mouseReleased(MouseEvent e) { - super.mouseReleased(e); + if (!slider.isEnabled()) { + return; + } + super.mouseReleased(e); + //Unpause once the mouse has been released. gstPlayBin.play(); } From 30c18c15bfdb829a4c1807b37cd316afdde50029 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 22 Oct 2019 13:05:47 -0400 Subject: [PATCH 30/91] Added fairness to semaphore and changed the acquire to not be interruptable. --- .../contentviewers/MediaPlayerPanel.java | 82 +++++++++---------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 966d5829e6..1f02708f64 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -66,6 +66,7 @@ import javax.swing.JSlider; import javax.swing.SwingUtilities; import javax.swing.event.ChangeListener; import javax.swing.plaf.basic.BasicSliderUI; +import javax.swing.plaf.basic.BasicSliderUI.TrackListener; import org.freedesktop.gstreamer.ClockTime; import org.freedesktop.gstreamer.Format; import org.freedesktop.gstreamer.GstException; @@ -212,7 +213,9 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie public MediaPlayerPanel() throws GstException, UnsatisfiedLinkError { initComponents(); customizeComponents(); - sliderLock = new Semaphore(1); + //True for fairness. In other words, + //acquire() calls are processed in order of invocation. + sliderLock = new Semaphore(1, true); } private void customizeComponents() { @@ -549,29 +552,24 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie @Override public void actionPerformed(ActionEvent e) { - try { - if (!progressSlider.getValueIsAdjusting()) { - sliderLock.acquire(); - long position = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); - long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); - /** - * Duration may not be known until there is video data in - * the pipeline. We start this updater when data-flow has - * just been initiated so buffering may still be in - * progress. - */ - if (duration >= 0 && position >= 0) { - double relativePosition = (double) position / duration; - progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE)); - } - - SwingUtilities.invokeLater(() -> { - updateTimeLabel(position, duration); - }); - sliderLock.release(); + if (!progressSlider.getValueIsAdjusting()) { + sliderLock.acquireUninterruptibly(); + long position = gstPlayBin.queryPosition(TimeUnit.NANOSECONDS); + long duration = gstPlayBin.queryDuration(TimeUnit.NANOSECONDS); + /** + * Duration may not be known until there is video data in the + * pipeline. We start this updater when data-flow has just been + * initiated so buffering may still be in progress. + */ + if (duration >= 0 && position >= 0) { + double relativePosition = (double) position / duration; + progressSlider.setValue((int) (relativePosition * PROGRESS_SLIDER_SIZE)); } - } catch (InterruptedException ex) { - //Video panel thread interrupted while waiting on lock. + + SwingUtilities.invokeLater(() -> { + updateTimeLabel(position, duration); + }); + sliderLock.release(); } } } @@ -708,27 +706,23 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie @Override protected void scrollDueToClickInTrack(int direction) { - try { - //Set the thumb position to the mouse press location, as opposed - //to the closest "block" which is the default behavior. - Point mousePosition = slider.getMousePosition(); - if (mousePosition == null) { - return; - } - int value = this.valueForXPosition(mousePosition.x); - - //Lock the slider down, which is a shared resource. - //The VideoPanelUpdater (dedicated thread) keeps the - //slider in sync with the video position, so without - //proper locking our change could be overwritten. - sliderLock.acquire(); - slider.setValueIsAdjusting(true); - slider.setValue(value); - slider.setValueIsAdjusting(false); - sliderLock.release(); - } catch (InterruptedException ex) { - //Thread (EDT) interrupted while waiting on lock. + //Set the thumb position to the mouse press location, as opposed + //to the closest "block" which is the default behavior. + Point mousePosition = slider.getMousePosition(); + if (mousePosition == null) { + return; } + int value = this.valueForXPosition(mousePosition.x); + + //Lock the slider down, which is a shared resource. + //The VideoPanelUpdater (dedicated thread) keeps the + //slider in sync with the video position, so without + //proper locking our change could be overwritten. + sliderLock.acquireUninterruptibly(); + slider.setValueIsAdjusting(true); + slider.setValue(value); + slider.setValueIsAdjusting(false); + sliderLock.release(); } /** @@ -774,7 +768,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie if (!slider.isEnabled()) { return; } - + super.mouseReleased(e); //Unpause once the mouse has been released. From a0c34afa5ebe938ef1622b6a253ab238cda66ab5 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 22 Oct 2019 14:06:39 -0400 Subject: [PATCH 31/91] Continued to clean up api --- .../datamodel/ArtifactWaypoint.java | 225 ++++++++++++++ .../geolocation/datamodel/AttributeUtils.java | 122 ++++++++ .../datamodel/BlackboardArtifactWaypoint.java | 282 ------------------ .../datamodel/Bundle.properties-MERGED | 6 +- .../geolocation/datamodel/EXIFWaypoint.java | 78 +++++ .../datamodel/GPSSearchWaypoint.java | 65 ++++ .../datamodel/GeolocationManager.java | 123 -------- .../datamodel/GeolocationUtils.java | 170 ++--------- .../datamodel/LastKnownWaypoint.java | 55 ++++ .../autopsy/geolocation/datamodel/Route.java | 50 ++-- .../geolocation/datamodel/RoutePoint.java | 6 +- .../datamodel/TrackpointWaypoint.java | 71 +++++ .../geolocation/datamodel/Waypoint.java | 226 ++++++++++++-- .../autopsy/report/modules/kml/KMLReport.java | 71 ++--- 14 files changed, 918 insertions(+), 632 deletions(-) create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java new file mode 100755 index 0000000000..09fd01d5a1 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java @@ -0,0 +1,225 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import java.util.Collections; +import java.util.List; +import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * Representation of a Waypoint created from a BlackboardArtifact. + * + */ +class ArtifactWaypoint implements Waypoint { + + final private Long timestamp; + final private Double longitude; + final private Double latitude; + final private Double altitude; + final private String label; + final private AbstractFile image; + final private BlackboardArtifact artifact; + final private Waypoint.Type type; + + // This list is not expected to change after construction so the + // constructor will take care of creating an unmodifiable List + final private List immutablePropertiesList; + + /** + * Construct a simple waypoint with the given artifact and assign the given + * 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 type Waypoint type + * + * @throws TskCoreException + */ + protected ArtifactWaypoint(BlackboardArtifact artifact, Waypoint.Type type) throws TskCoreException { + this(artifact, + getLabelFromArtifact(artifact), + type); + } + + /** + * For use by subclasses that want to customize the label, but use the basic + * attributes of: TSK_GEO_LONGITUDE TSK_GEO_LATITUDE TSK_GEO_ALITUDE + * TSK_DATETIME + * + * @param artifact BlackboardArtifact for this waypoint + * @param label String label for this waypoint + * @param type Waypoint type + * + * @throws TskCoreException + */ + protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Waypoint.Type type) throws TskCoreException { + this(artifact, + label, + getTimestampFromArtifact(artifact), + null, + type); + } + + /** + * 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 TskCoreException + */ + protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, AbstractFile image, Waypoint.Type type) throws TskCoreException { + this(artifact, + label, + timestamp, + AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE), + AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE), + AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE), + image, + type); + } + + /** + * 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 TskCoreException + */ + private ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Waypoint.Type type) throws TskCoreException { + this.artifact = artifact; + this.label = label; + this.type = type; + this.image = image; + this.timestamp = timestamp; + this.longitude = longitude; + this.latitude = latitude; + this.altitude = altitude; + + immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.getOtherGeolocationProperties(artifact)); + } + + /** + * Get the BlackboardArtifact that this waypoint represents. + * + * @return BlackboardArtifact for this waypoint. + */ + BlackboardArtifact getArtifact() { + return artifact; + } + + @Override + public Long getTimestamp() { + return timestamp; + } + + @Override + public String getLabel() { + return label; + } + + @Override + public Double getLatitude() { + return latitude; + } + + @Override + public Double getLongitude() { + return longitude; + } + + @Override + public Double getAltitude() { + return altitude; + } + + @Override + public AbstractFile getImage() { + return image; + } + + @Override + public Waypoint.Type getType() { + return type; + } + + @Override + public List getOtherProperties() { + return immutablePropertiesList; + } + + /** + * Get the timestamp attribute based on type for the given artifact. + * + * @param artifact BlackboardArtifact for waypoint + * + * @return Long timestamp or null if a value was not found. + * + * @throws TskCoreException + */ + private static Long getTimestampFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + if (artifact == null) { + return null; + } + + return AttributeUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); + } + + /** + * 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 TskCoreException + */ + private static String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + + String typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + if (typeLabel == null) { + typeLabel = ""; + } + return typeLabel; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java new file mode 100755 index 0000000000..00ca090bee --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java @@ -0,0 +1,122 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * Utilities for simplifying and reducing redundant when getting Artifact + * attributes. + */ +public class AttributeUtils { + + /** + * Helper function for getting a String attribute from an artifact. This + * will work for all attributes + * + * @param artifact The BlackboardArtifact to get the attributeType + * @param attributeType BlackboardAttribute attributeType + * + * @return String value for the given attribute or null if attribute was not + * set for the given artifact + * + * @throws TskCoreException + */ + static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + if (artifact == null) { + return null; + } + + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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 TskCoreException { + if (artifact == null) { + return null; + } + + if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE) { + return null; + } + + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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 TskCoreException { + 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 = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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 TskCoreException { + if (artifact == null) { + return null; + } + + if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER) { + return null; + } + + BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + return (attribute != null ? attribute.getValueInt() : null); + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java deleted file mode 100755 index 3487c61aba..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/BlackboardArtifactWaypoint.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import java.util.Map; -import org.openide.util.NbBundle.Messages; -import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Representation of a Waypoint created from a BlackboardArtifact. - * - */ -public class BlackboardArtifactWaypoint implements Waypoint { - - final private Long timestamp; - final private Double longitude; - final private Double latitude; - final private Double altitude; - final private String label; - final private AbstractFile image; - final private BlackboardArtifact artifact; - final private Waypoint.Type type; - final private Map otherAttributesMap; - - @Messages({ - "BlackboardArtifactWaypoint_Last_Known_Label=Last Known Location", - "BlackboardArtifactWaypoint_GPS_Trackpoint=GPS Trackpoint", - "BlackboardArtifactWaypoint_GPS_Search=GPS Search" - }) - - /** - * Constructs a Waypoint from a BlackboardArtifact - * - * @param artifact BlackboardArtifact with which to create the waypoint - * - * @throws TskCoreException - */ - protected BlackboardArtifactWaypoint(BlackboardArtifact artifact) throws TskCoreException { - this.artifact = artifact; - timestamp = getTimestampFromArtifact(artifact); - longitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE); - latitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE); - altitude = GeolocationUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); - image = getImageFromArtifact(artifact); - label = getLabelFromArtifact(artifact); - type = getTypeFromArtifact(artifact); - otherAttributesMap = GeolocationUtils.getOtherGeolocationAttributes(artifact); - } - - /** - * Get the BlackboardArtifact that this waypoint represents. - * - * @return BlackboardArtifact for this waypoint. - */ - BlackboardArtifact getArtifact() { - return artifact; - } - - @Override - public Long getTimestamp() { - return timestamp; - } - - @Override - public String getLabel() { - return label; - } - - @Override - public Double getLatitude() { - return latitude; - } - - @Override - public Double getLongitude() { - return longitude; - } - - @Override - public Double getAltitude() { - return altitude; - } - - @Override - public AbstractFile getImage() { - return image; - } - - @Override - public Waypoint.Type getType() { - return type; - } - - @Override - public Map getOtherProperties() { - return otherAttributesMap; - } - - /** - * Get the timestamp attribute based on type for the given artifact. - * - * @param artifact BlackboardArtifact for waypoint - * - * @return Long timestamp or null if a value was not found. - * - * @throws TskCoreException - */ - private Long getTimestampFromArtifact(BlackboardArtifact artifact) throws TskCoreException { - if (artifact == null) { - return null; - } - - BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - - if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { - return GeolocationUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED); - } - - return GeolocationUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - } - - /** - * Gets the image from the given artifact, this is really only applicable to - * the artifact type TSK_METADATA_EXIF - * - * @param artifact BlackboardArtifact for waypoint - * - * @return AbstractFile image for this waypoint or null if one is not - * available - * - * @throws TskCoreException - */ - private AbstractFile getImageFromArtifact(BlackboardArtifact artifact) throws TskCoreException { - BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - - if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { - return artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); - } - - return null; - } - - /** - * 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 TskCoreException - */ - private String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { - String typeLabel = getLabelFromImage(artifact); - if (typeLabel != null && !typeLabel.isEmpty()) { - return typeLabel; - } - - BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - if (typeLabel == null || typeLabel.isEmpty()) { - switch (artifactType) { - case TSK_GPS_SEARCH: - typeLabel = getLabelForSearch(artifact); - break; - case TSK_GPS_TRACKPOINT: - typeLabel = getLabelforTrackpoint(artifact); - break; - case TSK_GPS_LAST_KNOWN_LOCATION: - typeLabel = Bundle.BlackboardArtifactWaypoint_Last_Known_Label(); - break; - default: - typeLabel = ""; - break; - } - } - return typeLabel; - } - - /** - * Returns a Label for a GPS_Trackpoint artifact. This function assumes the - * calling function has already checked TSK_NAME. - * - * @param artifact BlackboardArtifact for waypoint - * - * @return String label for the artifacts way point. - * - * @throws TskCoreException - */ - private String getLabelforTrackpoint(BlackboardArtifact artifact) throws TskCoreException { - String typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); - } - - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = Bundle.BlackboardArtifactWaypoint_GPS_Trackpoint(); - } - - return typeLabel; - } - - /** - * Returns a Label for a GPS_SEARCH artifact. This function assumes the - * calling function has already checked TSK_NAME. - * - * @param artifact BlackboardArtifact for waypoint - * - * @return String label for the artifacts way point. - * - * @throws TskCoreException - */ - private String getLabelForSearch(BlackboardArtifact artifact) throws TskCoreException { - String typeLabel = GeolocationUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = Bundle.BlackboardArtifactWaypoint_GPS_Search(); - } - - return typeLabel; - } - - /** - * Returns a Label from an image. - * - * @return String label for waypoint with image or null. - */ - private String getLabelFromImage(BlackboardArtifact artifact) throws TskCoreException{ - if (getImageFromArtifact(artifact) != null) { - return getImage().getName(); - } else { - return null; - } - } - - /** - * Gets the type of waypoint based on the artifact. - * - * @param artifact BlackboardArtifact for waypoint - * - * @return A waypoint type. - */ - private Waypoint.Type getTypeFromArtifact(BlackboardArtifact artifact) { - BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - - switch (artifactType) { - case TSK_GPS_LAST_KNOWN_LOCATION: - return Waypoint.Type.LAST_KNOWN_LOCATION; - case TSK_GPS_TRACKPOINT: - return Waypoint.Type.TRACKPOINT; - case TSK_GPS_SEARCH: - return Waypoint.Type.SEARCH; - case TSK_GPS_BOOKMARK: - return Waypoint.Type.BOOKMARK; - case TSK_METADATA_EXIF: - return Waypoint.Type.METADATA_EXIF; - default: - return Waypoint.Type.UNKNOWN; - } - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED index 33e0ff3247..60345f2e57 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED @@ -1,9 +1,9 @@ -BlackboardArtifactWaypoint_GPS_Search=GPS Search -BlackboardArtifactWaypoint_GPS_Trackpoint=GPS Trackpoint -BlackboardArtifactWaypoint_Last_Known_Label=Last Known Location +LastKnownWaypoint_Label=Last Known Location Route_End_Label=End Route_Label=As-the-crow-flies Route Route_Start_Label=Start +SearchWaypoint_DisplayLabel=GPS Search +TrackpointWaypoint_DisplayLabel=GPS Trackpoint Waypoint_Bookmark_Display_String=GPS Bookmark Waypoint_EXIF_Display_String=EXIF Metadata With Location Waypoint_Last_Known_Display_String=GPS Last Known Location diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java new file mode 100755 index 0000000000..37a1a2c7e2 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java @@ -0,0 +1,78 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * Waypoint wrapper class for TSK_METADATA_EXIF artifacts. + */ +final class EXIFWaypoint extends ArtifactWaypoint { + + /** + * Construct a way point with the given artifact. + * + * @param artifact BlackboardArtifact for waypoint + * + * @throws TskCoreException + */ + protected EXIFWaypoint(BlackboardArtifact artifact) throws TskCoreException { + this(artifact, getImageFromArtifact(artifact)); + } + + /** + * Private constructor to help with the construction of EXIFWaypoints. + * + * @param artifact Waypoint BlackboardArtifact + * @param image EXIF AbstractFile image + * + * @throws TskCoreException + */ + private EXIFWaypoint(BlackboardArtifact artifact, AbstractFile image) throws TskCoreException { + super(artifact, + image != null ? image.getName() : "", + AttributeUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED), + image, + Waypoint.Type.METADATA_EXIF); + } + + /** + * Gets the image from the given artifact. + * + * @param artifact BlackboardArtifact for waypoint + * + * @return AbstractFile image for this waypoint or null if one is not + * available + * + * @throws TskCoreException + */ + private static AbstractFile getImageFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); + + if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { + return artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); + } + + return null; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java new file mode 100755 index 0000000000..28bd7127a0 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java @@ -0,0 +1,65 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * A GPSSearchWaypoint is a subclass of ArtifactWaypoint. + */ +final class GPSSearchWaypoint extends ArtifactWaypoint { + + @Messages({ + "SearchWaypoint_DisplayLabel=GPS Search" + }) + + /** + * Construct a GPS Search waypoint. + */ + public GPSSearchWaypoint(BlackboardArtifact artifact) throws TskCoreException { + super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.SEARCH); + } + + /** + * Returns a Label for a GPS_SEARCH artifact. + * + * @param artifact BlackboardArtifact for waypoint + * + * @return String label for the artifacts way point. + * + * @throws TskCoreException + */ + private static String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + String typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); + } + + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = Bundle.SearchWaypoint_DisplayLabel(); + } + + return typeLabel; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java deleted file mode 100755 index a6a882caa9..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationManager.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import java.util.ArrayList; -import java.util.List; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.SleuthkitCase; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Static functions for the creations of geolocation points for artifacts. - * - */ -public final class GeolocationManager { - - /** - * Add a private constructor to silence codacy warning about making this - * class a utility class as I suspect this class may grow when filtering is - * added. - */ - private GeolocationManager() { - - } - - /** - * Returns a list of Waypoints for the artifacts with geolocation - * information. - * - * List will include artifacts of type: TSK_GPS_TRACKPOINT TSK_GPS_SEARCH - * TSK_GPS_LAST_KNOWN_LOCATION TSK_GPS_BOOKMARK TSK_METADATA_EXIF - * - * @param skCase Currently open SleuthkitCase - * @param includeRoutes True to include the points at are in TSK_GPS_ROUTE - * objects - * - * @return List of BlackboardArtifactPoints - * - * @throws TskCoreException - */ - static public List getWaypoints(SleuthkitCase skCase) throws TskCoreException { - List points = new ArrayList<>(); - - points.addAll(getBasicPoints(skCase)); - - return points; - } - - /** - * Gets the list of Routes from the TSK_GPS_ROUTE artifacts. - * - * @param skCase Currently open SleuthkitCase - * - * @return List of Route objects, empty list will be returned if no Routes - * where found - * - * @throws TskCoreException - */ - static public List getGPSRoutes(SleuthkitCase skCase) throws TskCoreException { - List routes = new ArrayList<>(); - List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); - for (BlackboardArtifact artifact : artifacts) { - Route route = new Route(artifact); - routes.add(route); - } - return routes; - } - - /** - * Get a list of Waypoints for the GPS artifacts. Artifacts that will be - * included: TSK_GPS_TRACKPOINT TSK_GPS_SEARCH TSK_GPS_LAST_KNOWN_LOCATION - * TSK_GPS_BOOKMARK - * - * Waypoint objects will be created and added to the list only for artifacts - * with TSK_GEO_LONGITUDE and TSK_LATITUDE attributes. - * - * @param skCase Currently open SleuthkitCase - * - * @return List of BlackboardArtifactPoints for above artifacts or empty - * list if none where found. - * - * @throws TskCoreException - */ - static private List getBasicPoints(SleuthkitCase skCase) throws TskCoreException { - - List points = new ArrayList<>(); - - List artifacts = new ArrayList<>(); - artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)); - artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH)); - artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION)); - artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK)); - artifacts.addAll(skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF)); - - for (BlackboardArtifact artifact : artifacts) { - BlackboardArtifactWaypoint point = new BlackboardArtifactWaypoint(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); - } - } - - return points; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java index ee8d917fce..19e42c5707 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java @@ -1,23 +1,34 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; -import java.util.HashMap; -import java.util.Map; +import java.util.ArrayList; +import java.util.List; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; /** - * + * GeolocationUtilis class for common to be share across in the package * */ -public final class GeolocationUtils { - - private static final String DEFAULT_COORD_FORMAT = "%.2f, %.2f"; +final class GeolocationUtils { /** * This is a list of attributes that are related to a geolocation waypoint @@ -40,160 +51,37 @@ public final class GeolocationUtils { BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MAKE, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_MODEL }; - + /** * This is a Utility class that should not be constructed. */ private GeolocationUtils() { - - } - static public String getFormattedCoordinates(Double latitude, Double longitude) { - if (latitude == null || longitude == null) { - return ""; - } - - return String.format(DEFAULT_COORD_FORMAT, latitude, longitude); } /** - * Helper function for getting a String attribute from an artifact. This - * will work for all attributes + * Get a list of Waypoint.Property objects for the given artifact. * - * @param artifact The BlackboardArtifact to get the attributeType - * @param attributeType BlackboardAttribute attributeType + * @param artifact Blackboard artifact to get attributes\properties from * - * @return String value for the given attribute or null if attribute was not - * set for the given artifact + * @return A List of Waypoint.Property objects * * @throws TskCoreException */ - static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { - if (artifact == null) { - return null; - } - - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); - 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 TskCoreException { - if (artifact == null) { - return null; - } - - if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DOUBLE) { - return null; - } - - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); - 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 TskCoreException { - 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 = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); - 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 TskCoreException { - if (artifact == null) { - return null; - } - - if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.INTEGER) { - return null; - } - - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); - return (attribute != null ? attribute.getValueInt() : null); - } - - /** - * Helper function for consistently formatting the timestamp. - * - * @param type BlackboardAttribute type - * - * @return The timestamp value formatted as string, or empty string if no - * timestamp is available. - * - * @throws TskCoreException - */ - static String getFormattedTimestamp(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { - if (artifact == null) { - return null; - } - - if (attributeType.getValueType() != BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME) { - return null; - } - - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); - return (attribute != null ? attribute.getDisplayString() : null); - } - - /** - * Returns a Map of formatted artifact attributes for geolocation artifacts. - * The map key will be the display string off the attribute, the value will - * be either a formatted value or a an empty string. - * - * @param artifact - * - * @return - */ - static Map getOtherGeolocationAttributes(BlackboardArtifact artifact) throws TskCoreException { - Map map = new HashMap<>(); + static List getOtherGeolocationProperties(BlackboardArtifact artifact) throws TskCoreException { + List list = new ArrayList<>(); for (BlackboardAttribute.ATTRIBUTE_TYPE type : OTHER_GEO_ATTRIBUTES) { String key = type.getDisplayName(); - String value = getString(artifact, type); + String value = AttributeUtils.getString(artifact, type); if (value == null) { value = ""; } - map.put(key, value); + list.add(new Waypoint.Property(key, value)); } - return map; + return list; } - } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java new file mode 100755 index 0000000000..6ef47f76a2 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java @@ -0,0 +1,55 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * A Last Know Location Waypoint object. + */ +@Messages({ + "LastKnownWaypoint_Label=Last Known Location",}) +final class LastKnownWaypoint extends ArtifactWaypoint { + + protected LastKnownWaypoint(BlackboardArtifact artifact) throws TskCoreException { + super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.LAST_KNOWN_LOCATION); + } + + /** + * Gets the label for a TSK_LAST_KNOWN_LOCATION. + * + * @param artifact BlackboardArtifact to get label from + * + * @return String value from attribute TSK_NAME or LastKnownWaypoint_Label + * + * @throws TskCoreException + */ + private static String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + String label = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + + if (label == null || label.isEmpty()) { + label = Bundle.LastKnownWaypoint_Label(); + } + + return label; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index 68d93509d5..4eefc72bca 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -20,11 +20,12 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.ArrayList; +import java.util.Collections; import java.util.List; -import java.util.Map; import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; /** @@ -43,7 +44,30 @@ public class Route { private final List points; private final Long timestamp; private final Double altitude; - private final Map otherAttributesMap; + + // This list is not expected to change after construction so the + // constructor will take care of creating an unmodifiable List + private final List immutablePropertiesList; + + /** + * Gets the list of Routes from the TSK_GPS_ROUTE artifacts. + * + * @param skCase Currently open SleuthkitCase + * + * @return List of Route objects, empty list will be returned if no Routes + * where found + * + * @throws TskCoreException + */ + static public List getGPSRoutes(SleuthkitCase skCase) throws TskCoreException { + List routes = new ArrayList<>(); + List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); + for (BlackboardArtifact artifact : artifacts) { + Route route = new Route(artifact); + routes.add(route); + } + return routes; + } /** * Construct a route for the given artifact. @@ -66,7 +90,7 @@ public class Route { altitude = getRouteAltitude(artifact); timestamp = getRouteTimestamp(artifact); - otherAttributesMap = initalizeOtherAttributes(artifact); + immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.getOtherGeolocationProperties(artifact)); } /** @@ -98,12 +122,12 @@ public class Route { /** * Get the "Other attributes" for this route. The map will contain display - * name, formatted value pairs. + * name, formatted value pairs. This list is unmodifiable. * * @return Map of key, value pairs. */ - public Map getOtherProperties() { - return otherAttributesMap; + public List getOtherProperties() { + return immutablePropertiesList; } /** @@ -206,18 +230,4 @@ public class Route { return attribute != null ? attribute.getValueLong() : null; } - /** - * Retrieve the "Other attributes" for this route. The map will contain - * display name, formatted value pairs. - * - * @param artifact The BlackboardARtifact object from which this route is - * created - * - * @return A Map of other attributes for this route. - * - * @throws TskCoreException - */ - private Map initalizeOtherAttributes(BlackboardArtifact artifact) throws TskCoreException { - return GeolocationUtils.getOtherGeolocationAttributes(artifact); - } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java index 23cc4b8198..25eac21422 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java @@ -19,14 +19,14 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; -import java.util.Map; +import java.util.List; import org.sleuthkit.datamodel.AbstractFile; /** * A point in a Route. For future use this point will have a pointer to its * parent route. */ -public class RoutePoint implements Waypoint { +final class RoutePoint implements Waypoint { private final Route parent; private final Double longitude; @@ -74,7 +74,7 @@ public class RoutePoint implements Waypoint { } @Override - public Map getOtherProperties() { + public List getOtherProperties() { return parent.getOtherProperties(); } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java new file mode 100755 index 0000000000..b4b1205c77 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java @@ -0,0 +1,71 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; + +/** + * A wrapper class for TSK_GPS_TRACKPOINT artifacts. + */ +final class TrackpointWaypoint extends ArtifactWaypoint { + + @Messages({ + "TrackpointWaypoint_DisplayLabel=GPS Trackpoint" + }) + + /** + * Construct a waypoint for trackpoints. + */ + TrackpointWaypoint(BlackboardArtifact artifact) throws TskCoreException { + super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.TRACKPOINT); + } + + /** + * Returns a Label for a GPS_Trackpoint artifact. This function assumes the + * calling function has already checked TSK_NAME. + * + * @param artifact BlackboardArtifact for waypoint + * + * @return String label for the artifacts way point. + * + * @throws TskCoreException + */ + private static String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + + String typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + } + + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + } + + if (typeLabel == null || typeLabel.isEmpty()) { + typeLabel = Bundle.TrackpointWaypoint_DisplayLabel(); + } + + return typeLabel; + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java index edd3257391..2bf606b18b 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java @@ -18,9 +18,13 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; -import java.util.Map; +import java.util.ArrayList; +import java.util.List; import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.SleuthkitCase; +import org.sleuthkit.datamodel.TskCoreException; /** * The basic details of a waypoint. @@ -28,6 +32,16 @@ import org.sleuthkit.datamodel.AbstractFile; */ public interface Waypoint { + // Display names are from the original KML Report + @Messages({ + "Waypoint_Bookmark_Display_String=GPS Bookmark", + "Waypoint_Last_Known_Display_String=GPS Last Known Location", + "Waypoint_EXIF_Display_String=EXIF Metadata With Location", + "Waypoint_Route_Point_Display_String=GPS Individual Route Point", + "Waypoint_Search_Display_String=GPS Search", + "Waypoint_Trackpoint_Display_String=GPS Trackpoint" + }) + /** * Get the timestamp for this BlackboardArtifact. * @@ -64,16 +78,13 @@ public interface Waypoint { Double getAltitude(); /** - * Gets a Map of other properties that may be interesting to this way point. - * This map will not include properties for which there are getter functions + * Gets an unmodifiable List of other properties that may be interesting to this way point. + * The List will not include properties for which there are getter functions * for. * - * The key is a "Display String", the value will be either an empty string - * or the formatted value. - * - * @return A Map of waypoint properties + * @return A List of waypoint properties */ - Map getOtherProperties(); + List getOtherProperties(); /** * Get the image for this waypoint. @@ -89,15 +100,153 @@ public interface Waypoint { */ Type getType(); - // Display names are from the original KML Report - @Messages({ - "Waypoint_Bookmark_Display_String=GPS Bookmark", - "Waypoint_Last_Known_Display_String=GPS Last Known Location", - "Waypoint_EXIF_Display_String=EXIF Metadata With Location", - "Waypoint_Route_Point_Display_String=GPS Individual Route Point", - "Waypoint_Search_Display_String=GPS Search", - "Waypoint_Trackpoint_Display_String=GPS Trackpoint" - }) + /** + * Returns a list of Waypoints for the artifacts with geolocation + * information. + * + * List will include artifacts of type: TSK_GPS_TRACKPOINT TSK_GPS_SEARCH + * TSK_GPS_LAST_KNOWN_LOCATION TSK_GPS_BOOKMARK TSK_METADATA_EXIF + * + * @param skCase Currently open SleuthkitCase + * + * @return List of Waypoint + * + * @throws TskCoreException + */ + static List getAllWaypoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); + + points.addAll(getTrackpointWaypoints(skCase)); + points.addAll(getEXIFWaypoints(skCase)); + points.addAll(getSearchWaypoints(skCase)); + points.addAll(getLastKnownWaypoints(skCase)); + points.addAll(getBookmarkWaypoints(skCase)); + + return points; + } + + /** + * Gets a list of Waypoints for TSK_GPS_TRACKPOINT artifacts. + * + * @param skCase Currently open SleuthkitCase + * + * @return List of Waypoint + * + * @throws TskCoreException + */ + static List getTrackpointWaypoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); + List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT); + for (BlackboardArtifact artifact : artifacts) { + ArtifactWaypoint point = new TrackpointWaypoint(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); + } + } + return points; + } + + /** + * Gets a list of Waypoints for TSK_METADATA_EXIF artifacts. + * + * @param skCase Currently open SleuthkitCase + * + * @return List of Waypoint + * + * @throws TskCoreException + */ + static List getEXIFWaypoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); + List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); + if (artifacts != null) { + for (BlackboardArtifact artifact : artifacts) { + ArtifactWaypoint point = new EXIFWaypoint(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); + } + } + } + return points; + } + + /** + * Gets a list of Waypoints for TSK_GPS_SEARCH artifacts. + * + * @param skCase Currently open SleuthkitCase + * + * @return List of Waypoint + * + * @throws TskCoreException + */ + static List getSearchWaypoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); + List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH); + if (artifacts != null) { + for (BlackboardArtifact artifact : artifacts) { + ArtifactWaypoint point = new GPSSearchWaypoint(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); + } + } + } + return points; + } + + /** + * Gets a list of Waypoints for TSK_GPS_LAST_KNOWN_LOCATION artifacts. + * + * @param skCase Currently open SleuthkitCase + * + * @return List of Waypoint + * + * @throws TskCoreException + */ + static List getLastKnownWaypoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); + List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION); + if (artifacts != null) { + for (BlackboardArtifact artifact : artifacts) { + 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); + } + } + } + return points; + } + + /** + * Gets a list of Waypoints for TSK_GPS_BOOKMARK artifacts. + * + * @param skCase Currently open SleuthkitCase + * + * @return List of Waypoint + * + * @throws TskCoreException + */ + static List getBookmarkWaypoints(SleuthkitCase skCase) throws TskCoreException { + List points = new ArrayList<>(); + List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK); + if (artifacts != null) { + for (BlackboardArtifact artifact : artifacts) { + ArtifactWaypoint point = new ArtifactWaypoint(artifact, Waypoint.Type.BOOKMARK); + // Only add to the list if the point has a valid latitude + // and longitude. + if (point.getLatitude() != null && point.getLongitude() != null) { + points.add(point); + } + } + } + return points; + } /** * An enum to keep track of the type of a way point. @@ -108,8 +257,7 @@ public interface Waypoint { METADATA_EXIF(Bundle.Waypoint_EXIF_Display_String()), ROUTE_POINT(Bundle.Waypoint_Route_Point_Display_String()), SEARCH(Bundle.Waypoint_Search_Display_String()), - TRACKPOINT(Bundle.Waypoint_Trackpoint_Display_String()), - UNKNOWN("Unknown"); + TRACKPOINT(Bundle.Waypoint_Trackpoint_Display_String()); private final String displayName; @@ -131,4 +279,44 @@ public interface Waypoint { return displayName; } } + + /** + * Simple property class for waypoint properties that a purely + * informational. + */ + class Property { + + private final String displayName; + private final String value; + + /** + * Construct a Property object. + * + * @param displayName String display name for property. Ideally not null + * or empty string. + * @param value String value for property. Can be null. + */ + Property(String displayName, String value) { + this.displayName = displayName; + this.value = value; + } + + /** + * Get the display name for this property. + * + * @return String display name. + */ + public String getDisplayName() { + return displayName; + } + + /** + * Get the property value. + * + * @return String value. + */ + public String getValue() { + return value; + } + } } diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index 175819610f..4a5afdc200 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -36,9 +36,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.List; -import java.util.Map; -import java.util.Iterator; -import java.util.Map.Entry; import java.util.logging.Level; import org.jdom2.Document; import org.jdom2.Element; @@ -49,8 +46,6 @@ import org.jdom2.CDATA; import org.openide.filesystems.FileUtil; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; -import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationManager; -import org.sleuthkit.autopsy.geolocation.datamodel.GeolocationUtils; import org.sleuthkit.autopsy.geolocation.datamodel.Route; import org.sleuthkit.autopsy.report.ReportBranding; import org.sleuthkit.autopsy.report.ReportProgressPanel; @@ -70,7 +65,7 @@ class KMLReport implements GeneralReportModule { private SleuthkitCase skCase; private final SimpleDateFormat kmlDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); private Namespace ns; - String HTML_PROP_FORMAT = "%s: %s
    "; + private final String HTML_PROP_FORMAT = "%s: %s
    "; private Element gpsExifMetadataFolder; private Element gpsBookmarksFolder; @@ -309,7 +304,7 @@ class KMLReport implements GeneralReportModule { path = Paths.get(abstractFile.getName()); } - gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, GeolocationUtils.getFormattedCoordinates(point.getLatitude(), point.getLongitude()))); + gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, formattedCoordinates(point.getLatitude(), point.getLongitude()))); } /** @@ -322,7 +317,7 @@ class KMLReport implements GeneralReportModule { * @throws IOException */ void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws TskCoreException, IOException { - List points = GeolocationManager.getWaypoints(skCase); + List points = Waypoint.getAllWaypoints(skCase); for (Waypoint point : points) { Element reportPoint = makePoint(point); @@ -330,7 +325,7 @@ class KMLReport implements GeneralReportModule { continue; } - String formattedCords = GeolocationUtils.getFormattedCoordinates(point.getLatitude(), point.getLongitude()); + String formattedCords = formattedCoordinates(point.getLatitude(), point.getLongitude()); switch (point.getType()) { case METADATA_EXIF: @@ -363,7 +358,7 @@ class KMLReport implements GeneralReportModule { * @throws TskCoreException */ void makeRoutes(SleuthkitCase skCase) throws TskCoreException { - List routes = GeolocationManager.getGPSRoutes(skCase); + List routes = Route.getGPSRoutes(skCase); if(routes == null) { return; @@ -392,12 +387,12 @@ class KMLReport implements GeneralReportModule { return; } - Element reportRoute = makeLineString(start.getLatitude(), start.getLongitude(), start.getAltitude(), end.getLatitude(), end.getLongitude(), end.getAltitude()); + Element reportRoute = makeLineString(start.getLatitude(), start.getLongitude(), end.getLatitude(), end.getLongitude()); Element startingPoint = makePoint(start.getLatitude(), start.getLongitude(), start.getAltitude()); Element endingPoint = makePoint(end.getLatitude(), end.getLongitude(), end.getAltitude()); - String formattedEnd = GeolocationUtils.getFormattedCoordinates(end.getLatitude(), end.getLongitude()); - String formattedStart = GeolocationUtils.getFormattedCoordinates(start.getLatitude(), start.getLongitude()); + String formattedEnd = formattedCoordinates(end.getLatitude(), end.getLongitude()); + String formattedStart = formattedCoordinates(start.getLatitude(), start.getLongitude()); String formattedCoordinates = String.format("%s to %s", formattedStart, formattedEnd); @@ -452,15 +447,12 @@ class KMLReport implements GeneralReportModule { return null; } - if (altitude == null) { - altitude = 0.0; - } Element point = new Element("Point", ns); //NON-NLS - // KML uses lon, lat. Deliberately reversed. - Element coordinates = new Element("coordinates", ns).addContent(longitude + "," + latitude + "," + altitude); //NON-NLS + // KML uses lon, lat. Deliberately reversed.1 + Element coordinates = new Element("coordinates", ns).addContent(longitude + "," + latitude + "," + (altitude != null ? altitude : 0.0)); //NON-NLS - if (altitude != 0) { + if (altitude != null && altitude != 0) { /* * Though we are including a non-zero altitude, clamp it to the * ground because inaccuracies from the GPS data can cause the @@ -494,18 +486,11 @@ class KMLReport implements GeneralReportModule { * * @return the Line as an Element */ - private Element makeLineString(Double startLatitude, Double startLongitude, Double startAltitude, Double stopLatitude, Double stopLongitude, Double stopAltitude) { + private Element makeLineString(Double startLatitude, Double startLongitude, Double stopLatitude, Double stopLongitude) { if (startLatitude == null || startLongitude == null || stopLatitude == null || stopLongitude == null) { return null; } - if (startAltitude == null) { - startAltitude = 0.0; - } - if (stopAltitude == null) { - stopAltitude = 0.0; - } - Element lineString = new Element("LineString", ns); //NON-NLS lineString.addContent(new Element("extrude", ns).addContent("1")); //NON-NLS lineString.addContent(new Element("tessellate", ns).addContent("1")); //NON-NLS @@ -691,13 +676,11 @@ class KMLReport implements GeneralReportModule { result.append(formatAttribute("Altitude", point.getAltitude().toString())); } - Map otherProps = point.getOtherProperties(); - Iterator> iterator = otherProps.entrySet().iterator(); - while (iterator.hasNext()) { - Entry entry = iterator.next(); - String value = entry.getValue(); - if (value != null && !value.isEmpty()) { - result.append(formatAttribute(entry.getKey(), value)); + List list = point.getOtherProperties(); + for(Waypoint.Property prop: list) { + String value = prop.getValue(); + if(value != null && !value.isEmpty()) { + result.append(formatAttribute(prop.getDisplayName(), value)); } } @@ -750,16 +733,22 @@ class KMLReport implements GeneralReportModule { result.append(formatAttribute("Altitude", route.getAltitude().toString())); } - Map otherProps = route.getOtherProperties(); - Iterator> iterator = otherProps.entrySet().iterator(); - while (iterator.hasNext()) { - Entry entry = iterator.next(); - String value = entry.getValue(); - if (value != null && !value.isEmpty()) { - result.append(formatAttribute(entry.getKey(), value)); + List list = route.getOtherProperties(); + for(Waypoint.Property prop: list) { + String value = prop.getValue(); + if(value != null && !value.isEmpty()) { + result.append(formatAttribute(prop.getDisplayName(), value)); } } return result.toString(); } + + private String formattedCoordinates(Double latitude, Double longitude) { + if (latitude == null || longitude == null) { + return ""; + } + + return String.format("%.2f, %.2f", latitude, longitude); + } } From b5ccef0fb200ae3ef3d6a275f21790379182a6af Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 22 Oct 2019 14:19:59 -0400 Subject: [PATCH 32/91] Two small codacy fixes --- .../autopsy/geolocation/datamodel/AttributeUtils.java | 7 +++++++ .../sleuthkit/autopsy/report/modules/kml/KMLReport.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java index 00ca090bee..5892733350 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java @@ -27,6 +27,13 @@ import org.sleuthkit.datamodel.TskCoreException; * attributes. */ public class AttributeUtils { + + /** + * Private constructor for this Utility class. + */ + private AttributeUtils() { + + } /** * Helper function for getting a String attribute from an artifact. This diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index 4a5afdc200..ff5d1c35ba 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -65,7 +65,7 @@ class KMLReport implements GeneralReportModule { private SleuthkitCase skCase; private final SimpleDateFormat kmlDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); private Namespace ns; - private final String HTML_PROP_FORMAT = "%s: %s
    "; + private final static String HTML_PROP_FORMAT = "%s: %s
    "; private Element gpsExifMetadataFolder; private Element gpsBookmarksFolder; From 750c8b86fb9387ed7fa6e7f71787e567a5000501 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 22 Oct 2019 14:20:00 -0400 Subject: [PATCH 33/91] Fix DataContentViewerUtility.java formatting --- .../DataContentViewerUtility.java | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerUtility.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerUtility.java index 24f54fa7ac..ea1e7b58a0 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerUtility.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerUtility.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * - * Copyright 2018 Basis Technology Corp. + * + * Copyright 2018-2019 Basis Technology Corp. * Contact: carrier sleuthkit 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. @@ -23,32 +23,32 @@ import org.openide.nodes.Node; import org.sleuthkit.datamodel.BlackboardArtifact; /** - * Utility classes for content viewers. - * In theory, this would live in the contentviewer package, - * but the initial method was needed only be viewers in + * Utility classes for content viewers. In theory, this would live in the + * contentviewer package, but the initial method was needed only be viewers in * corecomponents and therefore can stay out of public API. */ public class DataContentViewerUtility { + /** - * Returns the first non-Blackboard Artifact from a Node. - * Needed for (at least) Hex and Strings that want to view - * all types of content (not just AbstractFile), but don't want - * to display an artifact unless that's the only thing there. - * Scenario is hash hit or interesting item hit. - * + * Returns the first non-Blackboard Artifact from a Node. Needed for (at + * least) Hex and Strings that want to view all types of content (not just + * AbstractFile), but don't want to display an artifact unless that's the + * only thing there. Scenario is hash hit or interesting item hit. + * * @param node Node passed into content viewer + * * @return highest priority content or null if there is no content */ public static Content getDefaultContent(Node node) { Content bbContentSeen = null; - for (Content content : (node).getLookup().lookupAll(Content.class)) { + for (Content content : (node).getLookup().lookupAll(Content.class)) { if (content instanceof BlackboardArtifact) { bbContentSeen = content; - } - else { + } else { return content; } } return bbContentSeen; } + } From e9890a72679597d1c8bb0b3a68a2e59345839f42 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 22 Oct 2019 14:42:15 -0400 Subject: [PATCH 34/91] Cleaned up line queries and tested for regressions --- InternalPythonModules/android/line.py | 85 ++++++++++----------------- 1 file changed, 31 insertions(+), 54 deletions(-) diff --git a/InternalPythonModules/android/line.py b/InternalPythonModules/android/line.py index ab8e24c9f9..6edcf158fa 100644 --- a/InternalPythonModules/android/line.py +++ b/InternalPythonModules/android/line.py @@ -236,28 +236,23 @@ class LineCallLogsParser(TskCallLogsParser): def __init__(self, calllog_db): super(LineCallLogsParser, self).__init__(calllog_db.runQuery( """ - SELECT Substr(CH.call_type, -1) AS direction, - CH.start_time AS start_time, - CH.end_time AS end_time, - contacts_list_with_groups.members AS group_members, - contacts_list_with_groups.member_names AS names, - CH.caller_mid, - CH.voip_type AS call_type, - CH.voip_gc_media_type AS group_call_type + SELECT Substr(calls.call_type, -1) AS direction, + calls.start_time AS start_time, + calls.end_time AS end_time, + contact_book_w_groups.members AS group_members, + calls.caller_mid, + calls.voip_type AS call_type, + calls.voip_gc_media_type AS group_call_type FROM (SELECT id, - Group_concat(M.m_id) AS members, - Group_concat(Replace(C.server_name, ",", "")) AS member_names + Group_concat(M.m_id) AS members FROM membership AS M - JOIN naver.contacts AS C - ON M.m_id = C.m_id GROUP BY id UNION SELECT m_id, - NULL, - server_name - FROM naver.contacts) AS contacts_list_with_groups - JOIN call_history AS CH - ON CH.caller_mid = contacts_list_with_groups.id + NULL + FROM naver.contacts) AS contact_book_w_groups + JOIN call_history AS calls + ON calls.caller_mid = contact_book_w_groups.id """ ) ) @@ -355,43 +350,25 @@ class LineMessagesParser(TskMessagesParser): def __init__(self, message_db): super(LineMessagesParser, self).__init__(message_db.runQuery( """ - SELECT contact_list_with_groups.name, - contact_list_with_groups.id, - contact_list_with_groups.members, - contact_list_with_groups.member_names, - CH.from_mid, - C.server_name AS from_name, - CH.content, - CH.created_time, - CH.attachement_type, - CH.attachement_local_uri, - CH.status - FROM (SELECT G.name, - group_members.id, - group_members.members, - group_members.member_names - FROM (SELECT id, - group_concat(M.m_id) AS members, - group_concat(replace(C.server_name, - ",", - "")) as member_names - FROM membership AS M - JOIN contacts as C - ON M.m_id = C.m_id - GROUP BY id) AS group_members - JOIN groups AS G - ON G.id = group_members.id - UNION - SELECT server_name, - m_id, - NULL, - NULL - FROM contacts) AS contact_list_with_groups - JOIN chat_history AS CH - ON CH.chat_id = contact_list_with_groups.id - LEFT JOIN contacts as C - ON C.m_id = CH.from_mid - WHERE attachement_type != 6 + SELECT contact_book_w_groups.id, + contact_book_w_groups.members, + messages.from_mid, + messages.content, + messages.created_time, + messages.attachement_type, + messages.attachement_local_uri, + messages.status + FROM (SELECT id, + Group_concat(M.m_id) AS members + FROM membership AS M + GROUP BY id + UNION + SELECT m_id, + NULL + FROM contacts) AS contact_book_w_groups + JOIN chat_history AS messages + ON messages.chat_id = contact_book_w_groups.id + WHERE attachement_type != 6 """ ) ) From 77aa843d862c55c861d41cd77ecd5580be71e839 Mon Sep 17 00:00:00 2001 From: Eammon Date: Tue, 22 Oct 2019 14:43:30 -0400 Subject: [PATCH 35/91] Added mechanism to get the startup window and to use it or the multi user case dialog as the parent of the file chooser. --- .../autopsy/casemodule/CaseOpenAction.java | 14 ++++++++------ .../autopsy/casemodule/StartupWindowProvider.java | 9 +++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseOpenAction.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseOpenAction.java index b68d1a49f6..0ba92c7bce 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseOpenAction.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseOpenAction.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.casemodule; +import java.awt.Component; import java.awt.Cursor; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -93,7 +94,8 @@ public final class CaseOpenAction extends CallableSystemAction implements Action * If the open multi user case dialog is open make sure it's not set * to always be on top as this hides the file chooser on macOS. */ - OpenMultiUserCaseDialog.getInstance().setAlwaysOnTop(false); + OpenMultiUserCaseDialog multiUserCaseDialog = OpenMultiUserCaseDialog.getInstance(); + multiUserCaseDialog.setAlwaysOnTop(false); String optionsDlgTitle = NbBundle.getMessage(Case.class, "CloseCaseWhileIngesting.Warning.title"); String optionsDlgMessage = NbBundle.getMessage(Case.class, "CloseCaseWhileIngesting.Warning"); if (IngestRunningCheck.checkAndConfirmProceed(optionsDlgTitle, optionsDlgMessage)) { @@ -102,11 +104,11 @@ public final class CaseOpenAction extends CallableSystemAction implements Action * file (.aut file). */ /** - * Passing the fileChooser as its own parent gets around an issue - * where the fileChooser was hidden behind the CueBannerPanel ("Welcome" dialog) - * on macOS. + * The parent of the fileChooser will either be the multi user + * case dialog or the startup window. */ - int retval = fileChooser.showOpenDialog(fileChooser); + int retval = fileChooser.showOpenDialog(multiUserCaseDialog.isVisible() + ? multiUserCaseDialog : (Component) StartupWindowProvider.getInstance().getStartupWindow()); if (retval == JFileChooser.APPROVE_OPTION) { /* * Close the startup window, if it is open. @@ -116,7 +118,7 @@ public final class CaseOpenAction extends CallableSystemAction implements Action /* * Close the Open Multi-User Case window, if it is open. */ - OpenMultiUserCaseDialog.getInstance().setVisible(false); + multiUserCaseDialog.setVisible(false); /* * Try to open the case associated with the case metadata file diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java index 13aae1c0de..8bec55f53c 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/StartupWindowProvider.java @@ -144,4 +144,13 @@ public class StartupWindowProvider implements StartupWindowInterface { startupWindowToUse.close(); } } + + /** + * Get the chosen startup window. + * + * @return The startup window. + */ + public StartupWindowInterface getStartupWindow() { + return startupWindowToUse; + } } From 65af0dfb40000fe83fec244441373f3f36075f17 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 22 Oct 2019 15:11:54 -0400 Subject: [PATCH 36/91] Fixed bug in ArtifactWaypoint.java --- .../autopsy/geolocation/datamodel/ArtifactWaypoint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java index 09fd01d5a1..280da3a563 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java @@ -102,7 +102,7 @@ class ArtifactWaypoint implements Waypoint { label, timestamp, AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE), - AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE), + AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE), AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE), image, type); From 7bd266027ea028be8d68c3b7a456718fef06974b Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 22 Oct 2019 15:27:00 -0400 Subject: [PATCH 37/91] Updated to get waypoints from new datamodel --- .../geolocation/Bundle.properties-MERGED | 1 + .../geolocation/GeolocationTopComponent.java | 8 +-- .../autopsy/geolocation/MapWaypoint.java | 56 +++++++++++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED index 5f7a6cd2f0..f925437b0b 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/geolocation/Bundle.properties-MERGED @@ -1,6 +1,7 @@ CTL_OpenGeolocation=Geolocation CTL_GeolocationTopComponentAction=GeolocationTopComponent CTL_GeolocationTopComponent=Geolocation +GLTopComponent_initilzation_error=An error occurred during waypoint initilization. Geolocation data maybe incomplete. GLTopComponent_name=Geolocation OpenGeolocationAction_displayName=Geolocation OpenGeolocationAction_name=Geolocation diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java index 3678f562e8..1e3143d678 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -42,8 +42,6 @@ import org.sleuthkit.autopsy.ingest.IngestManager; import static org.sleuthkit.autopsy.ingest.IngestManager.IngestModuleEvent.DATA_ADDED; import org.sleuthkit.autopsy.ingest.ModuleDataEvent; import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.SleuthkitCase; -import org.sleuthkit.datamodel.TskCoreException; /** * Top component which displays the Geolocation Tool. @@ -157,11 +155,7 @@ public final class GeolocationTopComponent extends TopComponent { Case currentCase = Case.getCurrentCaseThrows(); -// waypoints.addAll(getGPSRouteWaypoints(currentCase.getSleuthkitCase())); -// waypoints.addAll(getEXIFWaypoints(currentCase.getSleuthkitCase())); -// waypoints.addAll(getSimpleWaypoints(currentCase.getSleuthkitCase())); - - return waypoints; + return MapWaypoint.getWaypoints(currentCase.getSleuthkitCase()); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java new file mode 100755 index 0000000000..d1fb35ae46 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java @@ -0,0 +1,56 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.geolocation; + +import java.util.ArrayList; +import java.util.List; +import org.jxmapviewer.viewer.GeoPosition; +import org.sleuthkit.autopsy.geolocation.datamodel.Route; +import org.sleuthkit.datamodel.SleuthkitCase; +import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; + +/** + * + * + */ +final class MapWaypoint implements org.jxmapviewer.viewer.Waypoint{ + + private final Waypoint dataModelWaypoint; + private final GeoPosition position; + + private MapWaypoint(Waypoint dataModelWaypoint) { + this.dataModelWaypoint = dataModelWaypoint; + position = new GeoPosition(dataModelWaypoint.getLatitude(), dataModelWaypoint.getLongitude()); + } + + static List getWaypoints(SleuthkitCase skCase) throws TskCoreException{ + List points = Waypoint.getAllWaypoints(skCase); + + List routes = Route.getGPSRoutes(skCase); + for(Route route: routes) { + points.addAll(route.getRoute()); + } + + List mapPoints = new ArrayList<>(); + + for(Waypoint point: points) { + mapPoints.add(new MapWaypoint(point)); + } + + return mapPoints; + } + + @Override + public GeoPosition getPosition() { + return position; + } + + String getDisplayName() { + return dataModelWaypoint.getLabel(); + } + +} From 2883e5f2814972f8d31de9cfe5c4f1d4feb162a2 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 22 Oct 2019 15:28:59 -0400 Subject: [PATCH 38/91] Removed updated file name and func name for consistancy --- .../org/sleuthkit/autopsy/geolocation/datamodel/Route.java | 2 +- .../{GPSSearchWaypoint.java => SearchWaypoint.java} | 6 +++--- .../sleuthkit/autopsy/geolocation/datamodel/Waypoint.java | 2 +- .../org/sleuthkit/autopsy/report/modules/kml/KMLReport.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename Core/src/org/sleuthkit/autopsy/geolocation/datamodel/{GPSSearchWaypoint.java => SearchWaypoint.java} (90%) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index 4eefc72bca..728c5995c7 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -59,7 +59,7 @@ public class Route { * * @throws TskCoreException */ - static public List getGPSRoutes(SleuthkitCase skCase) throws TskCoreException { + static public List getRoutes(SleuthkitCase skCase) throws TskCoreException { List routes = new ArrayList<>(); List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); for (BlackboardArtifact artifact : artifacts) { diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java similarity index 90% rename from Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java rename to Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java index 28bd7127a0..0c780861dc 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java @@ -24,9 +24,9 @@ import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.TskCoreException; /** - * A GPSSearchWaypoint is a subclass of ArtifactWaypoint. + * A SearchWaypoint is a subclass of ArtifactWaypoint. */ -final class GPSSearchWaypoint extends ArtifactWaypoint { +final class SearchWaypoint extends ArtifactWaypoint { @Messages({ "SearchWaypoint_DisplayLabel=GPS Search" @@ -35,7 +35,7 @@ final class GPSSearchWaypoint extends ArtifactWaypoint { /** * Construct a GPS Search waypoint. */ - public GPSSearchWaypoint(BlackboardArtifact artifact) throws TskCoreException { + public SearchWaypoint(BlackboardArtifact artifact) throws TskCoreException { super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.SEARCH); } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java index 2bf606b18b..c64bc29ae2 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java @@ -187,7 +187,7 @@ public interface Waypoint { List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH); if (artifacts != null) { for (BlackboardArtifact artifact : artifacts) { - ArtifactWaypoint point = new GPSSearchWaypoint(artifact); + ArtifactWaypoint point = new SearchWaypoint(artifact); // Only add to the list if the point has a valid latitude // and longitude. if (point.getLatitude() != null && point.getLongitude() != null) { diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index ff5d1c35ba..30ff371860 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -358,7 +358,7 @@ class KMLReport implements GeneralReportModule { * @throws TskCoreException */ void makeRoutes(SleuthkitCase skCase) throws TskCoreException { - List routes = Route.getGPSRoutes(skCase); + List routes = Route.getRoutes(skCase); if(routes == null) { return; From 7e745617c0cb5009ad8e50d6053e3e7bc6b02a9b Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 22 Oct 2019 15:38:16 -0400 Subject: [PATCH 39/91] Simplifed and tested the textnow queries --- InternalPythonModules/android/textnow.py | 78 +++++++++++------------- 1 file changed, 37 insertions(+), 41 deletions(-) diff --git a/InternalPythonModules/android/textnow.py b/InternalPythonModules/android/textnow.py index ad9704cece..1890c7ae42 100644 --- a/InternalPythonModules/android/textnow.py +++ b/InternalPythonModules/android/textnow.py @@ -290,53 +290,50 @@ class TextNowMessagesParser(TskMessagesParser): """ super(TextNowMessagesParser, self).__init__(message_db.runQuery( """ - - SELECT CASE - WHEN message_direction == 2 THEN "" - WHEN to_addresses IS NULL THEN M.contact_value - ELSE contact_name - end from_address, - CASE - WHEN message_direction == 1 THEN "" - WHEN to_addresses IS NULL THEN M.contact_value - ELSE to_addresses - end to_address, - message_direction, - message_text, - M.READ, - M.date, - M.attach, - thread_id - FROM (SELECT group_info.contact_value, - group_info.to_addresses, - G.contact_value AS thread_id - FROM (SELECT GM.contact_value, - Group_concat(GM.member_contact_value) AS to_addresses - FROM group_members AS GM - GROUP BY GM.contact_value) AS group_info - JOIN groups AS G - ON G.contact_value = group_info.contact_value - UNION - SELECT c.contact_value, - NULL, - "-1" - FROM contacts AS c) AS to_from_map - JOIN messages AS M - ON M.contact_value = to_from_map.contact_value - WHERE message_type NOT IN ( 102, 100 ) + SELECT CASE + WHEN messages.message_direction == 2 THEN NULL + WHEN contact_book_w_groups.to_addresses IS NULL THEN + messages.contact_value + END from_address, + CASE + WHEN messages.message_direction == 1 THEN NULL + WHEN contact_book_w_groups.to_addresses IS NULL THEN + messages.contact_value + ELSE contact_book_w_groups.to_addresses + END to_address, + messages.message_direction, + messages.message_text, + messages.READ, + messages.DATE, + messages.attach, + thread_id + FROM (SELECT GM.contact_value, + Group_concat(GM.member_contact_value) AS to_addresses, + G.contact_value AS thread_id + FROM group_members AS GM + join GROUPS AS G + ON G.contact_value = GM.contact_value + GROUP BY GM.contact_value + UNION + SELECT contact_value, + NULL, + NULL + FROM contacts) AS contact_book_w_groups + join messages + ON messages.contact_value = contact_book_w_groups.contact_value + WHERE message_type NOT IN ( 102, 100 ) """ ) ) self._TEXTNOW_MESSAGE_TYPE = "TextNow Message" self._INCOMING_MESSAGE_TYPE = 1 self._OUTGOING_MESSAGE_TYPE = 2 - self._UNKNOWN_THREAD_ID = "-1" def get_message_type(self): return self._TEXTNOW_MESSAGE_TYPE def get_phone_number_from(self): - if self.result_set.getString("from_address") == "": + if self.result_set.getString("from_address") is None: return super(TextNowMessagesParser, self).get_phone_number_from() return self.result_set.getString("from_address") @@ -347,10 +344,9 @@ class TextNowMessagesParser(TskMessagesParser): return self.OUTGOING def get_phone_number_to(self): - if self.result_set.getString("to_address") == "": + if self.result_set.getString("to_address") is None: return super(TextNowMessagesParser, self).get_phone_number_to() - recipients = self.result_set.getString("to_address").split(",") - return recipients + return self.result_set.getString("to_address").split(",") def get_message_date_time(self): #convert ms to s @@ -359,7 +355,7 @@ class TextNowMessagesParser(TskMessagesParser): def get_message_read_status(self): read = self.result_set.getBoolean("read") if self.get_message_direction() == self.INCOMING: - if read == True: + if read: return self.READ return self.UNREAD @@ -375,6 +371,6 @@ class TextNowMessagesParser(TskMessagesParser): def get_thread_id(self): thread_id = self.result_set.getString("thread_id") - if thread_id == self._UNKNOWN_THREAD_ID: + if thread_id is None: return super(TextNowMessagesParser, self).get_thread_id() return thread_id From f458b7d2254cf99cdf16e50227a5d8b04c750f98 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 22 Oct 2019 15:42:08 -0400 Subject: [PATCH 40/91] 5665 allow creation of sub menus for collection instead of lookup --- .../AddBlackboardArtifactTagAction.java | 28 +++++++--- .../autopsy/actions/AddContentTagAction.java | 15 ++++- .../autopsy/actions/AddTagAction.java | 17 ++++++ .../actions/DeleteFileContentTagAction.java | 55 ++++++++++--------- .../AddContentToHashDbAction.java | 19 +++++-- 5 files changed, 94 insertions(+), 40 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java index 9015d9a6ad..ce5b5167ed 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,6 +30,7 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; @@ -72,15 +73,24 @@ public class AddBlackboardArtifactTagAction extends AddTagAction { @Override protected void addTag(TagName tagName, String comment) { - /* - * The documentation for Lookup.lookupAll() explicitly says that the - * collection it returns may contain duplicates. Within this invocation - * of addTag(), we don't want to tag the same BlackboardArtifact more - * than once, so we dedupe the BlackboardArtifacts by stuffing them into - * a HashSet. - */ - final Collection selectedArtifacts = new HashSet<>(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class)); + final Collection selectedArtifacts = new HashSet<>(); + if (getContentToTag().isEmpty()) { + /* + * The documentation for Lookup.lookupAll() explicitly says that the + * collection it returns may contain duplicates. Within this + * invocation of addTag(), we don't want to tag the same + * BlackboardArtifact more than once, so we dedupe the + * BlackboardArtifacts by stuffing them into a HashSet. + */ + selectedArtifacts.addAll(Utilities.actionsGlobalContext().lookupAll(BlackboardArtifact.class)); + } else { + for (Content content : getContentToTag()) { + if (content instanceof BlackboardArtifact) { + selectedArtifacts.add((BlackboardArtifact) content); + } + } + } new Thread(() -> { for (BlackboardArtifact artifact : selectedArtifacts) { try { diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java index 34e7b2a110..e6f09ede0c 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java @@ -76,6 +76,8 @@ public class AddContentTagAction extends AddTagAction { @Override protected void addTag(TagName tagName, String comment) { + final Collection selectedFiles = new HashSet<>(); + if (getContentToTag().isEmpty()) { /* * The documentation for Lookup.lookupAll() explicitly says that the * collection it returns may contain duplicates. Within this invocation @@ -84,8 +86,17 @@ public class AddContentTagAction extends AddTagAction { * * We don't want VirtualFile and DerivedFile objects to be tagged. */ - final Collection selectedFiles = new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class)); - + + selectedFiles.addAll(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class)); + } + else { + for (Content content : getContentToTag()){ + if (content instanceof AbstractFile){ + selectedFiles.add((AbstractFile)content); + } + } + + } new Thread(() -> { for (AbstractFile file : selectedFiles) { try { diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java index 6606185e24..00fe6630c5 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java @@ -20,6 +20,9 @@ package org.sleuthkit.autopsy.actions; import java.awt.event.ActionEvent; import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -33,6 +36,8 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskData; @@ -45,6 +50,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { private static final long serialVersionUID = 1L; private static final String NO_COMMENT = ""; + private final Collection content = new HashSet<>(); AddTagAction(String menuText) { super(menuText); @@ -52,6 +58,17 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { @Override public JMenuItem getPopupPresenter() { + content.clear(); + return new TagMenu(); + } + + Collection getContentToTag(){ + return Collections.unmodifiableCollection(content); + } + + public JMenuItem getMenuForContent(Collection contentToTag){ + content.clear(); + content.addAll(contentToTag); return new TagMenu(); } diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java index c8a8a69fdc..ea3d2369be 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * + * * Copyright 2017-2018 Basis Technology Corp. * Contact: carrier sleuthkit 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. @@ -53,7 +53,7 @@ import org.sleuthkit.datamodel.TskData; "DeleteFileContentTagAction.deleteTag=Remove File Tag" }) public class DeleteFileContentTagAction extends AbstractAction implements Presenter.Popup { - + private static final Logger logger = Logger.getLogger(DeleteFileContentTagAction.class.getName()); private static final long serialVersionUID = 1L; @@ -81,6 +81,10 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen return new TagMenu(); } + public JMenuItem getMenuForFiles(Collection selectedFiles) { + return new TagMenu(selectedFiles); + } + @Override public void actionPerformed(ActionEvent e) { } @@ -102,19 +106,19 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen tagsManager = Case.getCurrentCaseThrows().getServices().getTagsManager(); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Error untagging file. No open case found.", ex); //NON-NLS - Platform.runLater(() -> - new Alert(Alert.AlertType.ERROR, Bundle.DeleteFileContentTagAction_deleteTag_alert(fileId)).show() + Platform.runLater(() + -> new Alert(Alert.AlertType.ERROR, Bundle.DeleteFileContentTagAction_deleteTag_alert(fileId)).show() ); return null; } - + try { logger.log(Level.INFO, "Removing tag {0} from {1}", new Object[]{tagName.getDisplayName(), contentTag.getContent().getName()}); //NON-NLS tagsManager.deleteContentTag(contentTag); } catch (TskCoreException tskCoreException) { logger.log(Level.SEVERE, "Error untagging file", tskCoreException); //NON-NLS - Platform.runLater(() -> - new Alert(Alert.AlertType.ERROR, Bundle.DeleteFileContentTagAction_deleteTag_alert(fileId)).show() + Platform.runLater(() + -> new Alert(Alert.AlertType.ERROR, Bundle.DeleteFileContentTagAction_deleteTag_alert(fileId)).show() ); } return null; @@ -142,14 +146,15 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen private static final long serialVersionUID = 1L; TagMenu() { + this(new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class))); + } + + TagMenu(Collection selectedFiles) { super(getActionDisplayName()); - - final Collection selectedAbstractFilesList = - new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class)); - - if(!selectedAbstractFilesList.isEmpty()) { - AbstractFile file = selectedAbstractFilesList.iterator().next(); - + + if (!selectedFiles.isEmpty()) { + AbstractFile file = selectedFiles.iterator().next(); + Map tagNamesMap = null; List standardTagNames = TagsManager.getStandardTagNames(); List standardTagMenuitems = new ArrayList<>(); @@ -167,22 +172,22 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen // a tag with the associated tag name. if (null != tagNamesMap && !tagNamesMap.isEmpty()) { try { - List existingTagsList = - Case.getCurrentCaseThrows().getServices().getTagsManager() + List existingTagsList + = Case.getCurrentCaseThrows().getServices().getTagsManager() .getContentTagsByContent(file); for (Map.Entry entry : tagNamesMap.entrySet()) { String tagDisplayName = entry.getKey(); TagName tagName = entry.getValue(); - for(ContentTag contentTag : existingTagsList) { - if(tagDisplayName.equals(contentTag.getName().getDisplayName())) { + for (ContentTag contentTag : existingTagsList) { + if (tagDisplayName.equals(contentTag.getName().getDisplayName())) { String notableString = tagName.getKnownStatus() == TskData.FileKnown.BAD ? TagsManager.getNotableTagLabel() : ""; JMenuItem tagNameItem = new JMenuItem(tagDisplayName + notableString); tagNameItem.addActionListener((ActionEvent e) -> { deleteTag(tagName, contentTag, file.getId()); }); - + // Show custom tags before predefined tags in the menu if (standardTagNames.contains(tagDisplayName)) { standardTagMenuitems.add(tagNameItem); @@ -198,14 +203,14 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen } } - if ((getItemCount() > 0) && !standardTagMenuitems.isEmpty() ){ + if ((getItemCount() > 0) && !standardTagMenuitems.isEmpty()) { addSeparator(); } standardTagMenuitems.forEach((menuItem) -> { add(menuItem); }); - - if(getItemCount() == 0) { + + if (getItemCount() == 0) { setEnabled(false); } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java index f80d791bf3..121f76522f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.modules.hashdatabase; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Collection; +import java.util.HashSet; import java.util.List; import java.util.logging.Level; import javax.swing.AbstractAction; @@ -42,7 +43,7 @@ import org.sleuthkit.datamodel.TskCoreException; /** * Instances of this Action allow users to content to a hash database. */ -final class AddContentToHashDbAction extends AbstractAction implements Presenter.Popup { +public final class AddContentToHashDbAction extends AbstractAction implements Presenter.Popup { private static AddContentToHashDbAction instance; @@ -83,6 +84,10 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter private AddContentToHashDbAction() { } + public JMenuItem getMenuForFiles(Collection selectedFiles) { + return new AddContentToHashDbMenu(selectedFiles); + } + @Override public JMenuItem getPopupPresenter() { return new AddContentToHashDbMenu(); @@ -96,10 +101,10 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter // action. private final class AddContentToHashDbMenu extends JMenu { - AddContentToHashDbMenu() { + private static final long serialVersionUID = 1L; + + AddContentToHashDbMenu(Collection selectedFiles) { super(SINGLE_SELECTION_NAME); - // Get any AbstractFile objects from the lookup of the currently focused top component. - final Collection selectedFiles = Utilities.actionsGlobalContext().lookupAll(AbstractFile.class); int numberOfFilesSelected = selectedFiles.size(); // Disable the menu if file ingest is in progress. @@ -178,6 +183,12 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter add(newHashSetItem); } + AddContentToHashDbMenu() { + // Get any AbstractFile objects from the lookup of the currently focused top component. + this(new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class))); + + } + /** * Determines which (2) display text should be set given the number of * files selected. From b3705dd123e5a62638b60fee9b3266bbf0bbe5bf Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 22 Oct 2019 16:00:45 -0400 Subject: [PATCH 41/91] 5665 add comments update dates --- .../AddBlackboardArtifactTagAction.java | 2 +- .../autopsy/actions/AddContentTagAction.java | 31 ++++++------ .../autopsy/actions/AddTagAction.java | 48 ++++++++++++------- .../actions/DeleteFileContentTagAction.java | 19 +++++++- .../AddContentToHashDbAction.java | 19 +++++++- 5 files changed, 83 insertions(+), 36 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java index ce5b5167ed..26d1c7a9bc 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddBlackboardArtifactTagAction.java @@ -74,6 +74,7 @@ public class AddBlackboardArtifactTagAction extends AddTagAction { @Override protected void addTag(TagName tagName, String comment) { final Collection selectedArtifacts = new HashSet<>(); + //If the contentToTag is empty look up the selected content if (getContentToTag().isEmpty()) { /* * The documentation for Lookup.lookupAll() explicitly says that the @@ -89,7 +90,6 @@ public class AddBlackboardArtifactTagAction extends AddTagAction { selectedArtifacts.add((BlackboardArtifact) content); } } - } new Thread(() -> { for (BlackboardArtifact artifact : selectedArtifacts) { diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java index e6f09ede0c..c32533b0cd 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddContentTagAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -77,25 +77,24 @@ public class AddContentTagAction extends AddTagAction { @Override protected void addTag(TagName tagName, String comment) { final Collection selectedFiles = new HashSet<>(); + //If the contentToTag is empty look up the selected content if (getContentToTag().isEmpty()) { - /* - * The documentation for Lookup.lookupAll() explicitly says that the - * collection it returns may contain duplicates. Within this invocation - * of addTag(), we don't want to tag the same AbstractFile more than - * once, so we dedupe the AbstractFiles by stuffing them into a HashSet. - * - * We don't want VirtualFile and DerivedFile objects to be tagged. - */ - + /* + * The documentation for Lookup.lookupAll() explicitly says that the + * collection it returns may contain duplicates. Within this + * invocation of addTag(), we don't want to tag the same + * AbstractFile more than once, so we dedupe the AbstractFiles by + * stuffing them into a HashSet. + * + * We don't want VirtualFile and DerivedFile objects to be tagged. + */ selectedFiles.addAll(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class)); - } - else { - for (Content content : getContentToTag()){ - if (content instanceof AbstractFile){ - selectedFiles.add((AbstractFile)content); + } else { + for (Content content : getContentToTag()) { + if (content instanceof AbstractFile) { + selectedFiles.add((AbstractFile) content); } } - } new Thread(() -> { for (AbstractFile file : selectedFiles) { diff --git a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java index 00fe6630c5..3709592e62 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/AddTagAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2011-2018 Basis Technology Corp. + * Copyright 2011-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,7 +36,6 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.casemodule.services.TagsManager; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TagName; import org.sleuthkit.datamodel.TskCoreException; @@ -61,12 +60,27 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { content.clear(); return new TagMenu(); } - - Collection getContentToTag(){ + + /** + * Get the collection of content which may have been specified for this + * action. Empty collection returned when no content was specified. + * + * @return The specified content for this action. + */ + Collection getContentToTag() { return Collections.unmodifiableCollection(content); } - - public JMenuItem getMenuForContent(Collection contentToTag){ + + /** + * Get the menu for adding tags to the specified collection of Content. + * + * @param contentToTag The collection of Content the menu actions will be + * applied to. + * + * @return The menu which will allow users to choose the tag they want to + * apply to the Content specified. + */ + public JMenuItem getMenuForContent(Collection contentToTag) { content.clear(); content.addAll(contentToTag); return new TagMenu(); @@ -135,26 +149,26 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { tagNameItem.addActionListener((ActionEvent e) -> { getAndAddTag(entry.getKey(), entry.getValue(), NO_COMMENT); }); - - // Show custom tags before predefined tags in the menu + + // Show custom tags before predefined tags in the menu if (standardTagNames.contains(tagDisplayName)) { standardTagMenuitems.add(tagNameItem); } else { add(tagNameItem); } } - } - + } + if (getItemCount() > 0) { addSeparator(); } - + standardTagMenuitems.forEach((menuItem) -> { add(menuItem); }); - + addSeparator(); - + // Create a "Choose Tag and Comment..." menu item. Selecting this item initiates // a dialog that can be used to create or select a tag name with an // optional comment and adds a tag with the resulting name. @@ -167,7 +181,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { } }); add(tagAndCommentItem); - + // Create a "New Tag..." menu item. // Selecting this item initiates a dialog that can be used to create // or select a tag name and adds a tag with the resulting name. @@ -179,7 +193,7 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { } }); add(newTagMenuItem); - + } /** @@ -211,10 +225,10 @@ abstract class AddTagAction extends AbstractAction implements Presenter.Popup { tagName = openCase.getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(tagDisplayName); } catch (TskCoreException ex1) { Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, tagDisplayName + " already exists in database but an error occurred in retrieving it.", ex1); //NON-NLS - } + } } catch (TskCoreException ex) { Logger.getLogger(AddTagAction.class.getName()).log(Level.SEVERE, "Error adding " + tagDisplayName + " tag name", ex); //NON-NLS - } + } } addTag(tagName, comment); } diff --git a/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java b/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java index ea3d2369be..f68017de19 100644 --- a/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java +++ b/Core/src/org/sleuthkit/autopsy/actions/DeleteFileContentTagAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2017-2018 Basis Technology Corp. + * Copyright 2017-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -81,6 +81,15 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen return new TagMenu(); } + /** + * Get the menu for removing tags from the specified collection of Files. + * + * @param selectedFiles The collection of AbstractFiles the menu actions + * will be applied to. + * + * @return The menu which will allow users to remove tags from the specified + * collection of Files. + */ public JMenuItem getMenuForFiles(Collection selectedFiles) { return new TagMenu(selectedFiles); } @@ -145,10 +154,18 @@ public class DeleteFileContentTagAction extends AbstractAction implements Presen private static final long serialVersionUID = 1L; + /** + * Construct an TagMenu object using the specified collection of files + * as the files to remove a tag from. + */ TagMenu() { this(new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class))); } + /** + * Construct an TagMenu object using the specified collection of files + * as the files to remove a tag from. + */ TagMenu(Collection selectedFiles) { super(getActionDisplayName()); diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java index 121f76522f..18acd79d6f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2013-2018 Basis Technology Corp. + * Copyright 2013-2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -84,6 +84,15 @@ public final class AddContentToHashDbAction extends AbstractAction implements Pr private AddContentToHashDbAction() { } + /** + * Get the menu for adding the specified collection of Files to a HashDb. + * + * @param selectedFiles The collection of AbstractFiles the menu actions + * will be applied to. + * + * @return The menu which will allow users to add the specified files to a + * HashDb. + */ public JMenuItem getMenuForFiles(Collection selectedFiles) { return new AddContentToHashDbMenu(selectedFiles); } @@ -103,6 +112,10 @@ public final class AddContentToHashDbAction extends AbstractAction implements Pr private static final long serialVersionUID = 1L; + /** + * Construct an AddContentToHashDbMenu object using the specified + * collection of files as the files to be added to a HashDb. + */ AddContentToHashDbMenu(Collection selectedFiles) { super(SINGLE_SELECTION_NAME); int numberOfFilesSelected = selectedFiles.size(); @@ -183,6 +196,10 @@ public final class AddContentToHashDbAction extends AbstractAction implements Pr add(newHashSetItem); } + /** + * Construct an AddContentToHashDbMenu object using the currently + * selected files as the files to be added to a HashDb. + */ AddContentToHashDbMenu() { // Get any AbstractFile objects from the lookup of the currently focused top component. this(new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class))); From b46fe4d52432ed47e77589cccee69df604c2b1e2 Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 22 Oct 2019 16:56:54 -0400 Subject: [PATCH 42/91] Cleaned up the whatsapp query and tested changes --- InternalPythonModules/android/whatsapp.py | 49 +++++++++++------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/InternalPythonModules/android/whatsapp.py b/InternalPythonModules/android/whatsapp.py index 9cb7ea3d73..438784f3e2 100644 --- a/InternalPythonModules/android/whatsapp.py +++ b/InternalPythonModules/android/whatsapp.py @@ -433,31 +433,28 @@ class WhatsAppMessagesParser(TskMessagesParser): def __init__(self, message_db): super(WhatsAppMessagesParser, self).__init__(message_db.runQuery( """ - SELECT M.key_remote_jid AS id, - contact_info.recipients, - key_from_me AS direction, - CASE - WHEN M.data IS NULL THEN "" - ELSE M.data - END AS content, - M.timestamp AS send_timestamp, - M.received_timestamp, - M.remote_resource AS group_sender, - M.media_url As attachment - FROM (SELECT jid, - recipients - FROM wadb.wa_contacts AS WC - LEFT JOIN (SELECT gjid, - group_concat(CASE - WHEN jid == "" THEN NULL - ELSE jid - END) AS recipients - FROM group_participants - GROUP BY gjid) AS group_map - ON WC.jid = group_map.gjid - GROUP BY jid) AS contact_info - JOIN messages AS M - ON M.key_remote_jid = contact_info.jid + SELECT messages.key_remote_jid AS id, + contact_book_w_groups.recipients, + key_from_me AS direction, + messages.data AS content, + messages.timestamp AS send_timestamp, + messages.received_timestamp, + messages.remote_resource AS group_sender, + messages.media_url AS attachment + FROM (SELECT jid, + recipients + FROM wadb.wa_contacts AS contacts + left join (SELECT gjid, + Group_concat(CASE + WHEN jid == "" THEN NULL + ELSE jid + END) AS recipients + FROM group_participants + GROUP BY gjid) AS groups + ON contacts.jid = groups.gjid + GROUP BY jid) AS contact_book_w_groups + join messages + ON messages.key_remote_jid = contact_book_w_groups.jid """ ) ) @@ -503,6 +500,8 @@ class WhatsAppMessagesParser(TskMessagesParser): def get_message_text(self): message = self.result_set.getString("content") + if message is None: + message = super(WhatsAppMessagesParser, self).get_message_text() attachment = self.result_set.getString("attachment") if attachment is not None: return general.appendAttachmentList(message, [attachment]) From cb820db3753638602373173ded34439b600eaca4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 22 Oct 2019 16:59:20 -0400 Subject: [PATCH 43/91] 5665 attempt to reduce cyclomatic complexity and address other codacy issue --- .../AddContentToHashDbAction.java | 51 ++++++++++--------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java index 18acd79d6f..1868d3c57f 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java +++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java @@ -67,12 +67,16 @@ public final class AddContentToHashDbAction extends AbstractAction implements Pr "AddContentToHashDbAction.singleSelectionNameNoMD5"); private final static String MULTI_SELECTION_NAME_NO_MD5 = NbBundle.getMessage(AddContentToHashDbAction.class, "AddContentToHashDbAction.multipleSelectionNameNoMD5"); + private static final long serialVersionUID = 1L; /** * AddContentToHashDbAction is a singleton to support multi-selection of * nodes, since org.openide.nodes.NodeOp.findActions(Node[] nodes) will only * pick up an Action from a node if every node in the nodes array returns a * reference to the same action object from Node.getActions(boolean). + * + * @return The AddContentToHashDbAction instance which is used to provide + * the menu for adding content to a HashDb. */ public static synchronized AddContentToHashDbAction getInstance() { if (null == instance) { @@ -127,16 +131,13 @@ public final class AddContentToHashDbAction extends AbstractAction implements Pr SINGLE_SELECTION_NAME_DURING_INGEST, MULTI_SELECTION_NAME_DURING_INGEST); return; - } - - if (selectedFiles.isEmpty()) { + } else if (numberOfFilesSelected == 0) { setEnabled(false); return; - } else { - setTextBasedOnNumberOfSelections(numberOfFilesSelected, - SINGLE_SELECTION_NAME, - MULTI_SELECTION_NAME); } + setTextBasedOnNumberOfSelections(numberOfFilesSelected, + SINGLE_SELECTION_NAME, + MULTI_SELECTION_NAME); // Disable the menu if md5 have not been computed or if the file size // is empty. Display the appropriate reason to the user. @@ -155,7 +156,26 @@ public final class AddContentToHashDbAction extends AbstractAction implements Pr return; } } + addExistingHashDatabases(selectedFiles); + // Add a "New Hash Set..." menu item. Selecting this item invokes a + // a hash database creation dialog and adds the selected files to the + // the new database. + addSeparator(); + JMenuItem newHashSetItem = new JMenuItem(NbBundle.getMessage(this.getClass(), + "AddContentToHashDbAction.ContentMenu.createDbItem")); + newHashSetItem.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + HashDb hashDb = new HashDbCreateDatabaseDialog().getHashDatabase(); + if (null != hashDb) { + addFilesToHashSet(selectedFiles, hashDb); + } + } + }); + add(newHashSetItem); + } + private void addExistingHashDatabases(Collection selectedFiles) { // Get the current set of updateable hash databases and add each // one to the menu as a separate menu item. Selecting a hash database // adds the selected files to the selected database. @@ -177,23 +197,6 @@ public final class AddContentToHashDbAction extends AbstractAction implements Pr empty.setEnabled(false); add(empty); } - - // Add a "New Hash Set..." menu item. Selecting this item invokes a - // a hash database creation dialog and adds the selected files to the - // the new database. - addSeparator(); - JMenuItem newHashSetItem = new JMenuItem(NbBundle.getMessage(this.getClass(), - "AddContentToHashDbAction.ContentMenu.createDbItem")); - newHashSetItem.addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - HashDb hashDb = new HashDbCreateDatabaseDialog().getHashDatabase(); - if (null != hashDb) { - addFilesToHashSet(selectedFiles, hashDb); - } - } - }); - add(newHashSetItem); } /** From cd7942af8905fc399f94e130466f95aa9c5c21d5 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 22 Oct 2019 17:06:52 -0400 Subject: [PATCH 44/91] 5506 More robust machine trans --- .../ui/TranslatedTextViewer.java | 158 +++++++++--------- 1 file changed, 75 insertions(+), 83 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index 8c49c23ed7..883b36c2fb 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -53,6 +53,7 @@ import org.sleuthkit.autopsy.texttranslation.TranslationException; import org.sleuthkit.datamodel.Content; import java.util.List; import java.util.logging.Level; +import javax.swing.SwingUtilities; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.texttranslation.ui.TranslationContentPanel.DisplayDropdownOptions; @@ -63,7 +64,7 @@ import org.sleuthkit.autopsy.texttranslation.ui.TranslationContentPanel.DisplayD @ServiceProvider(service = TextViewer.class, position = 4) public final class TranslatedTextViewer implements TextViewer { - private static final Logger logger = Logger.getLogger(TranslatedTextViewer.class.getName()); + private static final Logger logger = Logger.getLogger(TranslatedTextViewer.class.getName()); private static final boolean OCR_ENABLED = true; private static final boolean OCR_DISABLED = false; @@ -72,7 +73,7 @@ public final class TranslatedTextViewer implements TextViewer { private final TranslationContentPanel panel = new TranslationContentPanel(); private volatile Node node; - private volatile BackgroundTranslationTask updateTask; + private volatile ExtractAndTranslateTextTask backgroundTask; private final ThreadFactory translationThreadFactory = new ThreadFactoryBuilder().setNameFormat("translation-content-viewer-%d").build(); private final ExecutorService executorService = Executors.newSingleThreadExecutor(translationThreadFactory); @@ -95,7 +96,7 @@ public final class TranslatedTextViewer implements TextViewer { panel.addLanguagePackNames(INSTALLED_LANGUAGE_PACKS); } } - + int payloadMaxInKB = TextTranslationService.getInstance().getMaxTextChars() / 1000; panel.setWarningLabelMsg(String.format(Bundle.TranslatedTextViewer_maxPayloadSize(), payloadMaxInKB)); @@ -129,10 +130,10 @@ public final class TranslatedTextViewer implements TextViewer { public void resetComponent() { panel.reset(); this.node = null; - if (updateTask != null) { - updateTask.cancel(true); + if (backgroundTask != null) { + backgroundTask.cancel(true); } - updateTask = null; + backgroundTask = null; } @Override @@ -157,62 +158,62 @@ public final class TranslatedTextViewer implements TextViewer { } /** - * Fetches file text and performs translation. + * Extracts text from a file in the currently selected display node and + * optionally translates it. */ - private class BackgroundTranslationTask extends SwingWorker { + private class ExtractAndTranslateTextTask extends SwingWorker { + + private final AbstractFile file; + private final boolean translateText; + + private ExtractAndTranslateTextTask(AbstractFile file, boolean translateText) { + this.file = file; + this.translateText = translateText; + } @NbBundle.Messages({ - "TranslatedContentViewer.noIndexedTextMsg=Run the Keyword Search Ingest Module to get text for translation.", - "TranslatedContentViewer.textAlreadyIndexed=Please view the original text in the Indexed Text viewer.", - "TranslatedContentViewer.errorMsg=Error encountered while getting file text.", - "TranslatedContentViewer.errorExtractingText=Could not extract text from file.", - "TranslatedContentViewer.translatingText=Translating text, please wait..." + "TranslatedContentViewer.translatingText=Translating text, please wait...", + "TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file.", + "TranslatedContentViewer.fileHasNoText=File has no text.", + "TranslatedContentViewer.errorTranslatingText=Could not translate text from file." }) @Override public String doInBackground() throws InterruptedException { if (this.isCancelled()) { throw new InterruptedException(); } - String dropdownSelection = panel.getDisplayDropDownSelection(); - if (dropdownSelection.equals(DisplayDropdownOptions.ORIGINAL_TEXT.toString())) { - try { - return getFileText(node); - } catch (IOException ex) { - logger.log(Level.WARNING, "Error getting text", ex); - return Bundle.TranslatedContentViewer_errorMsg(); - } catch (TextExtractor.InitReaderException ex) { - logger.log(Level.WARNING, "Error getting text", ex); - return Bundle.TranslatedContentViewer_errorExtractingText(); - } - } else { - try { - return translate(getFileText(node)); - } catch (IOException ex) { - logger.log(Level.WARNING, "Error translating text", ex); - return Bundle.TranslatedContentViewer_errorMsg(); - } catch (TextExtractor.InitReaderException ex) { - logger.log(Level.WARNING, "Error translating text", ex); - return Bundle.TranslatedContentViewer_errorExtractingText(); - } - } - } + SwingUtilities.invokeLater(() -> { + panel.display(Bundle.TranslatedContentViewer_translatingText(), + ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); + }); - /** - * Update the extraction loading message depending on the file type. - * - * @param isImage Boolean indicating if the selecting node is an image - */ - @NbBundle.Messages({"TranslatedContentViewer.extractingImageText=Extracting text from image, please wait...", - "TranslatedContentViewer.extractingFileText=Extracting text from file, please wait...",}) - private void updateExtractionLoadingMessage(boolean isImage) { - if (isImage) { - panel.display(Bundle.TranslatedContentViewer_extractingImageText(), - ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); - } else { - panel.display(Bundle.TranslatedContentViewer_extractingFileText(), - ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); + String fileText; + try { + fileText = getFileText(file); + } catch (IOException | TextExtractor.InitReaderException ex) { + logger.log(Level.WARNING, String.format("Error getting text for file %s (objId=%d)", file.getName(), file.getId()), ex); + return Bundle.TranslatedContentViewer_errorExtractingText(); } + + if (this.isCancelled()) { + throw new InterruptedException(); + } + + if (fileText == null || fileText.isEmpty()) { + return Bundle.TranslatedContentViewer_fileHasNoText(); + } + + if (this.translateText) { + String translation = translate(fileText); + if (this.isCancelled()) { + throw new InterruptedException(); + } + return translation; + } else { + return fileText; + } + } @Override @@ -227,8 +228,10 @@ public final class TranslatedTextViewer implements TextViewer { String orientDetectSubstring = result.substring(0, maxOrientChars); ComponentOrientation orientation = TextUtil.getTextDirection(orientDetectSubstring); panel.display(result, orientation, Font.PLAIN); - } catch (InterruptedException | ExecutionException | CancellationException ignored) { - //InterruptedException & CancellationException - User cancelled, no error. + } catch (InterruptedException | CancellationException ignored) { + // Task cancelled, no error. + } catch (ExecutionException ex) { + logger.log(Level.WARNING, "Error occurred during background task execution", ex); } } @@ -243,14 +246,7 @@ public final class TranslatedTextViewer implements TextViewer { "TranslatedContentViewer.emptyTranslation=The resulting translation was empty.", "TranslatedContentViewer.noServiceProvider=Machine Translation software was not found.", "TranslatedContentViewer.translationException=Error encountered while attempting translation."}) - private String translate(String input) throws InterruptedException { - if (this.isCancelled()) { - throw new InterruptedException(); - } - - panel.display(Bundle.TranslatedContentViewer_translatingText(), - ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); - + private String translate(String input) { try { TextTranslationService translatorInstance = TextTranslationService.getInstance(); String translatedResult = translatorInstance.translate(input); @@ -277,33 +273,22 @@ public final class TranslatedTextViewer implements TextViewer { * @throws InterruptedException * @throws * org.sleuthkit.autopsy.textextractors.TextExtractor.InitReaderException - * @throws NoOpenCoreException - * @throws KeywordSearchModuleException */ - private String getFileText(Node node) throws IOException, + private String getFileText(AbstractFile file) throws IOException, InterruptedException, TextExtractor.InitReaderException { - AbstractFile source = (AbstractFile) DataContentViewerUtility.getDefaultContent(node); - boolean isImage = false; - - if (source != null) { - isImage = source.getMIMEType().toLowerCase().startsWith("image/"); - } - - updateExtractionLoadingMessage(isImage); - + final boolean isImage = file.getMIMEType().toLowerCase().startsWith("image/"); // NON-NLS String result; - if (isImage) { - result = extractText(source, OCR_ENABLED); + result = extractText(file, OCR_ENABLED); } else { - result = extractText(source, OCR_DISABLED); + result = extractText(file, OCR_DISABLED); } //Correct for UTF-8 byte[] resultInUTF8Bytes = result.getBytes("UTF8"); - byte[] trimToArraySize = Arrays.copyOfRange(resultInUTF8Bytes, 0, - Math.min(resultInUTF8Bytes.length, MAX_EXTRACT_SIZE_BYTES) ); + byte[] trimToArraySize = Arrays.copyOfRange(resultInUTF8Bytes, 0, + Math.min(resultInUTF8Bytes.length, MAX_EXTRACT_SIZE_BYTES)); return new String(trimToArraySize, "UTF-8"); } @@ -348,7 +333,7 @@ public final class TranslatedTextViewer implements TextViewer { textBuilder.append(cbuf, 0, read); bytesRead += read; } - + return textBuilder.toString(); } @@ -399,7 +384,7 @@ public final class TranslatedTextViewer implements TextViewer { */ private abstract class SelectionChangeListener implements ActionListener { - public String currentSelection = null; + public String currentSelection; public abstract String getSelection(); @@ -408,14 +393,21 @@ public final class TranslatedTextViewer implements TextViewer { String selection = getSelection(); if (!selection.equals(currentSelection)) { currentSelection = selection; - if (updateTask != null && !updateTask.isDone()) { - updateTask.cancel(true); + + if (backgroundTask != null && !backgroundTask.isDone()) { + backgroundTask.cancel(true); } - updateTask = new BackgroundTranslationTask(); + + AbstractFile file = node.getLookup().lookup(AbstractFile.class); + if (file == null) { + return; + } + boolean translateText = currentSelection.equals(DisplayDropdownOptions.ORIGINAL_TEXT.toString()); + backgroundTask = new ExtractAndTranslateTextTask(file, translateText); //Pass the background task to a single threaded pool to keep //the number of jobs running to one. - executorService.execute(updateTask); + executorService.execute(backgroundTask); } } } From ec58218cb21addcf7139ab51650cf1566b08cf55 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 22 Oct 2019 17:16:11 -0400 Subject: [PATCH 45/91] 5506 More robust machine trans --- .../autopsy/texttranslation/ui/TranslatedTextViewer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index 883b36c2fb..ee8d4d96b4 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -158,8 +158,7 @@ public final class TranslatedTextViewer implements TextViewer { } /** - * Extracts text from a file in the currently selected display node and - * optionally translates it. + * Extracts text from a file and optionally translates it. */ private class ExtractAndTranslateTextTask extends SwingWorker { @@ -183,6 +182,11 @@ public final class TranslatedTextViewer implements TextViewer { throw new InterruptedException(); } + /* + * This message is only written to the viewer once this task starts + * and any previous task has been completed by the single-threaded + * executor. + */ SwingUtilities.invokeLater(() -> { panel.display(Bundle.TranslatedContentViewer_translatingText(), ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); From a58de8029febce29f4f454a79d0dc0fe6f7811aa Mon Sep 17 00:00:00 2001 From: "U-BASIS\\dsmyda" Date: Tue, 22 Oct 2019 17:28:13 -0400 Subject: [PATCH 46/91] Cleaned up skype queries and tested them --- InternalPythonModules/android/skype.py | 141 ++++++++----------------- 1 file changed, 45 insertions(+), 96 deletions(-) diff --git a/InternalPythonModules/android/skype.py b/InternalPythonModules/android/skype.py index 5044898d5f..d8b79ac7fe 100644 --- a/InternalPythonModules/android/skype.py +++ b/InternalPythonModules/android/skype.py @@ -76,11 +76,8 @@ class SkypeAnalyzer(general.AndroidComponentAnalyzer): as they would be excluded in the join. Since the chatItem table stores both the group id or skype_id in one column, an implementation decision was made to union the person and particiapnt table together so that all rows are matched in one join - with chatItem. This result is consistently labeled contact_list_with_groups in the + with chatItem. This result is consistently labeled contact_book_w_groups in the following queries. - - In order to keep the formatting of the name consistent throughout each query, - a _format_user_name() function was created to encapsulate the CASE statement - that was being shared across them. Refer to the method for more details. """ def __init__(self): @@ -93,7 +90,12 @@ class SkypeAnalyzer(general.AndroidComponentAnalyzer): account_query_result = skype_db.runQuery( """ SELECT entry_id, - """+_format_user_name()+""" AS name + CASE + WHEN Ifnull(first_name, "") == "" AND Ifnull(last_name, "") == "" THEN entry_id + WHEN first_name is NULL THEN replace(last_name, ",", "") + WHEN last_name is NULL THEN replace(first_name, ",", "") + ELSE replace(first_name, ",", "") || " " || replace(last_name, ",", "") + END AS name FROM user """ ) @@ -251,14 +253,6 @@ class SkypeCallLogsParser(TskCallLogsParser): def __init__(self, calllog_db): """ - Big picture: - The query below creates a contacts_list_with_groups table, which - represents the recipient info. A chatItem record holds ids for - both the recipient and sender. The first join onto chatItem fills - in the blanks for the recipients. The second join back onto person - handles the sender info. The result is a table with all of the - communication details. - Implementation details: - message_type w/ value 3 appeared to be the call type, regardless of if it was audio or video. @@ -266,37 +260,23 @@ class SkypeCallLogsParser(TskCallLogsParser): """ super(SkypeCallLogsParser, self).__init__(calllog_db.runQuery( """ - SELECT contacts_list_with_groups.conversation_id, - contacts_list_with_groups.participant_ids, - contacts_list_with_groups.participants, - time, - duration, - is_sender_me, - person_id as sender_id, - sender_name.name as sender_name + SELECT contact_book_w_groups.conversation_id, + contact_book_w_groups.participant_ids, + messages.time, + messages.duration, + messages.is_sender_me, + messages.person_id AS sender_id FROM (SELECT conversation_id, - Group_concat(person_id) AS participant_ids, - Group_concat("""+_format_user_name()+""") AS participants - FROM particiapnt AS PART - JOIN person AS P - ON PART.person_id = P.entry_id + Group_concat(person_id) AS participant_ids + FROM particiapnt GROUP BY conversation_id UNION - SELECT entry_id, - NULL, - """+_format_user_name()+""" AS participant - FROM person) AS contacts_list_with_groups - JOIN chatitem AS C - ON C.conversation_link = contacts_list_with_groups.conversation_id - JOIN (SELECT entry_id as id, - """+_format_user_name()+""" AS name - FROM person - UNION - SELECT entry_id as id, - """+_format_user_name()+""" AS name - FROM user) AS sender_name - ON sender_name.id = C.person_id - WHERE message_type == 3 + SELECT entry_id AS conversation_id, + NULL + FROM person) AS contact_book_w_groups + join chatitem AS messages + ON messages.conversation_link = contact_book_w_groups.conversation_id + WHERE message_type == 3 """ ) ) @@ -347,7 +327,12 @@ class SkypeContactsParser(TskContactsParser): super(SkypeContactsParser, self).__init__(contact_db.runQuery( """ SELECT entry_id, - """+_format_user_name()+""" AS name + CASE + WHEN Ifnull(first_name, "") == "" AND Ifnull(last_name, "") == "" THEN entry_id + WHEN first_name is NULL THEN replace(last_name, ",", "") + WHEN last_name is NULL THEN replace(first_name, ",", "") + ELSE replace(first_name, ",", "") || " " || replace(last_name, ",", "") + END AS name FROM person """ ) @@ -379,39 +364,25 @@ class SkypeMessagesParser(TskMessagesParser): """ super(SkypeMessagesParser, self).__init__(message_db.runQuery( """ - SELECT contacts_list_with_groups.conversation_id, - contacts_list_with_groups.participant_ids, - contacts_list_with_groups.participants, - time, - content, - device_gallery_path, - is_sender_me, - person_id as sender_id, - sender_name.name AS sender_name - FROM (SELECT conversation_id, - Group_concat(person_id) AS participant_ids, - Group_concat("""+_format_user_name()+""") AS participants - FROM particiapnt AS PART - JOIN person AS P - ON PART.person_id = P.entry_id - GROUP BY conversation_id - UNION - SELECT entry_id as conversation_id, - NULL, - """+_format_user_name()+""" AS participant - FROM person) AS contacts_list_with_groups - JOIN chatitem AS C - ON C.conversation_link = contacts_list_with_groups.conversation_id - JOIN (SELECT entry_id as id, - """+_format_user_name()+""" AS name - FROM person - UNION - SELECT entry_id as id, - """+_format_user_name()+""" AS name - FROM user) AS sender_name - ON sender_name.id = C.person_id + SELECT contact_book_w_groups.conversation_id, + contact_book_w_groups.participant_ids, + messages.time, + messages.content, + messages.device_gallery_path, + messages.is_sender_me, + messages.person_id as sender_id + FROM (SELECT conversation_id, + Group_concat(person_id) AS participant_ids + FROM particiapnt + GROUP BY conversation_id + UNION + SELECT entry_id as conversation_id, + NULL + FROM person) AS contact_book_w_groups + JOIN chatitem AS messages + ON messages.conversation_link = contact_book_w_groups.conversation_id WHERE message_type != 3 - """ + """ ) ) self._SKYPE_MESSAGE_TYPE = "Skype Message" @@ -469,25 +440,3 @@ class SkypeMessagesParser(TskMessagesParser): if group_ids is not None: return self.result_set.getString("conversation_id") return super(SkypeMessagesParser, self).get_thread_id() - -def _format_user_name(): - """ - This CASE SQL statement is used in many queries to - format the names of users. For a user, there is a first_name - column and a last_name column. Some of these columns can be null - and our goal is to produce the cleanest data possible. In the event - that both the first and last name columns are null, we return the skype_id - which is stored in the database as 'entry_id'. Commas are removed from the name - so that we can concatenate names into a comma seperate list for group chats. - """ - - return """ - CASE - WHEN Ifnull(first_name, "") == "" AND Ifnull(last_name, "") == "" THEN entry_id - WHEN first_name is NULL THEN replace(last_name, ",", "") - WHEN last_name is NULL THEN replace(first_name, ",", "") - ELSE replace(first_name, ",", "") || " " || replace(last_name, ",", "") - END - """ - - From 1acd1ccfd1c81d2d6137d0fbd398cb095dff5040 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 22 Oct 2019 17:30:35 -0400 Subject: [PATCH 47/91] 5506 More robust machine trans --- .../ui/Bundle.properties-MERGED | 16 ++++++------- .../ui/TranslatedTextViewer.java | 23 +++++++++---------- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED index 141ca2f7ef..bbf7046f47 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED @@ -2,16 +2,14 @@ OptionsCategory_Name_Machine_Translation=Machine Translation OptionsCategory_Keywords_Machine_Translation_Settings=Machine Translation Settings TranslatedContentPanel.comboBoxOption.originalText=Original Text (Up to 25KB) TranslatedContentPanel.comboBoxOption.translatedText=Translated Text -TranslatedContentViewer.emptyTranslation=The resulting translation was empty. -TranslatedContentViewer.errorExtractingText=Could not extract text from file. -TranslatedContentViewer.errorMsg=Error encountered while getting file text. -TranslatedContentViewer.extractingFileText=Extracting text from file, please wait... -TranslatedContentViewer.extractingImageText=Extracting text from image, please wait... -TranslatedContentViewer.noIndexedTextMsg=Run the Keyword Search Ingest Module to get text for translation. -TranslatedContentViewer.noServiceProvider=Machine Translation software was not found. -TranslatedContentViewer.textAlreadyIndexed=Please view the original text in the Indexed Text viewer. +TranslatedContentViewer.emptyTranslation=The translation is empty. +TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file. +TranslatedContentViewer.errorTranslatingText=Could not translate text from file. +TranslatedContentViewer.fileHasNoText=File has no text. +TranslatedContentViewer.noServiceProvider=Machine translation software was not found. TranslatedContentViewer.translatingText=Translating text, please wait... -TranslatedContentViewer.translationException=Error encountered while attempting translation. +# {0} - exception message +TranslatedContentViewer.translationException=Error encountered while attempting translation ({0}). TranslatedTextViewer.maxPayloadSize=Up to the first %dKB of text will be translated TranslatedTextViewer.title=Translation TranslatedTextViewer.toolTip=Displays translated file text. diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index ee8d4d96b4..035d9f6398 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -188,8 +188,7 @@ public final class TranslatedTextViewer implements TextViewer { * executor. */ SwingUtilities.invokeLater(() -> { - panel.display(Bundle.TranslatedContentViewer_translatingText(), - ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); + panel.display(Bundle.TranslatedContentViewer_translatingText(), ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); }); String fileText; @@ -235,7 +234,7 @@ public final class TranslatedTextViewer implements TextViewer { } catch (InterruptedException | CancellationException ignored) { // Task cancelled, no error. } catch (ExecutionException ex) { - logger.log(Level.WARNING, "Error occurred during background task execution", ex); + logger.log(Level.WARNING, String.format("Error occurred during background task execution for file %s (objId=%d)", file.getName(), file.getId()), ex); } } @@ -247,9 +246,9 @@ public final class TranslatedTextViewer implements TextViewer { * @return Translated text or error message */ @NbBundle.Messages({ - "TranslatedContentViewer.emptyTranslation=The resulting translation was empty.", - "TranslatedContentViewer.noServiceProvider=Machine Translation software was not found.", - "TranslatedContentViewer.translationException=Error encountered while attempting translation."}) + "TranslatedContentViewer.emptyTranslation=The translation is empty.", + "TranslatedContentViewer.noServiceProvider=Machine translation software was not found.", + "# {0} - exception message", "TranslatedContentViewer.translationException=Error encountered while attempting translation ({0})."}) private String translate(String input) { try { TextTranslationService translatorInstance = TextTranslationService.getInstance(); @@ -261,8 +260,8 @@ public final class TranslatedTextViewer implements TextViewer { } catch (NoServiceProviderException ex) { return Bundle.TranslatedContentViewer_noServiceProvider(); } catch (TranslationException ex) { - logger.log(Level.WARNING, "Error translating text", ex); - return Bundle.TranslatedContentViewer_translationException() + " (" + ex.getMessage() + ")"; + logger.log(Level.WARNING, String.format("Error occurred translating text for file %s (objId=%d)", file.getName(), file.getId()), ex); + return Bundle.TranslatedContentViewer_translationException(ex.getMessage()); } } @@ -388,9 +387,9 @@ public final class TranslatedTextViewer implements TextViewer { */ private abstract class SelectionChangeListener implements ActionListener { - public String currentSelection; + private String currentSelection; - public abstract String getSelection(); + abstract String getSelection(); @Override public final void actionPerformed(ActionEvent e) { @@ -422,7 +421,7 @@ public final class TranslatedTextViewer implements TextViewer { private class DisplayDropDownChangeListener extends SelectionChangeListener { @Override - public String getSelection() { + String getSelection() { return panel.getDisplayDropDownSelection(); } } @@ -433,7 +432,7 @@ public final class TranslatedTextViewer implements TextViewer { private class OCRDropdownChangeListener extends SelectionChangeListener { @Override - public String getSelection() { + String getSelection() { return panel.getSelectedOcrLanguagePack(); } } From 3d19a07ba4bd75d4e7150216d492a1e5d193fdfa Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 22 Oct 2019 17:48:58 -0400 Subject: [PATCH 48/91] 5506 More robust machine trans --- .../ui/Bundle.properties-MERGED | 4 +- .../ui/TranslatedTextViewer.java | 59 ++++++++++--------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED index bbf7046f47..cfa9af0fb7 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED @@ -3,8 +3,8 @@ OptionsCategory_Keywords_Machine_Translation_Settings=Machine Translation Settin TranslatedContentPanel.comboBoxOption.originalText=Original Text (Up to 25KB) TranslatedContentPanel.comboBoxOption.translatedText=Translated Text TranslatedContentViewer.emptyTranslation=The translation is empty. -TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file. -TranslatedContentViewer.errorTranslatingText=Could not translate text from file. +# {0} - exception message +TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file ({0}). TranslatedContentViewer.fileHasNoText=File has no text. TranslatedContentViewer.noServiceProvider=Machine translation software was not found. TranslatedContentViewer.translatingText=Translating text, please wait... diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index 035d9f6398..b6490b70bd 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -172,9 +172,11 @@ public final class TranslatedTextViewer implements TextViewer { @NbBundle.Messages({ "TranslatedContentViewer.translatingText=Translating text, please wait...", - "TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file.", + "# {0} - exception message", "TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file ({0}).", "TranslatedContentViewer.fileHasNoText=File has no text.", - "TranslatedContentViewer.errorTranslatingText=Could not translate text from file." + "TranslatedContentViewer.emptyTranslation=The translation is empty.", + "TranslatedContentViewer.noServiceProvider=Machine translation software was not found.", + "# {0} - exception message", "TranslatedContentViewer.translationException=Error encountered while attempting translation ({0})." }) @Override public String doInBackground() throws InterruptedException { @@ -184,8 +186,8 @@ public final class TranslatedTextViewer implements TextViewer { /* * This message is only written to the viewer once this task starts - * and any previous task has been completed by the single-threaded - * executor. + * and any previous task has therefore been completed by the + * single-threaded executor. */ SwingUtilities.invokeLater(() -> { panel.display(Bundle.TranslatedContentViewer_translatingText(), ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); @@ -196,7 +198,7 @@ public final class TranslatedTextViewer implements TextViewer { fileText = getFileText(file); } catch (IOException | TextExtractor.InitReaderException ex) { logger.log(Level.WARNING, String.format("Error getting text for file %s (objId=%d)", file.getName(), file.getId()), ex); - return Bundle.TranslatedContentViewer_errorExtractingText(); + return Bundle.TranslatedContentViewer_errorExtractingText(ex.getMessage()); } if (this.isCancelled()) { @@ -207,16 +209,26 @@ public final class TranslatedTextViewer implements TextViewer { return Bundle.TranslatedContentViewer_fileHasNoText(); } - if (this.translateText) { - String translation = translate(fileText); - if (this.isCancelled()) { - throw new InterruptedException(); - } - return translation; - } else { + if (!this.translateText) { return fileText; } + String translation; + try { + translation = translate(fileText); + } catch (NoServiceProviderException ex) { + logger.log(Level.WARNING, String.format("Error occurred translating text for file %s (objId=%d)", file.getName(), file.getId()), ex); + translation = Bundle.TranslatedContentViewer_noServiceProvider(); + } catch (TranslationException ex) { + logger.log(Level.WARNING, String.format("Error occurred translating text for file %s (objId=%d)", file.getName(), file.getId()), ex); + translation = Bundle.TranslatedContentViewer_translationException(ex.getMessage()); + } + + if (this.isCancelled()) { + throw new InterruptedException(); + } + + return translation; } @Override @@ -245,24 +257,13 @@ public final class TranslatedTextViewer implements TextViewer { * * @return Translated text or error message */ - @NbBundle.Messages({ - "TranslatedContentViewer.emptyTranslation=The translation is empty.", - "TranslatedContentViewer.noServiceProvider=Machine translation software was not found.", - "# {0} - exception message", "TranslatedContentViewer.translationException=Error encountered while attempting translation ({0})."}) - private String translate(String input) { - try { - TextTranslationService translatorInstance = TextTranslationService.getInstance(); - String translatedResult = translatorInstance.translate(input); - if (translatedResult.isEmpty()) { - return Bundle.TranslatedContentViewer_emptyTranslation(); - } - return translatedResult; - } catch (NoServiceProviderException ex) { - return Bundle.TranslatedContentViewer_noServiceProvider(); - } catch (TranslationException ex) { - logger.log(Level.WARNING, String.format("Error occurred translating text for file %s (objId=%d)", file.getName(), file.getId()), ex); - return Bundle.TranslatedContentViewer_translationException(ex.getMessage()); + private String translate(String input) throws NoServiceProviderException, TranslationException { + TextTranslationService translatorInstance = TextTranslationService.getInstance(); + String translatedResult = translatorInstance.translate(input); + if (translatedResult.isEmpty()) { + return Bundle.TranslatedContentViewer_emptyTranslation(); } + return translatedResult; } /** From 5a9c630d4b3284de7f0564c73496a99763e16b6f Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 22 Oct 2019 17:50:19 -0400 Subject: [PATCH 49/91] 5506 More robust machine trans --- .../autopsy/texttranslation/ui/TranslatedTextViewer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index b6490b70bd..65d65f4ad5 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -176,7 +176,7 @@ public final class TranslatedTextViewer implements TextViewer { "TranslatedContentViewer.fileHasNoText=File has no text.", "TranslatedContentViewer.emptyTranslation=The translation is empty.", "TranslatedContentViewer.noServiceProvider=Machine translation software was not found.", - "# {0} - exception message", "TranslatedContentViewer.translationException=Error encountered while attempting translation ({0})." + "# {0} - exception message", "TranslatedContentViewer.translationException=Error encountered while translating file ({0})." }) @Override public String doInBackground() throws InterruptedException { @@ -243,6 +243,7 @@ public final class TranslatedTextViewer implements TextViewer { String orientDetectSubstring = result.substring(0, maxOrientChars); ComponentOrientation orientation = TextUtil.getTextDirection(orientDetectSubstring); panel.display(result, orientation, Font.PLAIN); + } catch (InterruptedException | CancellationException ignored) { // Task cancelled, no error. } catch (ExecutionException ex) { From 0de0c7d852bae5dfba0e0a085e494202a458e62b Mon Sep 17 00:00:00 2001 From: esaunders Date: Tue, 22 Oct 2019 17:53:07 -0400 Subject: [PATCH 50/91] Add note about location of Options dialog on Mac. --- docs/doxygen-user/main.dox | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/doxygen-user/main.dox b/docs/doxygen-user/main.dox index 122e14fb0f..61d555ace4 100644 --- a/docs/doxygen-user/main.dox +++ b/docs/doxygen-user/main.dox @@ -6,6 +6,8 @@ Overview This is the User's Guide for the open source Autopsy platform. Autopsy allows you to examine a hard drive or mobile device and recover evidence from it. This guide should help you with using Autopsy. The developer's guide will help you develop your own Autopsy modules. +Note: For those users running Autopsy on Mac devices, the functionality available through the "Tools" -> "Options" dialog as described in this documentation can be accessed through the system menu bar under "Preferences" or through the Cmd + , (command-comma) shortcut. + Help Topics ------- The following topics are available here: From 9e01f63d5008b18d90a8fa360cfa36fb1760a412 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Tue, 22 Oct 2019 17:53:42 -0400 Subject: [PATCH 51/91] 5506 More robust machine trans --- .../autopsy/texttranslation/ui/TranslatedTextViewer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index 65d65f4ad5..811dc229cc 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -248,6 +248,7 @@ public final class TranslatedTextViewer implements TextViewer { // Task cancelled, no error. } catch (ExecutionException ex) { logger.log(Level.WARNING, String.format("Error occurred during background task execution for file %s (objId=%d)", file.getName(), file.getId()), ex); + panel.display(Bundle.TranslatedContentViewer_translationException(ex.getMessage()), ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); } } From 9efea1c6a3a6bfbf4ec012e5b3202e1c90604a7c Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Wed, 23 Oct 2019 10:23:51 -0400 Subject: [PATCH 52/91] codacy fix --- .../sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java index 5892733350..c757c63c28 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java @@ -26,7 +26,7 @@ import org.sleuthkit.datamodel.TskCoreException; * Utilities for simplifying and reducing redundant when getting Artifact * attributes. */ -public class AttributeUtils { +final class AttributeUtils { /** * Private constructor for this Utility class. From 08ccb2a9c95dd0ff1decac9124318ab8a5fce53a Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Wed, 23 Oct 2019 11:39:13 -0400 Subject: [PATCH 53/91] Update EmailMessage.java If messageid is null then set it to "" in setMessageID --- .../thunderbirdparser/EmailMessage.java | 74 ++++++++++--------- 1 file changed, 40 insertions(+), 34 deletions(-) diff --git a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/EmailMessage.java b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/EmailMessage.java index 40f2fc0933..09a6637e6e 100644 --- a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/EmailMessage.java +++ b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/EmailMessage.java @@ -83,7 +83,7 @@ class EmailMessage { void setSubject(String subject) { if (subject != null) { this.subject = subject; - if(subject.matches("^[R|r][E|e].*?:.*")) { + if (subject.matches("^[R|r][E|e].*?:.*")) { this.simplifiedSubject = subject.replaceAll("[R|r][E|e].*?:", "").trim(); replySubject = true; } else { @@ -93,19 +93,19 @@ class EmailMessage { this.simplifiedSubject = ""; } } - + /** * Returns the orginal subject with the "RE:" stripped off". - * + * * @return Message subject with the "RE" stripped off */ String getSimplifiedSubject() { return simplifiedSubject; } - + /** * Returns whether or not the message subject started with "RE:" - * + * * @return true if the original subject started with RE otherwise false. */ boolean isReplySubject() { @@ -121,6 +121,7 @@ class EmailMessage { this.headers = headers; } } + String getTextBody() { return textBody; } @@ -211,75 +212,80 @@ class EmailMessage { this.localPath = localPath; } } - + /** - * Returns the value of the Message-ID header field of this message or - * empty string if it is not present. - * + * Returns the value of the Message-ID header field of this message or empty + * string if it is not present. + * * @return the identifier of this message. */ String getMessageID() { return messageID; } - + /** * Sets the identifier of this message. - * + * * @param messageID identifer of this message */ void setMessageID(String messageID) { - this.messageID = messageID; + if (messageID != null) { + this.messageID = messageID; + } else { + this.messageID = ""; + } } - + /** - * Returns the messageID of the parent message or empty String if not present. - * + * Returns the messageID of the parent message or empty String if not + * present. + * * @return the idenifier of the message parent */ String getInReplyToID() { return inReplyToID; } - + /** * Sets the messageID of the parent message. - * + * * @param inReplyToID messageID of the parent message. */ void setInReplyToID(String inReplyToID) { this.inReplyToID = inReplyToID; } - + /** - * Returns a list of Message-IDs listing the parent, grandparent, - * great-grandparent, and so on, of this message. - * + * Returns a list of Message-IDs listing the parent, grandparent, + * great-grandparent, and so on, of this message. + * * @return The reference list or empty string if none is available. */ List getReferences() { return references; } - + /** * Set the list of reference message-IDs from the email message header. - * - * @param references + * + * @param references */ void setReferences(List references) { this.references = references; } - + /** * Sets the ThreadID of this message. - * + * * @param threadID - the thread ID to set */ void setMessageThreadID(String threadID) { this.messageThreadID = threadID; } - + /** * Returns the ThreadID for this message. - * + * * @return - the message thread ID or "" is non is available */ String getMessageThreadID() { @@ -308,7 +314,7 @@ class EmailMessage { private long aTime = 0L; private long mTime = 0L; - + private TskData.EncodingType encodingType = TskData.EncodingType.NONE; String getName() { @@ -394,14 +400,14 @@ class EmailMessage { this.mTime = mTime.getTime() / 1000; } } - - void setEncodingType(TskData.EncodingType encodingType){ + + void setEncodingType(TskData.EncodingType encodingType) { this.encodingType = encodingType; } - - TskData.EncodingType getEncodingType(){ + + TskData.EncodingType getEncodingType() { return encodingType; } - + } } From 0b8ea73f7f52f3968a90aaab94b7a7c0a6cefd98 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Wed, 23 Oct 2019 11:45:25 -0400 Subject: [PATCH 54/91] Update ThunderbirdMboxFileIngestModule.java Revert changes from prior commit. --- .../ThunderbirdMboxFileIngestModule.java | 162 +++++++++--------- 1 file changed, 81 insertions(+), 81 deletions(-) diff --git a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java index 91bf391e63..5c42269a8a 100644 --- a/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java +++ b/thunderbirdparser/src/org/sleuthkit/autopsy/thunderbirdparser/ThunderbirdMboxFileIngestModule.java @@ -65,13 +65,12 @@ import org.sleuthkit.datamodel.TskException; * structure and metadata. */ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { - private static final Logger logger = Logger.getLogger(ThunderbirdMboxFileIngestModule.class.getName()); private final IngestServices services = IngestServices.getInstance(); private FileManager fileManager; private IngestJobContext context; private Blackboard blackboard; - + private Case currentCase; /** @@ -81,7 +80,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } @Override - @Messages({"ThunderbirdMboxFileIngestModule.noOpenCase.errMsg=Exception while getting open case."}) + @Messages ({"ThunderbirdMboxFileIngestModule.noOpenCase.errMsg=Exception while getting open case."}) public void startUp(IngestJobContext context) throws IngestModuleException { this.context = context; try { @@ -104,8 +103,8 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } //skip unalloc - if ((abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) - || (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK))) { + if ((abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) || + (abstractFile.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK))) { return ProcessResult.OK; } @@ -116,7 +115,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { // check its signature boolean isMbox = false; boolean isEMLFile = false; - + try { byte[] t = new byte[64]; if (abstractFile.getSize() > 64) { @@ -133,7 +132,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { if (isMbox) { return processMBox(abstractFile); } - + if (isEMLFile) { return processEMLFile(abstractFile); } @@ -141,7 +140,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { if (PstParser.isPstFile(abstractFile)) { return processPst(abstractFile); } - + if (VcardParser.isVcardFile(abstractFile)) { return processVcard(abstractFile); } @@ -161,7 +160,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { String fileName; try { fileName = getTempPath() + File.separator + abstractFile.getName() - + "-" + String.valueOf(abstractFile.getId()); + + "-" + String.valueOf(abstractFile.getId()); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS return ProcessResult.ERROR; @@ -189,11 +188,11 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { PstParser parser = new PstParser(services); PstParser.ParseResult result = parser.open(file, abstractFile.getId()); - switch (result) { + switch( result) { case OK: Iterator pstMsgIterator = parser.getEmailMessageIterator(); if (pstMsgIterator != null) { - processEmails(parser.getPartialEmailMessages(), pstMsgIterator, abstractFile); + processEmails(parser.getPartialEmailMessages(), pstMsgIterator , abstractFile); } else { // sometimes parser returns ParseResult=OK but there are no messages postErrorMessage( @@ -274,7 +273,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { String fileName; try { fileName = getTempPath() + File.separator + abstractFile.getName() - + "-" + String.valueOf(abstractFile.getId()); + + "-" + String.valueOf(abstractFile.getId()); } catch (NoCurrentCaseException ex) { logger.log(Level.SEVERE, "Exception while getting open case.", ex); //NON-NLS return ProcessResult.ERROR; @@ -299,16 +298,16 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { return ProcessResult.OK; } - MboxParser emailIterator = MboxParser.getEmailIterator(emailFolder, file, abstractFile.getId()); + MboxParser emailIterator = MboxParser.getEmailIterator( emailFolder, file, abstractFile.getId()); List emails = new ArrayList<>(); - if (emailIterator != null) { - while (emailIterator.hasNext()) { + if(emailIterator != null) { + while(emailIterator.hasNext()) { EmailMessage emailMessage = emailIterator.next(); - if (emailMessage != null) { + if(emailMessage != null) { emails.add(emailMessage); } } - + String errors = emailIterator.getErrors(); if (!errors.isEmpty()) { postErrorMessage( @@ -316,7 +315,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { abstractFile.getName()), errors); } } - processEmails(emails, MboxParser.getEmailIterator(emailFolder, file, abstractFile.getId()), abstractFile); + processEmails(emails, MboxParser.getEmailIterator( emailFolder, file, abstractFile.getId()), abstractFile); if (file.delete() == false) { logger.log(Level.INFO, "Failed to delete temp file: {0}", file.getName()); //NON-NLS @@ -324,7 +323,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { return ProcessResult.OK; } - + /** * Parse and extract data from a vCard file. * @@ -348,8 +347,8 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } return ProcessResult.OK; } - - private ProcessResult processEMLFile(AbstractFile abstractFile) { + + private ProcessResult processEMLFile(AbstractFile abstractFile) { try { EmailMessage message = EMLParser.parse(abstractFile); @@ -401,7 +400,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { /** * Get a module output folder. - * + * * @throws NoCurrentCaseException if there is no open case. * * @return the module output folder @@ -436,39 +435,38 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { * @param abstractFile */ private void processEmails(List partialEmailsForThreading, Iterator fullMessageIterator, AbstractFile abstractFile) { - + // Putting try/catch around this to catch any exception and still allow // the creation of the artifacts to continue. - try { + try{ EmailMessageThreader.threadMessages(partialEmailsForThreading); - } catch (Exception ex) { + } catch(Exception ex) { logger.log(Level.WARNING, String.format("Exception thrown parsing emails from %s", abstractFile.getName()), ex); } - + List derivedFiles = new ArrayList<>(); int msgCnt = 0; - while (fullMessageIterator.hasNext()) { + while(fullMessageIterator.hasNext()) { EmailMessage current = fullMessageIterator.next(); - - if (current == null) { + + if(current == null) { continue; } - if (partialEmailsForThreading.size() > msgCnt) { + if(partialEmailsForThreading.size() > msgCnt) { EmailMessage threaded = partialEmailsForThreading.get(msgCnt++); - - if ((threaded.getMessageID() != null) && - (threaded.getMessageID().equals(current.getMessageID()) - && threaded.getSubject().equals(current.getSubject()))) { - current.setMessageThreadID(threaded.getMessageThreadID()); - } + + if(threaded.getMessageID().equals(current.getMessageID()) && + threaded.getSubject().equals(current.getSubject())) { + current.setMessageThreadID(threaded.getMessageThreadID()); + } } - + BlackboardArtifact msgArtifact = addEmailArtifact(current, abstractFile); - - if ((msgArtifact != null) && (current.hasAttachment())) { - derivedFiles.addAll(handleAttachments(current.getAttachments(), abstractFile, msgArtifact)); + + if ((msgArtifact != null) && (current.hasAttachment())) { + derivedFiles.addAll(handleAttachments(current.getAttachments(), abstractFile, msgArtifact )); } } @@ -479,7 +477,6 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } context.addFilesToJob(derivedFiles); } - /** * Add the given attachments as derived files and reschedule them for * ingest. @@ -520,30 +517,29 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { } /** - * Finds and returns a set of unique email addresses found in the input - * string + * Finds and returns a set of unique email addresses found in the input string * * @param input - input string, like the To/CC line from an email header - * + * * @return Set: set of email addresses found in the input string */ private Set findEmailAddresess(String input) { Pattern p = Pattern.compile("\\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}\\b", - Pattern.CASE_INSENSITIVE); + Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(input); Set emailAddresses = new HashSet<>(); while (m.find()) { - emailAddresses.add(m.group()); + emailAddresses.add( m.group()); } return emailAddresses; } - + /** * Add a blackboard artifact for the given e-mail message. * * @param email The e-mail message. * @param abstractFile The associated file. - * + * * @return The generated e-mail message artifact. */ @Messages({"ThunderbirdMboxFileIngestModule.addArtifact.indexError.message=Failed to index email message detected artifact for keyword search."}) @@ -567,69 +563,73 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { List senderAddressList = new ArrayList<>(); String senderAddress; senderAddressList.addAll(findEmailAddresess(from)); - + AccountFileInstance senderAccountInstance = null; if (senderAddressList.size() == 1) { senderAddress = senderAddressList.get(0); try { senderAccountInstance = currentCase.getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.EMAIL, senderAddress, EmailParserModuleFactory.getModuleName(), abstractFile); - } catch (TskCoreException ex) { - logger.log(Level.WARNING, "Failed to create account for email address " + senderAddress, ex); //NON-NLS } - } else { - logger.log(Level.WARNING, "Failed to find sender address, from = {0}", from); //NON-NLS + catch(TskCoreException ex) { + logger.log(Level.WARNING, "Failed to create account for email address " + senderAddress, ex); //NON-NLS + } } - + else { + logger.log(Level.WARNING, "Failed to find sender address, from = {0}", from); //NON-NLS + } + List recipientAddresses = new ArrayList<>(); recipientAddresses.addAll(findEmailAddresess(to)); recipientAddresses.addAll(findEmailAddresess(cc)); recipientAddresses.addAll(findEmailAddresess(bcc)); - + List recipientAccountInstances = new ArrayList<>(); recipientAddresses.forEach((addr) -> { try { - AccountFileInstance recipientAccountInstance - = currentCase.getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.EMAIL, addr, - EmailParserModuleFactory.getModuleName(), abstractFile); + AccountFileInstance recipientAccountInstance = + currentCase.getSleuthkitCase().getCommunicationsManager().createAccountFileInstance(Account.Type.EMAIL, addr, + EmailParserModuleFactory.getModuleName(), abstractFile); recipientAccountInstances.add(recipientAccountInstance); - } catch (TskCoreException ex) { + } + catch(TskCoreException ex) { logger.log(Level.WARNING, "Failed to create account for email address " + addr, ex); //NON-NLS } }); - + addArtifactAttribute(headers, ATTRIBUTE_TYPE.TSK_HEADERS, bbattributes); addArtifactAttribute(from, ATTRIBUTE_TYPE.TSK_EMAIL_FROM, bbattributes); addArtifactAttribute(to, ATTRIBUTE_TYPE.TSK_EMAIL_TO, bbattributes); addArtifactAttribute(subject, ATTRIBUTE_TYPE.TSK_SUBJECT, bbattributes); - + addArtifactAttribute(dateL, ATTRIBUTE_TYPE.TSK_DATETIME_RCVD, bbattributes); addArtifactAttribute(dateL, ATTRIBUTE_TYPE.TSK_DATETIME_SENT, bbattributes); - + addArtifactAttribute(body, ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_PLAIN, bbattributes); - - addArtifactAttribute(((id < 0L) ? NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.notAvail") : String.valueOf(id)), + + addArtifactAttribute(((id < 0L) ? NbBundle.getMessage(this.getClass(), "ThunderbirdMboxFileIngestModule.notAvail") : String.valueOf(id)), ATTRIBUTE_TYPE.TSK_MSG_ID, bbattributes); - - addArtifactAttribute(((localPath.isEmpty() == false) ? localPath : ""), + + addArtifactAttribute(((localPath.isEmpty() == false) ? localPath : ""), ATTRIBUTE_TYPE.TSK_PATH, bbattributes); - + addArtifactAttribute(cc, ATTRIBUTE_TYPE.TSK_EMAIL_CC, bbattributes); addArtifactAttribute(bodyHTML, ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_HTML, bbattributes); addArtifactAttribute(rtf, ATTRIBUTE_TYPE.TSK_EMAIL_CONTENT_RTF, bbattributes); addArtifactAttribute(threadID, ATTRIBUTE_TYPE.TSK_THREAD_ID, bbattributes); - + + try { - + bbart = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_EMAIL_MSG); bbart.addAttributes(bbattributes); // Add account relationships - currentCase.getSleuthkitCase().getCommunicationsManager().addRelationships(senderAccountInstance, recipientAccountInstances, bbart, Relationship.Type.MESSAGE, dateL); - + currentCase.getSleuthkitCase().getCommunicationsManager().addRelationships(senderAccountInstance, recipientAccountInstances, bbart,Relationship.Type.MESSAGE, dateL); + try { // index the artifact for keyword search - blackboard.postArtifact(bbart, EmailParserModuleFactory.getModuleName()); + blackboard.postArtifact(bbart, EmailParserModuleFactory.getModuleName()); } catch (Blackboard.BlackboardException ex) { logger.log(Level.SEVERE, "Unable to index blackboard artifact " + bbart.getArtifactID(), ex); //NON-NLS MessageNotifyUtil.Notify.error(Bundle.ThunderbirdMboxFileIngestModule_addArtifact_indexError_message(), bbart.getDisplayName()); @@ -640,11 +640,11 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { return bbart; } - + /** * Add an attribute of a specified type to a supplied Collection. - * - * @param stringVal The attribute value. + * + * @param stringVal The attribute value. * @param attrType The type of attribute to be added. * @param bbattributes The Collection to which the attribute will be added. */ @@ -656,7 +656,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { /** * Add an attribute of a specified type to a supplied Collection. - * + * * @param stringVal The attribute value. * @param attrType The type of attribute to be added. * @param bbattributes The Collection to which the attribute will be added. @@ -666,10 +666,10 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { bbattributes.add(new BlackboardAttribute(attrType, EmailParserModuleFactory.getModuleName(), stringVal)); } } - + /** * Add an attribute of a specified type to a supplied Collection. - * + * * @param longVal The attribute value. * @param attrType The type of attribute to be added. * @param bbattributes The Collection to which the attribute will be added. @@ -679,10 +679,10 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { bbattributes.add(new BlackboardAttribute(attrType, EmailParserModuleFactory.getModuleName(), longVal)); } } - + /** * Post an error message for the user. - * + * * @param subj The error subject. * @param details The error details. */ @@ -693,7 +693,7 @@ public final class ThunderbirdMboxFileIngestModule implements FileIngestModule { /** * Get the IngestServices object. - * + * * @return The IngestServices object. */ IngestServices getServices() { From 166366e2410e468a9070b8689f04cd00ea1ab96c Mon Sep 17 00:00:00 2001 From: esaunders Date: Wed, 23 Oct 2019 14:12:52 -0400 Subject: [PATCH 55/91] Don't make building dependent on downloading test data files. Out Travis build occasionally fails when attempting to dowmload these files. Ideally these files should be downloaded only if tests are to be run that require them. --- Core/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/build.xml b/Core/build.xml index 28e64b83e5..0e5c90ef04 100644 --- a/Core/build.xml +++ b/Core/build.xml @@ -137,7 +137,7 @@ - + From f306fc28ad13da320f545ff51525efeae750c39a Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 23 Oct 2019 14:43:35 -0400 Subject: [PATCH 56/91] 5506 More robust machine trans --- .../ui/Bundle.properties-MERGED | 3 ++- .../ui/TranslatedTextViewer.java | 25 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED index cfa9af0fb7..c4da06114c 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED @@ -5,11 +5,12 @@ TranslatedContentPanel.comboBoxOption.translatedText=Translated Text TranslatedContentViewer.emptyTranslation=The translation is empty. # {0} - exception message TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file ({0}). +TranslatedContentViewer.extractingText=Getting text, please wait... TranslatedContentViewer.fileHasNoText=File has no text. TranslatedContentViewer.noServiceProvider=Machine translation software was not found. TranslatedContentViewer.translatingText=Translating text, please wait... # {0} - exception message -TranslatedContentViewer.translationException=Error encountered while attempting translation ({0}). +TranslatedContentViewer.translationException=Error encountered while translating file ({0}). TranslatedTextViewer.maxPayloadSize=Up to the first %dKB of text will be translated TranslatedTextViewer.title=Translation TranslatedTextViewer.toolTip=Displays translated file text. diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index 811dc229cc..aed254c9e0 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -171,6 +171,7 @@ public final class TranslatedTextViewer implements TextViewer { } @NbBundle.Messages({ + "TranslatedContentViewer.extractingText=Getting text, please wait...", "TranslatedContentViewer.translatingText=Translating text, please wait...", "# {0} - exception message", "TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file ({0}).", "TranslatedContentViewer.fileHasNoText=File has no text.", @@ -184,15 +185,14 @@ public final class TranslatedTextViewer implements TextViewer { throw new InterruptedException(); } - /* - * This message is only written to the viewer once this task starts - * and any previous task has therefore been completed by the - * single-threaded executor. - */ SwingUtilities.invokeLater(() -> { - panel.display(Bundle.TranslatedContentViewer_translatingText(), ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); + /* + * This message is only written to the viewer once this task + * starts and any previous task has therefore been completed by + * the single-threaded executor. + */ + panel.display(Bundle.TranslatedContentViewer_extractingText(), ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); }); - String fileText; try { fileText = getFileText(file); @@ -213,6 +213,9 @@ public final class TranslatedTextViewer implements TextViewer { return fileText; } + SwingUtilities.invokeLater(() -> { + panel.display(Bundle.TranslatedContentViewer_translatingText(), ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); + }); String translation; try { translation = translate(fileText); @@ -243,7 +246,7 @@ public final class TranslatedTextViewer implements TextViewer { String orientDetectSubstring = result.substring(0, maxOrientChars); ComponentOrientation orientation = TextUtil.getTextDirection(orientDetectSubstring); panel.display(result, orientation, Font.PLAIN); - + } catch (InterruptedException | CancellationException ignored) { // Task cancelled, no error. } catch (ExecutionException ex) { @@ -405,10 +408,8 @@ public final class TranslatedTextViewer implements TextViewer { } AbstractFile file = node.getLookup().lookup(AbstractFile.class); - if (file == null) { - return; - } - boolean translateText = currentSelection.equals(DisplayDropdownOptions.ORIGINAL_TEXT.toString()); + String textDisplaySelection = panel.getDisplayDropDownSelection(); + boolean translateText = !textDisplaySelection.equals(DisplayDropdownOptions.ORIGINAL_TEXT.toString()); backgroundTask = new ExtractAndTranslateTextTask(file, translateText); //Pass the background task to a single threaded pool to keep From a416f04a46b5baf7cd6145975181b5a536fe9348 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 23 Oct 2019 14:45:13 -0400 Subject: [PATCH 57/91] 5506 More robust machine trans --- .../autopsy/texttranslation/ui/TranslatedTextViewer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index aed254c9e0..242c32684d 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -171,7 +171,7 @@ public final class TranslatedTextViewer implements TextViewer { } @NbBundle.Messages({ - "TranslatedContentViewer.extractingText=Getting text, please wait...", + "TranslatedContentViewer.extractingText=Extracting text, please wait...", "TranslatedContentViewer.translatingText=Translating text, please wait...", "# {0} - exception message", "TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file ({0}).", "TranslatedContentViewer.fileHasNoText=File has no text.", From 156edd28f5962dcadb88ab3cc37816cfc15fa7cf Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Wed, 23 Oct 2019 15:11:23 -0400 Subject: [PATCH 58/91] Updated basic window to use new datamodel --- .../geolocation/GeolocationTopComponent.java | 14 ++++++++++++++ .../sleuthkit/autopsy/geolocation/MapWaypoint.java | 2 +- .../autopsy/geolocation/OpenGeolocationAction.java | 4 +++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java index 1e3143d678..7e096aa4d7 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -33,6 +33,7 @@ import org.jxmapviewer.viewer.Waypoint; import org.openide.util.NbBundle.Messages; import org.openide.windows.RetainLocation; import org.openide.windows.TopComponent; +import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.casemodule.Case; import static org.sleuthkit.autopsy.casemodule.Case.Events.CURRENT_CASE; import org.sleuthkit.autopsy.coreutils.Logger; @@ -52,6 +53,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact; @RetainLocation("geolocation") @SuppressWarnings("PMD.SingularField") public final class GeolocationTopComponent extends TopComponent { + + private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(GeolocationTopComponent.class.getName()); @@ -127,6 +130,17 @@ public final class GeolocationTopComponent extends TopComponent { super.removeNotify(); IngestManager.getInstance().removeIngestModuleEventListener(ingestListener); } + + @Override + public void componentOpened() { + super.componentOpened(); + WindowManager.getDefault().setTopComponentFloating(this, true); + } + + @Override + public void open() { + super.open(); + } /** * Set the state of the refresh panel at the top of the mapPanel. diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java index d1fb35ae46..fc969c58e8 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java @@ -30,7 +30,7 @@ final class MapWaypoint implements org.jxmapviewer.viewer.Waypoint{ static List getWaypoints(SleuthkitCase skCase) throws TskCoreException{ List points = Waypoint.getAllWaypoints(skCase); - List routes = Route.getGPSRoutes(skCase); + List routes = Route.getRoutes(skCase); for(Route route: routes) { points.addAll(route.getRoute()); } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java b/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java index e13031cd6e..e0f8d42389 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/OpenGeolocationAction.java @@ -42,7 +42,9 @@ import org.sleuthkit.autopsy.core.RuntimeProperties; @ActionReferences(value = { @ActionReference(path = "Menu/Tools", position = 102)}) public class OpenGeolocationAction extends CallableSystemAction { - + + private static final long serialVersionUID = 1L; + @Messages({ "OpenGeolocationAction_name=Geolocation", "OpenGeolocationAction_displayName=Geolocation" From 4c7d14683aa6d01b97e78584c21b7b33f459402e Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 23 Oct 2019 15:11:44 -0400 Subject: [PATCH 59/91] 5506 More robust machine trans --- .../texttranslation/ui/Bundle.properties-MERGED | 10 +++++----- .../texttranslation/ui/TranslatedTextViewer.java | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED index c4da06114c..fa1a250e44 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/Bundle.properties-MERGED @@ -2,15 +2,15 @@ OptionsCategory_Name_Machine_Translation=Machine Translation OptionsCategory_Keywords_Machine_Translation_Settings=Machine Translation Settings TranslatedContentPanel.comboBoxOption.originalText=Original Text (Up to 25KB) TranslatedContentPanel.comboBoxOption.translatedText=Translated Text -TranslatedContentViewer.emptyTranslation=The translation is empty. +TranslatedContentViewer.emptyTranslation=The machine translation software did not return any text. # {0} - exception message -TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file ({0}). -TranslatedContentViewer.extractingText=Getting text, please wait... +TranslatedContentViewer.errorExtractingText=An error occurred while extracting the text ({0}). +TranslatedContentViewer.extractingText=Extracting text, please wait... TranslatedContentViewer.fileHasNoText=File has no text. -TranslatedContentViewer.noServiceProvider=Machine translation software was not found. +TranslatedContentViewer.noServiceProvider=The machine translation software was not found. TranslatedContentViewer.translatingText=Translating text, please wait... # {0} - exception message -TranslatedContentViewer.translationException=Error encountered while translating file ({0}). +TranslatedContentViewer.translationException=An error occurred while translating the text ({0}). TranslatedTextViewer.maxPayloadSize=Up to the first %dKB of text will be translated TranslatedTextViewer.title=Translation TranslatedTextViewer.toolTip=Displays translated file text. diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index 242c32684d..e3993e629b 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -173,11 +173,11 @@ public final class TranslatedTextViewer implements TextViewer { @NbBundle.Messages({ "TranslatedContentViewer.extractingText=Extracting text, please wait...", "TranslatedContentViewer.translatingText=Translating text, please wait...", - "# {0} - exception message", "TranslatedContentViewer.errorExtractingText=Error encountered while extracting text from file ({0}).", + "# {0} - exception message", "TranslatedContentViewer.errorExtractingText=An error occurred while extracting the text ({0}).", "TranslatedContentViewer.fileHasNoText=File has no text.", - "TranslatedContentViewer.emptyTranslation=The translation is empty.", - "TranslatedContentViewer.noServiceProvider=Machine translation software was not found.", - "# {0} - exception message", "TranslatedContentViewer.translationException=Error encountered while translating file ({0})." + "TranslatedContentViewer.emptyTranslation=The machine translation software did not return any text.", + "TranslatedContentViewer.noServiceProvider=The machine translation software was not found.", + "# {0} - exception message", "TranslatedContentViewer.translationException=An error occurred while translating the text ({0})." }) @Override public String doInBackground() throws InterruptedException { From 264a827f21b4c650d6ff54ccce87b3fa18e4097f Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 23 Oct 2019 15:17:53 -0400 Subject: [PATCH 60/91] 5506 More robust machine trans --- .../autopsy/texttranslation/ui/TranslatedTextViewer.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index e3993e629b..13dda67f5f 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -186,11 +186,6 @@ public final class TranslatedTextViewer implements TextViewer { } SwingUtilities.invokeLater(() -> { - /* - * This message is only written to the viewer once this task - * starts and any previous task has therefore been completed by - * the single-threaded executor. - */ panel.display(Bundle.TranslatedContentViewer_extractingText(), ComponentOrientation.LEFT_TO_RIGHT, Font.ITALIC); }); String fileText; From 6702fdb6acc6933753f992942410e80539d74336 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 23 Oct 2019 15:20:00 -0400 Subject: [PATCH 61/91] 5506 More robust machine trans --- .../autopsy/texttranslation/ui/TranslatedTextViewer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index 13dda67f5f..21e95cc329 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -192,7 +192,7 @@ public final class TranslatedTextViewer implements TextViewer { try { fileText = getFileText(file); } catch (IOException | TextExtractor.InitReaderException ex) { - logger.log(Level.WARNING, String.format("Error getting text for file %s (objId=%d)", file.getName(), file.getId()), ex); + logger.log(Level.WARNING, String.format("Error extracting text for file %s (objId=%d)", file.getName(), file.getId()), ex); return Bundle.TranslatedContentViewer_errorExtractingText(ex.getMessage()); } @@ -215,10 +215,10 @@ public final class TranslatedTextViewer implements TextViewer { try { translation = translate(fileText); } catch (NoServiceProviderException ex) { - logger.log(Level.WARNING, String.format("Error occurred translating text for file %s (objId=%d)", file.getName(), file.getId()), ex); + logger.log(Level.WARNING, String.format("Error translating text for file %s (objId=%d)", file.getName(), file.getId()), ex); translation = Bundle.TranslatedContentViewer_noServiceProvider(); } catch (TranslationException ex) { - logger.log(Level.WARNING, String.format("Error occurred translating text for file %s (objId=%d)", file.getName(), file.getId()), ex); + logger.log(Level.WARNING, String.format("Error translating text for file %s (objId=%d)", file.getName(), file.getId()), ex); translation = Bundle.TranslatedContentViewer_translationException(ex.getMessage()); } From 565a0296fba715f80adc2b907dfbd7f3fbf0a45d Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 23 Oct 2019 15:26:18 -0400 Subject: [PATCH 62/91] 5506 More robust machine trans --- .../autopsy/texttranslation/ui/TranslatedTextViewer.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index 21e95cc329..bed42e2287 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -175,7 +175,6 @@ public final class TranslatedTextViewer implements TextViewer { "TranslatedContentViewer.translatingText=Translating text, please wait...", "# {0} - exception message", "TranslatedContentViewer.errorExtractingText=An error occurred while extracting the text ({0}).", "TranslatedContentViewer.fileHasNoText=File has no text.", - "TranslatedContentViewer.emptyTranslation=The machine translation software did not return any text.", "TranslatedContentViewer.noServiceProvider=The machine translation software was not found.", "# {0} - exception message", "TranslatedContentViewer.translationException=An error occurred while translating the text ({0})." }) @@ -257,6 +256,9 @@ public final class TranslatedTextViewer implements TextViewer { * * @return Translated text or error message */ + @NbBundle.Messages({ + "TranslatedContentViewer.emptyTranslation=The machine translation software did not return any text." + }) private String translate(String input) throws NoServiceProviderException, TranslationException { TextTranslationService translatorInstance = TextTranslationService.getInstance(); String translatedResult = translatorInstance.translate(input); From 338f49a9af7843ac224b700196895f07eba20e66 Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Wed, 23 Oct 2019 15:33:09 -0400 Subject: [PATCH 63/91] Minor clean up of DataContentViewerUtility.java --- .../DataContentViewerUtility.java | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerUtility.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerUtility.java index ea1e7b58a0..d460a16f03 100755 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerUtility.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerUtility.java @@ -23,32 +23,42 @@ import org.openide.nodes.Node; import org.sleuthkit.datamodel.BlackboardArtifact; /** - * Utility classes for content viewers. In theory, this would live in the - * contentviewer package, but the initial method was needed only be viewers in - * corecomponents and therefore can stay out of public API. + * Utility methods for content viewers. */ public class DataContentViewerUtility { /** - * Returns the first non-Blackboard Artifact from a Node. Needed for (at - * least) Hex and Strings that want to view all types of content (not just - * AbstractFile), but don't want to display an artifact unless that's the - * only thing there. Scenario is hash hit or interesting item hit. + * Gets a Content object from the Lookup of a display Node object, + * preferring to return any Content object other than a BlackboardArtifact + * object. * - * @param node Node passed into content viewer + * This method was written with the needs of the hex and strings content + * viewers in mind - the algorithm is exactly what those viewers require. * - * @return highest priority content or null if there is no content + * @param node A display Node object. + * + * @return If there are multiple Content objects associated with the Node, + * the first Content object that is not a BlackboardArtifact object + * is returned. If no Content objects other than artifacts are found, + * the first BlackboardArtifact object found is returned. If no + * Content objects are found, null is returned. */ public static Content getDefaultContent(Node node) { - Content bbContentSeen = null; - for (Content content : (node).getLookup().lookupAll(Content.class)) { - if (content instanceof BlackboardArtifact) { - bbContentSeen = content; + Content artifact = null; + for (Content content : node.getLookup().lookupAll(Content.class)) { + if (content instanceof BlackboardArtifact && artifact == null) { + artifact = content; } else { return content; } } - return bbContentSeen; + return artifact; + } + + /* + * Private constructor to prevent instantiation of utility class. + */ + private DataContentViewerUtility() { } } From b7ef4bec44a19fb3600b8b05e24921ee8cb4e86d Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Wed, 23 Oct 2019 15:39:32 -0400 Subject: [PATCH 64/91] Fixed codacy issues --- .../autopsy/geolocation/GeolocationTopComponent.java | 7 ------- .../org/sleuthkit/autopsy/geolocation/MapPanel.java | 11 +++++++---- .../sleuthkit/autopsy/geolocation/RefreshPanel.java | 6 ++++-- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java index 7e096aa4d7..cf76a66a66 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -136,11 +136,6 @@ public final class GeolocationTopComponent extends TopComponent { super.componentOpened(); WindowManager.getDefault().setTopComponentFloating(this, true); } - - @Override - public void open() { - super.open(); - } /** * Set the state of the refresh panel at the top of the mapPanel. @@ -165,8 +160,6 @@ public final class GeolocationTopComponent extends TopComponent { SwingWorker, Waypoint> worker = new SwingWorker, Waypoint>() { @Override protected List doInBackground() throws Exception { - List waypoints = new ArrayList<>(); - Case currentCase = Case.getCurrentCaseThrows(); return MapWaypoint.getWaypoints(currentCase.getSleuthkitCase()); diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java index 7abc1ff5be..9aace08818 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java @@ -39,12 +39,12 @@ import org.jxmapviewer.viewer.WaypointPainter; /** * Main panel with the JJXMapViewer object and its basic controls. */ -public class MapPanel extends javax.swing.JPanel { +final class MapPanel extends javax.swing.JPanel { private static final long serialVersionUID = 1L; - private boolean zoomChanging = false; - private boolean sliderReversed = false; + private boolean zoomChanging; + private final boolean sliderReversed; // Using a DefaultListModel to store the way points because we get // a lot of functionality for free, like listeners. @@ -53,8 +53,11 @@ public class MapPanel extends javax.swing.JPanel { /** * Creates new form MapPanel */ - public MapPanel() { + MapPanel() { waypointListModel = new DefaultListModel<>(); + sliderReversed = false; + zoomChanging = false; + initComponents(); initMap(); } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java index d53dd26b70..e7ff40f31c 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/RefreshPanel.java @@ -26,12 +26,14 @@ import javax.swing.JPanel; * due to new artifacts. * */ -class RefreshPanel extends JPanel { +final class RefreshPanel extends JPanel { + + private static final long serialVersionUID = 1L; /** * Creates new form RefreshPanel */ - public RefreshPanel() { + RefreshPanel() { initComponents(); } From 2966483800306f7d9b6f7ed3d8de20ef6198e6a5 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Wed, 23 Oct 2019 15:44:36 -0400 Subject: [PATCH 65/91] Fixed codacy issues --- .../sleuthkit/autopsy/geolocation/GeolocationTopComponent.java | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java index cf76a66a66..328aa048b2 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -22,7 +22,6 @@ import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; -import java.util.ArrayList; import java.util.EnumSet; import java.util.List; import java.util.Set; From 6c54c81c7746b976a2438b94d06943645fb09b5f Mon Sep 17 00:00:00 2001 From: Ann Priestman Date: Thu, 24 Oct 2019 09:14:14 -0400 Subject: [PATCH 66/91] Update copyright for API docs. Fix doxygen warnings. --- .../centralrepository/eventlisteners/IngestEventsListener.java | 1 + .../org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java | 2 +- .../autopsy/texttranslation/ui/TranslatedTextViewer.java | 2 +- docs/doxygen/footer.html | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java index 282e225135..355c7c8dbc 100644 --- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java +++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java @@ -224,6 +224,7 @@ public class IngestEventsListener { * in the central repository. * * @param originalArtifact the artifact to create the interesting item for + * @param caseDisplayNames the case names the artifact was previously seen in */ @NbBundle.Messages({"IngestEventsListener.prevExists.text=Previously Seen Devices (Central Repository)", "# {0} - typeName", diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java index 1f02708f64..84f7da6c36 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/MediaPlayerPanel.java @@ -637,7 +637,7 @@ public class MediaPlayerPanel extends JPanel implements MediaFileViewer.MediaVie * thumb at the given width and height. It also paints the track blue as * the thumb progresses. * - * @param b JSlider component + * @param slider JSlider component * @param config Configuration object. Contains info about thumb * dimensions and colors. */ diff --git a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java index bed42e2287..7e07545b49 100644 --- a/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java +++ b/Core/src/org/sleuthkit/autopsy/texttranslation/ui/TranslatedTextViewer.java @@ -271,7 +271,7 @@ public final class TranslatedTextViewer implements TextViewer { /** * Extracts text from the given node * - * @param node Selected node in UI + * @param file Selected node in UI * * @return Extracted text * diff --git a/docs/doxygen/footer.html b/docs/doxygen/footer.html index ac0c0a8d1c..8bf1577a45 100644 --- a/docs/doxygen/footer.html +++ b/docs/doxygen/footer.html @@ -1,5 +1,5 @@
    -

    Copyright © 2012-2018 Basis Technology. Generated on: $date
    +

    Copyright © 2012-2019 Basis Technology. Generated on: $date
    This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

    From 73987f7a55cf857689092b4dbe3a0fb814ff1d95 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Fri, 25 Oct 2019 16:22:22 -0400 Subject: [PATCH 67/91] Updated with missed review comments and added GeolocationDataException --- ...AttributeUtils.java => ArtifactUtils.java} | 63 ++++++++++++++++--- .../datamodel/ArtifactWaypoint.java | 35 +++++------ .../geolocation/datamodel/EXIFWaypoint.java | 25 +++++--- .../datamodel/GPSSearchWaypoint.java | 13 ++-- .../datamodel/GeoLocationDataException.java | 41 ++++++++++++ .../datamodel/GeolocationUtils.java | 7 +-- .../datamodel/LastKnownWaypoint.java | 8 +-- .../autopsy/geolocation/datamodel/Route.java | 54 +++++++--------- .../datamodel/TrackpointWaypoint.java | 15 ++--- .../geolocation/datamodel/Waypoint.java | 58 +++++++++-------- .../autopsy/report/modules/kml/KMLReport.java | 7 ++- 11 files changed, 207 insertions(+), 119 deletions(-) rename Core/src/org/sleuthkit/autopsy/geolocation/datamodel/{AttributeUtils.java => ArtifactUtils.java} (60%) create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoLocationDataException.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java similarity index 60% rename from Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java rename to Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java index c757c63c28..e99350072e 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/AttributeUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java @@ -18,20 +18,22 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; +import java.util.List; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; /** * Utilities for simplifying and reducing redundant when getting Artifact * attributes. */ -final class AttributeUtils { +final class ArtifactUtils { /** * Private constructor for this Utility class. */ - private AttributeUtils() { + private ArtifactUtils() { } @@ -47,12 +49,17 @@ final class AttributeUtils { * * @throws TskCoreException */ - static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException { if (artifact == null) { return null; } - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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.getDisplayString() : null); } @@ -66,7 +73,7 @@ final class AttributeUtils { * * @throws TskCoreException */ - static Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static Double getDouble(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException { if (artifact == null) { return null; } @@ -75,7 +82,12 @@ final class AttributeUtils { return null; } - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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); } @@ -89,7 +101,7 @@ final class AttributeUtils { * * @throws TskCoreException */ - static Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static Long getLong(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException { if (artifact == null) { return null; } @@ -99,7 +111,12 @@ final class AttributeUtils { return null; } - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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); } @@ -113,7 +130,7 @@ final class AttributeUtils { * * @throws TskCoreException */ - static Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws TskCoreException { + static Integer getInteger(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException { if (artifact == null) { return null; } @@ -122,8 +139,34 @@ final class AttributeUtils { return null; } - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(attributeType)); + 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 getArtifactsForType(SleuthkitCase skCase, BlackboardArtifact.ARTIFACT_TYPE type) throws GeoLocationDataException { + List 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; + } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java index 280da3a563..511ad23b6d 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java @@ -23,7 +23,6 @@ import java.util.List; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; /** * Representation of a Waypoint created from a BlackboardArtifact. @@ -55,9 +54,9 @@ class ArtifactWaypoint implements Waypoint { * @param artifact BlackboardArtifact for this waypoint * @param type Waypoint type * - * @throws TskCoreException + * @throws GeoLocationDataException */ - protected ArtifactWaypoint(BlackboardArtifact artifact, Waypoint.Type type) throws TskCoreException { + protected ArtifactWaypoint(BlackboardArtifact artifact, Waypoint.Type type) throws GeoLocationDataException { this(artifact, getLabelFromArtifact(artifact), type); @@ -72,9 +71,9 @@ class ArtifactWaypoint implements Waypoint { * @param label String label for this waypoint * @param type Waypoint type * - * @throws TskCoreException + * @throws GeoLocationDataException */ - protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Waypoint.Type type) throws TskCoreException { + protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Waypoint.Type type) throws GeoLocationDataException { this(artifact, label, getTimestampFromArtifact(artifact), @@ -95,15 +94,15 @@ class ArtifactWaypoint implements Waypoint { * @param image AbstractFile image for waypoint, this maybe null * @param type Waypoint.Type value for waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, AbstractFile image, Waypoint.Type type) throws TskCoreException { + protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, AbstractFile image, Waypoint.Type type) throws GeoLocationDataException { this(artifact, label, timestamp, - AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE), - AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE), - AttributeUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE), + 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, type); } @@ -120,9 +119,9 @@ class ArtifactWaypoint implements Waypoint { * @param image AbstractFile image for waypoint, this maybe null * @param type Waypoint.Type value for waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Waypoint.Type type) throws TskCoreException { + private ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Waypoint.Type type) throws GeoLocationDataException { this.artifact = artifact; this.label = label; this.type = type; @@ -191,14 +190,14 @@ class ArtifactWaypoint implements Waypoint { * * @return Long timestamp or null if a value was not found. * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private static Long getTimestampFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + private static Long getTimestampFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { if (artifact == null) { return null; } - return AttributeUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); + return ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); } /** @@ -212,11 +211,11 @@ class ArtifactWaypoint implements Waypoint { * @return Returns a label for the waypoint based on artifact type, or empty * string if no label was found. * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private static String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { - String typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + String typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); if (typeLabel == null) { typeLabel = ""; } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java index 37a1a2c7e2..c4846595dc 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java @@ -33,9 +33,9 @@ final class EXIFWaypoint extends ArtifactWaypoint { * * @param artifact BlackboardArtifact for waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - protected EXIFWaypoint(BlackboardArtifact artifact) throws TskCoreException { + protected EXIFWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { this(artifact, getImageFromArtifact(artifact)); } @@ -45,12 +45,12 @@ final class EXIFWaypoint extends ArtifactWaypoint { * @param artifact Waypoint BlackboardArtifact * @param image EXIF AbstractFile image * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private EXIFWaypoint(BlackboardArtifact artifact, AbstractFile image) throws TskCoreException { + private EXIFWaypoint(BlackboardArtifact artifact, AbstractFile image) throws GeoLocationDataException { super(artifact, image != null ? image.getName() : "", - AttributeUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED), + ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED), image, Waypoint.Type.METADATA_EXIF); } @@ -63,16 +63,21 @@ final class EXIFWaypoint extends ArtifactWaypoint { * @return AbstractFile image for this waypoint or null if one is not * available * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private static AbstractFile getImageFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + private static AbstractFile getImageFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { + AbstractFile abstractFile = null; BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); - if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { - return artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); + + try{ + abstractFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); + } catch(TskCoreException ex) { + throw new GeoLocationDataException(String.format("Unable to getAbstractFileByID for artifact: %d", artifact.getArtifactID(), artifact.getArtifactID()), ex); + } } - return null; + return abstractFile; } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java index 28bd7127a0..f076aa0d22 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; /** * A GPSSearchWaypoint is a subclass of ArtifactWaypoint. @@ -34,8 +33,10 @@ final class GPSSearchWaypoint extends ArtifactWaypoint { /** * Construct a GPS Search waypoint. + * + * @throws GeoLocationDataException */ - public GPSSearchWaypoint(BlackboardArtifact artifact) throws TskCoreException { + GPSSearchWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.SEARCH); } @@ -46,13 +47,13 @@ final class GPSSearchWaypoint extends ArtifactWaypoint { * * @return String label for the artifacts way point. * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private static String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { - String typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { + String typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); + typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); } if (typeLabel == null || typeLabel.isEmpty()) { diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoLocationDataException.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoLocationDataException.java new file mode 100755 index 0000000000..24e8d142bc --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoLocationDataException.java @@ -0,0 +1,41 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.geolocation.datamodel; + +/** + * + * + */ +public class GeoLocationDataException extends Exception { + + 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 + * + * @param msg the message + */ + public GeoLocationDataException(String msg) { + super(msg); + } + + /** + * Create exception containing the error message and cause exception + * + * @param msg the message + * @param ex cause exception + */ + public GeoLocationDataException(String msg, Exception ex) { + super(msg, ex); + } +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java index 19e42c5707..51a7f73107 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java @@ -22,7 +22,6 @@ import java.util.ArrayList; import java.util.List; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; /** * GeolocationUtilis class for common to be share across in the package @@ -66,14 +65,14 @@ final class GeolocationUtils { * * @return A List of Waypoint.Property objects * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static List getOtherGeolocationProperties(BlackboardArtifact artifact) throws TskCoreException { + static List getOtherGeolocationProperties(BlackboardArtifact artifact) throws GeoLocationDataException { List list = new ArrayList<>(); for (BlackboardAttribute.ATTRIBUTE_TYPE type : OTHER_GEO_ATTRIBUTES) { String key = type.getDisplayName(); - String value = AttributeUtils.getString(artifact, type); + String value = ArtifactUtils.getString(artifact, type); if (value == null) { value = ""; diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java index 6ef47f76a2..3d95000677 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java @@ -30,7 +30,7 @@ import org.sleuthkit.datamodel.TskCoreException; "LastKnownWaypoint_Label=Last Known Location",}) final class LastKnownWaypoint extends ArtifactWaypoint { - protected LastKnownWaypoint(BlackboardArtifact artifact) throws TskCoreException { + protected LastKnownWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.LAST_KNOWN_LOCATION); } @@ -41,10 +41,10 @@ final class LastKnownWaypoint extends ArtifactWaypoint { * * @return String value from attribute TSK_NAME or LastKnownWaypoint_Label * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private static String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { - String label = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { + String label = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); if (label == null || label.isEmpty()) { label = Bundle.LastKnownWaypoint_Label(); diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index 4eefc72bca..bf93fe8803 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -26,7 +26,6 @@ import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; 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 @@ -39,7 +38,7 @@ import org.sleuthkit.datamodel.TskCoreException; "Route_Start_Label=Start", "Route_End_Label=End" }) -public class Route { +public final class Route { private final List points; private final Long timestamp; @@ -57,11 +56,12 @@ public class Route { * @return List of Route objects, empty list will be returned if no Routes * where found * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static public List getGPSRoutes(SleuthkitCase skCase) throws TskCoreException { + static public List getGPSRoutes(SleuthkitCase skCase) throws GeoLocationDataException { + List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); + List routes = new ArrayList<>(); - List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); for (BlackboardArtifact artifact : artifacts) { Route route = new Route(artifact); routes.add(route); @@ -74,7 +74,7 @@ public class Route { * * @param artifact TSK_GPS_ROUTE artifact object */ - protected Route(BlackboardArtifact artifact) throws TskCoreException { + Route(BlackboardArtifact artifact) throws GeoLocationDataException { points = new ArrayList<>(); Waypoint point = getRouteStartPoint(artifact); @@ -96,10 +96,10 @@ public class Route { /** * Get the list of way points for this route; * - * @return List of ArtifactWaypoints for this route + * @return List an unmodifiableList of ArtifactWaypoints for this route */ public List getRoute() { - return points; + return Collections.unmodifiableList(points); } /** @@ -149,19 +149,15 @@ public class Route { * @return Start RoutePoint or null if valid longitude and latitude are not * found * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private Waypoint getRouteStartPoint(BlackboardArtifact artifact) throws TskCoreException { + private Waypoint getRouteStartPoint(BlackboardArtifact artifact) throws GeoLocationDataException { Double latitude; Double longitude; - BlackboardAttribute attribute; RoutePoint point = null; - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START)); - latitude = attribute != null ? attribute.getValueDouble() : null; - - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START)); - longitude = attribute != null ? attribute.getValueDouble() : 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) { point = new RoutePoint(this, latitude, longitude, Bundle.Route_Start_Label()); @@ -179,19 +175,15 @@ public class Route { * @return End RoutePoint or null if valid longitude and latitude are not * found * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private Waypoint getRouteEndPoint(BlackboardArtifact artifact) throws TskCoreException { + private Waypoint getRouteEndPoint(BlackboardArtifact artifact) throws GeoLocationDataException { Double latitude; Double longitude; - BlackboardAttribute attribute; RoutePoint point = null; - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END)); - latitude = attribute != null ? attribute.getValueDouble() : null; - - attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END)); - longitude = attribute != null ? attribute.getValueDouble() : 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) { point = new RoutePoint(this, latitude, longitude, Bundle.Route_End_Label()); @@ -208,11 +200,10 @@ public class Route { * * @return The Altitude, or null if none was found * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private Double getRouteAltitude(BlackboardArtifact artifact) throws TskCoreException { - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE)); - return attribute != null ? attribute.getValueDouble() : null; + private Double getRouteAltitude(BlackboardArtifact artifact) throws GeoLocationDataException { + return ArtifactUtils.getDouble(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); } /** @@ -223,11 +214,10 @@ public class Route { * * @return The timestamp attribute, or null if none was found * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private Long getRouteTimestamp(BlackboardArtifact artifact) throws TskCoreException { - BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME)); - return attribute != null ? attribute.getValueLong() : null; + private Long getRouteTimestamp(BlackboardArtifact artifact) throws GeoLocationDataException { + return ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java index b4b1205c77..377477bef6 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; /** * A wrapper class for TSK_GPS_TRACKPOINT artifacts. @@ -34,8 +33,10 @@ final class TrackpointWaypoint extends ArtifactWaypoint { /** * Construct a waypoint for trackpoints. + * + * @throws GeoLocationDataException */ - TrackpointWaypoint(BlackboardArtifact artifact) throws TskCoreException { + TrackpointWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.TRACKPOINT); } @@ -47,18 +48,18 @@ final class TrackpointWaypoint extends ArtifactWaypoint { * * @return String label for the artifacts way point. * - * @throws TskCoreException + * @throws GeoLocationDataException */ - private static String getLabelFromArtifact(BlackboardArtifact artifact) throws TskCoreException { + private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { - String typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + String typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); } if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = AttributeUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); } if (typeLabel == null || typeLabel.isEmpty()) { diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java index 2bf606b18b..3dc3f3304d 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java @@ -24,7 +24,6 @@ import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.SleuthkitCase; -import org.sleuthkit.datamodel.TskCoreException; /** * The basic details of a waypoint. @@ -43,9 +42,12 @@ public interface Waypoint { }) /** - * Get the timestamp for this BlackboardArtifact. + * Interface to describe a waypoint. A waypoint is made up of + * a longitude, latitude, label, timestamp, type, image and altitude. + * + * A good way point should have at minimum a longitude and latutude. * - * @return Timestamp in epoch seconds or null if none was set. + * @return Timestamp in java/unix epoch seconds or null if none was set. */ Long getTimestamp(); @@ -71,16 +73,16 @@ public interface Waypoint { Double getLongitude(); /** - * Get the Altitude for this point. + * Get the altitude for this point. * - * @return Returns the Altitude for the point or null if none was set + * @return Returns the altitude for the point or null if none was set */ Double getAltitude(); /** * Gets an unmodifiable List of other properties that may be interesting to this way point. - * The List will not include properties for which there are getter functions - * for. + * The List will not include properties for which getter functions + * exist. * * @return A List of waypoint properties */ @@ -89,7 +91,7 @@ public interface Waypoint { /** * Get the image for this waypoint. * - * @return AbstractFile image + * @return AbstractFile image or null if one was not set */ AbstractFile getImage(); @@ -111,9 +113,9 @@ public interface Waypoint { * * @return List of Waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static List getAllWaypoints(SleuthkitCase skCase) throws TskCoreException { + static List getAllWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { List points = new ArrayList<>(); points.addAll(getTrackpointWaypoints(skCase)); @@ -132,11 +134,12 @@ public interface Waypoint { * * @return List of Waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static List getTrackpointWaypoints(SleuthkitCase skCase) throws TskCoreException { + static List getTrackpointWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { + List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT); + List points = new ArrayList<>(); - List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT); for (BlackboardArtifact artifact : artifacts) { ArtifactWaypoint point = new TrackpointWaypoint(artifact); // Only add to the list if the point has a valid latitude @@ -155,11 +158,12 @@ public interface Waypoint { * * @return List of Waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static List getEXIFWaypoints(SleuthkitCase skCase) throws TskCoreException { + static List getEXIFWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { + List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); + List points = new ArrayList<>(); - List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); if (artifacts != null) { for (BlackboardArtifact artifact : artifacts) { ArtifactWaypoint point = new EXIFWaypoint(artifact); @@ -180,11 +184,12 @@ public interface Waypoint { * * @return List of Waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static List getSearchWaypoints(SleuthkitCase skCase) throws TskCoreException { + static List getSearchWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { + List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH); + List points = new ArrayList<>(); - List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH); if (artifacts != null) { for (BlackboardArtifact artifact : artifacts) { ArtifactWaypoint point = new GPSSearchWaypoint(artifact); @@ -205,12 +210,14 @@ public interface Waypoint { * * @return List of Waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static List getLastKnownWaypoints(SleuthkitCase skCase) throws TskCoreException { + static List getLastKnownWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { + List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION); + List points = new ArrayList<>(); - List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION); if (artifacts != null) { + for (BlackboardArtifact artifact : artifacts) { ArtifactWaypoint point = new LastKnownWaypoint(artifact); // Only add to the list if the point has a valid latitude @@ -230,11 +237,12 @@ public interface Waypoint { * * @return List of Waypoint * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static List getBookmarkWaypoints(SleuthkitCase skCase) throws TskCoreException { + static List getBookmarkWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { + List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK); + List points = new ArrayList<>(); - List artifacts = skCase.getBlackboardArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK); if (artifacts != null) { for (BlackboardArtifact artifact : artifacts) { ArtifactWaypoint point = new ArtifactWaypoint(artifact, Waypoint.Type.BOOKMARK); diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index ff5d1c35ba..ebcc9853f0 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -45,6 +45,7 @@ import org.jdom2.output.XMLOutputter; import org.jdom2.CDATA; import org.openide.filesystems.FileUtil; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; +import org.sleuthkit.autopsy.geolocation.datamodel.GeoLocationDataException; import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; import org.sleuthkit.autopsy.geolocation.datamodel.Route; import org.sleuthkit.autopsy.report.ReportBranding; @@ -154,7 +155,7 @@ class KMLReport implements GeneralReportModule { try { makeRoutes(skCase); addLocationsToReport(skCase, baseReportDir); - } catch (TskCoreException | IOException ex) { + } catch (GeoLocationDataException | IOException ex) { errorMessage = "Failed to complete report."; logger.log(Level.SEVERE, errorMessage, ex); //NON-NLS result = ReportProgressPanel.ReportStatus.ERROR; @@ -316,7 +317,7 @@ class KMLReport implements GeneralReportModule { * @throws TskCoreException * @throws IOException */ - void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws TskCoreException, IOException { + void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws GeoLocationDataException, IOException { List points = Waypoint.getAllWaypoints(skCase); for (Waypoint point : points) { @@ -357,7 +358,7 @@ class KMLReport implements GeneralReportModule { * * @throws TskCoreException */ - void makeRoutes(SleuthkitCase skCase) throws TskCoreException { + void makeRoutes(SleuthkitCase skCase) throws GeoLocationDataException { List routes = Route.getGPSRoutes(skCase); if(routes == null) { From 585d1897f07e9264a2324e59f4280d67126c143d Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 28 Oct 2019 11:09:59 -0400 Subject: [PATCH 68/91] Removed Type from Waypoint class --- .../datamodel/ArtifactWaypoint.java | 26 +-- .../datamodel/Bundle.properties-MERGED | 6 - .../geolocation/datamodel/EXIFWaypoint.java | 3 +- .../datamodel/GPSSearchWaypoint.java | 2 +- .../datamodel/LastKnownWaypoint.java | 3 +- .../geolocation/datamodel/RoutePoint.java | 5 - .../datamodel/TrackpointWaypoint.java | 2 +- .../geolocation/datamodel/Waypoint.java | 53 +----- .../modules/kml/Bundle.properties-MERGED | 7 + .../autopsy/report/modules/kml/KMLReport.java | 164 +++++++++++------- 10 files changed, 118 insertions(+), 153 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java index 511ad23b6d..f30b2637b2 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java @@ -37,7 +37,6 @@ class ArtifactWaypoint implements Waypoint { final private String label; final private AbstractFile image; final private BlackboardArtifact artifact; - final private Waypoint.Type type; // This list is not expected to change after construction so the // constructor will take care of creating an unmodifiable List @@ -56,10 +55,9 @@ class ArtifactWaypoint implements Waypoint { * * @throws GeoLocationDataException */ - protected ArtifactWaypoint(BlackboardArtifact artifact, Waypoint.Type type) throws GeoLocationDataException { + protected ArtifactWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { this(artifact, - getLabelFromArtifact(artifact), - type); + getLabelFromArtifact(artifact)); } /** @@ -73,12 +71,11 @@ class ArtifactWaypoint implements Waypoint { * * @throws GeoLocationDataException */ - protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Waypoint.Type type) throws GeoLocationDataException { + protected ArtifactWaypoint(BlackboardArtifact artifact, String label) throws GeoLocationDataException { this(artifact, label, getTimestampFromArtifact(artifact), - null, - type); + null); } /** @@ -96,15 +93,14 @@ class ArtifactWaypoint implements Waypoint { * * @throws GeoLocationDataException */ - protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, AbstractFile image, Waypoint.Type type) 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, - type); + image); } /** @@ -121,10 +117,9 @@ class ArtifactWaypoint implements Waypoint { * * @throws GeoLocationDataException */ - private ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Waypoint.Type type) throws GeoLocationDataException { + private ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image) throws GeoLocationDataException { this.artifact = artifact; this.label = label; - this.type = type; this.image = image; this.timestamp = timestamp; this.longitude = longitude; @@ -172,12 +167,7 @@ class ArtifactWaypoint implements Waypoint { public AbstractFile getImage() { return image; } - - @Override - public Waypoint.Type getType() { - return type; - } - + @Override public List getOtherProperties() { return immutablePropertiesList; diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED index 60345f2e57..86acb2fdb1 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Bundle.properties-MERGED @@ -4,9 +4,3 @@ Route_Label=As-the-crow-flies Route Route_Start_Label=Start SearchWaypoint_DisplayLabel=GPS Search TrackpointWaypoint_DisplayLabel=GPS Trackpoint -Waypoint_Bookmark_Display_String=GPS Bookmark -Waypoint_EXIF_Display_String=EXIF Metadata With Location -Waypoint_Last_Known_Display_String=GPS Last Known Location -Waypoint_Route_Point_Display_String=GPS Individual Route Point -Waypoint_Search_Display_String=GPS Search -Waypoint_Trackpoint_Display_String=GPS Trackpoint diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java index c4846595dc..2ffdc92d23 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java @@ -51,8 +51,7 @@ final class EXIFWaypoint extends ArtifactWaypoint { super(artifact, image != null ? image.getName() : "", ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED), - image, - Waypoint.Type.METADATA_EXIF); + image); } /** diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java index f076aa0d22..1c5efec3f4 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java @@ -37,7 +37,7 @@ final class GPSSearchWaypoint extends ArtifactWaypoint { * @throws GeoLocationDataException */ GPSSearchWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.SEARCH); + super(artifact, getLabelFromArtifact(artifact)); } /** diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java index 3d95000677..32aec6f041 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; /** * A Last Know Location Waypoint object. @@ -31,7 +30,7 @@ import org.sleuthkit.datamodel.TskCoreException; final class LastKnownWaypoint extends ArtifactWaypoint { protected LastKnownWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.LAST_KNOWN_LOCATION); + super(artifact, getLabelFromArtifact(artifact)); } /** diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java index 25eac21422..f3d8f5afcc 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java @@ -82,9 +82,4 @@ final class RoutePoint implements Waypoint { public AbstractFile getImage() { return null; } - - @Override - public Waypoint.Type getType() { - return Waypoint.Type.ROUTE_POINT; - } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java index 377477bef6..3ef3279239 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java @@ -37,7 +37,7 @@ final class TrackpointWaypoint extends ArtifactWaypoint { * @throws GeoLocationDataException */ TrackpointWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - super(artifact, getLabelFromArtifact(artifact), Waypoint.Type.TRACKPOINT); + super(artifact, getLabelFromArtifact(artifact)); } /** diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java index 3dc3f3304d..aaf5a1afe5 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java @@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.ArrayList; import java.util.List; -import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.SleuthkitCase; @@ -30,17 +29,6 @@ import org.sleuthkit.datamodel.SleuthkitCase; * */ public interface Waypoint { - - // Display names are from the original KML Report - @Messages({ - "Waypoint_Bookmark_Display_String=GPS Bookmark", - "Waypoint_Last_Known_Display_String=GPS Last Known Location", - "Waypoint_EXIF_Display_String=EXIF Metadata With Location", - "Waypoint_Route_Point_Display_String=GPS Individual Route Point", - "Waypoint_Search_Display_String=GPS Search", - "Waypoint_Trackpoint_Display_String=GPS Trackpoint" - }) - /** * Interface to describe a waypoint. A waypoint is made up of * a longitude, latitude, label, timestamp, type, image and altitude. @@ -95,13 +83,6 @@ public interface Waypoint { */ AbstractFile getImage(); - /** - * Get the type of waypoint - * - * @return WaypointType value - */ - Type getType(); - /** * Returns a list of Waypoints for the artifacts with geolocation * information. @@ -245,7 +226,7 @@ public interface Waypoint { List points = new ArrayList<>(); if (artifacts != null) { for (BlackboardArtifact artifact : artifacts) { - ArtifactWaypoint point = new ArtifactWaypoint(artifact, Waypoint.Type.BOOKMARK); + ArtifactWaypoint point = new ArtifactWaypoint(artifact); // Only add to the list if the point has a valid latitude // and longitude. if (point.getLatitude() != null && point.getLongitude() != null) { @@ -256,38 +237,6 @@ public interface Waypoint { return points; } - /** - * An enum to keep track of the type of a way point. - */ - enum Type { - BOOKMARK(Bundle.Waypoint_Bookmark_Display_String()), - LAST_KNOWN_LOCATION(Bundle.Waypoint_Last_Known_Display_String()), - METADATA_EXIF(Bundle.Waypoint_EXIF_Display_String()), - ROUTE_POINT(Bundle.Waypoint_Route_Point_Display_String()), - SEARCH(Bundle.Waypoint_Search_Display_String()), - TRACKPOINT(Bundle.Waypoint_Trackpoint_Display_String()); - - private final String displayName; - - /** - * Constructs a Waypoint.Type enum value - * - * @param displayName String value title for enum - */ - Type(String displayName) { - this.displayName = displayName; - } - - /** - * Returns the display name for the type - * - * @return String display name - */ - public String getDisplayName() { - return displayName; - } - } - /** * Simple property class for waypoint properties that a purely * informational. diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/report/modules/kml/Bundle.properties-MERGED index 0823cd171b..3cbb7f6506 100755 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/Bundle.properties-MERGED @@ -23,3 +23,10 @@ ReportKML.genReport.srcModuleName.text=Geospatial Data ReportKML.genReport.reportName=KML Report ReportKML.latLongStartPoint={0};{1};;{2} (Start)\n ReportKML.latLongEndPoint={0};{1};;{2} (End)\n +Route_Details_Header=GPS Route +Waypoint_Bookmark_Display_String=GPS Bookmark +Waypoint_EXIF_Display_String=EXIF Metadata With Location +Waypoint_Last_Known_Display_String=GPS Last Known Location +Waypoint_Route_Point_Display_String=GPS Individual Route Point +Waypoint_Search_Display_String=GPS Search +Waypoint_Trackpoint_Display_String=GPS Trackpoint diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index ebcc9853f0..b72ad14f73 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -21,11 +21,9 @@ package org.sleuthkit.autopsy.report.modules.kml; import org.sleuthkit.autopsy.report.GeneralReportModule; import javax.swing.JPanel; - import org.openide.util.NbBundle; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.datamodel.*; import org.sleuthkit.autopsy.ingest.IngestManager; import java.io.File; import java.io.FileOutputStream; @@ -44,13 +42,18 @@ import org.jdom2.output.Format; import org.jdom2.output.XMLOutputter; import org.jdom2.CDATA; import org.openide.filesystems.FileUtil; +import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.autopsy.geolocation.datamodel.GeoLocationDataException; import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; import org.sleuthkit.autopsy.geolocation.datamodel.Route; import org.sleuthkit.autopsy.report.ReportBranding; import org.sleuthkit.autopsy.report.ReportProgressPanel; +import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.ReadContentInputStream; import org.sleuthkit.datamodel.ReadContentInputStream.ReadContentInputStreamException; +import org.sleuthkit.datamodel.SleuthkitCase; +import org.sleuthkit.datamodel.TskCoreException; /** * Generates a KML file based on geospatial information from the BlackBoard. @@ -111,7 +114,7 @@ class KMLReport implements GeneralReportModule { * @param baseReportDir path to save the report * @param progressPanel panel to update the report's progress */ - @NbBundle.Messages({ + @Messages({ "KMLReport.unableToExtractPhotos=Could not extract photo information.", "KMLReport.exifPhotoError=Could not extract photos with EXIF metadata.", "KMLReport.bookmarkError=Could not extract Bookmark information.", @@ -127,8 +130,16 @@ class KMLReport implements GeneralReportModule { "KMLReport.kmlFileWriteError=Could not write the KML file.", "# {0} - filePath", "KMLReport.errorGeneratingReport=Error adding {0} to case as a report.", - "KMLReport.unableToOpenCase=Exception while getting open case." + "KMLReport.unableToOpenCase=Exception while getting open case.", + "Waypoint_Bookmark_Display_String=GPS Bookmark", + "Waypoint_Last_Known_Display_String=GPS Last Known Location", + "Waypoint_EXIF_Display_String=EXIF Metadata With Location", + "Waypoint_Route_Point_Display_String=GPS Individual Route Point", + "Waypoint_Search_Display_String=GPS Search", + "Waypoint_Trackpoint_Display_String=GPS Trackpoint", + "Route_Details_Header=GPS Route" }) + @Override public void generateReport(String baseReportDir, ReportProgressPanel progressPanel) { try { @@ -285,27 +296,29 @@ class KMLReport implements GeneralReportModule { * * @throws IOException */ - void addExifMetadataContent(Waypoint point, String baseReportDirectory) throws IOException { - Element mapPoint = makePoint(point); - if (mapPoint == null) { - return; - } + void addExifMetadataContent(List points, String baseReportDirectory) throws IOException { + for(Waypoint point: points) { + Element mapPoint = makePoint(point); + if (mapPoint == null) { + return; + } - AbstractFile abstractFile = point.getImage(); - String details = getFormattedDetails(point); + AbstractFile abstractFile = point.getImage(); + String details = getFormattedDetails(point, Bundle.Waypoint_EXIF_Display_String()); - Path path; - copyFileUsingStream(abstractFile, Paths.get(baseReportDirectory, abstractFile.getName()).toFile()); - try { - path = Paths.get(removeLeadingImgAndVol(abstractFile.getUniquePath())); - } catch (TskCoreException ex) { - path = Paths.get(abstractFile.getParentPath(), abstractFile.getName()); - } - if (path == null) { - path = Paths.get(abstractFile.getName()); - } + Path path; + copyFileUsingStream(abstractFile, Paths.get(baseReportDirectory, abstractFile.getName()).toFile()); + try { + path = Paths.get(removeLeadingImgAndVol(abstractFile.getUniquePath())); + } catch (TskCoreException ex) { + path = Paths.get(abstractFile.getParentPath(), abstractFile.getName()); + } + if (path == null) { + path = Paths.get(abstractFile.getName()); + } - gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, formattedCoordinates(point.getLatitude(), point.getLongitude()))); + gpsExifMetadataFolder.addContent(makePlacemarkWithPicture(abstractFile.getName(), FeatureColor.RED, details, point.getTimestamp(), mapPoint, path, formattedCoordinates(point.getLatitude(), point.getLongitude()))); + } } /** @@ -318,36 +331,43 @@ class KMLReport implements GeneralReportModule { * @throws IOException */ void addLocationsToReport(SleuthkitCase skCase, String baseReportDir) throws GeoLocationDataException, IOException { - List points = Waypoint.getAllWaypoints(skCase); - - for (Waypoint point : points) { - Element reportPoint = makePoint(point); - if (reportPoint == null) { - continue; - } - - String formattedCords = formattedCoordinates(point.getLatitude(), point.getLongitude()); - - switch (point.getType()) { - case METADATA_EXIF: - addExifMetadataContent(point, baseReportDir); - break; - case BOOKMARK: - gpsBookmarksFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.BLUE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); - break; - case LAST_KNOWN_LOCATION: - gpsLastKnownLocationFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.PURPLE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); - break; - case SEARCH: - gpsSearchesFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); - break; - case TRACKPOINT: - gpsTrackpointsFolder.addContent(makePlacemark(point.getLabel(), FeatureColor.WHITE, getFormattedDetails(point), point.getTimestamp(), reportPoint, formattedCords)); - break; - default: - // default is here to make codacy happy. - break; - } + addExifMetadataContent(Waypoint.getEXIFWaypoints(skCase), baseReportDir); + addWaypoints(Waypoint.getBookmarkWaypoints(skCase), gpsBookmarksFolder, FeatureColor.BLUE, Bundle.Waypoint_Bookmark_Display_String()); + addWaypoints(Waypoint.getLastKnownWaypoints(skCase), gpsLastKnownLocationFolder, FeatureColor.PURPLE, Bundle.Waypoint_Last_Known_Display_String()); + addWaypoints(Waypoint.getSearchWaypoints(skCase), gpsSearchesFolder, FeatureColor.WHITE, Bundle.Waypoint_Search_Display_String()); + addWaypoints(Waypoint.getTrackpointWaypoints(skCase), gpsTrackpointsFolder, FeatureColor.WHITE, Bundle.Waypoint_Trackpoint_Display_String()); + } + + /** + * For each point in the waypoint list an Element to represent the given waypoint + * is created and added it to the given Element folder. + * + * @param points List of waypoints to add to the report + * @param folder The Element folder to add the points to + * @param waypointColor The color the waypoint should appear in the report + */ + void addWaypoints(List points, Element folder, FeatureColor waypointColor, String headerLabel) { + for(Waypoint point: points) { + addContent(folder, point.getLabel(), waypointColor, String.format("

    %s

    ", headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude()); + } + } + + /** + * Adds the waypoint Element with details to the report in the given folder. + * + * @param folder Element folder to add the waypoint to + * @param waypointLabel String waypoint Label + * @param waypointColor FeatureColor for the waypoint + * @param formattedDetails String HTML formatted waypoint details + * @param timestamp Long timestamp (unix\jave epoch seconds) + * @param point Element point object + * @param latitude Double latitude value + * @param longitude Double longitude value + */ + void addContent(Element folder, String waypointLabel, FeatureColor waypointColor, String formattedDetails, Long timestamp, Element point, Double latitude, Double longitude) { + if(folder != null && point != null) { + String formattedCords = formattedCoordinates(latitude, longitude); + folder.addContent(makePlacemark(waypointLabel, waypointColor, formattedDetails, timestamp, point, formattedCords)); } } @@ -402,11 +422,16 @@ class KMLReport implements GeneralReportModule { } if (startingPoint != null) { - gpsRouteFolder.addContent(makePlacemark(start.getLabel(), FeatureColor.GREEN, getFormattedDetails(start), start.getTimestamp(), startingPoint, formattedStart)); //NON-NLS + gpsRouteFolder.addContent(makePlacemark(start.getLabel(), + FeatureColor.GREEN, getFormattedDetails(start, Bundle.Waypoint_Route_Point_Display_String()), + start.getTimestamp(), startingPoint, formattedStart)); //NON-NLS } if (endingPoint != null) { - gpsRouteFolder.addContent(makePlacemark(end.getLabel(), FeatureColor.GREEN, getFormattedDetails(end), end.getTimestamp(), endingPoint, formattedEnd)); //NON-NLS + gpsRouteFolder.addContent(makePlacemark(end.getLabel(), + FeatureColor.GREEN, + getFormattedDetails(end, Bundle.Waypoint_Route_Point_Display_String()), + end.getTimestamp(), endingPoint, formattedEnd)); //NON-NLS } } @@ -660,9 +685,17 @@ class KMLReport implements GeneralReportModule { return strbuf.toString(); } - private String getFormattedDetails(Waypoint point) { + /** + * Get the nicely formatted details for the given waypoint. + * + * @param point Waypoint object + * @param header String details header + * + * @return HTML formatted String of details for given waypoint + */ + private String getFormattedDetails(Waypoint point, String header) { StringBuilder result = new StringBuilder(); //NON-NLS - result.append(getDetailsHeader(point)) + result.append(String.format("

    %s

    ", header)) .append(formatAttribute("Name", point.getLabel())); Long timestamp = point.getTimestamp(); @@ -692,15 +725,6 @@ class KMLReport implements GeneralReportModule { return String.format(HTML_PROP_FORMAT, title, value); } - /* - * This current retains the headers from the original report. There is - * probably a better way to do this using the display value of the - * blackboard artifact. - */ - private String getDetailsHeader(Waypoint point) { - return String.format("

    %s

    ", point.getType().getDisplayName()); - } - /** * Returns an HTML formatted string of all the * @@ -712,7 +736,7 @@ class KMLReport implements GeneralReportModule { List points = route.getRoute(); StringBuilder result = new StringBuilder(); //NON-NLS - result.append(String.format("

    %s

    ", "GPS Route")) + result.append(String.format("

    %s

    ", Bundle.Route_Details_Header())) .append(formatAttribute("Name", route.getLabel())); Long timestamp = route.getTimestamp(); @@ -745,6 +769,14 @@ class KMLReport implements GeneralReportModule { return result.toString(); } + /** + * Helper functions for consistently formatting longitude and latitude. + * + * @param latitude Double latitude value + * @param longitude Double longitude value + * + * @return String Nicely formatted double values separated by a comma + */ private String formattedCoordinates(Double latitude, Double longitude) { if (latitude == null || longitude == null) { return ""; From 9f658a2ebd82f0f21bc679b742929dc31325a168 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 28 Oct 2019 11:17:36 -0400 Subject: [PATCH 69/91] Small fixed to KMLReport --- .../src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index b72ad14f73..7f205da890 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -348,7 +348,7 @@ class KMLReport implements GeneralReportModule { */ void addWaypoints(List points, Element folder, FeatureColor waypointColor, String headerLabel) { for(Waypoint point: points) { - addContent(folder, point.getLabel(), waypointColor, String.format("

    %s

    ", headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude()); + addContent(folder, point.getLabel(), waypointColor, getFormattedDetails(point, headerLabel), point.getTimestamp(), makePoint(point), point.getLatitude(), point.getLongitude()); } } From a17bbacf9701a0c4769eb83884d1c8d8ab253972 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Mon, 28 Oct 2019 11:57:28 -0400 Subject: [PATCH 70/91] Change getGPSRoutes to getRoutes --- Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java | 2 +- .../src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index bf93fe8803..9d91cf8d9c 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -58,7 +58,7 @@ public final class Route { * * @throws GeoLocationDataException */ - static public List getGPSRoutes(SleuthkitCase skCase) throws GeoLocationDataException { + static public List getRoutes(SleuthkitCase skCase) throws GeoLocationDataException { List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); List routes = new ArrayList<>(); diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java index 7f205da890..002215bf04 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/kml/KMLReport.java @@ -379,7 +379,7 @@ class KMLReport implements GeneralReportModule { * @throws TskCoreException */ void makeRoutes(SleuthkitCase skCase) throws GeoLocationDataException { - List routes = Route.getGPSRoutes(skCase); + List routes = Route.getRoutes(skCase); if(routes == null) { return; From 74130ea1079e9e06da6828a0dacda0d8b2356252 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 29 Oct 2019 08:14:37 -0400 Subject: [PATCH 71/91] Getting attributes as a list instead of individually --- .../geolocation/datamodel/ArtifactUtils.java | 151 +++--------------- .../datamodel/ArtifactWaypoint.java | 144 ++++++----------- .../geolocation/datamodel/EXIFWaypoint.java | 26 +-- .../datamodel/GPSSearchWaypoint.java | 66 -------- .../datamodel/GeoLocationDataException.java | 28 ++-- .../datamodel/GeolocationUtils.java | 56 ++++--- .../datamodel/LastKnownWaypoint.java | 36 ++++- .../autopsy/geolocation/datamodel/Route.java | 104 +++++------- .../geolocation/datamodel/SearchWaypoint.java | 77 +++++++++ .../datamodel/TrackpointWaypoint.java | 34 ++-- .../geolocation/datamodel/Waypoint.java | 94 +++++++---- 11 files changed, 364 insertions(+), 452 deletions(-) delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java create mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java index e99350072e..b5cf4ab75c 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java @@ -18,155 +18,48 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; /** - * Utilities for simplifying and reducing redundant when getting Artifact - * attributes. + * Utilities for simplifying the use of Waypoint Artifacts. */ final class ArtifactUtils { - + /** * Private constructor for this Utility class. */ private ArtifactUtils() { - + } /** - * Helper function for getting a String attribute from an artifact. This - * will work for all attributes + * Gets the list of attributes from the artifact and puts them into a map + * with the ATRIBUTE_TYPE as the key. * - * @param artifact The BlackboardArtifact to get the attributeType - * @param attributeType BlackboardAttribute attributeType + * @param artifact BlackboardArtifact current artifact * - * @return String value for the given attribute or null if attribute was not - * set for the given artifact + * @return A Map of BlackboardAttributes for the given artifact with + * ATTRIBUTE_TYPE as the key. * - * @throws TskCoreException + * @throws GeoLocationDataException */ - static String getString(BlackboardArtifact artifact, BlackboardAttribute.ATTRIBUTE_TYPE attributeType) throws GeoLocationDataException { - if (artifact == null) { - return null; + static Map getAttributesFromArtifactAsMap(BlackboardArtifact artifact) throws GeoLocationDataException { + Map attributeMap = new HashMap<>(); + try { + List 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; - 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); + return attributeMap; } - - /** - * 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 getArtifactsForType(SleuthkitCase skCase, BlackboardArtifact.ARTIFACT_TYPE type) throws GeoLocationDataException { - List 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; - } - } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java index f30b2637b2..1ce27b28fc 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java @@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.Collections; import java.util.List; +import java.util.Map; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; @@ -43,81 +44,39 @@ class ArtifactWaypoint implements Waypoint { final private List immutablePropertiesList; /** - * Construct a simple waypoint with the given artifact and assign the given - * 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 + * Construct a waypoint with the given artifact. * * @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 { this(artifact, - getLabelFromArtifact(artifact)); + ArtifactUtils.getAttributesFromArtifactAsMap(artifact)); } /** - * For use by subclasses that want to customize the label, but use the basic - * attributes of: TSK_GEO_LONGITUDE TSK_GEO_LATITUDE TSK_GEO_ALITUDE - * TSK_DATETIME + * Constructor that sets all of the member variables. * - * @param artifact BlackboardArtifact for this waypoint - * @param label String label for this waypoint - * @param type Waypoint type + * @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 + * @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 { - this(artifact, - label, - getTimestampFromArtifact(artifact), - null); - } + protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Map attributeMap) throws GeoLocationDataException { + if (longitude == null || latitude == null) { + throw new GeoLocationDataException("Invalid waypoint, null value passed for longitude or latitude"); + } - /** - * 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.label = label; this.image = image; @@ -126,7 +85,26 @@ class ArtifactWaypoint implements Waypoint { this.latitude = latitude; 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 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() { return image; } - + @Override public List getOtherProperties() { return immutablePropertiesList; } /** - * Get the timestamp attribute based on type for the given artifact. + * Gets the label for this waypoint. * * @param artifact BlackboardArtifact for waypoint * - * @return Long timestamp or null if a value was not found. - * - * @throws GeoLocationDataException + * @return Returns a label for the waypoint, or empty string if no label was + * found. */ - private static Long getTimestampFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { - if (artifact == null) { - return null; + private static String getLabelFromArtifact(Map attributeMap) { + BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + if (attribute != null) { + return attribute.getDisplayString(); } - return ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); - } - - /** - * 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; + return ""; } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java index 2ffdc92d23..399ae17ea1 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; +import java.util.Map; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; @@ -36,22 +37,26 @@ final class EXIFWaypoint extends ArtifactWaypoint { * @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 image EXIF AbstractFile image + * @param artifact Waypoint BlackboardArtifact + * @param attributeMap Map of artifact attributes + * @param image EXIF AbstractFile image * * @throws GeoLocationDataException */ - private EXIFWaypoint(BlackboardArtifact artifact, AbstractFile image) throws GeoLocationDataException { + private EXIFWaypoint(BlackboardArtifact artifact, Map attributeMap, AbstractFile image) throws GeoLocationDataException { super(artifact, image != null ? image.getName() : "", - ArtifactUtils.getLong(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED), - image); + attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED) != null ? attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_CREATED).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, + image, attributeMap); } /** @@ -68,15 +73,14 @@ final class EXIFWaypoint extends ArtifactWaypoint { AbstractFile abstractFile = null; BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { - - try{ + + try { 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); } } return abstractFile; } - } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java deleted file mode 100755 index 1c5efec3f4..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GPSSearchWaypoint.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import org.openide.util.NbBundle.Messages; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; - -/** - * A GPSSearchWaypoint is a subclass of ArtifactWaypoint. - */ -final class GPSSearchWaypoint extends ArtifactWaypoint { - - @Messages({ - "SearchWaypoint_DisplayLabel=GPS Search" - }) - - /** - * Construct a GPS Search waypoint. - * - * @throws GeoLocationDataException - */ - GPSSearchWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - super(artifact, getLabelFromArtifact(artifact)); - } - - /** - * Returns a Label for a GPS_SEARCH artifact. - * - * @param artifact BlackboardArtifact for waypoint - * - * @return String label for the artifacts way point. - * - * @throws GeoLocationDataException - */ - private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { - String typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); - } - - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = Bundle.SearchWaypoint_DisplayLabel(); - } - - return typeLabel; - } - -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoLocationDataException.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoLocationDataException.java index 24e8d142bc..44aad62b58 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoLocationDataException.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeoLocationDataException.java @@ -1,25 +1,31 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; /** - * + * An exception class for the Geolocation dateModel; * */ public class GeoLocationDataException extends Exception { 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 * diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java index 51a7f73107..644c65dacc 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java @@ -20,36 +20,31 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.ArrayList; import java.util.List; -import org.sleuthkit.datamodel.BlackboardArtifact; +import java.util.Map; +import java.util.Set; 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 { /** - * This is a list of attributes that are related to a geolocation waypoint - * but are for information\artifact properties purpose. They are not needed - * for the placement of a point on a map; + * This is a list of attributes that are already being handled by the + * waypoint classes and will have get functions. */ - private static final BlackboardAttribute.ATTRIBUTE_TYPE[] OTHER_GEO_ATTRIBUTES = { - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END, + private static final BlackboardAttribute.ATTRIBUTE_TYPE[] ALREADY_HANDLED_ATTRIBUTES = { + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, + 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_GEO_VELOCITY, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_BEARING, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_HPRECISION, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_VPRECISION, - 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 - }; + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END,}; /** * 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 * @@ -67,20 +64,21 @@ final class GeolocationUtils { * * @throws GeoLocationDataException */ - static List getOtherGeolocationProperties(BlackboardArtifact artifact) throws GeoLocationDataException { + static List createGeolocationProperties(Map attributeMap) throws GeoLocationDataException { List list = new ArrayList<>(); - for (BlackboardAttribute.ATTRIBUTE_TYPE type : OTHER_GEO_ATTRIBUTES) { - String key = type.getDisplayName(); - String value = ArtifactUtils.getString(artifact, type); + Set keys = attributeMap.keySet(); - if (value == null) { - value = ""; - } + for (BlackboardAttribute.ATTRIBUTE_TYPE type : ALREADY_HANDLED_ATTRIBUTES) { + 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)); } - return list; } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java index 32aec6f041..4f44cb956d 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; +import java.util.Map; import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; @@ -29,21 +30,48 @@ import org.sleuthkit.datamodel.BlackboardAttribute; "LastKnownWaypoint_Label=Last Known Location",}) 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 { - 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 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. * - * @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 * * @throws GeoLocationDataException */ - private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { - String label = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + private static String getLabelFromArtifact(Map attributeMap) throws GeoLocationDataException { + BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + String label = attribute.getDisplayString(); if (label == null || label.isEmpty()) { label = Bundle.LastKnownWaypoint_Label(); diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index 9d91cf8d9c..a7d9c651cf 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -22,10 +22,12 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; 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 @@ -58,9 +60,14 @@ public final class Route { * * @throws GeoLocationDataException */ - static public List getRoutes(SleuthkitCase skCase) throws GeoLocationDataException { - List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE); - + static public List getRoutes(SleuthkitCase skCase) throws GeoLocationDataException { + List 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); + } + List routes = new ArrayList<>(); for (BlackboardArtifact artifact : artifacts) { Route route = new Route(artifact); @@ -76,21 +83,28 @@ public final class Route { */ Route(BlackboardArtifact artifact) throws GeoLocationDataException { points = new ArrayList<>(); - Waypoint point = getRouteStartPoint(artifact); + + Map attributeMap = ArtifactUtils.getAttributesFromArtifactAsMap(artifact); + + Waypoint point = getRouteStartPoint(attributeMap); if (point != null) { points.add(point); } - point = getRouteEndPoint(artifact); + point = getRouteEndPoint(attributeMap); if (point != null) { points.add(point); } - altitude = getRouteAltitude(artifact); - timestamp = getRouteTimestamp(artifact); - immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.getOtherGeolocationProperties(artifact)); + BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); + altitude = attribute != null ? attribute.getValueDouble() : null; + + 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. * - * @param artifact The BlackboardARtifact object from which this route is - * created + * @param attributeMap Map of artifact attributes for this waypoint * - * @return Start RoutePoint or null if valid longitude and latitude are not - * found + * @return Start RoutePoint * - * @throws GeoLocationDataException + * @throws GeoLocationDataException when longitude or latitude is null */ - private Waypoint getRouteStartPoint(BlackboardArtifact artifact) throws GeoLocationDataException { - Double latitude; - Double longitude; - 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); + private Waypoint getRouteStartPoint(Map attributeMap) throws GeoLocationDataException { + BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START); + BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START); 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. * - * @param artifact The BlackboardARtifact object from which this route is - * created + * @param attributeMap Map of artifact attributes for this waypoint * * @return End RoutePoint or null if valid longitude and latitude are not * found * - * @throws GeoLocationDataException + * @throws GeoLocationDataException when longitude or latitude is null */ - private Waypoint getRouteEndPoint(BlackboardArtifact artifact) throws GeoLocationDataException { - Double latitude; - Double longitude; - 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); + private Waypoint getRouteEndPoint(Map attributeMap) throws GeoLocationDataException { + BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END); + BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END); 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); - } - } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java new file mode 100755 index 0000000000..0041c05870 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java @@ -0,0 +1,77 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * contact: carrier sleuthkit 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; + +import java.util.Map; +import org.openide.util.NbBundle.Messages; +import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; + +/** + * A SearchWaypoint is a subclass of ArtifactWaypoint. + */ +final class SearchWaypoint extends ArtifactWaypoint { + + @Messages({ + "SearchWaypoint_DisplayLabel=GPS Search" + }) + + /** + * Construct a waypoint for TSK_GPS_SEARCH artifact. + * + * @throws GeoLocationDataException + */ + SearchWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { + this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact)); + } + + private SearchWaypoint(BlackboardArtifact artifact, Map 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. + * + * @param attributeMap Map of artifact attributes + * + * @return String label for the artifacts way point. + * + * @throws GeoLocationDataException + */ + private static String getLabelFromArtifact(Map attributeMap) throws GeoLocationDataException { + BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + if (attribute != null) { + return attribute.getDisplayString(); + } + + attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION); + if (attribute != null) { + return attribute.getDisplayString(); + } + + return Bundle.SearchWaypoint_DisplayLabel(); + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java index 3ef3279239..01b2f6557e 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.autopsy.geolocation.datamodel; +import java.util.Map; import org.openide.util.NbBundle.Messages; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; @@ -37,7 +38,17 @@ final class TrackpointWaypoint extends ArtifactWaypoint { * @throws GeoLocationDataException */ TrackpointWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - super(artifact, getLabelFromArtifact(artifact)); + this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact)); + } + + private TrackpointWaypoint(BlackboardArtifact artifact, Map 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 */ - private static String getLabelFromArtifact(BlackboardArtifact artifact) throws GeoLocationDataException { + private static String getLabelFromArtifact(Map attributeMap) throws GeoLocationDataException { - String typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); - - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); + if (attribute != null) { + return attribute.getDisplayString(); } - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = ArtifactUtils.getString(artifact, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME); + if (attribute != null) { + return attribute.getDisplayString(); } - if (typeLabel == null || typeLabel.isEmpty()) { - typeLabel = Bundle.TrackpointWaypoint_DisplayLabel(); + attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_FLAG); + if (attribute != null) { + return attribute.getDisplayString(); } - return typeLabel; + return Bundle.TrackpointWaypoint_DisplayLabel(); } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java index aaf5a1afe5..d9affaebe6 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java @@ -20,15 +20,19 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.ArrayList; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.SleuthkitCase; +import org.sleuthkit.datamodel.TskCoreException; /** * The basic details of a waypoint. * */ public interface Waypoint { + static final Logger logger = Logger.getLogger(Waypoint.class.getName()); /** * Interface to describe a waypoint. A waypoint is made up of * a longitude, latitude, label, timestamp, type, image and altitude. @@ -118,16 +122,21 @@ public interface Waypoint { * @throws GeoLocationDataException */ static List getTrackpointWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { - List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT); + List 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 points = new ArrayList<>(); for (BlackboardArtifact artifact : artifacts) { - ArtifactWaypoint point = new TrackpointWaypoint(artifact); - // Only add to the list if the point has a valid latitude - // and longitude. - if (point.getLatitude() != null && point.getLongitude() != null) { + try{ + ArtifactWaypoint point = new TrackpointWaypoint(artifact); 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; } @@ -142,17 +151,24 @@ public interface Waypoint { * @throws GeoLocationDataException */ static List getEXIFWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { - List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF); + List 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 points = new ArrayList<>(); if (artifacts != null) { for (BlackboardArtifact artifact : artifacts) { - ArtifactWaypoint point = new EXIFWaypoint(artifact); - // Only add to the list if the point has a valid latitude - // and longitude. - if (point.getLatitude() != null && point.getLongitude() != null) { + try{ + ArtifactWaypoint point = new EXIFWaypoint(artifact); 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; @@ -168,17 +184,22 @@ public interface Waypoint { * @throws GeoLocationDataException */ static List getSearchWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { - List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_SEARCH); + List 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 points = new ArrayList<>(); if (artifacts != null) { for (BlackboardArtifact artifact : artifacts) { - ArtifactWaypoint point = new GPSSearchWaypoint(artifact); - // Only add to the list if the point has a valid latitude - // and longitude. - if (point.getLatitude() != null && point.getLongitude() != null) { + try{ + ArtifactWaypoint point = new SearchWaypoint(artifact); 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; @@ -194,18 +215,22 @@ public interface Waypoint { * @throws GeoLocationDataException */ static List getLastKnownWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { - List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_LAST_KNOWN_LOCATION); + List 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 points = new ArrayList<>(); if (artifacts != null) { - - for (BlackboardArtifact artifact : artifacts) { - 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) { + for (BlackboardArtifact artifact : artifacts) { + try{ + ArtifactWaypoint point = new LastKnownWaypoint(artifact); 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; @@ -221,17 +246,22 @@ public interface Waypoint { * @throws GeoLocationDataException */ static List getBookmarkWaypoints(SleuthkitCase skCase) throws GeoLocationDataException { - List artifacts = ArtifactUtils.getArtifactsForType(skCase, BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_BOOKMARK); + List 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 points = new ArrayList<>(); if (artifacts != null) { for (BlackboardArtifact artifact : artifacts) { - ArtifactWaypoint point = new ArtifactWaypoint(artifact); - // Only add to the list if the point has a valid latitude - // and longitude. - if (point.getLatitude() != null && point.getLongitude() != null) { + try{ + ArtifactWaypoint point = new ArtifactWaypoint(artifact); 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; From e145592d38346730304868d0ddfcd2304a2059cf Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 29 Oct 2019 11:40:06 -0400 Subject: [PATCH 72/91] Modified based on comments from Richard --- .../geolocation/datamodel/ArtifactUtils.java | 65 -------------- .../datamodel/ArtifactWaypoint.java | 41 +++++++-- .../geolocation/datamodel/EXIFWaypoint.java | 7 +- .../datamodel/GeolocationUtils.java | 84 ------------------- .../datamodel/LastKnownWaypoint.java | 10 +-- .../autopsy/geolocation/datamodel/Route.java | 42 ++++------ .../geolocation/datamodel/RoutePoint.java | 2 +- .../geolocation/datamodel/SearchWaypoint.java | 11 ++- .../datamodel/TrackpointWaypoint.java | 10 +-- .../geolocation/datamodel/Waypoint.java | 50 +++++++++++ 10 files changed, 119 insertions(+), 203 deletions(-) delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java delete mode 100755 Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java deleted file mode 100755 index b5cf4ab75c..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.sleuthkit.datamodel.BlackboardArtifact; -import org.sleuthkit.datamodel.BlackboardAttribute; -import org.sleuthkit.datamodel.TskCoreException; - -/** - * Utilities for simplifying the use of Waypoint Artifacts. - */ -final class ArtifactUtils { - - /** - * Private constructor for this Utility class. - */ - private ArtifactUtils() { - - } - - /** - * Gets the list of attributes from the artifact and puts them into a map - * with the ATRIBUTE_TYPE as the key. - * - * @param artifact BlackboardArtifact current artifact - * - * @return A Map of BlackboardAttributes for the given artifact with - * ATTRIBUTE_TYPE as the key. - * - * @throws GeoLocationDataException - */ - static Map getAttributesFromArtifactAsMap(BlackboardArtifact artifact) throws GeoLocationDataException { - Map attributeMap = new HashMap<>(); - try { - List 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); - } - - return attributeMap; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java index 1ce27b28fc..a2a0f3315f 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/ArtifactWaypoint.java @@ -19,11 +19,13 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; +import org.sleuthkit.datamodel.TskCoreException; /** * Representation of a Waypoint created from a BlackboardArtifact. @@ -42,7 +44,7 @@ class ArtifactWaypoint implements Waypoint { // This list is not expected to change after construction so the // constructor will take care of creating an unmodifiable List final private List immutablePropertiesList; - + /** * Construct a waypoint with the given artifact. * @@ -51,9 +53,9 @@ class ArtifactWaypoint implements Waypoint { * @throws GeoLocationDataException Exception will be thrown if artifact did * not have a valid longitude and latitude. */ - protected ArtifactWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { + ArtifactWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { this(artifact, - ArtifactUtils.getAttributesFromArtifactAsMap(artifact)); + getAttributesFromArtifactAsMap(artifact)); } /** @@ -61,18 +63,17 @@ class ArtifactWaypoint implements Waypoint { * * @param artifact BlackboardArtifact for this waypoint * @param label String waypoint label - * @param timestamp Long timestamp, epoch seconds + * @param timestamp Long timestamp, unix/java 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 Exception will be thrown if artifact did * not have a valid longitude and latitude. */ - protected ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Map attributeMap) throws GeoLocationDataException { + ArtifactWaypoint(BlackboardArtifact artifact, String label, Long timestamp, Double latitude, Double longitude, Double altitude, AbstractFile image, Map attributeMap) throws GeoLocationDataException { if (longitude == null || latitude == null) { throw new GeoLocationDataException("Invalid waypoint, null value passed for longitude or latitude"); } @@ -85,7 +86,7 @@ class ArtifactWaypoint implements Waypoint { this.latitude = latitude; this.altitude = altitude; - immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.createGeolocationProperties(attributeMap)); + immutablePropertiesList = Collections.unmodifiableList(Waypoint.createGeolocationProperties(attributeMap)); } /** @@ -167,4 +168,30 @@ class ArtifactWaypoint implements Waypoint { return ""; } + + /** + * Gets the list of attributes from the artifact and puts them into a map + * with the ATRIBUTE_TYPE as the key. + * + * @param artifact BlackboardArtifact current artifact + * + * @return A Map of BlackboardAttributes for the given artifact with + * ATTRIBUTE_TYPE as the key. + * + * @throws GeoLocationDataException + */ + static Map getAttributesFromArtifactAsMap(BlackboardArtifact artifact) throws GeoLocationDataException { + Map attributeMap = new HashMap<>(); + try { + List 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); + } + + return attributeMap; + } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java index 399ae17ea1..927b91b1d4 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/EXIFWaypoint.java @@ -36,8 +36,8 @@ final class EXIFWaypoint extends ArtifactWaypoint { * * @throws GeoLocationDataException */ - protected EXIFWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact), getImageFromArtifact(artifact)); + EXIFWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { + this(artifact, getAttributesFromArtifactAsMap(artifact), getImageFromArtifact(artifact)); } /** @@ -73,11 +73,10 @@ final class EXIFWaypoint extends ArtifactWaypoint { AbstractFile abstractFile = null; BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID()); if (artifactType == BlackboardArtifact.ARTIFACT_TYPE.TSK_METADATA_EXIF) { - try { abstractFile = artifact.getSleuthkitCase().getAbstractFileById(artifact.getObjectID()); } 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 artifactID: %d", artifact.getArtifactID()), ex); } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java deleted file mode 100755 index 644c65dacc..0000000000 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/GeolocationUtils.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2019 Basis Technology Corp. - * contact: carrier sleuthkit 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; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.sleuthkit.datamodel.BlackboardAttribute; - -/** - * GeolocationUtilis class for common shared between Routes and Waypoints. - * - */ -final class GeolocationUtils { - - /** - * This is a list of attributes that are already being handled by the - * waypoint classes and will have get functions. - */ - private static final BlackboardAttribute.ATTRIBUTE_TYPE[] ALREADY_HANDLED_ATTRIBUTES = { - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, - 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_GEO_LATITUDE_START, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END, - BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END,}; - - /** - * This is a Utility class that should not be constructed. - */ - private GeolocationUtils() { - - } - - /** - * 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 - * - * @return A List of Waypoint.Property objects - * - * @throws GeoLocationDataException - */ - static List createGeolocationProperties(Map attributeMap) throws GeoLocationDataException { - List list = new ArrayList<>(); - - Set keys = attributeMap.keySet(); - - for (BlackboardAttribute.ATTRIBUTE_TYPE type : ALREADY_HANDLED_ATTRIBUTES) { - 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)); - } - return list; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java index 4f44cb956d..3c27e81f5d 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/LastKnownWaypoint.java @@ -24,10 +24,8 @@ import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; /** - * A Last Know Location Waypoint object. + * A Last Known Location Waypoint object. */ -@Messages({ - "LastKnownWaypoint_Label=Last Known Location",}) final class LastKnownWaypoint extends ArtifactWaypoint { /** @@ -37,8 +35,8 @@ final class LastKnownWaypoint extends ArtifactWaypoint { * * @throws GeoLocationDataException */ - protected LastKnownWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact)); + LastKnownWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { + this(artifact, getAttributesFromArtifactAsMap(artifact)); } /** @@ -69,6 +67,8 @@ final class LastKnownWaypoint extends ArtifactWaypoint { * * @throws GeoLocationDataException */ + @Messages({ + "LastKnownWaypoint_Label=Last Known Location",}) private static String getLabelFromArtifact(Map attributeMap) throws GeoLocationDataException { BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); String label = attribute.getDisplayString(); diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java index a7d9c651cf..8b6d3a968b 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Route.java @@ -35,13 +35,7 @@ import org.sleuthkit.datamodel.TskCoreException; * more that two points. * */ -@Messages({ - "Route_Label=As-the-crow-flies Route", - "Route_Start_Label=Start", - "Route_End_Label=End" -}) public final class Route { - private final List points; private final Long timestamp; private final Double altitude; @@ -56,7 +50,7 @@ public final class Route { * @param skCase Currently open SleuthkitCase * * @return List of Route objects, empty list will be returned if no Routes - * where found + * were found * * @throws GeoLocationDataException */ @@ -84,19 +78,9 @@ public final class Route { Route(BlackboardArtifact artifact) throws GeoLocationDataException { points = new ArrayList<>(); - Map attributeMap = ArtifactUtils.getAttributesFromArtifactAsMap(artifact); - - Waypoint point = getRouteStartPoint(attributeMap); - - if (point != null) { - points.add(point); - } - - point = getRouteEndPoint(attributeMap); - - if (point != null) { - points.add(point); - } + Map attributeMap = ArtifactWaypoint.getAttributesFromArtifactAsMap(artifact); + points.add(getRouteStartPoint(attributeMap)); + points.add(getRouteEndPoint(attributeMap)); BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_ALTITUDE); altitude = attribute != null ? attribute.getValueDouble() : null; @@ -104,7 +88,7 @@ public final class Route { attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME); timestamp = attribute != null ? attribute.getValueLong() : null; - immutablePropertiesList = Collections.unmodifiableList(GeolocationUtils.createGeolocationProperties(attributeMap)); + immutablePropertiesList = Collections.unmodifiableList(Waypoint.createGeolocationProperties(attributeMap)); } /** @@ -119,7 +103,7 @@ public final class Route { /** * Get the timestamp for this Route * - * @return The timestamp (epoch seconds) or null if none was set. + * @return The timestamp (java/unix epoch seconds) or null if none was set. */ public Long getTimestamp() { return timestamp; @@ -146,10 +130,12 @@ public final class Route { /** * Get the route label. - * - * This will return the original hard coded label from the KML report: - * As-the-crow-flies Route */ + @Messages({ + // This is the original static hardcoded label from the + // original kml-report code + "Route_Label=As-the-crow-flies Route" + }) public String getLabel() { return Bundle.Route_Label(); } @@ -163,6 +149,9 @@ public final class Route { * * @throws GeoLocationDataException when longitude or latitude is null */ + @Messages({ + "Route_Start_Label=Start" + }) private Waypoint getRouteStartPoint(Map attributeMap) throws GeoLocationDataException { BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START); BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START); @@ -184,6 +173,9 @@ public final class Route { * * @throws GeoLocationDataException when longitude or latitude is null */ + @Messages({ + "Route_End_Label=End" + }) private Waypoint getRouteEndPoint(Map attributeMap) throws GeoLocationDataException { BlackboardAttribute latitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END); BlackboardAttribute longitude = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END); diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java index f3d8f5afcc..50087de873 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/RoutePoint.java @@ -41,7 +41,7 @@ final class RoutePoint implements Waypoint { * @param longitude Longitude for point * @param label Way point label. */ - protected RoutePoint(Route parent, double latitude, double longitude, String label) { + RoutePoint(Route parent, double latitude, double longitude, String label) { this.longitude = longitude; this.latitude = latitude; this.label = label; diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java index 0041c05870..f4a27ef34e 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/SearchWaypoint.java @@ -27,18 +27,13 @@ import org.sleuthkit.datamodel.BlackboardAttribute; * A SearchWaypoint is a subclass of ArtifactWaypoint. */ final class SearchWaypoint extends ArtifactWaypoint { - - @Messages({ - "SearchWaypoint_DisplayLabel=GPS Search" - }) - /** * Construct a waypoint for TSK_GPS_SEARCH artifact. * * @throws GeoLocationDataException */ SearchWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact)); + this(artifact, getAttributesFromArtifactAsMap(artifact)); } private SearchWaypoint(BlackboardArtifact artifact, Map attributeMap) throws GeoLocationDataException { @@ -60,6 +55,10 @@ final class SearchWaypoint extends ArtifactWaypoint { * * @throws GeoLocationDataException */ + @Messages({ + "SearchWaypoint_DisplayLabel=GPS Search" + }) + private static String getLabelFromArtifact(Map attributeMap) throws GeoLocationDataException { BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); if (attribute != null) { diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java index 01b2f6557e..ea724f2821 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/TrackpointWaypoint.java @@ -27,18 +27,13 @@ import org.sleuthkit.datamodel.BlackboardAttribute; * A wrapper class for TSK_GPS_TRACKPOINT artifacts. */ final class TrackpointWaypoint extends ArtifactWaypoint { - - @Messages({ - "TrackpointWaypoint_DisplayLabel=GPS Trackpoint" - }) - /** * Construct a waypoint for trackpoints. * * @throws GeoLocationDataException */ TrackpointWaypoint(BlackboardArtifact artifact) throws GeoLocationDataException { - this(artifact, ArtifactUtils.getAttributesFromArtifactAsMap(artifact)); + this(artifact, getAttributesFromArtifactAsMap(artifact)); } private TrackpointWaypoint(BlackboardArtifact artifact, Map attributeMap) throws GeoLocationDataException { @@ -61,6 +56,9 @@ final class TrackpointWaypoint extends ArtifactWaypoint { * * @throws GeoLocationDataException */ + @Messages({ + "TrackpointWaypoint_DisplayLabel=GPS Trackpoint" + }) private static String getLabelFromArtifact(Map attributeMap) throws GeoLocationDataException { BlackboardAttribute attribute = attributeMap.get(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME); diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java index d9affaebe6..45c8816574 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/datamodel/Waypoint.java @@ -20,10 +20,13 @@ package org.sleuthkit.autopsy.geolocation.datamodel; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; +import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; @@ -33,6 +36,23 @@ import org.sleuthkit.datamodel.TskCoreException; */ public interface Waypoint { static final Logger logger = Logger.getLogger(Waypoint.class.getName()); + + /** + * This is a list of attributes that are already being handled by the + * waypoint classes and will have get functions. + */ + BlackboardAttribute.ATTRIBUTE_TYPE[] ALREADY_HANDLED_ATTRIBUTES = { + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, + 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_GEO_LATITUDE_START, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END, + BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END,}; + /** * Interface to describe a waypoint. A waypoint is made up of * a longitude, latitude, label, timestamp, type, image and altitude. @@ -266,6 +286,36 @@ public interface Waypoint { } return points; } + + + /** + * 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 + * + * @return A List of Waypoint.Property objects + * + * @throws GeoLocationDataException + */ + static List createGeolocationProperties(Map attributeMap) throws GeoLocationDataException { + List list = new ArrayList<>(); + + Set keys = attributeMap.keySet(); + + for (BlackboardAttribute.ATTRIBUTE_TYPE type : ALREADY_HANDLED_ATTRIBUTES) { + 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)); + } + return list; + } /** * Simple property class for waypoint properties that a purely From 4bc0eba02e55b8d4afa796a51b3ee1eddc57ba79 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Tue, 29 Oct 2019 13:41:13 -0400 Subject: [PATCH 73/91] Update CaseMetadata.java Add UTF-8 Encoding so it writes to the aut file correctly for non-latin characters. --- Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java index 20dfabd93c..6f93b984a3 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java @@ -24,6 +24,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.StringWriter; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import java.text.DateFormat; @@ -427,9 +428,10 @@ public final class CaseMetadata { transformer.transform(source, streamResult); /* - * Write the DOM to the metadata file. + * Write the DOM to the metadata file. Add UTF-8 Characterset so it writes to the file + * correctly for non-latin charadters */ - try (BufferedWriter fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metadataFilePath.toFile())))) { + try (BufferedWriter fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metadataFilePath.toFile()), StandardCharsets.UTF_8))) { fileWriter.write(stringWriter.toString()); fileWriter.flush(); } From e984b4e363adeaf8f57c5fa933e0d3407bba08fb Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Tue, 29 Oct 2019 14:31:45 -0400 Subject: [PATCH 74/91] Added comments to MapWaypoint --- .../autopsy/geolocation/MapWaypoint.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java index b965074055..e93c871ef8 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java @@ -14,7 +14,8 @@ import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.autopsy.geolocation.datamodel.Waypoint; /** - * + * A Wrapper for the datamodel Waypoint class that implements the jxmapviewer + * Waypoint interfact for use in the map. * */ final class MapWaypoint implements org.jxmapviewer.viewer.Waypoint{ @@ -22,11 +23,25 @@ final class MapWaypoint implements org.jxmapviewer.viewer.Waypoint{ private final Waypoint dataModelWaypoint; private final GeoPosition position; + /** + * Private constructor for MapWaypoint + * + * @param dataModelWaypoint The datamodel waypoint to wrap + */ private MapWaypoint(Waypoint dataModelWaypoint) { this.dataModelWaypoint = dataModelWaypoint; position = new GeoPosition(dataModelWaypoint.getLatitude(), dataModelWaypoint.getLongitude()); } + /** + * Gets a list of jxmapviewer waypoints from the current case. + * + * @param skCase Current case + * + * @return List of jxmapviewer waypoints + * + * @throws GeoLocationDataException + */ static List getWaypoints(SleuthkitCase skCase) throws GeoLocationDataException{ List points = Waypoint.getAllWaypoints(skCase); @@ -44,13 +59,11 @@ final class MapWaypoint implements org.jxmapviewer.viewer.Waypoint{ return mapPoints; } + /** + * {@inheritDoc} + */ @Override public GeoPosition getPosition() { return position; } - - String getDisplayName() { - return dataModelWaypoint.getLabel(); - } - } From 88c10eeed87a704aad59f801cff8e160bdafb058 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Tue, 29 Oct 2019 16:29:53 -0400 Subject: [PATCH 75/91] Update CaseMetadata.java Fix typo --- Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java b/Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java index 6f93b984a3..5f7ffe9ea7 100644 --- a/Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java +++ b/Core/src/org/sleuthkit/autopsy/casemodule/CaseMetadata.java @@ -429,7 +429,7 @@ public final class CaseMetadata { /* * Write the DOM to the metadata file. Add UTF-8 Characterset so it writes to the file - * correctly for non-latin charadters + * correctly for non-latin characters */ try (BufferedWriter fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(metadataFilePath.toFile()), StandardCharsets.UTF_8))) { fileWriter.write(stringWriter.toString()); From fcd4dace0ae89a39f96fa5b09a7b51c1c0069d70 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Tue, 29 Oct 2019 22:13:23 -0400 Subject: [PATCH 76/91] 5078-HTML-viewer-not-correctly-interpreting-Unicode Determine encoding of html file and display html file using encoding. --- Core/ivy.xml | 1 + Core/nbproject/project.properties | 1 + Core/nbproject/project.xml | 12 +++++--- .../autopsy/contentviewers/HtmlViewer.java | 29 +++++++++++++++++-- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Core/ivy.xml b/Core/ivy.xml index 9ba4a3c371..8ff512127b 100644 --- a/Core/ivy.xml +++ b/Core/ivy.xml @@ -44,6 +44,7 @@ + diff --git a/Core/nbproject/project.properties b/Core/nbproject/project.properties index 2a952926ba..a04f1516f5 100644 --- a/Core/nbproject/project.properties +++ b/Core/nbproject/project.properties @@ -35,6 +35,7 @@ file.reference.java-libpst-0.8.1.jar=release\\modules\\ext\\java-libpst-0.8.1.ja file.reference.javax.activation-1.2.0.jar=release\\modules\\ext\\javax.activation-1.2.0.jar file.reference.javax.annotation-api-1.3.2.jar=release\\modules\\ext\\javax.annotation-api-1.3.2.jar file.reference.jbig2-imageio-3.0.2.jar=release\\modules\\ext\\jbig2-imageio-3.0.2.jar +file.reference.jchardet-1.0.jar=release/modules/ext/jchardet-1.0.jar file.reference.jcl-over-slf4j-1.7.25.jar=release\\modules\\ext\\jcl-over-slf4j-1.7.25.jar file.reference.jdom-2.0.5-contrib.jar=release/modules/ext/jdom-2.0.5-contrib.jar file.reference.jdom-2.0.5.jar=release/modules/ext/jdom-2.0.5.jar diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index c33dabfbc7..9a473f40e7 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -517,6 +517,14 @@ ext/google-http-client-1.29.0.jar release/modules/ext/google-http-client-1.29.0.jar + + ext/sleuthkit-postgresql-4.7.0.jar + release/modules/ext/sleuthkit-postgresql-4.7.0.jar + + + ext/jchardet-1.0.jar + release/modules/ext/jchardet-1.0.jar + ext/bcpkix-jdk15on-1.60.jar release\modules\ext\bcpkix-jdk15on-1.60.jar @@ -605,10 +613,6 @@ ext/jbig2-imageio-3.0.2.jar release\modules\ext\jbig2-imageio-3.0.2.jar - - ext/sleuthkit-postgresql-4.7.0.jar - release/modules/ext/sleuthkit-postgresql-4.7.0.jar - ext/apache-mime4j-dom-0.8.2.jar release\modules\ext\apache-mime4j-dom-0.8.2.jar diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java index fb88ed9312..c9e4411437 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java @@ -20,9 +20,11 @@ package org.sleuthkit.autopsy.contentviewers; import java.awt.Component; import java.awt.Cursor; +import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.List; import java.util.logging.Level; +import org.mozilla.universalchardet.UniversalDetector; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; @@ -65,14 +67,37 @@ final class HtmlViewer extends javax.swing.JPanel implements FileTypeViewer { int fileSize = (int) abstractFile.getSize(); byte[] buffer = new byte[fileSize]; abstractFile.read(buffer, 0, fileSize); - return new String(buffer); - } catch (TskCoreException ex) { + String encoding = determineEncoding(buffer); + if (encoding != null) { + return new String(buffer, encoding); + } else { + return new String(buffer); + } + } catch (TskCoreException | UnsupportedEncodingException ex) { logger.log(Level.SEVERE, String.format("Unable to read from file '%s' (id=%d).", abstractFile.getName(), abstractFile.getId()), ex); return String.format("

    %s

    ", Bundle.HtmlViewer_file_error()); } } + /** + * This method will try and determine the encoding of the html file based on its contents + * + * @param buffer byte array of the html file to check + * + * @return encoding type, null if encoding could not be determined + */ + private String determineEncoding(byte[] buffer) { + UniversalDetector detector = new UniversalDetector(null); + + detector.handleData(buffer, 0, buffer.length - 1); + detector.dataEnd(); + + String encoding = detector.getDetectedCharset(); + detector.reset(); + return encoding; + } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always From 39696906dac985e3eb6bd991be6bf0954ae06116 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Wed, 30 Oct 2019 12:07:21 -0400 Subject: [PATCH 77/91] Updated after review comments --- .../geolocation/GeolocationTopComponent.java | 6 +++--- .../autopsy/geolocation/MapPanel.java | 12 +++--------- .../autopsy/geolocation/MapWaypoint.java | 19 ++++++++++++++++--- 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java index 328aa048b2..a33bc1d15e 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -80,7 +80,7 @@ public final class GeolocationTopComponent extends TopComponent { this.ingestListener = pce -> { String eventType = pce.getPropertyName(); if (eventType.equals(DATA_ADDED.toString())) { - // Indicate that a refresh may be needed, unless the data added is Keyword or Hashset hits + // Indicate that a refresh may be needed for GPS data. ModuleDataEvent eventData = (ModuleDataEvent) pce.getOldValue(); if (null != eventData && (eventData.getBlackboardArtifactType().getTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT.getTypeID() @@ -182,10 +182,10 @@ public final class GeolocationTopComponent extends TopComponent { mapPanel.setCenterLocation(waypoints.get(0)); } catch (ExecutionException ex) { - logger.log(Level.WARNING, "An exception occured while initalizing waypoints for geolocation window.", ex); + logger.log(Level.WARNING, "An exception occured while initializing waypoints for geolocation window.", ex); MessageNotifyUtil.Message.error(Bundle.GLTopComponent_initilzation_error()); } catch (InterruptedException ex) { - logger.log(Level.WARNING, "The initilization thread for geolocation window was interrupted.", ex); + logger.log(Level.WARNING, "The initializing thread for geolocation window was interrupted.", ex); } } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java index 9aace08818..fdc8b7c8f1 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java @@ -44,7 +44,6 @@ final class MapPanel extends javax.swing.JPanel { private static final long serialVersionUID = 1L; private boolean zoomChanging; - private final boolean sliderReversed; // Using a DefaultListModel to store the way points because we get // a lot of functionality for free, like listeners. @@ -55,8 +54,7 @@ final class MapPanel extends javax.swing.JPanel { */ MapPanel() { waypointListModel = new DefaultListModel<>(); - sliderReversed = false; - zoomChanging = false; + zoomChanging = false; initComponents(); initMap(); @@ -91,7 +89,7 @@ final class MapPanel extends javax.swing.JPanel { zoomSlider.setMaximum(tileFactory.getInfo().getMaximumZoomLevel()); - mapViewer.setZoom(tileFactory.getInfo().getMaximumZoomLevel()- 1); + setZoom(tileFactory.getInfo().getMaximumZoomLevel()- 1); mapViewer.setAddressLocation(new GeoPosition(0, 0)); // Listener for new way points being added to the map. @@ -149,11 +147,7 @@ final class MapPanel extends javax.swing.JPanel { void setZoom(int zoom) { zoomChanging = true; mapViewer.setZoom(zoom); - if (sliderReversed) { - zoomSlider.setValue(zoomSlider.getMaximum() - zoom); - } else { - zoomSlider.setValue(zoom); - } + zoomSlider.setValue((zoomSlider.getMaximum() + zoomSlider.getMinimum())- zoom); zoomChanging = false; } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java index e93c871ef8..d58223d98f 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java @@ -1,7 +1,20 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2019 Basis Technology Corp. + * Contact: carrier sleuthkit 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; From a650ac6b21cd84a5c8b8fa72974b0fe22c74c492 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Wed, 30 Oct 2019 12:37:53 -0400 Subject: [PATCH 78/91] Remove jchardet and add tiki text detection Remove jchardet text detection and add tiki text detection. --- Core/ivy.xml | 1 - Core/nbproject/project.properties | 1 - Core/nbproject/project.xml | 4 ---- .../autopsy/contentviewers/HtmlViewer.java | 23 +++++++++---------- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/Core/ivy.xml b/Core/ivy.xml index 8ff512127b..9ba4a3c371 100644 --- a/Core/ivy.xml +++ b/Core/ivy.xml @@ -44,7 +44,6 @@ - diff --git a/Core/nbproject/project.properties b/Core/nbproject/project.properties index a04f1516f5..2a952926ba 100644 --- a/Core/nbproject/project.properties +++ b/Core/nbproject/project.properties @@ -35,7 +35,6 @@ file.reference.java-libpst-0.8.1.jar=release\\modules\\ext\\java-libpst-0.8.1.ja file.reference.javax.activation-1.2.0.jar=release\\modules\\ext\\javax.activation-1.2.0.jar file.reference.javax.annotation-api-1.3.2.jar=release\\modules\\ext\\javax.annotation-api-1.3.2.jar file.reference.jbig2-imageio-3.0.2.jar=release\\modules\\ext\\jbig2-imageio-3.0.2.jar -file.reference.jchardet-1.0.jar=release/modules/ext/jchardet-1.0.jar file.reference.jcl-over-slf4j-1.7.25.jar=release\\modules\\ext\\jcl-over-slf4j-1.7.25.jar file.reference.jdom-2.0.5-contrib.jar=release/modules/ext/jdom-2.0.5-contrib.jar file.reference.jdom-2.0.5.jar=release/modules/ext/jdom-2.0.5.jar diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml index 9a473f40e7..50254259f0 100644 --- a/Core/nbproject/project.xml +++ b/Core/nbproject/project.xml @@ -521,10 +521,6 @@ ext/sleuthkit-postgresql-4.7.0.jar release/modules/ext/sleuthkit-postgresql-4.7.0.jar
    - - ext/jchardet-1.0.jar - release/modules/ext/jchardet-1.0.jar - ext/bcpkix-jdk15on-1.60.jar release\modules\ext\bcpkix-jdk15on-1.60.jar diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java index c9e4411437..23fe65dbbf 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java @@ -20,11 +20,12 @@ package org.sleuthkit.autopsy.contentviewers; import java.awt.Component; import java.awt.Cursor; -import java.io.UnsupportedEncodingException; +import java.io.IOException; import java.util.Arrays; import java.util.List; import java.util.logging.Level; -import org.mozilla.universalchardet.UniversalDetector; +import org.apache.tika.parser.txt.CharsetDetector; +import org.apache.tika.parser.txt.CharsetMatch; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.coreutils.Logger; @@ -73,7 +74,7 @@ final class HtmlViewer extends javax.swing.JPanel implements FileTypeViewer { } else { return new String(buffer); } - } catch (TskCoreException | UnsupportedEncodingException ex) { + } catch (TskCoreException | IOException ex) { logger.log(Level.SEVERE, String.format("Unable to read from file '%s' (id=%d).", abstractFile.getName(), abstractFile.getId()), ex); return String.format("

    %s

    ", Bundle.HtmlViewer_file_error()); @@ -87,15 +88,13 @@ final class HtmlViewer extends javax.swing.JPanel implements FileTypeViewer { * * @return encoding type, null if encoding could not be determined */ - private String determineEncoding(byte[] buffer) { - UniversalDetector detector = new UniversalDetector(null); - - detector.handleData(buffer, 0, buffer.length - 1); - detector.dataEnd(); - - String encoding = detector.getDetectedCharset(); - detector.reset(); - return encoding; + private String determineEncoding(byte[] buffer) throws IOException { + + CharsetDetector detector = new CharsetDetector(); + detector.setText(buffer); + CharsetMatch match = detector.detect(); + return match.getName(); + } /** From af56179eba6e2e8ab4f960cd47ee3c9ba3b73195 Mon Sep 17 00:00:00 2001 From: esaunders Date: Wed, 30 Oct 2019 13:23:05 -0400 Subject: [PATCH 79/91] Added support for Mac OS and addressed issue with Travis Mac OS builds failing silently when 'set -e' command is used in the .travis.yml file by moving the script into travis_build.sh. --- .travis.yml | 27 +++++++++++++++++++++------ travis_build.sh | 12 ++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 travis_build.sh diff --git a/.travis.yml b/.travis.yml index 56c8b7bbbd..5e7c79a9c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,11 @@ language: java sudo: required -dist: bionic -os: - - linux + +jobs: + include: + - os: linux + dist bionic + - os: osx env: global: @@ -12,6 +15,7 @@ addons: apt: update: true packages: + - testdisk - libafflib-dev - libewf-dev - libpq-dev @@ -29,11 +33,13 @@ addons: update: true packages: - ant - - ant-optional + - wget + - libpq - libewf - gettext - cppunit - afflib + - testdisk python: - "2.7" @@ -43,7 +49,6 @@ before_install: - python setupSleuthkitBranch.py install: - - sudo apt-get install testdisk - cd sleuthkit/sleuthkit - ./travis_install_libs.sh @@ -54,12 +59,22 @@ before_script: export PATH=/usr/bin:$PATH; unset JAVA_HOME; fi + - if [ $TRAVIS_OS_NAME = osx ]; then + brew uninstall java --force; + brew cask uninstall java --force; + brew tap adoptopenjdk/openjdk; + brew cask install adoptopenjdk8; + wget https://cdn.azul.com/zulu/bin/zulu8.40.0.25-ca-fx-jdk8.0.222-macosx_x64.tar.gz; + sudo tar xf zulu8.40.0.25-ca-fx-jdk8.0.222-macosx_x64.tar.gz --strip-components=1 -C /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home; + export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home; + fi + - java -version script: - set -e - echo "Building TSK..." - ./bootstrap && ./configure --prefix=/usr && make - - pushd bindings/java/ && ant -q dist-PostgreSQL && popd + - pushd bindings/java && ant dist-PostgreSQL && popd - echo "Building Autopsy..." && echo -en 'travis_fold:start:script.build\\r' - cd $TRAVIS_BUILD_DIR/ - ant build diff --git a/travis_build.sh b/travis_build.sh new file mode 100644 index 0000000000..d25d52d6ae --- /dev/null +++ b/travis_build.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -e +echo "Building TSK..." +cd sleuthkit/sleuthkit +./bootstrap && configure --prefix=/usr && make +pushd bindings/java && ant -q dist-PostgreSQL && popd + +echo "Building Autopsy..." && echo -en 'travis_fold:start:script.build\\r' +cd $TRAVIS_BUILD_DIR/ +ant build +echo -en 'travis_fold:end:script.build\\r' From af3f20db9504b6d6ef5867e8925e874016fc62c7 Mon Sep 17 00:00:00 2001 From: esaunders Date: Wed, 30 Oct 2019 13:25:21 -0400 Subject: [PATCH 80/91] Forgot to add updated .travis.yml file on previous commit. --- .travis.yml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e7c79a9c0..be8df28a5d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,8 +49,7 @@ before_install: - python setupSleuthkitBranch.py install: - - cd sleuthkit/sleuthkit - - ./travis_install_libs.sh + - pushd sleuthkit/sleuthkit && ./travis_install_libs.sh && popd before_script: - if [ $TRAVIS_OS_NAME = linux ]; then @@ -70,12 +69,4 @@ before_script: fi - java -version -script: - - set -e - - echo "Building TSK..." - - ./bootstrap && ./configure --prefix=/usr && make - - pushd bindings/java && ant dist-PostgreSQL && popd - - echo "Building Autopsy..." && echo -en 'travis_fold:start:script.build\\r' - - cd $TRAVIS_BUILD_DIR/ - - ant build - - echo -en 'travis_fold:end:script.build\\r' +script: ./travis_build.sh From 8ec2f2b28160148616ccd9b31e32c28e2b2c17cd Mon Sep 17 00:00:00 2001 From: esaunders Date: Wed, 30 Oct 2019 14:39:03 -0400 Subject: [PATCH 81/91] Missed a : --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index be8df28a5d..b907afbd81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: required jobs: include: - os: linux - dist bionic + dist: bionic - os: osx env: From ac434d35239f46e86f9598d34006536a11938087 Mon Sep 17 00:00:00 2001 From: Mark McKinnon Date: Wed, 30 Oct 2019 15:34:25 -0400 Subject: [PATCH 82/91] Update code to suggestions Update code using suggestions --- .../contentviewers/Bundle.properties-MERGED | 1 + .../autopsy/contentviewers/HtmlViewer.java | 33 +++++++------------ 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED index ba39d1d419..2d9df0ae33 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/Bundle.properties-MERGED @@ -23,6 +23,7 @@ GstVideoPanel.noOpenCase.errMsg=No open case available. Html_text_display_error=The HTML text cannot be displayed, it may not be correctly formed HTML. HtmlPanel_showImagesToggleButton_hide=Hide Images HtmlPanel_showImagesToggleButton_show=Download Images +HtmlViewer_encoding_error=This file has unsupported encoding HtmlViewer_file_error=This file is missing or unreadable. MediaFileViewer.initGst.gstException.msg=Error initializing gstreamer for audio/video viewing and frame extraction capabilities. Video and audio viewing will be disabled. GstVideoPanel.setupVideo.infoLabel.text=Playback of deleted videos is not supported, use an external player. diff --git a/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java b/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java index 23fe65dbbf..138e70ae47 100755 --- a/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java +++ b/Core/src/org/sleuthkit/autopsy/contentviewers/HtmlViewer.java @@ -20,7 +20,7 @@ package org.sleuthkit.autopsy.contentviewers; import java.awt.Component; import java.awt.Cursor; -import java.io.IOException; +import java.io.UnsupportedEncodingException; import java.util.Arrays; import java.util.List; import java.util.logging.Level; @@ -62,41 +62,30 @@ final class HtmlViewer extends javax.swing.JPanel implements FileTypeViewer { * @return The text content of the file. */ @NbBundle.Messages({ - "HtmlViewer_file_error=This file is missing or unreadable.",}) + "HtmlViewer_file_error=This file is missing or unreadable.", + "HtmlViewer_encoding_error=This file has unsupported encoding"}) private String getHtmlText(AbstractFile abstractFile) { try { int fileSize = (int) abstractFile.getSize(); byte[] buffer = new byte[fileSize]; abstractFile.read(buffer, 0, fileSize); - String encoding = determineEncoding(buffer); - if (encoding != null) { - return new String(buffer, encoding); + CharsetMatch match = new CharsetDetector().setText(buffer).detect(); + if (match != null) { + return new String(buffer, match.getName()); } else { return new String(buffer); } - } catch (TskCoreException | IOException ex) { + } catch (TskCoreException ex) { logger.log(Level.SEVERE, String.format("Unable to read from file '%s' (id=%d).", abstractFile.getName(), abstractFile.getId()), ex); return String.format("

    %s

    ", Bundle.HtmlViewer_file_error()); + } catch (UnsupportedEncodingException ex) { + logger.log(Level.SEVERE, String.format("Unsupported encoding for file '%s' (id=%d).", + abstractFile.getName(), abstractFile.getId()), ex); + return String.format("

    %s

    ", Bundle.HtmlViewer_encoding_error()); } } - /** - * This method will try and determine the encoding of the html file based on its contents - * - * @param buffer byte array of the html file to check - * - * @return encoding type, null if encoding could not be determined - */ - private String determineEncoding(byte[] buffer) throws IOException { - - CharsetDetector detector = new CharsetDetector(); - detector.setText(buffer); - CharsetMatch match = detector.detect(); - return match.getName(); - - } - /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always From ca5558993a74ea7e1f36a263fd4af8d999673c59 Mon Sep 17 00:00:00 2001 From: Kelly Kelly Date: Thu, 31 Oct 2019 10:00:00 -0400 Subject: [PATCH 83/91] Added getLabel function --- Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java index d58223d98f..d765d17ff5 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapWaypoint.java @@ -79,4 +79,8 @@ final class MapWaypoint implements org.jxmapviewer.viewer.Waypoint{ public GeoPosition getPosition() { return position; } + + String getLabel() { + return dataModelWaypoint.getLabel(); + } } From cccbde6452a041dc5b0bc669e88edfa42b259efc Mon Sep 17 00:00:00 2001 From: Raman Arora Date: Thu, 31 Oct 2019 13:50:16 -0400 Subject: [PATCH 84/91] 5706: Message attachments. --- .../DataContentViewerArtifact.java | 14 +++++++ .../datamodel/ArtifactStringContent.java | 1 + .../PortableCaseReportModule.java | 1 + .../autopsy/test/CustomArtifactType.java | 4 ++ .../autoingest/FileExporterSettingsPanel.java | 2 + InternalPythonModules/android/imo.py | 38 ++++++++++++++++--- 6 files changed, 55 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java index 39d3203b13..8c8e722bce 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataContentViewerArtifact.java @@ -56,6 +56,10 @@ import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskException; import org.netbeans.swing.etable.ETable; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; /** * Instances of this class display the BlackboardArtifacts associated with the @@ -552,6 +556,16 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat value = dateFormatter.format(new java.util.Date(epoch * 1000)); } break; + case JSON: + // @TODO: 5726 - return a multilevel bulleted list instead of prettyprint JSON + String jsonVal = attr.getValueString(); + + JsonParser parser = new JsonParser(); + JsonObject json = parser.parse(jsonVal).getAsJsonObject(); + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + + value = gson.toJson(json); + break; } /* * Attribute sources column. diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/ArtifactStringContent.java b/Core/src/org/sleuthkit/autopsy/datamodel/ArtifactStringContent.java index 774d1f2f9e..e2950e5b12 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/ArtifactStringContent.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/ArtifactStringContent.java @@ -122,6 +122,7 @@ public class ArtifactStringContent implements StringContent { case LONG: case DOUBLE: case BYTE: + case JSON: default: value = attr.getDisplayString(); break; diff --git a/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java b/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java index de3350ad88..38e53b5eb6 100644 --- a/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/report/modules/portablecase/PortableCaseReportModule.java @@ -768,6 +768,7 @@ public class PortableCaseReportModule implements ReportModule { oldAttr.getValueLong())); break; case STRING: + case JSON: newAttrs.add(new BlackboardAttribute(newAttributeType, String.join(",", oldAttr.getSources()), oldAttr.getValueString())); break; diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java index b27fa29dd6..49784b46a7 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java @@ -50,6 +50,8 @@ final class CustomArtifactType { private static final String BYTES_ATTR_DISPLAY_NAME = "Custom Bytes"; private static final String STRING_ATTR_TYPE_NAME = "CUSTOM_STRING_ATTRIBUTE"; private static final String STRING_ATTR_DISPLAY_NAME = "Custom String"; + private static final String JSON_ATTR_TYPE_NAME = "CUSTOM_JSON_ATTRIBUTE"; + private static final String JSON_ATTR_DISPLAY_NAME = "Custom Json"; private static BlackboardArtifact.Type artifactType; private static BlackboardAttribute.Type intAttrType; private static BlackboardAttribute.Type doubleAttrType; @@ -57,6 +59,7 @@ final class CustomArtifactType { private static BlackboardAttribute.Type dateTimeAttrType; private static BlackboardAttribute.Type bytesAttrType; private static BlackboardAttribute.Type stringAttrType; + private static BlackboardAttribute.Type jsonAttrType; /** * Adds the custom artifact type, with its associated custom attribute @@ -73,6 +76,7 @@ final class CustomArtifactType { dateTimeAttrType = blackboard.getOrAddAttributeType(DATETIME_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME, DATETIME_ATTR_DISPLAY_NAME); bytesAttrType = blackboard.getOrAddAttributeType(BYTES_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.BYTE, BYTES_ATTR_DISPLAY_NAME); stringAttrType = blackboard.getOrAddAttributeType(STRING_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING, STRING_ATTR_DISPLAY_NAME); + jsonAttrType = blackboard.getOrAddAttributeType(JSON_ATTR_TYPE_NAME, BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.JSON, JSON_ATTR_DISPLAY_NAME); } /** diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java index 517c1e46a6..001ad7271d 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/FileExporterSettingsPanel.java @@ -244,6 +244,8 @@ public final class FileExporterSettingsPanel extends JPanel { comboBoxValueType.addItem(BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.STRING.getLabel()); comboBoxValueType.addItem(BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.DATETIME.getLabel()); comboBoxValueType.addItem(BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.BYTE.getLabel()); + comboBoxValueType.addItem(BlackboardAttribute.TSK_BLACKBOARD_ATTRIBUTE_VALUE_TYPE.JSON.getLabel()); + comboBoxValueType.addItem(UNSET); load(); diff --git a/InternalPythonModules/android/imo.py b/InternalPythonModules/android/imo.py index 25dd750c1e..5a1bd89778 100644 --- a/InternalPythonModules/android/imo.py +++ b/InternalPythonModules/android/imo.py @@ -43,10 +43,14 @@ from org.sleuthkit.datamodel import Content from org.sleuthkit.datamodel import TskCoreException from org.sleuthkit.datamodel.Blackboard import BlackboardException from org.sleuthkit.datamodel import Account +from org.sleuthkit.datamodel.blackboardutils import FileAttachment +from org.sleuthkit.datamodel.blackboardutils import URLAttachment +from org.sleuthkit.datamodel.blackboardutils import MessageAttachments from org.sleuthkit.datamodel.blackboardutils import CommunicationArtifactsHelper from org.sleuthkit.datamodel.blackboardutils.CommunicationArtifactsHelper import MessageReadStatus from org.sleuthkit.datamodel.blackboardutils.CommunicationArtifactsHelper import CommunicationDirection +import json import traceback import general @@ -66,6 +70,8 @@ class IMOAnalyzer(general.AndroidComponentAnalyzer): -- A messages table which stores the message details --- sender/receiver buid, timestamp, message_type (1: incoming, 0: outgoing), message_read... --- 'imdata' column stores a json structure with all the message details, including attachments + ---- attachment file path may be specified in local_path or original_path. Original path, if available is a better candidate. + ---- For sent files, files seem to get uploaded to IMO Servers. There is no URL available in the imdata though. """ @@ -156,7 +162,7 @@ class IMOAnalyzer(general.AndroidComponentAnalyzer): msgReadStatus = MessageReadStatus.UNKNOWN timeStamp = messagesResultSet.getLong("timestamp") / 1000000000 - + msgBody = messagesResultSet.getString("last_message") messageArtifact = friendsDBHelper.addMessage( self._MESSAGE_TYPE, @@ -166,12 +172,34 @@ class IMOAnalyzer(general.AndroidComponentAnalyzer): timeStamp, msgReadStatus, "", # subject - messagesResultSet.getString("last_message"), + msgBody, "") # thread id - - # TBD: parse the imdata JSON structure to figure out if there is an attachment. - # If one exists, add the attachment as a derived file and a child of the message artifact. + + # Parse the imdata JSON structure to check if there is an attachment. + # If one exists, create an attachment and add to the message. + fileAttachments = ArrayList() + urlAttachments = ArrayList() + + imdataJsonStr = messagesResultSet.getString("imdata") + if imdataJsonStr is not None: + imdata_dict = json.loads(imdataJsonStr) + + # set to none if the key doesn't exist in the dict + attachmentOriginalPath = imdata_dict.get('original_path', None) + attachmentLocalPath = imdata_dict.get('local_path', None) + if attachmentOriginalPath: + attachmentPath = attachmentOriginalPath + else: + attachmentPath = attachmentLocalPath + + if attachmentPath: + # Create a file attachment with given path + fileAttachment = FileAttachment(current_case.getSleuthkitCase(), friendsDb.getDBFile().getDataSource(), attachmentPath) + fileAttachments.add(fileAttachment) + + msgAttachments = MessageAttachments(fileAttachments, []) + attachmentArtifact = friendsDBHelper.addAttachments(messageArtifact, msgAttachments) except SQLException as ex: self._logger.log(Level.WARNING, "Error processing query result for IMO friends", ex) From 1a07c9d3709a903844cca8ad4c43cdd106c93a8a Mon Sep 17 00:00:00 2001 From: Raman Arora Date: Thu, 31 Oct 2019 14:04:07 -0400 Subject: [PATCH 85/91] Addressed Codacy comment. --- Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java index 49784b46a7..e584c6bdfc 100644 --- a/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java +++ b/Core/src/org/sleuthkit/autopsy/test/CustomArtifactType.java @@ -97,6 +97,7 @@ final class CustomArtifactType { attributes.add(new BlackboardAttribute(dateTimeAttrType, MODULE_NAME, 60L)); attributes.add(new BlackboardAttribute(bytesAttrType, MODULE_NAME, DatatypeConverter.parseHexBinary("ABCD"))); attributes.add(new BlackboardAttribute(stringAttrType, MODULE_NAME, "Zero")); + attributes.add(new BlackboardAttribute(jsonAttrType, MODULE_NAME, "{\"fruit\": \"Apple\",\"size\": \"Large\",\"color\": \"Red\"}")); artifact.addAttributes(attributes); /* From d80dafc478408674c9c6abc8b904fccdeb6cb3e3 Mon Sep 17 00:00:00 2001 From: Raman Arora Date: Thu, 31 Oct 2019 15:06:18 -0400 Subject: [PATCH 86/91] Don't add caller/sender to the callee/recipient list. --- InternalPythonModules/android/fbmessenger.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/InternalPythonModules/android/fbmessenger.py b/InternalPythonModules/android/fbmessenger.py index e3c27d1765..2347144f09 100644 --- a/InternalPythonModules/android/fbmessenger.py +++ b/InternalPythonModules/android/fbmessenger.py @@ -182,11 +182,13 @@ class FBMessengerAnalyzer(general.AndroidComponentAnalyzer): contactsDb.close() - ## Extracts recipeint id from 'user_key' column and adds recipient to given list. - def addRecipientToList(self, user_key, recipientList): + ## Extracts recipeint id from 'user_key' column and adds recipient to given list, + ## if the recipeint id is not the same as sender id + def addRecipientToList(self, user_key, senderId, recipientList): if user_key is not None: - recipientId = user_key.replace('FACEBOOK:', '') - recipientList.append(recipientId) + recipientId = user_key.replace('FACEBOOK:', '') + if recipientId != senderId: + recipientList.append(recipientId) ## Extracts sender id from the json in 'sender' column. @@ -268,7 +270,7 @@ class FBMessengerAnalyzer(general.AndroidComponentAnalyzer): direction = self.deduceDirectionFromSenderId(fromId) # Get recipient and add to list - self.addRecipientToList(messagesResultSet.getString("user_key"), + self.addRecipientToList(messagesResultSet.getString("user_key"), fromId, recipientIdsList) timeStamp = messagesResultSet.getLong("timestamp_ms") / 1000 @@ -285,7 +287,7 @@ class FBMessengerAnalyzer(general.AndroidComponentAnalyzer): threadId = messagesResultSet.getString("thread_key") else: # same msgId as last, just collect recipient from current row - self.addRecipientToList(messagesResultSet.getString("user_key"), + self.addRecipientToList(messagesResultSet.getString("user_key"), fromId, recipientIdsList) @@ -373,7 +375,7 @@ class FBMessengerAnalyzer(general.AndroidComponentAnalyzer): direction = self.deduceDirectionFromSenderId(callerId) # Get recipient and add to list - self.addRecipientToList(messagesResultSet.getString("user_key"), + self.addRecipientToList(messagesResultSet.getString("user_key"), callerId, calleeIdsList) # the timestamp from call ended msg is used as end timestamp @@ -391,7 +393,7 @@ class FBMessengerAnalyzer(general.AndroidComponentAnalyzer): startTimeStamp = endTimeStamp - duration else: # same msgId as last, just collect callee from current row - self.addRecipientToList(messagesResultSet.getString("user_key"), + self.addRecipientToList(messagesResultSet.getString("user_key"), callerId, calleeIdsList) # at the end of the loop, add last message From c007b27f602d05d86d03d897417c2a3c4c828d15 Mon Sep 17 00:00:00 2001 From: esaunders Date: Mon, 4 Nov 2019 15:03:24 -0500 Subject: [PATCH 87/91] Switch to Amazon Corretto JDK which bundles Java FX. --- .travis.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index b907afbd81..575fa3f9dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,11 +61,9 @@ before_script: - if [ $TRAVIS_OS_NAME = osx ]; then brew uninstall java --force; brew cask uninstall java --force; - brew tap adoptopenjdk/openjdk; - brew cask install adoptopenjdk8; - wget https://cdn.azul.com/zulu/bin/zulu8.40.0.25-ca-fx-jdk8.0.222-macosx_x64.tar.gz; - sudo tar xf zulu8.40.0.25-ca-fx-jdk8.0.222-macosx_x64.tar.gz --strip-components=1 -C /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home; - export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home; + brew tap homebrew/cask-versions; + brew cask install corretto8; + export JAVA_HOME=/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home; fi - java -version From 8905b0d1679cacc24be8cebfea4063599e452a04 Mon Sep 17 00:00:00 2001 From: esaunders Date: Tue, 5 Nov 2019 14:32:30 -0500 Subject: [PATCH 88/91] Update Linux/Mac installation instructions and remove reference to Oracle. --- .../sleuthkit/autopsy/core/Bundle.properties | 2 +- .../autopsy/core/Bundle.properties-MERGED | 2 +- .../autopsy/core/Bundle_ja.properties | 57 +++++++++---------- Running_Linux_OSX.txt | 14 ++--- 4 files changed, 37 insertions(+), 38 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/core/Bundle.properties b/Core/src/org/sleuthkit/autopsy/core/Bundle.properties index db8e9e9808..4fccbcb6fa 100644 --- a/Core/src/org/sleuthkit/autopsy/core/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/core/Bundle.properties @@ -11,7 +11,7 @@ OpenIDE-Module-Short-Description=Autopsy Core Module org_sleuthkit_autopsy_core_update_center=http://sleuthkit.org/autopsy/updates.xml Services/AutoupdateType/org_sleuthkit_autopsy_core_update_center.settings=Autopsy Update Center Installer.errorInitJavafx.msg=Error initializing JavaFX. -Installer.errorInitJavafx.details=\ Some features will not be available. Check that you have the right JRE installed (Oracle JRE > 1.7.10). +Installer.errorInitJavafx.details=\ Some features will not be available. Check that you have JavaFX installed (OpenJFX 8). ServicesMonitor.failedService.notify.title=Service Is Down ServicesMonitor.failedService.notify.msg=Connection to {0} is down ServicesMonitor.restoredService.notify.title=Service Is Up diff --git a/Core/src/org/sleuthkit/autopsy/core/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/core/Bundle.properties-MERGED index 087eaec314..0b16a9701f 100755 --- a/Core/src/org/sleuthkit/autopsy/core/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/core/Bundle.properties-MERGED @@ -15,7 +15,7 @@ OpenIDE-Module-Short-Description=Autopsy Core Module org_sleuthkit_autopsy_core_update_center=http://sleuthkit.org/autopsy/updates.xml Services/AutoupdateType/org_sleuthkit_autopsy_core_update_center.settings=Autopsy Update Center Installer.errorInitJavafx.msg=Error initializing JavaFX. -Installer.errorInitJavafx.details=\ Some features will not be available. Check that you have the right JRE installed (Oracle JRE > 1.7.10). +Installer.errorInitJavafx.details=\ Some features will not be available. Check that you have JavaFX installed (OpenJFX 8). ServicesMonitor.failedService.notify.title=Service Is Down ServicesMonitor.failedService.notify.msg=Connection to {0} is down ServicesMonitor.restoredService.notify.title=Service Is Up diff --git a/Core/src/org/sleuthkit/autopsy/core/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/core/Bundle_ja.properties index 171ced6172..7bd07e089b 100644 --- a/Core/src/org/sleuthkit/autopsy/core/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/core/Bundle_ja.properties @@ -1,31 +1,30 @@ -OpenIDE-Module-Display-Category=\u30A4\u30F3\u30D5\u30E9\u30B9\u30C8\u30E9\u30AF\u30C1\u30E3\u30FC +OpenIDE-Module-Display-Category=\u30a4\u30f3\u30d5\u30e9\u30b9\u30c8\u30e9\u30af\u30c1\u30e3\u30fc OpenIDE-Module-Long-Description=\ - \u3053\u308C\u304CAutopsy\u306E\u30B3\u30A2\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u3059\u3002\n\n\ - \u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u306E\u307F\u3067\u5B9F\u884C\u3059\u308B\u306E\u306B\u5FC5\u8981\u306A\u4E3B\u8981\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\uFF1ARCP\u30D7\u30E9\u30C3\u30C8\u30D5\u30A9\u30FC\u30E0\u3001\u30A6\u30A3\u30F3\u30C9\u30A6\u30A4\u30F3\u30B0GUI\u3001Sleuth Kit\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u3001\u30C7\u30FC\u30BF\u30E2\u30C7\u30EB\uFF0F\u30B9\u30C8\u30EC\u30FC\u30B8\u3001\u30A8\u30AF\u30B9\u30D7\u30ED\u30FC\u30E9\u3001\u7D50\u679C\u30D3\u30E5\u30FC\u30A2\u3001\u30B3\u30F3\u30C6\u30F3\u30C4\u30D3\u30E5\u30FC\u30A2\u3001\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u7528\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u3001\u30EC\u30DD\u30FC\u30C8\u751F\u6210\u3001\u30D5\u30A1\u30A4\u30EB\u691C\u7D22\u7B49\u306E\u4E3B\u8981\u30C4\u30FC\u30EB\u3002\n\n\ - \u30E2\u30B8\u30E5\u30FC\u30EB\u5185\u306E\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u306B\u306F\u30A4\u30F3\u30B8\u30A7\u30B9\u30C8\u3001\u30D3\u30E5\u30FC\u30A2\u3001\u30EC\u30DD\u30FC\u30C8\u751F\u6210\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u958B\u767A\u7528\u306EAPI\u304C\u542B\u307E\u308C\u307E\u3059\u3002\ - \u30E2\u30B8\u30E5\u30FC\u30EB\u306FAutopsy\u30D7\u30E9\u30B0\u30A4\u30F3\u30A4\u30F3\u30B9\u30C8\u30FC\u30E9\u30FC\u3092\u4F7F\u7528\u3057\u3001\u30D7\u30E9\u30B0\u30A4\u30F3\u3068\u3057\u3066\u5B9F\u88C5\u3067\u304D\u307E\u3059\u3002\n\ - \u3053\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u306F\u30A2\u30F3\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u3066\u3044\u306A\u3051\u308C\u3070\u3001Autopsy\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\n\n\ - \u8A73\u7D30\u306F\u3053\u3061\u3089\u3067\u3054\u78BA\u8A8D\u304F\u3060\u3055\u3044\u3002http\://www.sleuthkit.org/autopsy/ -OpenIDE-Module-Name=Autopsy-\u30B3\u30A2 -OpenIDE-Module-Short-Description=Autopsy\u30B3\u30A2\u30E2\u30B8\u30E5\u30FC\u30EB + \u3053\u308c\u304cAutopsy\u306e\u30b3\u30a2\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\n\n\ + \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u307f\u3067\u5b9f\u884c\u3059\u308b\u306e\u306b\u5fc5\u8981\u306a\u4e3b\u8981\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u304c\u542b\u307e\u308c\u3066\u3044\u307e\u3059\uff1aRCP\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3001\u30a6\u30a3\u30f3\u30c9\u30a6\u30a4\u30f3\u30b0GUI\u3001Sleuth Kit\u30d0\u30a4\u30f3\u30c7\u30a3\u30f3\u30b0\u3001\u30c7\u30fc\u30bf\u30e2\u30c7\u30eb\uff0f\u30b9\u30c8\u30ec\u30fc\u30b8\u3001\u30a8\u30af\u30b9\u30d7\u30ed\u30fc\u30e9\u3001\u7d50\u679c\u30d3\u30e5\u30fc\u30a2\u3001\u30b3\u30f3\u30c6\u30f3\u30c4\u30d3\u30e5\u30fc\u30a2\u3001\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u7528\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3001\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u3001\u30d5\u30a1\u30a4\u30eb\u691c\u7d22\u7b49\u306e\u4e3b\u8981\u30c4\u30fc\u30eb\u3002\n\n\ + \u30e2\u30b8\u30e5\u30fc\u30eb\u5185\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306b\u306f\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u3001\u30d3\u30e5\u30fc\u30a2\u3001\u30ec\u30dd\u30fc\u30c8\u751f\u6210\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u958b\u767a\u7528\u306eAPI\u304c\u542b\u307e\u308c\u307e\u3059\u3002\ + \u30e2\u30b8\u30e5\u30fc\u30eb\u306fAutopsy\u30d7\u30e9\u30b0\u30a4\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30e9\u30fc\u3092\u4f7f\u7528\u3057\u3001\u30d7\u30e9\u30b0\u30a4\u30f3\u3068\u3057\u3066\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002\n\ + \u3053\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u30a2\u30f3\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u306a\u3044\u3067\u304f\u3060\u3055\u3044\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070\u3001Autopsy\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002\n\n\ + \u8a73\u7d30\u306f\u3053\u3061\u3089\u3067\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002http\://www.sleuthkit.org/autopsy/ +OpenIDE-Module-Name=Autopsy-\u30b3\u30a2 +OpenIDE-Module-Short-Description=Autopsy\u30b3\u30a2\u30e2\u30b8\u30e5\u30fc\u30eb org_sleuthkit_autopsy_core_update_center=http\://sleuthkit.org/autopsy/updates_ja.xml -Services/AutoupdateType/org_sleuthkit_autopsy_core_update_center.settings=Autopsy\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8\u30BB\u30F3\u30BF\u30FC -Installer.errorInitJavafx.msg=JavaFX\u521D\u671F\u5316\u30A8\u30E9\u30FC -Installer.errorInitJavafx.details=\u4E00\u90E8\u306E\u6A5F\u80FD\u304C\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u6B63\u3057\u3044JRE\u304C\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u3055\u308C\u3066\u3044\u308B\u304B\u3092\u78BA\u8A8D\u3057\u3066\u4E0B\u3055\u3044\u3002\uFF08Oracle JRE > 1.7.10\uFF09 -ServicesMonitor.failedService.notify.title=\u30B5\u30FC\u30D3\u30B9\u304C\u505C\u6B62\u3057\u3066\u3044\u307E\u3059 -ServicesMonitor.failedService.notify.msg={0}\u3078\u306E\u63A5\u7D9A\u304C\u30C0\u30A6\u30F3\u3057\u3066\u3044\u307E\u3059 -ServicesMonitor.restoredService.notify.title=\u30B5\u30FC\u30D3\u30B9\u304C\u7A3C\u50CD\u4E2D\u3067\u3059 -ServicesMonitor.restoredService.notify.msg={0}\u3078\u306E\u63A5\u7D9A\u304C\u5229\u7528\u3067\u304D\u307E\u3059 -ServicesMonitor.statusChange.notify.title=\u30B5\u30FC\u30D3\u30B9\u30B9\u30C6\u30FC\u30BF\u30B9\u30A2\u30C3\u30D7\u30C7\u30FC\u30C8 -ServicesMonitor.statusChange.notify.msg={0}\u306E\u30B9\u30C6\u30FC\u30BF\u30B9\u306F{1} -ServicesMonitor.nullServiceName.excepton.txt=\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u305F\u30B5\u30FC\u30D3\u30B9\u306F\u30CC\u30EB\u3067\u3059 -ServicesMonitor.unknownServiceName.excepton.txt=\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u305F\u30B5\u30FC\u30D3\u30B9{0}\u306F\u4E0D\u660E\u3067\u3059 -TextConverter.convert.exception.txt=\u30C6\u30AD\u30B9\u30C8{0}\u3092hex\u30C6\u30AD\u30B9\u30C8\u306B\u5909\u63DB\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F -TextConverter.convertFromHex.exception.txt=hex\u30C6\u30AD\u30B9\u30C8\u3092\u30C6\u30AD\u30B9\u30C8\u306B\u5909\u63DB\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F -ServicesMonitor.KeywordSearchNull=\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22\u30B5\u30FC\u30D3\u30B9\u3092\u898B\u3064\u3051\u308C\u307E\u305B\u3093\u3067\u3057\u305F -ServicesMonitor.InvalidPortNumber=\u7121\u52B9\u306A\u30DD\u30FC\u30C8\u756A\u53F7 -ServicesMonitor.remoteCaseDatabase.displayName.text=\u8907\u6570\u306E\u30E6\u30FC\u30B6\u30FC\u306E\u30B1\u30FC\u30B9\u306E\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u30B5\u30FC\u30D3\u30B9 -ServicesMonitor.remoteKeywordSearch.displayName.text=\u8907\u6570\u306E\u30E6\u30FC\u30B6\u30FC\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u691C\u7D22\u30B5\u30FC\u30D3\u30B9 -ServicesMonitor.messaging.displayName.text=\u30E1\u30C3\u30BB\u30FC\u30B8\u30B5\u30FC\u30D3\u30B9 -ServicesMonitor.databaseConnectionInfo.error.msg=\u30B1\u30FC\u30B9\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u63A5\u7D9A\u60C5\u5831\u3092\u5165\u624B\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F -ServicesMonitor.messagingService.connErr.text=\u30E1\u30C3\u30BB\u30FC\u30B8\u30B5\u30FC\u30D3\u30B9\u306E\u63A5\u7D9A\u60C5\u5831\u3092\u5165\u624B\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F \ No newline at end of file +Services/AutoupdateType/org_sleuthkit_autopsy_core_update_center.settings=Autopsy\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8\u30bb\u30f3\u30bf\u30fc +Installer.errorInitJavafx.msg=JavaFX\u521d\u671f\u5316\u30a8\u30e9\u30fc +ServicesMonitor.failedService.notify.title=\u30b5\u30fc\u30d3\u30b9\u304c\u505c\u6b62\u3057\u3066\u3044\u307e\u3059 +ServicesMonitor.failedService.notify.msg={0}\u3078\u306e\u63a5\u7d9a\u304c\u30c0\u30a6\u30f3\u3057\u3066\u3044\u307e\u3059 +ServicesMonitor.restoredService.notify.title=\u30b5\u30fc\u30d3\u30b9\u304c\u7a3c\u50cd\u4e2d\u3067\u3059 +ServicesMonitor.restoredService.notify.msg={0}\u3078\u306e\u63a5\u7d9a\u304c\u5229\u7528\u3067\u304d\u307e\u3059 +ServicesMonitor.statusChange.notify.title=\u30b5\u30fc\u30d3\u30b9\u30b9\u30c6\u30fc\u30bf\u30b9\u30a2\u30c3\u30d7\u30c7\u30fc\u30c8 +ServicesMonitor.statusChange.notify.msg={0}\u306e\u30b9\u30c6\u30fc\u30bf\u30b9\u306f{1} +ServicesMonitor.nullServiceName.excepton.txt=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u30b5\u30fc\u30d3\u30b9\u306f\u30cc\u30eb\u3067\u3059 +ServicesMonitor.unknownServiceName.excepton.txt=\u30ea\u30af\u30a8\u30b9\u30c8\u3055\u308c\u305f\u30b5\u30fc\u30d3\u30b9{0}\u306f\u4e0d\u660e\u3067\u3059 +TextConverter.convert.exception.txt=\u30c6\u30ad\u30b9\u30c8{0}\u3092hex\u30c6\u30ad\u30b9\u30c8\u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f +TextConverter.convertFromHex.exception.txt=hex\u30c6\u30ad\u30b9\u30c8\u3092\u30c6\u30ad\u30b9\u30c8\u306b\u5909\u63db\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f +ServicesMonitor.KeywordSearchNull=\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u30b5\u30fc\u30d3\u30b9\u3092\u898b\u3064\u3051\u308c\u307e\u305b\u3093\u3067\u3057\u305f +ServicesMonitor.InvalidPortNumber=\u7121\u52b9\u306a\u30dd\u30fc\u30c8\u756a\u53f7 +ServicesMonitor.remoteCaseDatabase.displayName.text=\u8907\u6570\u306e\u30e6\u30fc\u30b6\u30fc\u306e\u30b1\u30fc\u30b9\u306e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b5\u30fc\u30d3\u30b9 +ServicesMonitor.remoteKeywordSearch.displayName.text=\u8907\u6570\u306e\u30e6\u30fc\u30b6\u30fc\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u30b5\u30fc\u30d3\u30b9 +ServicesMonitor.messaging.displayName.text=\u30e1\u30c3\u30bb\u30fc\u30b8\u30b5\u30fc\u30d3\u30b9 +ServicesMonitor.databaseConnectionInfo.error.msg=\u30b1\u30fc\u30b9\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u63a5\u7d9a\u60c5\u5831\u3092\u5165\u624b\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f +ServicesMonitor.messagingService.connErr.text=\u30e1\u30c3\u30bb\u30fc\u30b8\u30b5\u30fc\u30d3\u30b9\u306e\u63a5\u7d9a\u60c5\u5831\u3092\u5165\u624b\u4e2d\u306b\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f \ No newline at end of file diff --git a/Running_Linux_OSX.txt b/Running_Linux_OSX.txt index 56ea6a5888..bb60569a56 100644 --- a/Running_Linux_OSX.txt +++ b/Running_Linux_OSX.txt @@ -14,21 +14,21 @@ The following need to be done at least once. They do not need to be repeated for 1. Download a 64 bit Java 8 JRE for your specific platform from https://www.azul.com/downloads/zulu-community 2. Install the JRE. e.g. % sudo apt install ./zulu8.40.0.25-ca-jre8.0.222-linux_amd64.deb 3. Download a 64 bit Java 8 JavaFX for your specific platform from the same location. + - Note that you may need to select "Older Zulu versions" for FX to become available in the "Java Package" dropdown. 4. Extract the contents of the JavaFX archive into the folder where the JRE was installed. e.g. % sudo tar xzf ~/Downloads/zulu8.40.0.25-ca-fx-jre8.0.222-linux_x64.tar.gz -C /usr/lib/jvm/zre-8-amd64 --strip-components=1 NOTE: You may need to log out and back in again after setting JAVA_HOME before the Autopsy unix_setup.sh script can see the value. --- OS X: Any Java 8 version of OpenJDK/OpenJFX distribution should suffice. +-- OS X: Any Java 8 version of OpenJDK/OpenJFX distribution should suffice. The following instructions use the AdoptOpenJDK distribution. 1. Install a 64 bit Java 8 JRE. - % brew tap adoptopenjdk/openjdk % brew cask install adoptopenjdk8 - 2. Download a 64 bit Java 8 JavaFX for macOS from https://www.azul.com/downloads/zulu-community - 3. Extract the contents of the JavaFX archive into the folder where the JRE was installed. - e.g. % sudo tar xf ~/Downloads/zulu8.40.0.25-ca-fx-jre8.0.222-macosx_x64.tar.gz -C /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home--strip-components=1 - 4. Confirm Java 8 is being found by running 'java -version' - 5. Set JAVA_HOME environment variable to location of JRE installation. + 2. Set JAVA_HOME environment variable to location of JRE installation. + e.g. add the following to ~/.bashrc + export JAVA_HOME=$(/usr/libexec/java_home -v 1.8) + 3. Confirm your version of Java by running + % java -version * Install The Sleuth Kit Java Bindings * From 5293d319a031c4f61a3b1c3350ff68e2b7863b4e Mon Sep 17 00:00:00 2001 From: Eammon Date: Tue, 5 Nov 2019 16:21:58 -0500 Subject: [PATCH 89/91] Remove extra space which caused travis to ignore commits. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 575fa3f9dc..dd6b50f34a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: required jobs: include: - os: linux - dist: bionic + dist: bionic - os: osx env: From 6e1bc93225a0826fef56b0922b6bf14e7babfd5a Mon Sep 17 00:00:00 2001 From: Eammon Date: Tue, 5 Nov 2019 16:45:03 -0500 Subject: [PATCH 90/91] Set execute permission on travis_build.sh --- travis_build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 travis_build.sh diff --git a/travis_build.sh b/travis_build.sh old mode 100644 new mode 100755 From 80ae1aa934be0b02dab10fd53de6dad4bfdf66eb Mon Sep 17 00:00:00 2001 From: Eammon Date: Tue, 5 Nov 2019 17:41:45 -0500 Subject: [PATCH 91/91] configure not found. --- travis_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/travis_build.sh b/travis_build.sh index d25d52d6ae..f7b7cfb72d 100755 --- a/travis_build.sh +++ b/travis_build.sh @@ -3,7 +3,7 @@ set -e echo "Building TSK..." cd sleuthkit/sleuthkit -./bootstrap && configure --prefix=/usr && make +./bootstrap && ./configure --prefix=/usr && make pushd bindings/java && ant -q dist-PostgreSQL && popd echo "Building Autopsy..." && echo -en 'travis_fold:start:script.build\\r'