diff options
Diffstat (limited to 'dev')
-rw-r--r-- | dev/afccheck.c | 11 | ||||
-rw-r--r-- | dev/filerelaytest.c | 11 | ||||
-rw-r--r-- | dev/housearresttest.c | 11 | ||||
-rw-r--r-- | dev/ideviceclient.c | 43 | ||||
-rw-r--r-- | dev/lckdclient.c | 10 |
5 files changed, 62 insertions, 24 deletions
diff --git a/dev/afccheck.c b/dev/afccheck.c index 2dab6db..ead0ca0 100644 --- a/dev/afccheck.c +++ b/dev/afccheck.c @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { lockdownd_client_t client = NULL; idevice_t phone = NULL; - uint16_t port = 0; + lockdownd_service_descriptor_t service = NULL; afc_client_t afc = NULL; if (argc > 1 && !strcasecmp(argv[1], "--debug")) { @@ -111,14 +111,19 @@ int main(int argc, char *argv[]) return 1; } - if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) { + if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &service) && !service->port) { lockdownd_client_free(client); idevice_free(phone); fprintf(stderr, "Something went wrong when starting AFC."); return 1; } - afc_client_new(phone, port, &afc); + afc_client_new(phone, service, &afc); + + if (service) { + lockdownd_service_descriptor_free(service); + service = NULL; + } pthread_t threads[NB_THREADS]; param data[NB_THREADS]; diff --git a/dev/filerelaytest.c b/dev/filerelaytest.c index 8c9514b..9094130 100644 --- a/dev/filerelaytest.c +++ b/dev/filerelaytest.c @@ -27,6 +27,7 @@ int main(int argc, char **argv) { idevice_t dev = NULL; lockdownd_client_t client = NULL; + lockdownd_service_descriptor_t service = NULL; file_relay_client_t frc = NULL; if (idevice_new(&dev, NULL) != IDEVICE_E_SUCCESS) { @@ -40,8 +41,7 @@ int main(int argc, char **argv) goto leave_cleanup; } - uint16_t port = 0; - if (lockdownd_start_service(client, "com.apple.mobile.file_relay", &port) != LOCKDOWN_E_SUCCESS) { + if (lockdownd_start_service(client, "com.apple.mobile.file_relay", &service) != LOCKDOWN_E_SUCCESS) { printf("could not start file_relay service!\n"); goto leave_cleanup; } @@ -51,11 +51,16 @@ int main(int argc, char **argv) client = NULL; } - if (file_relay_client_new(dev, port, &frc) != FILE_RELAY_E_SUCCESS) { + if (file_relay_client_new(dev, service, &frc) != FILE_RELAY_E_SUCCESS) { printf("could not connect to file_relay service!\n"); goto leave_cleanup; } + if (service) { + lockdownd_service_descriptor_free(service); + service = NULL; + } + idevice_connection_t dump = NULL; const char *sources[] = {"AppleSupport", "Network", "VPN", "WiFi", "UserDatabases", "CrashReporter", "tmp", "SystemConfiguration", NULL}; diff --git a/dev/housearresttest.c b/dev/housearresttest.c index 951ebe4..2e24670 100644 --- a/dev/housearresttest.c +++ b/dev/housearresttest.c @@ -96,8 +96,8 @@ int main(int argc, char **argv) goto leave_cleanup; } - uint16_t port = 0; - if (lockdownd_start_service(client, "com.apple.mobile.house_arrest", &port) != LOCKDOWN_E_SUCCESS) { + lockdownd_service_descriptor_t service = NULL; + if (lockdownd_start_service(client, "com.apple.mobile.house_arrest", &service) != LOCKDOWN_E_SUCCESS) { printf("could not start house_arrest service!\n"); goto leave_cleanup; } @@ -107,11 +107,16 @@ int main(int argc, char **argv) client = NULL; } - if (house_arrest_client_new(dev, port, &hac) != HOUSE_ARREST_E_SUCCESS) { + if (house_arrest_client_new(dev, service, &hac) != HOUSE_ARREST_E_SUCCESS) { printf("could not connect to house_arrest service!\n"); goto leave_cleanup; } + if (service) { + lockdownd_service_descriptor_free(service); + service = NULL; + } + res = house_arrest_send_command(hac, "VendDocuments", appid); if (res != HOUSE_ARREST_E_SUCCESS) { printf("error %d when trying to get VendDocuments\n", res); diff --git a/dev/ideviceclient.c b/dev/ideviceclient.c index d467ee8..c8635d8 100644 --- a/dev/ideviceclient.c +++ b/dev/ideviceclient.c @@ -45,13 +45,13 @@ static void notifier(const char *notification, void *userdata) static void perform_notification(idevice_t phone, lockdownd_client_t client, const char *notification) { - uint16_t nport = 0; + lockdownd_service_descriptor_t service = NULL; np_client_t np; - lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &nport); - if (nport) { + lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &service); + if (service->port) { printf("::::::::::::::: np was started ::::::::::::\n"); - np_client_new(phone, nport, &np); + np_client_new(phone, service, &np); if (np) { printf("::::::::: PostNotification %s\n", notification); np_post_notification(np, notification); @@ -60,13 +60,18 @@ static void perform_notification(idevice_t phone, lockdownd_client_t client, con } else { printf("::::::::::::::: np was NOT started ::::::::::::\n"); } + + if (service) { + lockdownd_service_descriptor_free(service); + service = NULL; + } } int main(int argc, char *argv[]) { unsigned int bytes = 0; - uint16_t port = 0, i = 0; - uint16_t npp; + uint16_t i = 0; + lockdownd_service_descriptor_t service = NULL; lockdownd_client_t client = NULL; idevice_t phone = NULL; uint64_t lockfile = 0; @@ -102,19 +107,33 @@ int main(int argc, char *argv[]) free(nnn); } - lockdownd_start_service(client, "com.apple.afc", &port); + lockdownd_start_service(client, "com.apple.afc", &service); - if (port) { + if (service->port) { afc_client_t afc = NULL; - afc_client_new(phone, port, &afc); + afc_client_new(phone, service, &afc); + + if (service) { + lockdownd_service_descriptor_free(service); + service = NULL; + } + if (afc) { - lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &npp); - if (npp) { + service->port = 0; + service->ssl_enabled = 0; + lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &service); + if (service->port) { printf("Notification Proxy started.\n"); - np_client_new(phone, npp, &gnp); + np_client_new(phone, service, &gnp); } else { printf("ERROR: Notification proxy could not be started.\n"); } + + if (service) { + lockdownd_service_descriptor_free(service); + service = NULL; + } + if (gnp) { const char *nspec[5] = { NP_SYNC_CANCEL_REQUEST, diff --git a/dev/lckdclient.c b/dev/lckdclient.c index cc89634..b9be4de 100644 --- a/dev/lckdclient.c +++ b/dev/lckdclient.c @@ -136,9 +136,13 @@ int main(int argc, char *argv[]) } if (!strcmp(*args, "start") && len == 2) { - uint16_t port = 0; - if(LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, *(args + 1), &port)) { - printf("started service %s on port %i\n", *(args + 1), port); + lockdownd_service_descriptor_t service = NULL; + if(LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, *(args + 1), &service)) { + printf("started service %s on port %i\n", *(args + 1), service->port); + if (service) { + lockdownd_service_descriptor_free(service); + service = NULL; + } } else { |