You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

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.is_mounted = False
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)
self.is_mounted = True
self.location = DtSimulateLocation(self.lockdown)
return True
def spoof_gps(self, destination):
self.location = DtSimulateLocation(self.lockdown)
self.location.set(destination.latitude, destination.longitude)
return True
def stop_spoofing(self):
self.location.clear()
self.diagnostics.restart()