diff options
Diffstat (limited to 'tools/idevicebackup2.c')
| -rw-r--r-- | tools/idevicebackup2.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 382efc6..61302cc 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c | |||
| @@ -24,6 +24,8 @@ | |||
| 24 | #include <config.h> | 24 | #include <config.h> |
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #define TOOL_NAME "idevicebackup2" | ||
| 28 | |||
| 27 | #include <stdio.h> | 29 | #include <stdio.h> |
| 28 | #include <string.h> | 30 | #include <string.h> |
| 29 | #include <errno.h> | 31 | #include <errno.h> |
| @@ -346,7 +348,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, idevice_t d | |||
| 346 | char *udid_uppercase = NULL; | 348 | char *udid_uppercase = NULL; |
| 347 | 349 | ||
| 348 | lockdownd_client_t lockdown = NULL; | 350 | lockdownd_client_t lockdown = NULL; |
| 349 | if (lockdownd_client_new_with_handshake(device, &lockdown, "idevicebackup2") != LOCKDOWN_E_SUCCESS) { | 351 | if (lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME) != LOCKDOWN_E_SUCCESS) { |
| 350 | return NULL; | 352 | return NULL; |
| 351 | } | 353 | } |
| 352 | 354 | ||
| @@ -367,7 +369,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, idevice_t d | |||
| 367 | plist_t app_dict = plist_new_dict(); | 369 | plist_t app_dict = plist_new_dict(); |
| 368 | plist_t installed_apps = plist_new_array(); | 370 | plist_t installed_apps = plist_new_array(); |
| 369 | instproxy_client_t ip = NULL; | 371 | instproxy_client_t ip = NULL; |
| 370 | if (instproxy_client_start_service(device, &ip, "idevicebackup2") == INSTPROXY_E_SUCCESS) { | 372 | if (instproxy_client_start_service(device, &ip, TOOL_NAME) == INSTPROXY_E_SUCCESS) { |
| 371 | plist_t client_opts = instproxy_client_options_new(); | 373 | plist_t client_opts = instproxy_client_options_new(); |
| 372 | instproxy_client_options_add(client_opts, "ApplicationType", "User", NULL); | 374 | instproxy_client_options_add(client_opts, "ApplicationType", "User", NULL); |
| 373 | instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "ApplicationSINF", "iTunesMetadata", NULL); | 375 | instproxy_client_options_set_return_attributes(client_opts, "CFBundleIdentifier", "ApplicationSINF", "iTunesMetadata", NULL); |
| @@ -376,7 +378,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, idevice_t d | |||
| 376 | instproxy_browse(ip, client_opts, &apps); | 378 | instproxy_browse(ip, client_opts, &apps); |
| 377 | 379 | ||
| 378 | sbservices_client_t sbs = NULL; | 380 | sbservices_client_t sbs = NULL; |
| 379 | if (sbservices_client_start_service(device, &sbs, "idevicebackup2") != SBSERVICES_E_SUCCESS) { | 381 | if (sbservices_client_start_service(device, &sbs, TOOL_NAME) != SBSERVICES_E_SUCCESS) { |
| 380 | printf("Couldn't establish sbservices connection. Continuing anyway.\n"); | 382 | printf("Couldn't establish sbservices connection. Continuing anyway.\n"); |
| 381 | } | 383 | } |
| 382 | 384 | ||
| @@ -627,7 +629,7 @@ static void do_post_notification(idevice_t device, const char *notification) | |||
| 627 | 629 | ||
| 628 | lockdownd_client_t lockdown = NULL; | 630 | lockdownd_client_t lockdown = NULL; |
| 629 | 631 | ||
| 630 | if (lockdownd_client_new_with_handshake(device, &lockdown, "idevicebackup2") != LOCKDOWN_E_SUCCESS) { | 632 | if (lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME) != LOCKDOWN_E_SUCCESS) { |
| 631 | return; | 633 | return; |
| 632 | } | 634 | } |
| 633 | 635 | ||
| @@ -1427,11 +1429,12 @@ static void print_usage(int argc, char **argv) | |||
| 1427 | printf(" cloud on|off\tenable or disable cloud use (requires iCloud account)\n"); | 1429 | printf(" cloud on|off\tenable or disable cloud use (requires iCloud account)\n"); |
| 1428 | printf("\n"); | 1430 | printf("\n"); |
| 1429 | printf("OPTIONS:\n"); | 1431 | printf("OPTIONS:\n"); |
| 1430 | printf(" -d, --debug\t\tenable communication debugging\n"); | ||
| 1431 | printf(" -u, --udid UDID\ttarget specific device by UDID\n"); | 1432 | printf(" -u, --udid UDID\ttarget specific device by UDID\n"); |
| 1432 | printf(" -s, --source UDID\tuse backup data from device specified by UDID\n"); | 1433 | printf(" -s, --source UDID\tuse backup data from device specified by UDID\n"); |
| 1433 | printf(" -i, --interactive\trequest passwords interactively\n"); | 1434 | printf(" -i, --interactive\trequest passwords interactively\n"); |
| 1435 | printf(" -d, --debug\t\tenable communication debugging\n"); | ||
| 1434 | printf(" -h, --help\t\tprints usage information\n"); | 1436 | printf(" -h, --help\t\tprints usage information\n"); |
| 1437 | printf(" -v, --version\t\tprints version information\n"); | ||
| 1435 | printf("\n"); | 1438 | printf("\n"); |
| 1436 | printf("Homepage: <" PACKAGE_URL ">\n"); | 1439 | printf("Homepage: <" PACKAGE_URL ">\n"); |
| 1437 | printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); | 1440 | printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); |
| @@ -1501,6 +1504,10 @@ int main(int argc, char *argv[]) | |||
| 1501 | print_usage(argc, argv); | 1504 | print_usage(argc, argv); |
| 1502 | return 0; | 1505 | return 0; |
| 1503 | } | 1506 | } |
| 1507 | else if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) { | ||
| 1508 | printf("%s %s\n", TOOL_NAME, PACKAGE_VERSION); | ||
| 1509 | return 0; | ||
| 1510 | } | ||
| 1504 | else if (!strcmp(argv[i], "backup")) { | 1511 | else if (!strcmp(argv[i], "backup")) { |
| 1505 | cmd = CMD_BACKUP; | 1512 | cmd = CMD_BACKUP; |
| 1506 | } | 1513 | } |
| @@ -1746,7 +1753,7 @@ int main(int argc, char *argv[]) | |||
| 1746 | } | 1753 | } |
| 1747 | 1754 | ||
| 1748 | lockdownd_client_t lockdown = NULL; | 1755 | lockdownd_client_t lockdown = NULL; |
| 1749 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, "idevicebackup2"))) { | 1756 | if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(device, &lockdown, TOOL_NAME))) { |
| 1750 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); | 1757 | printf("ERROR: Could not connect to lockdownd, error code %d\n", ldret); |
| 1751 | idevice_free(device); | 1758 | idevice_free(device); |
| 1752 | return -1; | 1759 | return -1; |
| @@ -2136,7 +2143,7 @@ checkpoint: | |||
| 2136 | uint8_t passcode_hint = 0; | 2143 | uint8_t passcode_hint = 0; |
| 2137 | if (device_version >= DEVICE_VERSION(13,0,0)) { | 2144 | if (device_version >= DEVICE_VERSION(13,0,0)) { |
| 2138 | diagnostics_relay_client_t diag = NULL; | 2145 | diagnostics_relay_client_t diag = NULL; |
| 2139 | if (diagnostics_relay_client_start_service(device, &diag, "idevicebackup2") == DIAGNOSTICS_RELAY_E_SUCCESS) { | 2146 | if (diagnostics_relay_client_start_service(device, &diag, TOOL_NAME) == DIAGNOSTICS_RELAY_E_SUCCESS) { |
| 2140 | plist_t dict = NULL; | 2147 | plist_t dict = NULL; |
| 2141 | plist_t keys = plist_new_array(); | 2148 | plist_t keys = plist_new_array(); |
| 2142 | plist_array_append_item(keys, plist_new_string("PasswordConfigured")); | 2149 | plist_array_append_item(keys, plist_new_string("PasswordConfigured")); |
