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.
41 lines
1.2 KiB
41 lines
1.2 KiB
2 years ago
|
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):
|
||
2 years ago
|
if self.location is None:
|
||
|
self.location = DtSimulateLocation(self.lockdown)
|
||
2 years ago
|
self.location.set(destination.latitude, destination.longitude)
|
||
|
return True
|
||
|
|
||
|
def stop_spoofing(self):
|
||
|
self.location.clear()
|
||
|
self.diagnostics.restart()
|
||
|
|
||
|
|
||
|
|
||
|
|