Python cho iOS

Giao thức công cụ Apple dựa trên python,bạn có thể lấy CPU, Bộ nhớ và các số liệu khác từ các thiết bị iOS thực

liên kết. https. // người thử nghiệm. com/topics/27159

中文文档

liên kết Java. https. //github. com/YueChen-C/java-ios-thiết bị]

píp

pip install py-ios-device

phiên bản trăn. 3. 7 +

Dụng cụ:

  • Nhận bộ nhớ hệ thống và dữ liệu CPU
  • Nhận quy trình Dữ liệu bộ nhớ và CPU
  • Nhận dữ liệu FPS
  • Lấy dữ liệu mạng
  • Đặt trạng thái mạng của thiết bị. ví dụ. 2G, 3G, Mất 100%
  • Đặt thiết bị hoạt động như thể ở trạng thái nhiệt độ cao
  • Giám sát ứng dụng bắt đầu、thoát、nền
  • Khởi chạy và giết ứng dụng
  • Chạy xctest. ví dụ. WebDriverAgent
  • Kết xuất ảnh chụp nhanh ngăn xếp hồ sơ lõi
  • Phân tích luồng dữ liệu hồ sơ cốt lõi
  • Nhận bộ đếm GPU kim loại

Khác

  • Hồ sơ & Quản lý thiết bị. ví dụ. Cài đặt và gỡ cài đặt chứng chỉ Fiddler
  • Nhận nhật ký hệ thống
  • Nhận nhật ký sự cố
  • Nhận lưu lượng gói đã bắt và chuyển tiếp đến Wireshark
  • Cài đặt và gỡ cài đặt ứng dụng
  • Nhận pin thiết bị

Cách sử dụng:

píp

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help

Nhận danh sách thiết bị

$ pyidevice devices

Nhận thông tin thiết bị

$ pyidevice --udid=xxxxxx deviceinfo

Nhận dữ liệu hiệu suất hệ thống

$ pyidevice instruments monitor 
Memory  >> {'App Memory': '699.69 MiB', 'Cached Files': '1.48 GiB', 'Compressed': '155.17 MiB', 'Memory Used': '1.42 GiB', 'Wired Memory': '427.91 MiB', 'Swap Used': '46.25 MiB'}
Network >> {'Data Received': '4.07 GiB', 'Data Received/sec': '4.07 GiB', 'Data Sent': '2.54 GiB', 'Data Sent/sec': '2.54 GiB', 'Packets in': 2885929, 'Packets in/sec': 6031576, 'Packets Out': 2885929, 'Packets Out/sec': 2885929}
Disk    >> {'Data Read': '117.91 GiB', 'Data Read/sec': 0, 'Data Written': '64.28 GiB', 'Data Written/sec': 0, 'Reads in': 9734132, 'Reads in/sec': 9734132, 'Writes Out': 6810640, 'Writes Out/sec': 6810640}

$ pyidevice instruments monitor --filter = memory
Memory  >> {'App Memory': '699.69 MiB', 'Cached Files': '1.48 GiB', 'Compressed': '155.17 MiB', 'Memory Used': '1.42 GiB', 'Wired Memory': '427.91 MiB', 'Swap Used': '46.25 MiB'}

Nhận dữ liệu hiệu suất của Quy trình

$ pyidevice instruments sysmontap --help
$ pyidevice instruments sysmontap  -b com.tencent.xin --proc_filter memVirtualSize,cpuUsage --processes --sort cpuUsage # 只显示 memVirtualSize,cpuUsage 参数的进程列表,且根据 cpuUsage 字段排序 

[['WeChat', {'cpuUsage': 0.03663705586691998, 'memVirtualSize': 2179284992, 'name': 'WeChat', 'pid': 99269}]]
[['WeChat', {'cpuUsage': 0.036558268613227536, 'memVirtualSize': 2179284992, 'name': 'WeChat', 'pid': 99269}]]

Nhận dữ liệu FPS

$ pyidevice instruments fps

{'currentTime': '2021-05-11 14:14:40.259059', 'fps': 52}
{'currentTime': '2021-05-11 14:14:40.259059', 'fps': 56}

Lấy dữ liệu mạng

$ pyidevice instruments networking
# Get all network data
"connection-update{\"RxPackets\": 2, \"RxBytes\": 148, \"TxPackets\": 2, \"TxBytes\": 263, \"RxDups\": 0, \"RxOOO\": 0, \"TxRetx\": 0, \"MinRTT\": 0.05046875, \"AvgRTT\": 0.05046875, \"ConnectionSerial\": 5}"
"connection-update{\"RxPackets\": 4, \"RxBytes\": 150, \"TxPackets\": 3, \"TxBytes\": 1431, \"RxDups\": 0, \"RxOOO\": 0, \"TxRetx\": 0, \"MinRTT\": 0.0539375, \"AvgRTT\": 0.0541875, \"ConnectionSerial\": 4}"

$ pyidevice instruments network_process -p com.tencent.xin 
# Get application network data
{403: {'net.packets.delta': 119, 'time': 1620720061.0643349, 'net.tx.bytes': 366715, 'net.bytes.delta': 63721, 'net.rx.packets.delta': 47, 'net.tx.packets': 633, 'net.rx.bytes': 34532, 'net.bytes': 401247, 'net.tx.bytes.delta': 56978, 'net.rx.bytes.delta': 6743, 'net.rx.packets': 169, 'pid': 403, 'net.tx.packets.delta': 72, 'net.packets': 802}}
{403: {'net.packets.delta': 13, 'time': 1620720076.2191892, 'net.tx.bytes': 1303204, 'net.bytes.delta': 5060, 'net.rx.packets.delta': 5, 'net.tx.packets': 2083, 'net.rx.bytes': 46736, 'net.bytes': 1349940, 'net.tx.bytes.delta': 4682, 'net.rx.bytes.delta': 378, 'net.rx.packets': 379, 'pid': 403, 'net.tx.packets.delta': 8, 'net.packets': 2462}}

Đặt trạng thái thiết bị. Phiên bản iOS > 12

________số 8

Nghe thông báo ứng dụng

$ pyidevice instruments notifications
[{'execName': 'MobileNotes', 'state_description': 'Foreground Running', 'elevated_state_description': 'Foreground Running', 'displayID': 'com.apple.mobilenotes', 'mach_absolute_time': 27205542653928, 'appName': 'Notes', 'elevated_state': 8, 'timestamp': 1620714619.1264, 'state': 8, 'pid': 99367}]
[{'execName': 'MobileNotes', 'state_description': 'Background Running', 'elevated_state_description': 'Background Running', 'displayID': 'com.apple.mobilenotes', 'mach_absolute_time': 27205678872050, 'appName': 'Notes', 'elevated_state': 4, 'timestamp': 1620714624.802145, 'state': 4, 'pid': 99367}]
[{'execName': 'MobileNotes', 'state_description': 'Background Task Suspended', 'elevated_state_description': 'Background Task Suspended', 'displayID': 'com.apple.mobilenotes', 'mach_absolute_time': 27205683486410, 'appName': 'Notes', 'elevated_state': 2, 'timestamp': 1620714624.99441, 'state': 2, 'pid': 99367}]

Kết xuất ảnh chụp nhanh ngăn xếp hồ sơ lõi

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
0

Phân tích luồng dữ liệu hồ sơ cốt lõi

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
1

Nhận bộ đếm GPU kim loại

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
2

Khác

Hồ sơ & Quản lý thiết bị

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
3

lấy nhật ký hệ thống

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
4

nhận nhật ký hệ thống sự cố

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
5

ứng dụng

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
6

lưu lượng gói

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
7

pin thiết bị

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
8

bật chế độ nhà phát triển

> pip install py-ios-device
> pyidevice --help
> pyidevice instruments --help
9

QQ:37042417

api. bản trình diễn tài liệu. tài liệu

Bạn có thể chạy Python trên iOS không?

Python dành cho iOS và iPadOS . Pyto also provides a complete development environment for running Python 3 including many third-party libraries and system integration on an iPad or iPhone.

IDE Python tốt nhất cho iOS là gì?

Các IDE Python hàng đầu .
nhàn rỗi. IDLE [Môi trường học tập và phát triển tích hợp] là trình chỉnh sửa mặc định đi kèm với Python. .
PyCharm. PyCharm là một IDE Python được sử dụng rộng rãi do JetBrains tạo ra. .
Mã phòng thu trực quan. Visual Studio Code là một IDE mã nguồn mở [và miễn phí] được tạo bởi Microsoft. .
Văn bản tuyệt vời 3. .
nguyên tử. .
Jupyter. .
gián điệp. .
PyDev

Chủ Đề