Skip to content

Crawls iTunes-created iOS device backup directory and renames camera images/videos and SMS image/video attachments back to their original filenames. Also recovers contact information and SMS/iMessage conversations.

Notifications You must be signed in to change notification settings

chuynh18/itunes-backup-renamer-go

Repository files navigation

itunes-backup-renamer-go

itunes-backup-renamer is a quick and dirty Go program that renames the human-unfriendly filenames created by iTunes and renames them back into their original filenames.

It currently recovers the following from iTunes backups:

  • Contact information (not all fields, just some of the important ones)
  • SMS/iMessage conversations are saved as CSVs.
  • Photos and videos taken with the device's camera
  • Photos and videos sent/received as SMS attachments (technically MMS but whatever)

Quick! How do I use this?!

  1. Create an unencrypted iTunes backup of your iOS device.
  2. Locate the backup that iTunes created. (The link provided goes to an Apple Support article on how to locate iTunes backups. If this link is broken, then Apple has updated their support page and this script may no longer work on your iTunes backup. But you can always consult a search engine for this info if you still want to try!)
  3. Download the iphone-backup-crawler executable and place it inside your iTunes backup folder.
  4. Run the executable and wait for it to finish.
  5. Your files are now sitting inside the files directory.

See it in action

Click the image to see it in action on YouTube. Screenshot

Motivation

There are a ton of trialware and shareware apps (that look a whole lot friendlier and more polished, to be fair!) that will help you recover files from your iOS device. However, they are often limited in their capabilities until you pony up the $20 or $30 to fully unlock all their features. I did not want to pay $20 or $30.

I originally did this as a Node.js (JavaScript) script. Nothing wrong with that as it works, but it's more effort for the end-user versus a statically-linked and compiled executable.

What does it do?

This program crawls the iTunes-created backup for jpg and mov files captured by the device's camera, along with most images and videos sent to or from the device via SMS/MMS. It then copies them to the files directory under a more human-friendly name.

It also saves contact information stored on the device as a CSV. You likely already have this backed up to your iCloud account.

How does it work?

Apple obfuscates files saved from iOS devices via the iTunes backup function. The filenames on your local machine are SHA-1 hashes of the concatenation of the iOS domain, the dash character -, and the path to the file on the iOS device. A SQLite database is also saved under the name Manifest.db in the backup folder. This database stores both the obfuscated name and the original filename.

This program uses Manifest.db to rename the obfuscated names back to the original names. If duplicate filenames are encountered, a dash and number are appended to the filename but before the file extension.

Requirements

Compilation

Unfortunately, I can only provide Windows-specific instructions. That being said, Linux and macOS users should have an easier time.

  1. Run go get github.com/mattn/go-sqlite3
  2. A C compiler is required to build the go-sqlite3 database driver. Ensure gcc is installed and in your system PATH. gcc for Windows can be obtained via mingw-w64. I've had good experience with both MingW-W64-builds or Msys2. Note that with MingW-W64-builds, you may have to manually add the bin directory to your system PATH.
  3. cd into this (itunes-backup-renamer-go) repository.
  4. Run go build main.go

To cross compile, set the appropriate GOOS and GOARCH e.g. GOOS=linux GOARCH=386 go build main.go to build an Intel x86 32-bit Linux executable. Here is a convenient reference of valid GOOS and GOARCH values.

Caveats

tl;dr: Does not work on older versions of iOS (potentially not on versions of iOS older than 9.3.5, but I do not have access to devices to test this!) I haven't tested this program on anything other than Windows, but hope it will just work on other platforms. You may need a LOT of hard drive space to run this tool to completion!

Apple changes how they save files on iOS devices every so often, so this program probably only works on recent versions of iOS. I am not totally sure which versions, as I only wrote this to save files off a relative's iPhone and am not an iOS user myself! iTunes backups do not include music, as that's in theory already in your iTunes library, so this tool will not be able to recover your music.

As for why you need lots of hard drive space, this program copies rather than renames/moves files. So if you have a 128 GB iPhone that is nearly full, you may need up to 256 GB of free hard drive space to run this program to completion. If you're running this on an SSD, prepare to have it slammed with writes, but at least it'll complete quickly! If you're running this on a hard drive, have fun waiting. If you're running this on a RAM or 3D XPoint drive, wtf?

Linux and macOS binaries are available, but I don't know if they work at all.

And now for some fun copypasta, because I guarantee absolutely nothing:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Licensed permissively under the ISC license.

Lastly, please remember: "This worked on my machine!" - Me, July 9th, 2019

About

Crawls iTunes-created iOS device backup directory and renames camera images/videos and SMS image/video attachments back to their original filenames. Also recovers contact information and SMS/iMessage conversations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages