diff options
author | 2024-11-15 00:18:05 +0100 | |
---|---|---|
committer | 2024-11-15 00:18:05 +0100 | |
commit | ba829e6f1a62bdad7866572d1e2cff1836ced742 (patch) | |
tree | 5c4b23e376c90a664fe7089998e0a3e3c19a2552 /tools | |
parent | 5aebbc0c694d1048712505195c32a17c3091d417 (diff) | |
download | libimobiledevice-ba829e6f1a62bdad7866572d1e2cff1836ced742.tar.gz libimobiledevice-ba829e6f1a62bdad7866572d1e2cff1836ced742.tar.bz2 |
tools: Add --insecure option to idevicenotificationproxy tool
Diffstat (limited to 'tools')
-rw-r--r-- | tools/idevicenotificationproxy.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/tools/idevicenotificationproxy.c b/tools/idevicenotificationproxy.c index d1e25c1..00da916 100644 --- a/tools/idevicenotificationproxy.c +++ b/tools/idevicenotificationproxy.c @@ -2,7 +2,8 @@ * idevicenotificationproxy.c * Simple client for the notification_proxy service * - * Copyright (c) 2009-2015 Martin Szulecki All Rights Reserved. + * Copyright (c) 2018-2024 Nikias Bassen, All Rights Reserved. + * Copyright (c) 2009-2015 Martin Szulecki, All Rights Reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -75,6 +76,7 @@ static void print_usage(int argc, char **argv, int is_error) "\n" "The following OPTIONS are accepted:\n" " -u, --udid UDID target specific device by UDID\n" + " -i, --insecure use insecure notification proxy (non-paired device)\n" " -n, --network connect to network device\n" " -d, --debug enable communication debugging\n" " -h, --help prints usage information\n" @@ -102,6 +104,7 @@ int main(int argc, char *argv[]) int i = 0; const char* udid = NULL; int use_network = 0; + int insecure = 0; int cmd = CMD_NONE; char* cmd_arg = NULL; @@ -114,6 +117,7 @@ int main(int argc, char *argv[]) { "debug", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, { "udid", required_argument, NULL, 'u' }, + { "insecure", no_argument, NULL, 'i' }, { "network", no_argument, NULL, 'n' }, { "version", no_argument, NULL, 'v' }, { NULL, 0, NULL, 0} @@ -127,7 +131,7 @@ int main(int argc, char *argv[]) #endif /* parse cmdline args */ - while ((c = getopt_long(argc, argv, "dhu:nv", longopts, NULL)) != -1) { + while ((c = getopt_long(argc, argv, "dhu:inv", longopts, NULL)) != -1) { switch (c) { case 'd': idevice_set_debug_level(1); @@ -143,6 +147,9 @@ int main(int argc, char *argv[]) case 'n': use_network = 1; break; + case 'i': + insecure = 1; + break; case 'h': print_usage(argc, argv, 0); return 0; @@ -214,12 +221,17 @@ int main(int argc, char *argv[]) goto cleanup; } - if (LOCKDOWN_E_SUCCESS != (ret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME))) { - fprintf(stderr, "ERROR: Could not connect to lockdownd, error code %d\n", ret); + if (insecure) { + ret = lockdownd_client_new(device, &client, TOOL_NAME); + } else { + ret = lockdownd_client_new_with_handshake(device, &client, TOOL_NAME); + } + if (LOCKDOWN_E_SUCCESS != ret) { + fprintf(stderr, "ERROR: Could not connect to lockdownd: %s (%d)\n", lockdownd_strerror(ret), ret); goto cleanup; } - ret = lockdownd_start_service(client, NP_SERVICE_NAME, &service); + ret = lockdownd_start_service(client, (insecure) ? "com.apple.mobile.insecure_notification_proxy" : NP_SERVICE_NAME, &service); lockdownd_client_free(client); |