• Stars
    star
    194
  • Rank 196,407 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 11 years ago
  • Updated almost 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A python package, and command line tool, which wraps Apple's MobileDevice API - providing access to iOS devices.

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

More Repositories

1

jquery.graphviz.svg

jquery plugin to make graphviz svg charts responsive
JavaScript
184
star
2

CoreSymbolication

Reverse engineered headers for Apples CoreSymbolication private framework; plus the set of test cases I used to validate it
Objective-C
89
star
3

Flow

Flow control tracer/debugger for OSX; provides a complete trace of all instructions executed by a process. Perfect if you want to know exactly what a process did/does
C
21
star
4

llaudio

An old piece of work to reverse engineer the Mac OSX user/kernel audio interface. Shows how to read audio straight out of the kernel as you would on Darwin (where most the OSX goodness is missing)
C++
20
star
5

wormxattr

A write once, read many filesystem OSX kext. It uses the security policy module support within xnu; hooking filesystem operations to provide WORM functionality based on an extended attribute.
C
11
star
6

Squall

lldb UI for OSX; like the gui command ... but better
Objective-C
10
star
7

mt_urwid

urwid (python console librarys) wigets; scrollview, tabview ...
Python
8
star
8

pdbfile

Python clone of the CLR PDB (debug symbol) parsing library
Python
5
star
9

js.sddl

Simple Microsoft SDDL/SD/ACE parsing webpage, with nice descriptive output
HTML
5
star
10

Studio---Lightroom-Tether

A standalone application for tethering Nikon cameras to OSX; includes a lightroom2 plugin to automate download and import of images taken
Objective-C
5
star
11

FreeNas-Scripts

Various scripts to improve my HP Microserver (N54L) freenas experiance; auto wake, shutdown
Python
4
star
12

LightroomTether

Source and distro for the lua based version of Lightroom tether; this automates download and import of images form a tethered Nikon camera into Lightroom2
Lua
4
star
13

cxa_demangle

Python wrapper around the c++ library cxa_demangle function; provides access to the internal C++ name demangle parse tree, thus allowing acurate parsing of parameters, types, templates etc - used in a exported mangled symbol
C++
2
star
14

MtTheme

Simple Cocoa theme engine; think CSS for NSView
Objective-C
2
star
15

Subleq

A simple software implementation of a single instruction VM; including an assembler and debugger
Python
1
star
16

semantic.fiendish

Semantic-UI menu/sidebar template
JavaScript
1
star
17

pyproto

A simple ctypes wrapper to make it more usable for parsing network protocols
Python
1
star
18

TeapotCMS

A simple, modern, customizable CMS for small sites
PHP
1
star
19

kroll-lua

An extension module for the kroll microkernel (used in Titanium and TideSDK) which adds support for lua
Objective-C
1
star
20

MtUI

A simple gui library, in python, on top of pyglet 1.2, using Cocoa ideas. Provides a simple scroll view and split view but should have all the framework code to make everything else easy to add
Python
1
star