void list_installed_apps(struct am_device *device) { connect_to_device(device); CFDictionaryRef apps; ASSERT_OR_EXIT(!AMDeviceLookupApplications(device, 0, &apps), "!AMDeviceLookupApplications\n"); CFDictionaryApplyFunction(apps, print_installed_app, NULL); CFRelease(apps); unregister_device_notification(0); }
void uninstall_app(struct am_device *device) { connect_to_device(device); CFStringRef bundle_id = CFStringCreateWithCString(NULL, command.bundle_id, kCFStringEncodingUTF8); // install package on device ASSERT_OR_EXIT(!AMDeviceSecureUninstallApplication(0, device, bundle_id, 0, NULL, 0), "!AMDeviceSecureUninstallApplication\n"); CFRelease(bundle_id); printf("OK\n"); unregister_device_notification(0); }
int main (int argc, char *argv[]) { if ( argc != 2 ) /* argc should be 2 for correct execution */ { printf("plutonium is krypton1te's argument manager. Based on syringe and iRecovery.\nOpensource @ github.com/atomic-dev/plutonium\n\n"); printf("plutonium\t./args\n"); printf("-a\t\tActivate libkrypton1te\n"); printf("-b\t\tBash\n"); printf("-c <command>\tSend a command to iBoot\n"); printf("-k\t\tRun libkrypton1te\n"); } else { char** pArg; for (pArg = argv + 1; pArg < argv + argc; ++pArg) { const char* arg = *pArg; int* pIntOpt = NULL; if (!strcmp(arg, "-a")) { printf("\nInitiating libkrypton1te...\n"); do { printf("..."); } while ((libkrypton1te_init()) != 0); printf("\nSuccess!\n"); } else if (!strcmp(arg, "-b")) { printf("bash shell...\n"); do { fsck_client(1, "fsck_hfs", 10); } while ((libkrypton1te_init()) != 0); } else if (!strcmp(arg, "-c")) { connect_to_device(); } else if (!strcmp(arg, "-k")) { /* libkrypton1te */ } } } }
void on_device_connected(struct am_device *device) { if (command.type == GetUDID) { get_udid(device); } else if (command.type == InstallApp) { install_app(device); } else if (command.type == UninstallApp) { uninstall_app(device); } else if (command.type == ListInstalledApps) { list_installed_apps(device); } else if (command.type == Tunnel) { connect_to_device(device); create_tunnel(device, command.src_port, command.dst_port); } }
void install_app(struct am_device *device) { connect_to_device(device); CFURLRef local_app_url = get_absolute_file_url(command.app_path); CFStringRef keys[] = { CFSTR("PackageType") }, values[] = { CFSTR("Developer") }; CFDictionaryRef options = CFDictionaryCreate(NULL, (const void **)&keys, (const void **)&values, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); // copy .app to device ASSERT_OR_EXIT(!AMDeviceSecureTransferPath(0, device, local_app_url, options, NULL, 0), "!AMDeviceSecureTransferPath\n"); // install package on device ASSERT_OR_EXIT(!AMDeviceSecureInstallApplication(0, device, local_app_url, options, NULL, 0), "!AMDeviceSecureInstallApplication\n"); CFRelease(options); CFRelease(local_app_url); printf("OK\n"); unregister_device_notification(0); }
int main(int argc, char *argv[]) { int err; cl_platform_id platform; cl_device_id device; cl_command_queue command_queue; cl_program program; cl_kernel kernel; cl_context context; //##############################// //########OpenCL Stuff##########// //##############################// // find platform and device to use if (!connect_to_device(CL_DEVICE_TYPE_GPU, &platform, &device)) { printf ("Unable to find suitable OpenCL device!\n"); return 1; } char buffer[512]; clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof (buffer), buffer, NULL); printf ("Using device: %s\n", buffer); context = clCreateContext(0, 1, &device, NULL, NULL, &err); if (!context || err != CL_SUCCESS) { printf("ERROR: Failed to create a compute context! %s\n", get_ocl_error(err)); return EXIT_FAILURE; } cl_command_queue_properties properties = CL_QUEUE_PROFILING_ENABLE; command_queue = clCreateCommandQueue (context, device, properties, &err); if (!command_queue || err != CL_SUCCESS) { printf("ERROR: Failed to create a command commands! %s\n", get_ocl_error(err)); return EXIT_FAILURE; } const char *strings[] = {NULL, NULL}; strings[0] = read_file(KERNEL_FILE); if (strings[0] == NULL) { fprintf(stderr, "Unable to find \"%s\"", KERNEL_FILE); return 1; } program = clCreateProgramWithSource(context, 1, (const char **) & strings[0], NULL, &err); if (!program || err != CL_SUCCESS) { printf("ERROR: Failed to create compute program! %s\n", get_ocl_error(err)); return EXIT_FAILURE; } err = clBuildProgram(program, 0, NULL, NULL, NULL, NULL); if (err != CL_SUCCESS) { size_t len; char buffer[2048]; printf("ERROR: Failed to build program executable! %s\n", get_ocl_error(err)); clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &len); printf("%s\n", buffer); return EXIT_FAILURE; } kernel = clCreateKernel(program, KERNEL_FUNC, &err); if (!kernel || err != CL_SUCCESS) { printf("ERROR: Failed to create compute kernel! %s\n", get_ocl_error(err)); exit(1); } edizinami **all_histograms = malloc(0 * sizeof(edizinami*)); if(all_histograms == NULL) { printf("Cannot allocate memory!"); return -1; } // Get all weak classifiers and dataset we'll use read_all_histograms(&all_histograms); for(int i = 0; i < current_size; i++) { int total = 0; //printf("Hallelujah! %s\n", all_histograms[i]->filename); // Initial weights all_histograms[i]->weight = 1 / current_size; } for(int i = 0; i < current_size; i++) { free(all_histograms[i]->filename); free(all_histograms[i]->data); free(all_histograms[i]); } free(all_histograms); clReleaseCommandQueue(command_queue); clReleaseKernel(kernel); clReleaseContext(context); clReleaseProgram(program); return 0; }
int main(void) { switch(fork()) { case -1: die("fork\n"); break; case 0: dev_id = hci_devid(DEV_ID); if (dev_id < 0) { die("Invalid device\n"); } else { initsignals(); close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); Display *dpy = NULL; int rssi, screen; Bool help = True; check_version(dev_id); add_to_white_list(dev_id); handle = connect_to_device(dev_id); /* encryption(dev_id, handle); */ while (running) { if (help) { if (!(dpy = XOpenDisplay(0))) die("ble: cannot open display"); /* Get the number of screens in display "dpy" and blank them all. */ nscreens = ScreenCount(dpy); locks = malloc(sizeof(Lock *) * nscreens); if (locks == NULL) die("ble: malloc: %s", strerror(errno)); } if (help) { rssi = read_rssi(dev_id, handle); if ((calculate_distance(rssi) >= 2.0) && (rssi <= -71 && rssi >= -75)) { if (locks != NULL && help) { for (screen = 0; screen < nscreens; screen++) locks[screen] = lockscreen(dpy, screen); XSync(dpy, False); } help = False; } } sleep(1); if (!help) { rssi = read_rssi(dev_id, handle); if ((calculate_distance(rssi) <= 2.0) && (rssi <= -30 && rssi >= -70)) { for (screen = 0; screen < nscreens; screen++) unlockscreen(dpy, locks[screen]); if (locks != NULL || dpy != NULL) { free(locks); XCloseDisplay(dpy); help = True; } } } } disconnect_from_device(dev_id, handle); } default: break; } return EXIT_SUCCESS; }