Skip to content

Add support for iTunes/Finder backups. - #84

Merged
ydkhatri merged 5 commits into
abrignoni:masterfrom
threeplanetssoftware:add-itunes
Sep 22, 2020
Merged

ydkhatri merged 5 commits into
abrignoni:masterfrom
threeplanetssoftware:add-itunes

Conversation

@threeplanetssoftware

Copy link
Copy Markdown
Contributor

I do most of my research using a phone connected to a Mac, syncing via finder and SSH'ing the results over to the real development box. I noticed that iLEAPP didn't handle iTunes/Finder backups and wanted to see its output for something, so I added that in. This currently only handles the CLI-version, I haven't looked at the GUI yet.

I have to say, I generally dislike python, but you have some very easy to read code! Nice work.

…type to switches.

Adds FileSeekerItunes class to search_files which opens up Manifest.db and builds a
dict of each file path to the fileID. Then upon a search it copies out a file that matches
to have the appropriate path in a temp folder. Creates this seeker from ileapp.py.

Signed-off-by: Three Planets Software <[email protected]>
@ydkhatri

ydkhatri commented Sep 21, 2020 •

Copy link
Copy Markdown
Contributor

I generally dislike python, but you have some very easy to read code! Nice work.

Thanks. Keeping it simple and readable is the point, so more people can contribute easily.

I will test it out with the couple of itunes backups I have, then merge it. Seems straightforward, we should have done this a long time ago.. Thanks again!

@ydkhatri

ydkhatri commented Sep 21, 2020 •

Copy link
Copy Markdown
Contributor

Few things:

  1. Seems to have path related issues on Windows. / vs \
    Perhaps you can use Pathlib and/or os.path.join(...) to mitigate before issuing the copy command. It is also expecting trailing slash in folder path, which may not be there. This is for line 51 in search_files.py - I would change to this
db = sqlite3.connect(os.path.join(directory, "Manifest.db")) #sqlite3.connect(directory + "Manifest.db")
  1. Need to detect itunes from a folder for the GUI version, perhaps add detection of file Manifest.db and Info.plist to distinguish between full extraction folder vs itunes folder

@threeplanetssoftware

Copy link
Copy Markdown
Contributor Author

Great point, fixing the first bullet to use os.path.join made the code I had not yet submitted for the GUI work (yes, the lack of a trailing slash was an issue).

@threeplanetssoftware

Copy link
Copy Markdown
Contributor Author

Finally, I was going to open an issue and submit a separate PR, but figured I would just put it in here. I have a logical extraction which retained the original file properties (including ownership by root of some folders). When I ran the GUI to check if the above changes hurt anything, it died, due to lack of permission:

[notta@cuppa iLEAPP]$ python ileappGUI.py 
Traceback (most recent call last):
  File "ileappGUI.py", line 153, in <module>
    ileapp.crunch_artifacts(search_list, extracttype, input_path, out_params, len(ileapp.tosearch)/s_items)
  File "/home/notta/data/programming/python/iLEAPP/ileapp.py", line 60, in crunch_artifacts
    seeker = FileSeekerDir(input_path)
  File "/home/notta/data/programming/python/iLEAPP/scripts/search_files.py", line 27, in __init__
    self.build_files_list(directory)
  File "/home/notta/data/programming/python/iLEAPP/scripts/search_files.py", line 35, in build_files_list
    self.build_files_list(item.path)
  File "/home/notta/data/programming/python/iLEAPP/scripts/search_files.py", line 35, in build_files_list
    self.build_files_list(item.path)
  File "/home/notta/data/programming/python/iLEAPP/scripts/search_files.py", line 35, in build_files_list
    self.build_files_list(item.path)
  File "/home/notta/data/programming/python/iLEAPP/scripts/search_files.py", line 31, in build_files_list
    files_list = os.scandir(directory)
PermissionError: [Errno 13] Permission denied: '/home/notta/phone_rips/iphone/iOS13_logical/private/var/.DocumentRevisions-V100'

I've added a try/except block around the directory read such that it will fail a bit nicer and log the resulting failure if found. The log after the run looks like:

Procesing started. Please wait. This may take a few minutes...
--------------------------------------------------------------------------------------
iLEAPP v1.5.4: iLEAPP Logs, Events, and Properties Parser
Objective: Triage iOS Full System Extractions.
By: Alexis Brignoni | @AlexisBrignoni | abrignoni.com
By: Yogesh Khatri | @SwiftForensics | swiftforensics.com
Building files listing
Error reading /home/notta/phone_rips/iphone/iOS13_logical/private/var/.DocumentRevisions-V100
Error reading /home/notta/phone_rips/iphone/iOS13_logical/private/var/containers/Data/System/4BFD738A-387A-40CC-BDB1-6AA0D320AC8A/Documents
Error reading /home/notta/phone_rips/iphone/iOS13_logical/private/var/containers/Data/System/4BFD738A-387A-40CC-BDB1-6AA0D320AC8A/Library
... [etc]

If you want this as a separate issue/PR for tracking, happy to mvoe it, but since this was in a file I already touched, I hope this is acceptable.

@ydkhatri

Copy link
Copy Markdown
Contributor

I've added a try/except block around the directory read such that it will fail a bit nicer and log the resulting failure if found. The log after the run looks like:

That looks good. We can merge it all at once. Unfortunately it is still having path issues on windows -

Could not copy P:/iphone_nojb/0ffa9515ce698486c4eafb32275ca620d6e74de7\20\2041457d5fe04d39d0ab481178355df6781e6858 to \\?\w:\test\iLEAPP_Reports_2020-09-21_Monday_225449\temp\Library/Calendar/Calendar.sqlitedb

If you use Pathlib, this may be easier as it can handle mixed style paths.

If not, I can fix this later tomorrow and merge it all.

@threeplanetssoftware

Copy link
Copy Markdown
Contributor Author

My apologies. I broke a Windows evaluation copy out to test this last fix and this should hopefully work. The one thing I didn't do as you did in other areas was prepend \\?\ to the front as it appeared to already be doing that.

@ydkhatri
ydkhatri merged commit 36a84c5 into abrignoni:master Sep 22, 2020
@threeplanetssoftware
threeplanetssoftware deleted the add-itunes branch September 22, 2020 23:15
@abrignoni

Copy link
Copy Markdown
Owner

Thank you all so much. This is good stuff!!!
Lots of folks already reaching out saying they tested it and that it works great.
We just need to add a check to make sure the backup is not encrypted because if it is the script crashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants