Example #1
0
int main(int argc, char* argv[]) {
	if (argc > 1 && (!strcmp(argv[1],"--help") || !strcmp(argv[1],"-h"))) {
		printf("injectpois0n\n\t-t  Teather Boot\n\t-r  Boot ramdisk\n\t-s  Only execute iBSS payload\n\t-o  Only execute iBSS payload and boot iBoot\n\nUsage: %s [-r|-s|-o]\n", argv[0]);
		return 0;
	}
	pois0n_init();
	pois0n_set_callback(&print_progress, NULL);

	info("Waiting for device to enter DFU mode\n");
	while(pois0n_is_ready()) {
		sleep(1);
	}

	info("Found device in DFU mode\n");
	if(!pois0n_is_compatible()) {
		if (argc > 1) {
			if (!strcmp(argv[1],"-t"))
				pois0n_inject("1");
			else if (!strcmp(argv[1],"-r"))
				pois0n_inject("0");
			else if (!strcmp(argv[1],"-s"))
				pois0n_inject("2");
			else if (!strcmp(argv[1],"-o"))
				pois0n_inject("3");
		} else {
			pois0n_inject(NULL);
		}
	}

	pois0n_exit();
	return 0;
}
Example #2
0
int main(int argc, char* argv[]) {
	
    if (argc > 1) {
        if (!strcmp(argv[1],"-go")){
            pois0n_init();
            pois0n_set_callback(&print_progress, NULL);
            
            info("Waiting for device to enter DFU mode\n");
            pois0n_is_ready();
            
            info("Found device in DFU mode\n");
            if(!pois0n_is_compatible()){
            pois0n_inject("2");
        }
            pois0n_exit();
        }if (!strcmp(argv[1],"-irecovery")) {
            system("build/irecovery -v -s");
        }
        
    }else {
        help();
    }
    


	return 0;
}
Example #3
0
int main(int argc, char* argv[]) {
	pois0n_init();
	pois0n_set_callback(&print_progress, NULL);

	info("Waiting for device to enter DFU mode\n");
	while(pois0n_is_ready()) {
		sleep(1);
	}

	info("Found device in DFU mode\n");
	if(!pois0n_is_compatible()) {
		pois0n_inject();
	}

	pois0n_exit();
	return 0;
}
Example #4
0
int main(int argc, char* argv[]) 
{
	irecv_error_t error;
	unsigned int cpid;
	int can_ra1n = 0;

	printf("Loadibec " LOADIBEC_VERSION COMMIT_STRING ".\n");

	if(argc != 2)
	{
		printf("Usage: %s <file>\n"
			"\tLoads a file to an iDevice in recovery mode and jumps to it.\n", argv[0]);
		return 0;
	}


	irecv_init();

	printf("Connecting to iDevice...\n");

	error = irecv_open_attempts(&g_syringe_client, 10);
	if(error != IRECV_E_SUCCESS)
	{
		fprintf(stderr, "Failed to connect to iBoot, error %d.\n", error);
		return -error;
	}
	
	if(irecv_get_cpid(g_syringe_client, &cpid) == IRECV_E_SUCCESS)
	{
		if(cpid > 8900)
			can_ra1n = 1;
	}

	if(g_syringe_client->mode == kDfuMode && can_ra1n)
	{
		int ret;
		printf("linera1n compatible device detected, injecting limera1n.\n");
		irecv_close(&g_syringe_client);
		irecv_exit();

		pois0n_init();

		ret = pois0n_is_ready();
		if(ret < 0)
			return ret;

		ret = pois0n_is_compatible();
		if(ret < 0)
			return ret;

		pois0n_inject();

		irecv_close(&g_syringe_client);
		g_syringe_client = NULL;

		printf("limera1ned, reconnecting...\n");

		g_syringe_client = irecv_reconnect(g_syringe_client, 10);
		if(!g_syringe_client)
		{
			fprintf(stderr, "Failed to reconnect.\n");
			return 4;
		}
	}
	else
		can_ra1n = 0;

	printf("Starting transfer of '%s'.\n", argv[1]);

	irecv_event_subscribe(g_syringe_client, IRECV_PROGRESS, &progress_cb, NULL);
	
	error = irecv_send_file(g_syringe_client, argv[1], 0);
	if(error != IRECV_E_SUCCESS)
	{
		fprintf(stderr, "Failed to upload '%s', error %d.\n", argv[1], error);
		return 2;
	}

	error = irecv_send_command(g_syringe_client, "go");
	if(error != IRECV_E_SUCCESS)
	{
		fprintf(stderr, "Failed to jump to uploaded file, error %d.\n", error);
		return 3;
	}
	
	irecv_send_command(g_syringe_client, "go jump 0x41000000");

	printf("Uploaded Successfully.\n");

	irecv_exit();

	return 0;
}