• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

mountainstorm/MobileDevice: A python package, and command line tool, which wraps ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

mountainstorm/MobileDevice

开源软件地址(OpenSource Url):

https://github.com/mountainstorm/MobileDevice

开源编程语言(OpenSource Language):

Python 100.0%

开源软件介绍(OpenSource Introduction):

MobileDevice.py

A python package which aims to wrap Apple's MobileDevice API; to provide complete support for all iOS, device services.

The project aims to provide both a native Pythin API (using ctypes) and a fully features command line interface.

You can run the project directory as a package e.g.

python MobileDevice/ afc put myfile.txt /var/mobile/Media/

or:

python MobileDevice.zip afc put myfile.txt /var/mobile/Media/

or, if you install the library using: sudo python setup.py install

mdf afc put myfile.txt /var/mobile/Media/

(will upload a file to the device)

at any point append -h to the command line to get more help

In general I recommend you install the package if you're ever going to write scripts using it, or just fancy typing less characters.

Project Structure

The basic structure of the package is as follows:

MobileDevice.py: this is a bare bones ctypes wrapper over the native C library

CoreFoundation.py: this is a simple ctypes wrapper around CoreFoundation and a few helper methods to convert between CFTypes and python types

All other classes: afc.py, syslog.py, filerelay.py, amdevice.py etc are more pythonic wrappers around the base C library.

The idea being that we give a python abstraction of all the services e.g.

To list all files on the file system:

from command line:

mdf afc ls /var/mobile/Media

or in code:

from MobileDevice import *

def printdir(afc, path):
	for name in afc.listdir(path):
		isdir = u''
		if afc.lstat(path + name).st_ifmt == stat.S_IFDIR:
			isdir = u'/'
		print path + name + isdir
		if afc.lstat(path + name).st_ifmt == stat.S_IFDIR:
			printdir(afc, path + name + isdir)

dev = list_devices()[0]
dev.connect()
afc = AFC(dev)

printdir(afc, u'/var/mobile/Media') # recursive print of all files visible

afc.disconnect()

To retrieve a .cpio.gz file of all the readonly special data (crashlogs etc)

from command line:

mdf filerelay dump.cpio.gz

or in code:

from MobileDevice import *

dev = list_devices()[0]
dev.connect()
fr = FileRelay(dev)

f = open(u'dump.cpio.gz', 'wb')
f.write(fr.retrieve([
	u'AppleSupport',
	u'Network',
	u'VPN',
	u'WiFi',
	u'UserDatabases',
	u'CrashReporter',
	u'tmp',
	u'SystemConfiguration'
]))
f.close()

fr.disconnect()

To read and print all syslog messages

from command line:

mdf syslog

or in code:

from MobileDevice import *
import sys

dev = list_devices()[0]
dev.connect()
sl = Syslog(dev)

while True:
	msg = sl.read()
	if msg is None:
		break
	sys.stdout.write(msg)

sl.disconnect()

Keywords

iOS, iPad, iPhone, Apple, MobileDevice, python, command line, lockdownd, usbmuxd




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap