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;
40 class CallLogAnalyzer {
42 private Connection connection = null;
43 private ResultSet resultSet = null;
44 private Statement statement = null;
45 private String dbPath =
"";
46 private long fileId = 0;
47 private java.io.File jFile = null;
52 public void findCallLogs() {
54 List<AbstractFile> absFiles;
57 absFiles = skCase.findAllFilesWhere(
"name ='contacts2.db' OR name ='contacts.db'");
58 if (absFiles.isEmpty()) {
61 for (AbstractFile AF : absFiles) {
65 dbPath = jFile.toString();
67 findCallLogsInDB(dbPath, fileId);
68 }
catch (Exception e) {
69 logger.log(Level.SEVERE,
"Error parsing Call logs", e);
72 }
catch (TskCoreException e) {
73 logger.log(Level.SEVERE,
"Error finding Call logs", e);
77 private void findCallLogsInDB(String DatabasePath,
long fId) {
78 if (DatabasePath == null || DatabasePath.isEmpty()) {
82 Class.forName(
"org.sqlite.JDBC");
83 connection = DriverManager.getConnection(
"jdbc:sqlite:" + DatabasePath);
84 statement = connection.createStatement();
85 }
catch (ClassNotFoundException | SQLException e) {
86 logger.log(Level.SEVERE,
"Error opening database", e);
92 AbstractFile f = skCase.getAbstractFileById(fId);
94 logger.log(Level.SEVERE,
"Error getting abstract file " + fId);
99 resultSet = statement.executeQuery(
100 "SELECT number,date,duration,type, name FROM calls ORDER BY date DESC;");
102 BlackboardArtifact bba;
109 while (resultSet.next()) {
110 name = resultSet.getString(
"name");
111 number = resultSet.getString(
"number");
112 duration = resultSet.getString(
"duration");
113 date = resultSet.getString(
"date");
114 type = resultSet.getString(
"type");
116 bba = f.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG);
117 if (type.equalsIgnoreCase(
"outgoing")) {
118 bba.addAttribute(
new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, moduleName, number));
120 bba.addAttribute(
new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, moduleName, number));
122 bba.addAttribute(
new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START, moduleName, date));
123 bba.addAttribute(
new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END, moduleName, duration + date));
124 bba.addAttribute(
new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, type));
125 bba.addAttribute(
new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, moduleName, name));
131 logger.log(Level.SEVERE, NbBundle.getMessage(
Blackboard.class,
"Blackboard.unableToIndexArtifact.error.msg", bba.getDisplayName()), ex);
133 NbBundle.getMessage(
Blackboard.class,
"Blackboard.unableToIndexArtifact.exception.msg"), bba.getDisplayName());
136 }
catch (Exception e) {
137 logger.log(Level.SEVERE,
"Error parsing Call logs to the Blackboard", e);
143 }
catch (Exception e) {
144 logger.log(Level.SEVERE,
"Error closing the database", e);
147 }
catch (Exception e) {
148 logger.log(Level.SEVERE,
"Error parsing Call logs to the Blackboard", e);
void indexArtifact(BlackboardArtifact artifact)
String getTempDirectory()
static< T > long writeToFile(Content content, java.io.File outputFile, ProgressHandle progress, Future< T > worker, boolean source)
SleuthkitCase getSleuthkitCase()
Blackboard getBlackboard()
static void error(String title, String message)
static Case getCurrentCase()
synchronized static Logger getLogger(String name)