Newsletter
TechAnV Blog
Get updates on security engineering, Rust, eBPF, and DevSecOps. No spam, unsubscribe anytime.
Check your inbox and click the confirmation link to complete your subscription.
Browse files (including SQLite databases) on your iPhone with ifuse#
I spotted an intriguing note in the release notes for osxphotos 0.51.7:
Added ability to read Photos.sqlite from iPhone
This lead me to osxphotos issue #745 which lead me to How to access iPhone files with a disk mount which lead me to ifuse and homebrew-fuse .
Here’s what worked for me.
- Connect the iPhone to a Mac using a USB-C to Lightning cable
- Find the serial number of your iPhone, by running
system_profiler SPUSBDataType -detailLevel mini | grep -e iPhone -e Serialand looking for the first number. It will look something like00008110001631C105BA801E. - Add a hyphen to that serial number after the 8th character:
00008110-001631C105BA801E- you will need this later brew install macfusebrew install gromgit/fuse/ifuse-mac- A tricky bit: this has installed an unsigned binary, which macOS really doesn’t want to execute. So…
mkdir /tmp/iPhoneifuse /tmp/iPhone --udid 00008110-001631C105BA801E- using the serial number you figured out earlier- This should fail with an error complaining about the unsigned binary
- Open System Preferences -> Security & Privacy and allow that binary to run. You may then need to restart your computer.
- After the reboot,
mkdir /tmp/iPhoneagain. - Now try
ifuse /tmp/iPhone --udid 00008110-001631C105BA801Eagain - this time it should work
If everything goes right, you can run open /tmp/iPhone to open a Finder window showing at least some of the contents of your phone. You can also cd /tmp/iPhone to start poking around from the terminal.
Finding SQLite databases#
The easiest way to find SQLite databases to explore is to run:
1find /tmp/iPhone | grep 'wal'This searches for files with names like downloads.28.sqlitedb-wal - which indicate a SQLite database that has been opened in WAL mode.
On my iPhone I get these:
1/tmp/iPhone/Downloads/downloads.28.sqlitedb-wal2/tmp/iPhone/Books/MetadataStore/BookMetadataStore.sqlite-wal3/tmp/iPhone/Books/Sync/Database/OutstandingAssets_4.sqlite-wal4/tmp/iPhone/Radio/Radio.db-wal5/tmp/iPhone/iTunes_Control/iTunes/MediaLibrary.sqlitedb-wal6/tmp/iPhone/MediaAnalysis/mediaanalysis.db-wal7/tmp/iPhone/PhotoData/Caches/GraphService/CLSBusinessCategoryCache.Nature.sqlite-wal8/tmp/iPhone/PhotoData/Caches/GraphService/CLSContactCache.sqlite-wal9/tmp/iPhone/PhotoData/Caches/GraphService/musiccache.sqlite-wal10/tmp/iPhone/PhotoData/Caches/GraphService/CLSLocationCache.sqlite-wal11/tmp/iPhone/PhotoData/Caches/GraphService/CLSPublicEventCache.sqlite-wal12/tmp/iPhone/PhotoData/Caches/GraphService/PhotosGraph/construction-photosgraph.kgdb-wal13/tmp/iPhone/PhotoData/Caches/GraphService/PhotosGraph/photosgraph-tmp.kgdb-wal14/tmp/iPhone/PhotoData/Caches/GraphService/PhotosGraph/photosgraph.kgdb-wal15/tmp/iPhone/PhotoData/Caches/GraphService/CLSBusinessCategoryCache.POI.sqlite-wal16/tmp/iPhone/PhotoData/Caches/GraphService/CLSBusinessCategoryCache.ROI.sqlite-wal17/tmp/iPhone/PhotoData/Caches/GraphService/PGCurationCache.sqlite.sqlite-wal18/tmp/iPhone/PhotoData/Caches/GraphService/CLSBusinessCategoryCache.AOI.sqlite-wal19/tmp/iPhone/PhotoData/Caches/search/psi.sqlite-wal20/tmp/iPhone/PhotoData/CPL/storage/store.cloudphotodb-wal21/tmp/iPhone/PhotoData/Photos.sqlite-walYou can then open them in Datasette by specifying the filename without the -wal extension. For example:
1datasette /tmp/iPhone/Radio/Radio.db