Skip to content

Commit

Permalink
ios: add lockdown
Browse files Browse the repository at this point in the history
  • Loading branch information
doronz88 committed Mar 3, 2022
1 parent c827ac5 commit f76f401
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/rpcclient/rpcclient/ios/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from rpcclient.darwin.client import DarwinClient
from rpcclient.darwin.reports import Reports
from rpcclient.ios.backlight import Backlight
from rpcclient.ios.lockdown import Lockdown
from rpcclient.ios.mobile_gestalt import MobileGestalt

CRASH_REPORTS_DIR = 'Library/Logs/CrashReporter'
Expand All @@ -14,6 +15,7 @@ def __init__(self, sock, sysname: str, hostname: str, port: int = None):
self.backlight = Backlight(self)
self.reports = Reports(self, CRASH_REPORTS_DIR)
self.mobile_gestalt = MobileGestalt(self)
self.lockdown = Lockdown(self)

@property
def roots(self) -> typing.List[str]:
Expand Down
22 changes: 22 additions & 0 deletions src/rpcclient/rpcclient/ios/lockdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import plistlib
from collections import namedtuple
from typing import List

PairRecord = namedtuple('PairRecord', 'hostname host_id certificate')


class Lockdown:
def __init__(self, client):
self._client = client

@property
def pair_records(self) -> List[PairRecord]:
""" list pair records """
result = []
for entry in self._client.fs.scandir('/var/root/Library/Lockdown/pair_records'):
with self._client.fs.open(entry.path, 'r') as f:
record = plistlib.loads(f.readall())
result.append(PairRecord(hostname=record['HostName'], host_id=record['HostID'],
certificate=record['HostCertificate']))

return result

0 comments on commit f76f401

Please sign in to comment.