20 package org.sleuthkit.autopsy.datamodel.utils;
23 import java.sql.ResultSet;
24 import java.sql.SQLException;
25 import java.util.HashMap;
41 private static final String
SELECT_DATA_SOURCES_LOGICAL =
"select obj_id, name from tsk_files where obj_id in (SELECT obj_id FROM tsk_objects WHERE obj_id in (select obj_id from data_source_info))";
43 private static final String
SELECT_DATA_SOURCES_IMAGE =
"select obj_id, name from tsk_image_names where obj_id in (SELECT obj_id FROM tsk_objects WHERE obj_id in (select obj_id from data_source_info))";
55 public static Map<Long, String>
getLogicalDataSources(SleuthkitCase tskDb)
throws TskCoreException, SQLException {
57 Map<Long, String> dataSourceMap =
new HashMap<>();
60 SleuthkitCase.CaseDbQuery query = tskDb.executeQuery(SELECT_DATA_SOURCES_LOGICAL);
61 ResultSet resultSet = query.getResultSet()) {
62 while (resultSet.next()) {
63 Long objectId = resultSet.getLong(1);
64 String dataSourceName = resultSet.getString(2);
65 dataSourceMap.put(objectId, dataSourceName);
81 public static Map<Long, String>
getImageDataSources(SleuthkitCase tskDb)
throws SQLException, TskCoreException {
83 Map<Long, String> dataSourceMap =
new HashMap<>();
86 SleuthkitCase.CaseDbQuery query = tskDb.executeQuery(SELECT_DATA_SOURCES_IMAGE);
87 ResultSet resultSet = query.getResultSet()) {
89 while (resultSet.next()) {
90 Long objectId = resultSet.getLong(1);
91 if (!dataSourceMap.containsKey(objectId)) {
92 String dataSourceName = resultSet.getString(2);
93 File image =
new File(dataSourceName);
94 String dataSourceNameTrimmed = image.getName();
95 dataSourceMap.put(objectId, dataSourceNameTrimmed);
113 Map<Long, String> dataSourceMap =
new HashMap<>();
122 return dataSourceMap;
static final String SELECT_DATA_SOURCES_IMAGE
static Map< Long, String > getLogicalDataSources(SleuthkitCase tskDb)
static Map< Long, String > getAllDataSources()
SleuthkitCase getSleuthkitCase()
static Map< Long, String > getImageDataSources(SleuthkitCase tskDb)
static final String SELECT_DATA_SOURCES_LOGICAL
static Case getCurrentCaseThrows()