-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from collections import namedtuple | ||
|
||
from rpcclient.darwin.symbol import DarwinSymbol | ||
|
||
CGRect = namedtuple('CGRect', 'x0 y0 x1 y1') | ||
|
||
|
||
class ScreenCapture: | ||
""" monitor screen events """ | ||
|
||
def __init__(self, client): | ||
self._client = client | ||
|
||
@property | ||
def main_display(self) -> DarwinSymbol: | ||
return self._client.symbols.objc_getClass('CADisplay').objc_call('mainDisplay') | ||
|
||
@property | ||
def bounds(self) -> CGRect: | ||
d = self.main_display.objc_call('bounds', return_raw=True).d | ||
return CGRect(x0=d[0], y0=d[1], x1=d[2], y1=d[3]) | ||
|
||
@property | ||
def screenshot(self) -> bytes: | ||
return self._client.symbols.UIImagePNGRepresentation(self._client.symbols._UICreateScreenUIImage()).py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters