纯python plist操纵器

gplist的Python项目详细描述


plist公司

Build StatusPyPI version

简介

在信息列表是一个类似清单的文件,用于存储应用程序的属性。它的文件格式可以是xml或二进制。这个库是一个纯python实现,用于操作plist文件和解析mobileprovision文件。在

使用

PlistInfo是一个类似于有序dict的类,因此可以将其视为有序dict

当分析二进制数据或文件时,PlistInfo将自动检测格式并获得正确的结果。在

MobileProvision也是一个有序的类dict,它的数据基本上来自xml plist。在

二进制格式

importjsonimportosfromgplist.plistimportPlistInfo# raw binarywithopen("FooApp.app/Info.plist","rb")asfd:p=PlistInfo(fd.read())print(json.dumps(p,indent=2))# from raw filep=PlistInfo.from_file("FooApp.app/Info.plist")# from app or ipap=PlistInfo.from_app("FooApp.app")p=PlistInfo.from_app("FooApp.ipa")foo_file="foo.plist"p.to_binary_file(foo_file)assertos.path.isfile(foo_file)buf=p.to_binary()assertisinstance(buf,bytes)

XML格式

^{pr2}$

属性操作

fromgplist.plistimportPlistInfop=PlistInfo.from_app("FooApp.ipa")p.add_property({"a":1},"foo")assertp["foo"]=={"a":1}p.add_property("b","foo","b")assertp["foo"]["b"]=="b"p.update_property("c","foo","b")assertp["foo"]["b"]=="c"p.remove_property("foo","a")assertp["foo"]=={"b":"c"}

移动设备

fromgplist.mobileprovisionimportMobileProvisionm=MobileProvision.from_file(provision_file)print(m.is_expired())print(m["Name"])print(m.has_udid("00008030-001A2DA6********")forcertinm.certs:print(cert.sha1)print(cert.is_expired())print(cert.serial)print(cert.common_name)print(cert.organization_unit_name)print(cert.organization_name)print(cert.country_name)

命令行工具

python -m gplist Info.plist
python -m gplist embedded.mobileprovision
python -m gplist --cert embedded.mobileprovision
python -m gplist --has-udid "00008030-001A2DA6********" embedded.mobileprovision

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JPA。Eclipselink没有为mySQL提供密码,但它应该提供   我的Servlet和@FormDataParam存在java问题   java将什么作为上下文参数传递到文件I/O方法中?   如果两个值相同,java无法找到其中一个单选按钮   java在变量和方法名中使用下划线   JavaSpringMVC单线程安全?   klazz类的java Arraylist(反射Api)   java如何在数字字符串中查找最频繁的数字?   JavaAPI设计:使数据更易于阅读与强制更多API调用   JavaHadoopMapReduceforGoogleWebGraph   java无法启动gauge API:Runner意外退出   java如何在bluemix上使用ibm工作负载调度器?   拉取一年中某一周特定日期的所有日期   java为什么是我的角节点。js应用程序将图像上传到S3� 邮递员正确上传时的符号?   在不使用任何第三方jar的情况下将文件从本地传输到linux系统(java代码)   java将现有文件夹复制到Eclipse工作区中新创建的项目中   Java中的regex RegExp帮助   当使用“系统”外观时,Java组合框setSelectedItem会出现故障   JavaASM:在类的方法中获取局部变量名和值