from pathlib import Path from pymobiledevice3.lockdown import LockdownClient from pymobiledevice3.cli.mounter import MobileImageMounterService from pymobiledevice3.cli.developer import DtSimulateLocation from pymobiledevice3.services.diagnostics import DiagnosticsService class Device(): def __init__(self): self.lockdown = LockdownClient() self.mounter = MobileImageMounterService(self.lockdown) self.diagnostics = DiagnosticsService(self.lockdown) self.location = None def mount_image(self, image_path, signature_path): image_type = "Developer" image_path = Path(image_path) image = image_path.read_bytes() signature_path = Path(signature_path) signature = signature_path.read_bytes() self.mounter.upload_image(image_type, image, signature) self.mounter.mount(image_type, signature) return True def spoof_gps(self, destination): if self.location is None: self.location = DtSimulateLocation(self.lockdown) self.location.set(destination.latitude, destination.longitude) return True def stop_spoofing(self): self.location.clear() self.diagnostics.restart()