19 package org.sleuthkit.autopsy.modules.iOS;
21 import java.sql.Connection;
22 import java.sql.DriverManager;
23 import java.sql.ResultSet;
24 import java.sql.SQLException;
25 import java.sql.Statement;
26 import java.util.List;
27 import java.util.logging.Level;
28 import org.openide.util.NbBundle.Messages;
41 class CallLogAnalyzer {
43 private Connection connection = null;
44 private ResultSet resultSet = null;
45 private Statement statement = null;
46 private String dbPath =
"";
47 private long fileId = 0;
48 private java.io.File jFile = null;
55 List<AbstractFile> absFiles;
58 absFiles = skCase.
findAllFilesWhere(
"name ='contacts2.db' OR name ='contacts.db'");
59 if (absFiles.isEmpty()) {
66 dbPath = jFile.toString();
68 findCallLogsInDB(dbPath, fileId);
69 }
catch (Exception e) {
70 logger.log(Level.SEVERE,
"Error parsing Call logs", e);
74 logger.log(Level.SEVERE,
"Error finding Call logs", e);
78 @Messages({
"CallLogAnalyzer.indexError.message=Failed to index call log artifact for keyword search."})
79 private void findCallLogsInDB(String DatabasePath,
long fId) {
80 if (DatabasePath == null || DatabasePath.isEmpty()) {
84 Class.forName(
"org.sqlite.JDBC");
85 connection = DriverManager.getConnection(
"jdbc:sqlite:" + DatabasePath);
86 statement = connection.createStatement();
87 }
catch (ClassNotFoundException | SQLException e) {
88 logger.log(Level.SEVERE,
"Error opening database", e);
96 logger.log(Level.SEVERE,
"Error getting abstract file " + fId);
101 resultSet = statement.executeQuery(
102 "SELECT number,date,duration,type, name FROM calls ORDER BY date DESC;");
111 while (resultSet.next()) {
112 name = resultSet.getString(
"name");
113 number = resultSet.getString(
"number");
114 duration = resultSet.getString(
"duration");
115 date = resultSet.getString(
"date");
116 type = resultSet.getString(
"type");
119 if (type.equalsIgnoreCase(
"outgoing")) {
133 logger.log(Level.SEVERE,
"Unable to index blackboard artifact " + bba.
getArtifactID(), ex);
135 Bundle.CallLogAnalyzer_indexError_message(), bba.
getDisplayName());
138 }
catch (Exception e) {
139 logger.log(Level.SEVERE,
"Error parsing Call logs to the Blackboard", e);
145 }
catch (Exception e) {
146 logger.log(Level.SEVERE,
"Error closing the database", e);
149 }
catch (Exception e) {
150 logger.log(Level.SEVERE,
"Error parsing Call logs to the Blackboard", e);
String getTempDirectory()
static< T > long writeToFile(Content content, java.io.File outputFile, ProgressHandle progress, Future< T > worker, boolean source)
AbstractFile getAbstractFileById(long id)
void addAttribute(BlackboardAttribute attr)
SleuthkitCase getSleuthkitCase()
Blackboard getBlackboard()
BlackboardArtifact newArtifact(int artifactTypeID)
static void error(String title, String message)
synchronized void indexArtifact(BlackboardArtifact artifact)
List< AbstractFile > findAllFilesWhere(String sqlWhereClause)
static Case getCurrentCase()
synchronized static Logger getLogger(String name)