Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to run get data when run sysmontap.py. #11

Closed
rahul-1485 opened this issue Apr 15, 2021 · 15 comments
Closed

Not able to run get data when run sysmontap.py. #11

rahul-1485 opened this issue Apr 15, 2021 · 15 comments

Comments

@rahul-1485
Copy link

When i run sysmontap.py with command sudo python3 sysmontap.py i am getting below error.

2021-04-16 00:27:24,464 - lockdown.py[line:94] - WARNING: [Errno 1] Operation not permitted: '/var/db/lockdown/cd872c4dcfb573af88d218267581aa05b580d046.plist'
not supported: {'$version': 100000, '$archiver': 'NSKeyedArchiver', '$top': {'root': uid(1)}, '$objects': ['$null', '_channelCanceled:']}
Traceback (most recent call last):
File "/Users/Rahul/Downloads/py-ios-device-main/demo/instrument_demo/sysmontap.py", line 53, in
addresses, port, psk = rpc.start_wireless()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/servers/Instrument.py", line 60, in start_wireless
print("remove", self.call(channel, "removeDaemonFromService").parsed)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/servers/DTXSever.py", line 352, in call
ret = self._call(True, channel_id, selector, *auxiliaries)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/servers/DTXSever.py", line 368, in _call
raise RuntimeWarning("rpc service died")
RuntimeWarning: rpc service died

Screenshot 2021-04-16 at 12 35 23 AM

Please check @YueChen-C.

@YueChen-C
Copy link
Owner

@rahul-1485
Try to use USB to start sysmontap.py

if __name__ == '__main__':
    rpc = InstrumentServer().init()
    sysmontap(rpc)
    rpc.stop()

@rahul-1485
Copy link
Author

Thanks for the reply @YueChen-C after doing the changes you have suggested sudo python3 sysmontap.py is running now. I am facing one more issue the sudo python3 sysmontap.py command works for IOS 14.2 device but not for IOS 12 devices.

Error i am getting is -

apple@Apples-MBP-2 instrument_demo % sudo python3 sysmontap.py
2021-04-17 01:10:49,478 - lockdown.py[line:94] - WARNING: [Errno 1] Operation not permitted: '/var/db/lockdown/caf07925fafe65912231d022bcb889d9c38503d5.plist'
Traceback (most recent call last):
File "/Users/Rahul/Downloads/py-ios-device-main/demo/instrument_demo/sysmontap.py", line 52, in
rpc = InstrumentServer().init()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/servers/Instrument.py", line 14, in init
self.lockdown = lockdown if lockdown else LockdownClient(udid=udid)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 61, in init
self.paired = self._pair()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 79, in _pair
self._pair_full()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 140, in _pair_full
'DevicePublicKey': plistlib.Data(device_public_key),
AttributeError: module 'plistlib' has no attribute 'Data'

Also i have tested sudo python3 applictionListing.py it is also not working working for IOS 12

Can you please suggest any other changes required for running commands on devices lower than IOS 14.

@YueChen-C
Copy link
Owner

YueChen-C commented Apr 19, 2021

@rahul-1485

Python3.9 plistlib removed plistlib.data.
I need some time to test

In addition, you can try using execute the command: sudo chmod 777 /var/ db/lockdown. Use iTunes pair instead of private pair

@rahul-1485
Copy link
Author

hi @YueChen-C the command sudo chmod 777 /var/ db/lockdown showing error - chmod: Unable to change file mode on /var/db/lockdown: Operation not permitted.

@YueChen-C
Copy link
Owner

@rahul-1485
This issue has been fixed on python 3.9.Try to pull the main branch test sysmontap.py

@rahul-1485
Copy link
Author

Hi @YueChen-C i have tried the latest code but it is still not working for IOS devices less than 14.0 Version. Getting same error

apple@Apples-MBP-2 instrument_demo % sudo python3 sysmontap.py
2021-04-28 23:16:00,470 - lockdown.py[line:94] - WARNING: [Errno 1] Operation not permitted: '/var/db/lockdown/caf07925fafe65912231d022bcb889d9c38503d5.plist'
Traceback (most recent call last):
File "/Users/Rahul/Desktop/pCloud/py-ios-device/demo/instrument_demo/sysmontap.py", line 56, in
rpc = InstrumentServer().init()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/servers/Instrument.py", line 14, in init
self.lockdown = lockdown if lockdown else LockdownClient(udid=udid)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 61, in init
self.paired = self._pair()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 79, in _pair
self._pair_full()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 140, in _pair_full
'DevicePublicKey': plistlib.Data(device_public_key),
AttributeError: module 'plistlib' has no attribute 'Data'

Please check.

@doronz88
Copy link

This error is unrelated to the iOS version, but rather the python version and was already fixed as @YueChen-C said. It seems you haven't pulled the latest version.

Python had a really wierd way to deprecate this API (no deprecation warnings on older versions then 3.9). Its now replaced simply with bytes so the call to plistlib.Data was just removed.

@rahul-1485
Copy link
Author

hi @doronz88 i am currently on Python 3.9 version and the and taken the latest code it works fine for IOS 14 devices. But on devices lower than 14.0 the error is same for all Python scripts.

apple@Apples-MBP-2 instrument_demo % sudo python3.9 applictionListing.py
2021-04-29 01:19:05,492 - lockdown.py[line:94] - WARNING: [Errno 1] Operation not permitted: '/var/db/lockdown/caf07925fafe65912231d022bcb889d9c38503d5.plist'
Traceback (most recent call last):
File "/Users/Rahul/Downloads/py-ios-device-main/demo/instrument_demo/applictionListing.py", line 20, in
rpc = InstrumentServer().init()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/servers/Instrument.py", line 14, in init
self.lockdown = lockdown if lockdown else LockdownClient(udid=udid)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 61, in init
self.paired = self._pair()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 79, in _pair
self._pair_full()
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ios_device/util/lockdown.py", line 140, in _pair_full
'DevicePublicKey': plistlib.Data(device_public_key),
AttributeError: module 'plistlib' has no attribute 'Data'

Also tried to change permission for lockdown folder it says "chmod: Unable to change file mode on /var/db/lockdown: Operation not permitted"

@doronz88
Copy link

doronz88 commented Apr 28, 2021

Latest revision contains a different content on the error line from your backtrace so it seems you aren't on latest version. Try to install it as follows:

python3 -m pip install --user -U -e . 

The -e is for local installation so you don't need to pip install every time.

@rahul-1485
Copy link
Author

hi @doronz88 i got below error with your command -

apple@Apples-MBP-2 ~ % python3 -m pip install --user -U -e

Usage:
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m pip install [options] [package-index-options] ...
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m pip install [options] -r [package-index-options] ...
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m pip install [options] [-e] ...
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m pip install [options] [-e] ...
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3 -m pip install [options] <archive url/path> ...

-e option requires 1 argument

@doronz88
Copy link

You forgot the . after the -e flag.

@rahul-1485
Copy link
Author

rahul-1485 commented May 3, 2021

hi @doronz88 thanks for help it is working now i have one query when we run python3 applictionListing.py it shows app list and then when we run python3 sysmontap.py it shows the process and it's data. But how do we know the data belongs to particular app. Let suppose i want my know about data of safari app "python3 sysmontap.py" command shows listing but it not shows for which app data belongs too. Can you please suggest how to associate particular app process with data. Is there any parameter for it.

@doronz88
Copy link

doronz88 commented May 3, 2021

You can trigger the selector named processIdentifierForBundleIdentifier: for each given pid to have a pid/bundle/app-data relation. This selector is not implemented in this repo but can be easily done.

@rahul-1485
Copy link
Author

Hi @doronz88 when we run "sudo python3 sysmontap.py" we get data of all the process is there any command to get data only for the particular process id. Let suppose if we want to see the data of a particular process only associated with an app.

@doronz88
Copy link

doronz88 commented May 6, 2021

This script doesn't allow this. I've implemented this feature in my own tool:
https://github.com/doronz88/pymobiledevice3

You can run:

pymobiledevice3 developer sysmon processes -a pid=some_pid

You can filter on any field you desire.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants