Skip to content

Commit

Permalink
Broken sqlite3 program to extract databases (email,sms,etc)
Browse files Browse the repository at this point in the history
  • Loading branch information
milo2012 committed Oct 1, 2011
1 parent 585f6bc commit a0a3023
Show file tree
Hide file tree
Showing 22 changed files with 87 additions and 0 deletions.
Empty file added sql1/.theos/fakeroot
Empty file.
1 change: 1 addition & 0 deletions sql1/.theos/packages/com.yourcompany.sql1-0.0.1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1-31
6 changes: 6 additions & 0 deletions sql1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include theos/makefiles/common.mk

TOOL_NAME = sql1
sql1_FILES = main.mm
sql1_LDFLAGS = -lsqlite3
include $(THEOS_MAKE_PATH)/tool.mk
11 changes: 11 additions & 0 deletions sql1/_/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Package: com.yourcompany.sql1
Name: sql1
Depends:
Version: 0.0.1-31
Architecture: iphoneos-arm
Description: An awesome tool of some sort!!
Maintainer: System Administrator
Author: System Administrator
Section: System
Tag: role::hacker
Installed-Size: 16
Binary file added sql1/_/usr/bin/sql1
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions sql1/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Package: com.yourcompany.sql1
Name: sql1
Depends:
Version: 0.0.1
Architecture: iphoneos-arm
Description: An awesome tool of some sort!!
Maintainer: System Administrator
Author: System Administrator
Section: System
Tag: role::hacker
58 changes: 58 additions & 0 deletions sql1/main.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#import <sqlite3.h>
//#import "/usr/include/sqlite3.h"

#define allTrim( object ) [object stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]

int main(int argc, char **argv, char **envp) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *addressBook = @"/private/var/mobile/Library/AddressBook/AddressBook.sqlitedb";
NSString *smsDB = @"/private/var/mobile/Library/SMS/sms.db";
NSString *cellTowerLocation = @"/private/var/root/Library/Caches/locationd/consolidated.db";
NSString *callHistoryMobile = @"/private/var/mobile/Library/CallHistory/call_history.db";
NSString *callHistoryWireless = @"/private/var/wireless/Library/CallHistory/call_history.db";
NSString *googleMaps = @"/mobile/Library/Caches/Map/Tiles/MapTiles.sqlitedb";
NSString *emailDB = @"/mobile/Library/Mail/Envelope Index";
NSString *voiceMail = @"/mobile/Library/Voicemail/voicemail.db";

sqlite3 *database;
sqlite3_stmt *statement;

if(sqlite3_open([addressBook UTF8String],&database)==SQLITE_OK){
const char *sqlStatement = "select ABPerson.prefix, ABPerson.first,ABPerson.last, ABMultiValue.value from ABPerson,ABMultiValue where ABMultiValue.record_id=ABPerson.ROWID";
NSError* error = nil;
sqlite3_prepare_v2(database,sqlStatement,-1,&statement,nil);
if(error!=nil){
NSLog(@"Error: %@ %@",error, [error userInfo]);
}else{

while(sqlite3_step(statement)==SQLITE_ROW)
{
char *firstNameMessage1 = (char *)sqlite3_column_text(statement,1);
NSString *firstNameMessage2 = nil;
if(firstNameMessage1 != NULL){
firstNameMessage2 = [NSString stringWithUTF8String:(char *) sqlite3_column_text(statement,1)];
}

char *lastNameMessage1 = (char *)sqlite3_column_text(statement,2);
NSString *lastNameMessage2 = nil;
if(lastNameMessage1 != NULL){
lastNameMessage2 = [NSString stringWithUTF8String:(char *) sqlite3_column_text(statement,2)];
}
printf("%s\t\t%s\n",
[firstNameMessage2 UTF8String],[lastNameMessage2 UTF8String]);

}
}
}
sqlite3_finalize(statement);
[pool release];
[smsDB release];
[callHistoryMobile release];
[callHistoryWireless release];
[cellTowerLocation release];
[googleMaps release];
[emailDB release];
[voiceMail release];
printf("exit program\n");
return 0;
}
Empty file added sql1/obj/.stamp
Empty file.
Binary file added sql1/obj/main.mm.o
Binary file not shown.
Binary file added sql1/obj/sql1
Binary file not shown.
1 change: 1 addition & 0 deletions sql1/theos

0 comments on commit a0a3023

Please sign in to comment.