Ejemplo n.º 1
0
int iboot_command_(const char* s_cmd) {
	int s_ret = 0;	/*Value to be returned */
	s_ret = irecv_open_attempts(&client, 10);	/* Open attempts and load client */
	irecv_send_command(client, s_cmd);	/* Send commmand {s_cmd[2]} */
	irecv_exit();	/* kill & clear client */
	return s_ret;		/* Return ret */
}
Ejemplo n.º 2
0
int connect_to_device() {	

	irecv_error_t error;
	
	irecv_init();

	printf("\nWaiting for device...\n");	

	error = irecv_open_attempts(&client, 10);
	if(error != IRECV_E_SUCCESS)
	{
		fprintf(stderr, "Failed to connect to iBoot, error %d.\n", error);
		return -error;
	}	
	
	if (client->mode == kDfuMode) {
		printf("Loaded DFU\n");
		model();
	}
	if (client->mode == kRecoveryMode1 || client->mode == kRecoveryMode2 || client->mode == kRecoveryMode3 || client->mode == kRecoveryMode4 ) {
		model();
	}
	

			
	
	
	
}
Ejemplo n.º 3
0
int fsck_client(int _client_, const char* _order_operations, unsigned int argp) {
	argp = irecv_open_attempts(&client, 10);	/* Open attempts and load client */
	irecv_send_command(client, "fsck_hfs reset");	/* Send commmand {s_cmd[2]} */
	irecv_send_command(client, _order_operations);	/* Send specified order */
	/* Initation payload[] */
	if (argp != EOF)
		argp = irecv_send_command(client, ""); 
	do {
		//_client_ = client->DfuPath;
		argp = EOF;
	} while (argp != EOF);
	
	return 0;
}
Ejemplo n.º 4
0
irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause)
{
	irecv_error_t error = 0;
	irecv_client_t new_client = NULL;
	irecv_event_cb_t progress_callback = client->progress_callback;
#ifdef _WIN32
#ifdef _GUI_ENABLE_
	char buffer[256];
#endif
#endif

	if (check_context(client) == IRECV_E_SUCCESS) {
		irecv_close(client);
	}

#ifdef _WIN32
#ifdef _GUI_ENABLE_
	snprintf(buffer, 256, "Waiting %d seconds for the device...\n", initial_pause);
	SendMessage(hStatus3, WM_SETTEXT, 0, (LPARAM)buffer);
	InvalidateRect(window, NULL, TRUE);
#endif
#endif
	if (initial_pause > 0) {
		DPRINT("Waiting %d seconds for the device to pop up...\n",
		       initial_pause);
		sleep(initial_pause);
	}
#ifdef _WIN32
#ifdef _GUI_ENABLE_
	SendMessage(hStatus3, WM_SETTEXT, 0, (LPARAM) TEXT(" "));
	InvalidateRect(window, NULL, TRUE);
#endif
#endif

	error = irecv_open_attempts(&new_client, 10);
	if (error != IRECV_E_SUCCESS) {
		return NULL;
	}

	new_client->progress_callback = progress_callback;
	return new_client;
}
Ejemplo n.º 5
0
irecv_client_t irecv_reconnect(irecv_client_t client, int initial_pause) {
	irecv_error_t error = 0;
	irecv_client_t new_client = NULL;
	irecv_event_cb_t progress_callback = client->progress_callback;

	if (check_context(client) == IRECV_E_SUCCESS) {
		irecv_close(client);
	}

	if (initial_pause > 0) {
		debug("Waiting %d seconds for the device to pop up...\n", initial_pause);
		sleep(initial_pause);
	}
	
	error = irecv_open_attempts(&new_client, 10);
	if(error != IRECV_E_SUCCESS) {
		return NULL;
	}

	new_client->progress_callback = progress_callback;
	return new_client;
}
Ejemplo n.º 6
0
void resetRecovery(void) {	
	irecv_open_attempts(&client, 10);	
	irecv_send_command(client, "reset");
	irecv_exit();
	
}
Ejemplo n.º 7
0
void client_init() {	
	irecv_open_attempts(&client, 10);	/* Open attempts and load client */	
}
Ejemplo n.º 8
0
int libkrypton1te_init() {
	int s_ret = 0;	/*Value to be returned */
	irecv_open_attempts(&client, 10);	/* Open attempts and load client */
	pois0n_init();
	return s_ret;
}
Ejemplo n.º 9
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;
}