|
3 | 3 | A library to communicate with services on iOS devices using native protocols. |
4 | 4 |
|
5 | 5 | Based on [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice), additionally implemented **instrument_service**. |
| 6 | + |
| 7 | + |
| 8 | +## Build |
| 9 | + |
| 10 | +1. Compile the [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice) project first, and then set its pkgconfig output directory to the `IMB_PKG_CONFIG_PATH` environment variable. |
| 11 | + |
| 12 | +e.g.: |
| 13 | +``` |
| 14 | +$ export IMB_PKG_CONFIG_PATH="../libimobiledevice/built/darwin-arm64/lib/pkgconfig" |
| 15 | +``` |
| 16 | + |
| 17 | +2. Compile with CMake. |
| 18 | + |
| 19 | +``` |
| 20 | +$ mkdir build && cd build |
| 21 | +$ cmake .. |
| 22 | +// or cmake -G "Xcode" .. |
| 23 | +``` |
| 24 | + |
| 25 | +## Usage |
| 26 | + |
| 27 | +### library: libidevice |
| 28 | + |
| 29 | +```c++ |
| 30 | +idevice_t device = ...; |
| 31 | + |
| 32 | +DTXTransport* transport = new DTXTransport(device); |
| 33 | +DTXConnection* connection = new DTXConnection(transport); |
| 34 | +connection->Connect(); |
| 35 | + |
| 36 | +std::shared_ptr<DTXChannel> channel = connection->MakeChannelWithIdentifier( |
| 37 | + "com.apple.instruments.server.services.deviceinfo"); |
| 38 | +std::shared_ptr<DTXMessage> message = DTXMessage::Create("runningProcesses"); |
| 39 | +channel->SendMessageAsync(message, [&](auto msg) { |
| 40 | + printf("reply handler\n"); |
| 41 | + msg->Dump(); |
| 42 | +}); |
| 43 | +``` |
| 44 | +
|
| 45 | +
|
| 46 | +
|
| 47 | +### tool: idevice_decoder |
| 48 | +
|
| 49 | +This tool is used to decode the binary records of communication messages with Xcode. |
| 50 | +
|
| 51 | +``` |
| 52 | +$ idevice_decoder --hex received_outfile.bin transmit_outfile.bin |
| 53 | +``` |
| 54 | +
|
| 55 | +output: |
| 56 | +``` |
| 57 | +==== DTXMessage ==== |
| 58 | +message_type: 2 |
| 59 | +identifier: 5100 |
| 60 | +conversation_index: 0 |
| 61 | +channel_code: 0 |
| 62 | +expects_reply: 1 |
| 63 | +auxiliary: |
| 64 | +DTXPrimitiveArray, size=2: |
| 65 | + item #0: [type=kSignedInt32, size=4, value=18] |
| 66 | + item #1: [type=kBuffer, size=184, value="com.apple.instruments.server.services.assets"] |
| 67 | + 00000000h: 62 70 6C 69 73 74 30 30 D4 01 02 03 04 05 06 07 bplist00........ |
| 68 | + 00000010h: 0A 58 24 76 65 72 73 69 6F 6E 59 24 61 72 63 68 .X$versionY$arch |
| 69 | + 00000020h: 69 76 65 72 54 24 74 6F 70 58 24 6F 62 6A 65 63 iverT$topX$objec |
| 70 | + 00000030h: 74 73 12 00 01 86 A0 5F 10 0F 4E 53 4B 65 79 65 ts....._..NSKeye |
| 71 | + 00000040h: 64 41 72 63 68 69 76 65 72 D1 08 09 54 72 6F 6F dArchiver...Troo |
| 72 | + 00000050h: 74 80 01 A2 0B 0C 55 24 6E 75 6C 6C 5F 10 2C 63 t.....U$null_.,c |
| 73 | + 00000060h: 6F 6D 2E 61 70 70 6C 65 2E 69 6E 73 74 72 75 6D om.apple.instrum |
| 74 | + 00000070h: 65 6E 74 73 2E 73 65 72 76 65 72 2E 73 65 72 76 ents.server.serv |
| 75 | + 00000080h: 69 63 65 73 2E 61 73 73 65 74 73 08 11 1A 24 29 ices.assets...$) |
| 76 | + 00000090h: 32 37 49 4C 51 53 56 5C 00 00 00 00 00 00 01 01 27ILQSV\........ |
| 77 | + 000000a0h: 00 00 00 00 00 00 00 0D 00 00 00 00 00 00 00 00 ................ |
| 78 | + 000000b0h: 00 00 00 00 00 00 00 8B ........ |
| 79 | +payload(size=175): |
| 80 | + 00000000h: 62 70 6C 69 73 74 30 30 D4 01 02 03 04 05 06 07 bplist00........ |
| 81 | + 00000010h: 0A 58 24 76 65 72 73 69 6F 6E 59 24 61 72 63 68 .X$versionY$arch |
| 82 | + 00000020h: 69 76 65 72 54 24 74 6F 70 58 24 6F 62 6A 65 63 iverT$topX$objec |
| 83 | + 00000030h: 74 73 12 00 01 86 A0 5F 10 0F 4E 53 4B 65 79 65 ts....._..NSKeye |
| 84 | + 00000040h: 64 41 72 63 68 69 76 65 72 D1 08 09 54 72 6F 6F dArchiver...Troo |
| 85 | + 00000050h: 74 80 01 A2 0B 0C 55 24 6E 75 6C 6C 5F 10 23 5F t.....U$null_.#_ |
| 86 | + 00000060h: 72 65 71 75 65 73 74 43 68 61 6E 6E 65 6C 57 69 requestChannelWi |
| 87 | + 00000070h: 74 68 43 6F 64 65 3A 69 64 65 6E 74 69 66 69 65 thCode:identifie |
| 88 | + 00000080h: 72 3A 08 11 1A 24 29 32 37 49 4C 51 53 56 5C 00 r:...$)27ILQSV\. |
| 89 | + 00000090h: 00 00 00 00 00 01 01 00 00 00 00 00 00 00 0D 00 ................ |
| 90 | + 000000a0h: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 82 ............... |
| 91 | +"_requestChannelWithCode:identifier:" |
| 92 | +==== /DTXMessage ==== |
| 93 | + |
| 94 | +==== DTXMessage ==== |
| 95 | +message_type: 0 |
| 96 | +identifier: 5100 |
| 97 | +conversation_index: 1 |
| 98 | +channel_code: 0 |
| 99 | +expects_reply: 0 |
| 100 | +auxiliary: |
| 101 | +none |
| 102 | +payload(size=0): |
| 103 | +==== /DTXMessage ==== |
| 104 | +``` |
| 105 | +
|
0 commit comments