The iPhone Wiki has an article about the call history database, which is outdated at the time of this writing, but does indicate that it’s a SQLite database. My iPhone had this file, which I could open and read rows from with the given schema, but there were no rows!
After some more digging, I found this post in /r/jailbreakdevelopers which reveals that the location and schema of the SQLite database has changed as of iOS 8.3.
My device is the last version of iOS 8 (I am a jailbreak hold-out and missed the window for the iOS 9 update + JB).
Armed with the true location, I could continue to analyze and hopefully modify the database file correctly.
First thing I did was get openssh server running on my iPhone (available through Cydia).
Then I created a directory and downloaded the database directory.
scp -r firstname.lastname@example.org:/var/mobile/Library/CallHistoryDB .
Because I know I will make a lot of mistakes, I initialized a git repo and checked the files in. This way I could use git to
reset my get the original, untainted database back at any time.
Next I created this Makefile so I could rapidly iterate, sending the modified database to my phone.
all: reset modify push
Next I examined the database with a text editor to determine the schema… I extracted it out to a text file:
CREATE TABLE ZCALLRECORD (
Next I created my ruby script. Basically I open the database, print the rows, insert a row, then print the rows again.
I then ran
make until I had all my inputs correct and the call log was modified appropriately. Be sure to close the “Phone App” each time, so that it reads from the database file again.