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;
37 class CallLogAnalyzer {
39 private Connection connection = null;
40 private ResultSet resultSet = null;
41 private Statement statement = null;
42 private String dbPath =
"";
43 private long fileId = 0;
44 private java.io.File jFile = null;
48 public void findCallLogs() {
49 List<AbstractFile> absFiles;
52 absFiles = skCase.
findAllFilesWhere(
"name ='contacts2.db' OR name ='contacts.db'");
53 if (absFiles.isEmpty()) {
60 dbPath = jFile.toString();
62 findCallLogsInDB(dbPath, fileId);
63 }
catch (Exception e) {
64 logger.log(Level.SEVERE,
"Error parsing Call logs", e);
68 logger.log(Level.SEVERE,
"Error finding Call logs", e);
72 private void findCallLogsInDB(String DatabasePath,
long fId) {
73 if (DatabasePath == null || DatabasePath.isEmpty()) {
77 Class.forName(
"org.sqlite.JDBC");
78 connection = DriverManager.getConnection(
"jdbc:sqlite:" + DatabasePath);
79 statement = connection.createStatement();
80 }
catch (ClassNotFoundException | SQLException e) {
81 logger.log(Level.SEVERE,
"Error opening database", e);
89 logger.log(Level.SEVERE,
"Error getting abstract file " + fId);
94 resultSet = statement.executeQuery(
95 "SELECT number,date,duration,type, name FROM calls ORDER BY date DESC;");
104 while (resultSet.next()) {
105 name = resultSet.getString(
"name");
106 number = resultSet.getString(
"number");
107 duration = resultSet.getString(
"duration");
108 date = resultSet.getString(
"date");
109 type = resultSet.getString(
"type");
112 if(type.equalsIgnoreCase(
"outgoing")) {
124 }
catch (Exception e) {
125 logger.log(Level.SEVERE,
"Error parsing Call logs to the Blackboard", e);
131 }
catch (Exception e) {
132 logger.log(Level.SEVERE,
"Error closing the database", e);
135 }
catch (Exception e) {
136 logger.log(Level.SEVERE,
"Error parsing Call logs to the Blackboard", e);
static< T, V > long writeToFile(Content content, java.io.File outputFile, ProgressHandle progress, SwingWorker< T, V > worker, boolean source)
String getTempDirectory()
AbstractFile getAbstractFileById(long id)
void addAttribute(BlackboardAttribute attr)
SleuthkitCase getSleuthkitCase()
BlackboardArtifact newArtifact(int artifactTypeID)
List< AbstractFile > findAllFilesWhere(String sqlWhereClause)
static Case getCurrentCase()
static Logger getLogger(String name)