diff --git a/README.md b/README.md index 2e6944a8..12d0f125 100644 --- a/README.md +++ b/README.md @@ -14,13 +14,23 @@ This project includes two components: The python client utilizes the ability to call native functions in order to provide APIs for different aspects: -* Remote shell commands -* Filesystem management (APIs for `open()`, `read()`, etc...) -* Network management (WiFi scan, TCP connect, etc...) +* Remote shell commands (`p.spawn()`) +* Filesystem management (`p.fs.*`) +* Network management (WiFi scan, TCP connect, etc...) (`p.network.*`) * Darwin only: - * Multimedia automation (recording and playing) - * Preferences managemnent (remote manage CFPreference and SCPreferences) - * Process management (kill, list, query open FDs, etc...) + * Multimedia automation (recording and playing) (`p.media.*`) + * Preferences managemnent (remote manage CFPreference and SCPreferences) (`p.preferences.*`) + * Process management (kill, list, query open FDs, etc...) (`p.processes`) + * Location services (`p.location.*`) + * HID simulation (`p.hid.*`) + * IORegistry API (`p.ioregistry.*`) + * Reports management (Logs and Crash Reports) (`p.reports.*`) + * Time settings (`p.time.*`) + * iOS Only: + * MobileGestalt (`p.mobile_gestalt.*`) + * Backlight adjusting (`p.backlight.*`) + +and much more... ## Building C Server @@ -32,7 +42,7 @@ cd src/rpcserver make ``` -On iOS: +On iOS (Make sure to have XCode installed): ```shell git clone git@github.com:doronz88/rpc-project.git diff --git a/src/rpcclient/rpcclient/darwin/location.py b/src/rpcclient/rpcclient/darwin/location.py index bee93c9a..5c8d9393 100644 --- a/src/rpcclient/rpcclient/darwin/location.py +++ b/src/rpcclient/rpcclient/darwin/location.py @@ -47,14 +47,17 @@ def _load_location_library(self): @property def location_services_enabled(self) -> bool: + """ opt-in status for location services """ return bool(self._location_manager.objc_call('locationServicesEnabled')) @location_services_enabled.setter def location_services_enabled(self, value: bool): + """ opt-in status for location services """ self._CLLocationManager.objc_call('setLocationServicesEnabled:', value) @property def authorization_status(self) -> CLAuthorizationStatus: + """ authorization status for current server process of accessing location services """ return CLAuthorizationStatus.from_value(self._location_manager.objc_call('authorizationStatus')) @property @@ -66,15 +69,17 @@ def last_sample(self) -> Optional[Mapping]: return location.objc_call('jsonObject').py def start_updating_location(self): + """ request location updates from CLLocationManager """ if self.authorization_status.value < CLAuthorizationStatus.kCLAuthorizationStatusAuthorizedAlways.value: raise PermissionDeniedError() self._location_manager.objc_call('startUpdatingLocation') def stop_updating_location(self): + """ stop requesting location updates from CLLocationManager """ self._location_manager.objc_call('stopUpdatingLocation') def request_oneshot_location(self): - """ Requests the one-time delivery of the user’s current location. """ + """ requests the one-time delivery of the user’s current location """ if self.authorization_status.value < CLAuthorizationStatus.kCLAuthorizationStatusAuthorizedAlways.value: raise PermissionDeniedError() self._location_manager.objc_call('requestLocation') diff --git a/src/rpcclient/rpcclient/darwin/time.py b/src/rpcclient/rpcclient/darwin/time.py index 2e50aaba..3ec67827 100644 --- a/src/rpcclient/rpcclient/darwin/time.py +++ b/src/rpcclient/rpcclient/darwin/time.py @@ -18,21 +18,25 @@ def _load_core_time_framework(self): return raise MissingLibraryError('failed to load CoreTime') - def now(self): + def now(self) -> datetime: + """ get current time """ with self._client.safe_calloc(timeval.sizeof()) as current: self._client.symbols.gettimeofday(current, 0) time_of_day = timeval.parse(current.peek(timeval.sizeof())) return datetime.fromtimestamp(time_of_day.tv_sec + (time_of_day.tv_usec / (10 ** 6))) def set_current(self, new_time: datetime): + """ set current time """ self._client.symbols.TMSetAutomaticTimeZoneEnabled(0) with self._client.safe_calloc(timeval.sizeof()) as current: current.poke(timeval.build({'tv_sec': int(new_time.timestamp()), 'tv_usec': new_time.microsecond})) self._client.symbols.settimeofday(current, 0) def set_auto(self): + """ opt-in automatic time settings """ self._client.symbols.TMSetAutomaticTimeZoneEnabled(1) @property def is_set_automatically(self): + """ tell is time settings are set to automatic """ return bool(self._client.symbols.TMIsAutomaticTimeZoneEnabled())