Python3, parse ".mobileprovision" file in MacOS System;
Project description
PyMobileProvision
parse ".mobileprovision" file in MacOS System;
解析 MacOS 系统里,iOS和Mac开发常用到的".mobileprovision"文件,提取出里面的"plist"格式的内容
仅支持 Python3,Python2版本见:Py2MobileProvision
Install
pip install PyMobileProvision
Example Modules:
from mobileprovision import MobileProvisionModel
mp_file_path = "/Users/shede333/Desktop/test.mobileprovision"
mp_model = MobileProvisionModel(mp_file_path)
print(mp_model) # 打印mobileprovision文件的详细信息
print(mp_model.app_id_prefix) # appID的前缀
print(mp_model.app_id(is_need_prefix=True)) # app的BundleID,带app_id_prefix前缀
print(mp_model["name"]) # mobileprovision的"Name"属性(属性不区分大小写)
print(mp_model.date_is_valid()) # 现在的是否过期
print(mp_model.creation_timestamp) # 证书创建时间(时间戳,int值)
# ......还有很多其他属性.......
# 将int时间戳 转换为 本地日期时间
from datetime import datetime
local_dt = datetime.fromtimestamp(mp_model.creation_timestamp)
print(local_dt)
# 打印mobileprovision文件里包含的cer公钥证书信息
print(mp_model.developer_certificates)
# mobileprovision文件是否包含(支持)device_id设备
device_id = "00008020-000XXXXXXXXXXXXXX" # 设备的唯一ID
print(mp_model.contain_device_id(device_id))
# 转换为plist格式文件
dst_plist_path = "/Users/shede333/Desktop/test.plist"
mp_model.convert_to_plist_file(dst_plist_path)
# 导出entitlements.plist文件信息
ent_dst_path = "Users/shede333/Desktop/entitlements.plist"
mp_model.export_entitlements_file(ent_dst_path)
Example CLI:
mobileprovision -h
输出:
usage: OKEx工程里的多语言国际化相关的便捷操作 [-h] {import,parse,convert,entitlements} ...
positional arguments:
{import,parse,convert,entitlements}
支持的命令如下:
import 导入mobileprovision文件到系统默认路径里
parse 解析、打印mobileprovision文件里的内容
convert 转换mobileprovision文件为plist文件
entitlements 打印/导出 mobileprovision文件里 entitlements信息
optional arguments:
-h, --help show this help message and exit
待完成的功能
增加pytest标准测试;增加mp等测试资源;增加CLI控制功能;DevCertificateModel增加创建、失效日期属性;将日期属性,改为时间戳,避免UTC歧义;
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file PyMobileProvision-1.2.2.tar.gz
.
File metadata
- Download URL: PyMobileProvision-1.2.2.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c73fc27434a21748bea5d88968e740279999e507c767243eb404a97d323c7af9 |
|
MD5 | 0a5d21b9c9e565b78e09c1ceaebf0625 |
|
BLAKE2b-256 | 8a689ba48b7b8bb3afef39d274fca46b4e66b00d81659b72f6355737d423ddc4 |
File details
Details for the file PyMobileProvision-1.2.2-py3-none-any.whl
.
File metadata
- Download URL: PyMobileProvision-1.2.2-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef705461ebb8520f0173b7921fb5275b8c853e966fa4dd874750138aea1b6445 |
|
MD5 | c2fd5c3171d50dfcf7a7444fd3a171db |
|
BLAKE2b-256 | 1302a7040bba34e8ca1f490717049018521df0672c18e2e96f615e835e33daed |