|
|
@ -1,10 +1,14 @@
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
from pymobiledevice3.lockdown import LockdownClient
|
|
|
|
from pymobiledevice3.lockdown import LockdownClient
|
|
|
|
from pymobiledevice3.cli.mounter import MobileImageMounterService, download_developer_disk_image
|
|
|
|
from pymobiledevice3.cli.mounter import MobileImageMounterService
|
|
|
|
from pymobiledevice3.cli.developer import DtSimulateLocation
|
|
|
|
from pymobiledevice3.cli.developer import DtSimulateLocation
|
|
|
|
from pymobiledevice3.services.diagnostics import DiagnosticsService
|
|
|
|
from pymobiledevice3.services.diagnostics import DiagnosticsService
|
|
|
|
from pymobiledevice3.exceptions import PasscodeRequiredError
|
|
|
|
from pymobiledevice3.exceptions import PasscodeRequiredError
|
|
|
|
import logging
|
|
|
|
import logging
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
|
|
|
import tempfile
|
|
|
|
|
|
|
|
import zipfile
|
|
|
|
|
|
|
|
from tqdm import tqdm
|
|
|
|
from ispoof.utils import get_home_folder
|
|
|
|
from ispoof.utils import get_home_folder
|
|
|
|
|
|
|
|
|
|
|
|
DEVELOPER_DISK_IMAGE_URL = 'https://github.com/pdso/DeveloperDiskImage/raw/master/{ios_version}/{ios_version}.zip'
|
|
|
|
DEVELOPER_DISK_IMAGE_URL = 'https://github.com/pdso/DeveloperDiskImage/raw/master/{ios_version}/{ios_version}.zip'
|
|
|
@ -33,11 +37,11 @@ class Device:
|
|
|
|
image_dir = f'{get_home_folder()}/DevDiskImage/'
|
|
|
|
image_dir = f'{get_home_folder()}/DevDiskImage/'
|
|
|
|
image_path = f'{image_dir}/DeveloperDiskImage.dmg'
|
|
|
|
image_path = f'{image_dir}/DeveloperDiskImage.dmg'
|
|
|
|
signature = f'{image_path}.signature'
|
|
|
|
signature = f'{image_path}.signature'
|
|
|
|
developer_disk_image_dir = Path(image_dir)
|
|
|
|
developer_disk_image_dir = Path(image_path).parent
|
|
|
|
|
|
|
|
|
|
|
|
if not developer_disk_image_dir.exists():
|
|
|
|
if not developer_disk_image_dir.exists():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
download_developer_disk_image(version, developer_disk_image_dir)
|
|
|
|
self.download_developer_disk_image(version, developer_disk_image_dir)
|
|
|
|
except PermissionError:
|
|
|
|
except PermissionError:
|
|
|
|
logger.error(
|
|
|
|
logger.error(
|
|
|
|
f'DeveloperDiskImage could not be saved to path ({developer_disk_image_dir}). '
|
|
|
|
f'DeveloperDiskImage could not be saved to path ({developer_disk_image_dir}). '
|
|
|
@ -65,8 +69,18 @@ class Device:
|
|
|
|
self.location.clear()
|
|
|
|
self.location.clear()
|
|
|
|
self.diagnostics.restart()
|
|
|
|
self.diagnostics.restart()
|
|
|
|
|
|
|
|
|
|
|
|
def get_ios_version(self):
|
|
|
|
def download_developer_disk_image(self, ios_version, directory):
|
|
|
|
pass
|
|
|
|
url = DEVELOPER_DISK_IMAGE_URL.format(ios_version=ios_version)
|
|
|
|
|
|
|
|
with requests.get(url, stream=True) as r:
|
|
|
|
|
|
|
|
r.raise_for_status()
|
|
|
|
|
|
|
|
total_size_in_bytes = int(r.headers.get('content-length', 0))
|
|
|
|
|
|
|
|
with tqdm(total=total_size_in_bytes, unit='iB', unit_scale=True, dynamic_ncols=True) as progress_bar:
|
|
|
|
|
|
|
|
with tempfile.NamedTemporaryFile('wb+') as f:
|
|
|
|
|
|
|
|
for chunk in r.iter_content(chunk_size=8192):
|
|
|
|
|
|
|
|
progress_bar.update(len(chunk))
|
|
|
|
|
|
|
|
f.write(chunk)
|
|
|
|
|
|
|
|
zip_file = zipfile.ZipFile(f)
|
|
|
|
|
|
|
|
zip_file.extractall(directory)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|