diff --git a/iMessageAnalyzer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/iMessageAnalyzer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/iMessageAnalyzer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/iMessageAnalyzer/.DS_Store b/iMessageAnalyzer/.DS_Store index ad65093..e98cc22 100644 Binary files a/iMessageAnalyzer/.DS_Store and b/iMessageAnalyzer/.DS_Store differ diff --git a/iMessageAnalyzer/Assets.xcassets/.DS_Store b/iMessageAnalyzer/Assets.xcassets/.DS_Store index 6989fda..d17a747 100644 Binary files a/iMessageAnalyzer/Assets.xcassets/.DS_Store and b/iMessageAnalyzer/Assets.xcassets/.DS_Store differ diff --git a/iMessageAnalyzer/DatabaseManager.m b/iMessageAnalyzer/DatabaseManager.m index 3a2f5f2..00e30f3 100644 --- a/iMessageAnalyzer/DatabaseManager.m +++ b/iMessageAnalyzer/DatabaseManager.m @@ -365,7 +365,7 @@ - (NSMutableArray*) getAllMessagesForPerson:(Person *)person "CASE WHEN LENGTH(date) >= 18 " "THEN (date / 1000000000) " "ELSE date END AS adjusted_date, " - "date_read, is_from_me, cache_has_attachments, handle_id " + "date_read, is_from_me, cache_has_attachments, handle_id, attributedBody " "FROM message AS messageT " "INNER JOIN chat_message_join AS chatMessageT " "ON chatMessageT.chat_id IN (%@) " @@ -386,6 +386,43 @@ - (NSMutableArray*) getAllMessagesForPerson:(Person *)person NSString *text = @""; if(sqlite3_column_text(statement, 2) != NULL) { text = [NSString stringWithUTF8String: (const char*) sqlite3_column_text(statement, 2)]; + } else { + const void *blob = sqlite3_column_blob(statement, 10); + int blob_size = sqlite3_column_bytes(statement, 10); + + NSData *data = [NSData dataWithBytes:blob length:blob_size]; + + const char *bytes = [data bytes]; + char hexBuffer[2 * [data length] + 1]; // a buffer 2 times the size of data + 1 null character + int len = 0; + for (int i = 0; i < [data length]; i++) { + len += sprintf(hexBuffer + len, "%02x", bytes[i] & 0xff); + } + NSString* hexString = [NSString stringWithUTF8String:hexBuffer]; + NSRange range = [hexString rangeOfString:@"4e53537472696e67"]; + if (range.location != NSNotFound) { + hexString = [hexString substringFromIndex:range.location + range.length]; + hexString = [hexString substringFromIndex:12]; + } + range = [hexString rangeOfString:@"8684"]; + if (range.location != NSNotFound) { + hexString = [hexString substringToIndex:range.location]; + } + // hexString = [hexString stringByReplacingOccurrencesOfString:@" " withString:@""]; + NSMutableData *newData= [[NSMutableData alloc] init]; + unsigned char whole_byte; + char byte_chars[3] = {'\0','\0','\0'}; + int i; + for (i=0; i < [hexString length]/2; i++) { + byte_chars[0] = [hexString characterAtIndex:i*2]; + byte_chars[1] = [hexString characterAtIndex:i*2+1]; + whole_byte = strtol(byte_chars, NULL, 16); + [newData appendBytes:&whole_byte length:1]; + } + NSString *result = [[NSString alloc] initWithData:newData encoding:NSUTF8StringEncoding]; + if (result) { + text = result; + } } const unsigned char *isIMessage = sqlite3_column_text(statement, 3); diff --git a/import sqlite3.py b/import sqlite3.py new file mode 100644 index 0000000..1646b15 --- /dev/null +++ b/import sqlite3.py @@ -0,0 +1,2 @@ +import sqlite3 +conn = sqlite3.connect('example.db') \ No newline at end of file