15
libimobiledevice пятница, 26 июля 13 г.

Алексей Сторожев «Библиотека libimobiledevice»

Embed Size (px)

DESCRIPTION

Видео доклада: http://www.youtube.com/watch?v=jIbPiBkt3Vg

Citation preview

Page 1: Алексей Сторожев «Библиотека libimobiledevice»

libimobiledevice

пятница, 26 июля 13 г.

Page 2: Алексей Сторожев «Библиотека libimobiledevice»

libimobiledevice.org

пятница, 26 июля 13 г.

Page 3: Алексей Сторожев «Библиотека libimobiledevice»

usbmuxdhttp://cgit.sukimashita.com/usbmuxd.git/

A socket daemon to multiplex connections from and to iOS devices.

Mac OS, Linux: /var/run/usbmuxd Windows: localhost:27015

пятница, 26 июля 13 г.

Page 4: Алексей Сторожев «Библиотека libimobiledevice»

iTunes

пятница, 26 июля 13 г.

Page 5: Алексей Сторожев «Библиотека libimobiledevice»

Apple Mobile Device Support

пятница, 26 июля 13 г.

Page 6: Алексей Сторожев «Библиотека libimobiledevice»

Socat - http://www.dest-unreach.org/socat/

$ brew install socat

sudo mv /var/run/usbmuxd /var/run/usbmuxx

sudo socat -t100 -x -v UNIX-LISTEN:/var/run/usbmuxd,mode=777,reuseaddr,fork UNIX-CONNECT:/var/run/usbmuxx > ~/Desktop/usbmuxd.log 2>&1

Sniffing

пятница, 26 июля 13 г.

Page 7: Алексей Сторожев «Библиотека libimobiledevice»

> 2013/07/03 18:05:32.872128 length=513 from=0 to=512 01 02 00 00 01 00 00 00 08 00 00 00 f8 00 00 00 ................ 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 <?xml version="1 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 .0" encoding="UT 46 2d 38 22 3f 3e 0a F-8"?>. 3c 21 44 4f 43 54 59 50 45 20 70 6c 69 73 74 20 <!DOCTYPE plist 50 55 42 4c 49 43 20 22 2d 2f 2f 41 70 70 6c 65 PUBLIC "-//Apple 2f 2f 44 54 44 20 50 4c 49 53 54 20 31 2e 30 2f //DTD PLIST 1.0/ 2f 45 4e 22 20 22 68 74 74 70 3a 2f 2f 77 77 77 /EN" "http://www 2e 61 70 70 6c 65 2e 63 6f 6d 2f 44 54 44 73 2f .apple.com/DTDs/ 50 72 6f 70 65 72 74 79 4c 69 73 74 2d 31 2e 30 PropertyList-1.0 2e 64 74 64 22 3e 0a .dtd">. 3c 70 6c 69 73 74 20 76 65 72 73 69 6f 6e 3d 22 <plist version=" 31 2e 30 22 3e 0a 1.0">. 3c 64 69 63 74 3e 0a <dict>. 09 3c 6b 65 79 3e 42 75 6e 64 6c 65 49 44 3c 2f .<key>BundleID</ 6b 65 79 3e 0a key>. 09 3c 73 74 72 69 6e 67 3e 63 6f 6d 2e 61 70 70 .<string>com.app 6c 65 2e 64 74 2e 58 63 6f 64 65 3c 2f 73 74 72 le.dt.Xcode</str 69 6e 67 3e 0a ing>. 09 3c 6b 65 79 3e 43 6c 69 65 6e 74 56 65 72 73 .<key>ClientVers 69 6f 6e 53 74 72 69 6e 67 3c 2f 6b 65 79 3e 0a ionString</key>. 09 3c 73 74 72 69 6e 67 3e 75 73 62 6d 75 78 64 .<string>usbmuxd 2d 33 31 37 3c 2f 73 74 72 69 6e 67 3e 0a -317</string>. 09 3c 6b 65 79 3e 43 6f 6e 6e 54 79 70 65 3c 2f .<key>ConnType</ 6b 65 79 3e 0a key>. 09 3c 69 6e 74 65 67 65 72 3e 30 3c 2f 69 6e 74 .<integer>0</int 65 67 65 72 3e 0a eger>. 09 3c 6b 65 79 3e 4d 65 73 73 61 67 65 54 79 70 .<key>MessageTyp 65 3c 2f 6b 65 79 3e 0a e</key>. 09 3c 73 74 72 69 6e 67 3e 4c 69 73 74 65 6e 3c .<string>Listen< 2f 73 74 72 69 6e 67 3e 0a /string>. 09 3c 6b 65 79 3e 50 72 6f 67 4e 61 6d 65 3c 2f .<key>ProgName</ 6b 65 79 3e 0a key>. 09 3c 73 74 72 69 6e 67 3e 58 63 6f 64 65 3c 2f .<string>Xcode</ 73 74 72 69 6e 67 3e 0a string>. 09 3c 6b 65 79 3e 6b 4c 69 62 55 53 42 4d 75 78 .<key>kLibUSBMux 56 65 72 73 69 6f 6e 3c 2f 6b 65 79 3e 0a Version</key>. 09 3c 69 6e 74 65 67 65 72 3e 33 3c 2f 69 6e 74 .<integer>3</int 65 67 65 72 3e 0a eger>. 3c 2f 64 69 63 74 3e 0a </dict>. 3c 2f 70 6c 69 73 74 3e 0a </plist>.--< 2013/07/03 18:05:32.874439 length=294 from=0 to=293 26 01 00 00 01 00 00 00 08 00 00 00 f8 00 00 00 &............... 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 <?xml version="1 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 55 54 .0" encoding="UT 46 2d 38 22 3f 3e 0a F-8"?>. 3c 21 44 4f 43 54 59 50 45 20 70 6c 69 73 74 20 <!DOCTYPE plist 50 55 42 4c 49 43 20 22 2d 2f 2f 41 70 70 6c 65 PUBLIC "-//Apple 2f 2f 44 54 44 20 50 4c 49 53 54 20 31 2e 30 2f //DTD PLIST 1.0/ 2f 45 4e 22 20 22 68 74 74 70 3a 2f 2f 77 77 77 /EN" "http://www 2e 61 70 70 6c 65 2e 63 6f 6d 2f 44 54 44 73 2f .apple.com/DTDs/ 50 72 6f 70 65 72 74 79 4c 69 73 74 2d 31 2e 30 PropertyList-1.0

Typical log

пятница, 26 июля 13 г.

Page 8: Алексей Сторожев «Библиотека libimobiledevice»

Packet analyzer :https://github.com/storoj/idevice-packet-analyzer

cd /path/to/packet/analyzerbash ioslog2html.sh /path/to/usbmuxd.log /path/to/usbmuxd.html

Help is on the way

пятница, 26 июля 13 г.

Page 9: Алексей Сторожев «Библиотека libimobiledevice»

Pretty log

пятница, 26 июля 13 г.

Page 10: Алексей Сторожев «Библиотека libimobiledevice»

#include <libimobiledevice/libimobiledevice.h>#include <libimobiledevice/lockdown.h>#include <libimobiledevice/screenshotr.h>

int main(int argc, char **argv){! idevice_t device = NULL;! lockdownd_client_t lckd = NULL;! screenshotr_client_t shotr = NULL;! lockdownd_service_descriptor_t service = NULL; ! const char *udid = "your udid here"; ! if (IDEVICE_E_SUCCESS != idevice_new(&device, udid)) {! ! return -1;! } ! if (LOCKDOWN_E_SUCCESS != lockdownd_client_new_with_handshake(device, &lckd, NULL)) {! ! return -1;! } ! if (LOCKDOWN_E_SUCCESS != lockdownd_start_service(lckd, "com.apple.mobile.screenshotr", &service)) {! ! return -1;! } ! if (screenshotr_client_new(device, service, &shotr) != SCREENSHOTR_E_SUCCESS) {! ! return -1;! }! if (screenshotr_take_screenshot(shotr, &imgdata, &imgsize) == SCREENSHOTR_E_SUCCESS) {! ! // screenshot taken! }! // ...}

Screnshotter client

пятница, 26 июля 13 г.

Page 11: Алексей Сторожев «Библиотека libimobiledevice»

$ idevicescreenshotCould not start screenshotr service! Remember that you have to mount the Developer disk image on your device if you want to use the screenshotr service.

$ ideviceinfo | grep ProductVersion | awk '{ print $2 }'6.1.3

$ export DeviceSupport=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/

$ ideviceimagemounter \ “$DeviceSupport/6.1 (10B141)/DeveloperDiskImage.dmg”

$ idevicescreenshotScreenshot saved to screenshot-2013-06-13-07-40-00.tiff

Screenshot

пятница, 26 июля 13 г.

Page 12: Алексей Сторожев «Библиотека libimobiledevice»

$ ls /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/

4.2 5.0 6.0 4.3 5.1 6.1 (10B141)

DeveloperDiskImage.dmgDeveloperDiskImage.dmg.signature

Developer Images

пятница, 26 июля 13 г.

Page 13: Алексей Сторожев «Библиотека libimobiledevice»

Developer Images

No developer image Developer image mountedпятница, 26 июля 13 г.

Page 14: Алексей Сторожев «Библиотека libimobiledevice»

Screenshotr service

пятница, 26 июля 13 г.

Page 15: Алексей Сторожев «Библиотека libimobiledevice»

Officialhttp://www.libimobiledevice.org/http://cgit.sukimashita.com/libimobiledevice.git/

VS projecthttps://github.com/storoj/libimobiledevice-win32

Mac OSX binarieshttps://github.com/benvium/libimobiledevice-macosx

Libimobiledevice

пятница, 26 июля 13 г.