Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for iTunes Backups #608

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions ileapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def crunch_artifacts(
log = open(os.path.join(out_params.report_folder_base, 'Script Logs', 'ProcessedFilesLog.html'), 'w+', encoding='utf8')
nl = '\n' #literal in order to have new lines in fstrings that create text files
log.write(f'Extraction/Path selected: {input_path}<br><br>')
log.write(f'Timezone selected: {time_offset}<br><br>')
log.write(f'Timezone selected: {time_offset}<br>')

categories_searched = 0
# Special processing for iTunesBackup Info.plist as it is a seperate entity, not part of the Manifest.db. Seeker won't find it
Expand Down Expand Up @@ -178,14 +178,15 @@ def crunch_artifacts(
search_regexes = [plugin.search]
files_found = []
for artifact_search_regex in search_regexes:
log.write(f'<br><b>For {plugin.name} parser</b><br>')
found = seeker.search(artifact_search_regex)
if not found:
log.write(f'No files found for {plugin.name} -> {artifact_search_regex}<br><br>')
log.write(f'No files found for regex {artifact_search_regex}<br>')
else:
for pathh in found:
if pathh.startswith('\\\\?\\'):
pathh = pathh[4:]
log.write(f'Files for {artifact_search_regex} located at {pathh}<br><br>')
log.write(f'Files for {artifact_search_regex} located at {pathh}<br>')
files_found.extend(found)
if files_found:
logfunc('{} [{}] artifact started'.format(plugin.name, plugin.module_name))
Expand Down
45 changes: 45 additions & 0 deletions scripts/builds_ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# https://www.gkgigs.com/list-of-all-macos-version-history/
# https://betawiki.net/wiki/Category:MacOS_versions

from os.path import join

OS_build = {
"1A543a": "iPhone OS 1.0",
"1C25": "iPhone OS 1.0.1",
Expand Down Expand Up @@ -744,6 +746,7 @@
"21B91": "iOS 17.1.1",
"21C5029g": "iOS 17.2 beta 1",
"21C5040g": "iOS 17.2 beta 2",
"21C5046c": "iOS 17.2 beta 3",
"4K78": "Mac OS X 10.0",
"4L8": "Mac OS X 10.0.1",
"4L13": "Mac OS X 10.0.1",
Expand Down Expand Up @@ -1829,6 +1832,8 @@
"21G918": "macOS 12.7.1 RC 2",
"21G920": "macOS 12.7.1",
"21G1925": "macOS 12.7.2 RC",
"21G1965": "macOS 12.7.2 RC 2",
"21G1967": "macOS 12.7.2 RC 3",
"22A5266r": "macOS 13.0 beta 1",
"22A5286j": "macOS 13.0 beta 2",
"22A5295h": "macOS 13.0 beta 3",
Expand Down Expand Up @@ -1894,6 +1899,7 @@
"22G2321": "macOS 13.6.2",
"22G417": "macOS 13.6.3 RC",
"22G423": "macOS 13.6.3 RC 2",
"22G430": "macOS 13.6.3 RC 3",
"23A5257q": "macOS 14.0 beta 1",
"23A5276g": "macOS 14.0 beta 2",
"23A5286g": "macOS 14.0 beta 3",
Expand All @@ -1916,6 +1922,7 @@
"23B2082": "macOS 14.1.1",
"23C5030f": "macOS 14.2 beta 1",
"23C5041e": "macOS 14.2 beta 2",
"23C5047e": "macOS 14.2 beta 3",
"12S507": "watchOS 1.0",
"12S632": "watchOS 1.0.1",
"13S5254w": "watchOS 2.0 beta 1",
Expand Down Expand Up @@ -2284,6 +2291,32 @@
"21S71": "watchOS 10.1.1",
"21S5331f": "watchOS 10.2 beta 1",
"21S5342e": "watchOS 10.2 beta 2",
"21S5349e": "watchOS 10.2 beta 3",
}

domains = {
"AppDomain-": "private/var/mobile/Containers/Data/Application",
"AppDomainGroup-" : "private/var/mobile/Containers/Shared/AppGroup",
"AppDomainPlugin-" : "private/var/mobile/Containers/Data/PluginKitPlugin",
"CameraRollDomain" : "private/var/mobile/Media",
"DatabaseDomain": "private/var/db",
"HealthDomain": "private/var/mobile",
"HomeDomain": "private/var/mobile",
"HomeKitDomain": "private/var/mobile",
"InstallDomain": "private/var/installd",
"KeyboardDomain": "private/var/mobile",
"KeychainDomain" : "private/var/protected/trustd/private",
"ManagedPreferencesDomain": "private/var/Managed Preferences",
"MediaDomain": "private/var/mobile",
"MobileDeviceDomain": "private/var/MobileDevice",
"NetworkDomain": "private/var/networkd",
"ProtectedDomain": "private/var/protected",
"RootDomain": "private/var/root",
"SysContainerDomain-": "private/var/containers/Data/System",
"SysSharedContainerDomain-": "private/var/containers/Shared/SystemGroup",
"SystemPreferencesDomain": "private/var/preferences",
"TonesDomain": "private/var/mobile",
"WirelessDomain": "private/var/wireless"
}

device_id = {
Expand Down Expand Up @@ -2385,3 +2418,15 @@
"iPhone16,1": "iPhone 15 Pro",
"iPhone16,2": "iPhone 15 Pro Max",
}


def get_root_path_from_domain(domain):
if domain in domains:
return domains[domain]
elif ('-') in domain:
dash_position = domain.find("-") + 1
path = domains[domain[:dash_position]]
bundle_identifier = domain[dash_position:]
return join(path, bundle_identifier)
return ''

12 changes: 9 additions & 3 deletions scripts/search_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

from fnmatch import _compile_pattern
from functools import lru_cache

from scripts.builds_ids import get_root_path_from_domain
normcase = lru_cache(maxsize=None)(os.path.normcase)

class FileSeekerBase:
Expand Down Expand Up @@ -65,7 +67,7 @@ def __init__(self, directory, temp_folder):
logfunc('Building files listing...')
self.build_files_list(directory)
logfunc(f'File listing complete - {len(self._all_files)} files')

def build_files_list(self, directory):
'''Populates paths from Manifest.db files into _all_files'''
try:
Expand All @@ -75,6 +77,7 @@ def build_files_list(self, directory):
"""
SELECT
fileID,
domain,
relativePath
FROM
Files
Expand All @@ -85,8 +88,11 @@ def build_files_list(self, directory):
all_rows = cursor.fetchall()
for row in all_rows:
hash_filename = row[0]
relative_path = row[1]
self._all_files[relative_path] = hash_filename
domain = row[1]
root_path = get_root_path_from_domain(domain)
relative_path = row[2]
full_path = os.path.join(root_path, relative_path)
self._all_files[full_path] = hash_filename
db.close()
except Exception as ex:
logfunc(f'Error opening Manifest.db from {directory}, ' + str(ex))
Expand Down