From 6f6922713e7f45c1b61b731f581f14f5a8d94bf7 Mon Sep 17 00:00:00 2001 From: DoronZ Date: Sun, 20 Feb 2022 01:04:03 +0200 Subject: [PATCH] darwin: bugfix: seperate roots for ios and macos --- src/rpcclient/rpcclient/darwin/client.py | 7 +------ src/rpcclient/rpcclient/ios/client.py | 7 ++++++- src/rpcclient/rpcclient/macos/client.py | 13 +++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/rpcclient/rpcclient/darwin/client.py b/src/rpcclient/rpcclient/darwin/client.py index ebc87245..b69207a3 100644 --- a/src/rpcclient/rpcclient/darwin/client.py +++ b/src/rpcclient/rpcclient/darwin/client.py @@ -83,12 +83,7 @@ def is_idevice(self): @property def roots(self) -> typing.List[str]: """ get a list of all accessible darwin roots when used for lookup of files/preferences/... """ - result = ['/'] - for username in self.fs.scandir('/Users'): - if not username.is_dir() or not self.fs.accessible(username.path): - continue - result.append(username.path) - return result + return ['/', '/var/root'] def set_airplane_mode(self, mode: bool): """ set whether the device should enter airplane mode (turns off baseband, bt, etc...) """ diff --git a/src/rpcclient/rpcclient/ios/client.py b/src/rpcclient/rpcclient/ios/client.py index e215b794..3cbe3bec 100644 --- a/src/rpcclient/rpcclient/ios/client.py +++ b/src/rpcclient/rpcclient/ios/client.py @@ -1,5 +1,10 @@ +import typing + from rpcclient.darwin.client import DarwinClient class IosClient(DarwinClient): - pass + @property + def roots(self) -> typing.List[str]: + """ get a list of all accessible darwin roots when used for lookup of files/preferences/... """ + return super().roots + ['/var/mobile'] diff --git a/src/rpcclient/rpcclient/macos/client.py b/src/rpcclient/rpcclient/macos/client.py index 2a8fc580..38f5e4ee 100644 --- a/src/rpcclient/rpcclient/macos/client.py +++ b/src/rpcclient/rpcclient/macos/client.py @@ -1,3 +1,5 @@ +import typing + from rpcclient.darwin.client import DarwinClient from rpcclient.macos.bluetooth import Bluetooth from rpcclient.darwin.reports import Reports @@ -11,3 +13,14 @@ def __init__(self, sock, sysname: str, hostname: str, port: int = None): super().__init__(sock, sysname, hostname, port) self.bluetooth = Bluetooth(self) self.reports = Reports(self, CRASH_REPORTS_DIR) + + @property + def roots(self) -> typing.List[str]: + """ get a list of all accessible darwin roots when used for lookup of files/preferences/... """ + + result = super().roots + for username in self.fs.scandir('/Users'): + if not username.is_dir() or not self.fs.accessible(username.path): + continue + result.append(username.path) + return result