Exemplo n.º 1
0
int main(int argc, char *argv[]) {
	printf("iRecovery - Recovery Utility\n");
	printf("by westbaer\nThanks to pod2g, tom3q, planetbeing and geohot.\n\n");
	if(argc < 2) {
		irecv_usage();
		exit(EXIT_FAILURE);
	}

	if(argv[1][0] != '-') {
		irecv_usage();
		exit(EXIT_FAILURE);
	}
	
	signal(SIGINT, irecv_quit); // Close USB on ^C
	
	if(strcmp(argv[1], "-f") == 0) {
		if(argc < 3) {
			printf("No valid file set.\n");
			exit(EXIT_FAILURE);
		} 

		irecv_sendfile(argv[2]);
	} else if(strcmp(argv[1], "-c") == 0) {
		irecv_sendcmd(argv[2]);
	} else if(strcmp(argv[1], "-s") == 0) {
		irecv_console();
	} else if(strcmp(argv[1], "-r") == 0) {
		irecv_reset();
	}
	
	return 0;
}
Exemplo n.º 2
0
int main(int argc, char *argv[]) {
	printf("iRecovery - Recovery Utility\n");
	printf("by westbaer\nThanks to pod2g, tom3q, planetbeing, geohot and posixninja.\n\n");
	if(argc < 2) {
		irecv_usage();
		return -1;
	}

	struct usb_dev_handle* handle = irecv_init(RECV_MODE);
	if (handle == NULL) {
		handle = irecv_init(WTF_MODE);
		if (handle == NULL) {
		    printf("No iPhone/iPod found.\n");
		    return -1;
		    
		} else {
		    printf("Found iPhone/iPod in DFU/WTF mode\n");
		}
	} else {
	    printf("Found iPhone/iPod in Recovery mode\n");
	}
	
	if(!strcmp(argv[1], "-f")) {
	    if(argc == 3) {
            irecv_upload(handle, argv[2]);
        }
            
	} else if(!strcmp(argv[1], "-c")) {
	   	if(argc >= 3) {
	        irecv_command(handle, argc-2, &argv[2]);
	    }

	} else if(!strcmp(argv[1], "-k")) {
	   	if(argc >= 3) {
	        irecv_exploit(handle, argv[2]);
	    } else {
	        irecv_exploit(handle, NULL);
	    }

	} else if(!strcmp(argv[1], "-s")) {
	   	if(argc >= 3) {
            irecv_console(handle, argv[2]);
	    } else {
	        irecv_console(handle, NULL);
	    }
	    
	} else if(!strcmp(argv[1], "-r")) {
        irecv_reset(handle);
	} else if (!strcmp(argv[1], "-l")) {
	    irecv_list(handle, argv[2]);
	}
	  else if (!strcmp(argv[1], "-x")) {
	    if(argc == 3) {
	    irecv_upload(handle, argv[2]);
	    irecv_reset(handle);
		}
	}
	irecv_close(handle);
	return 0;
}
Exemplo n.º 3
0
int main(int argc, char *argv[]) {
	printf("iRecovery - Recovery Utility\n");
	printf("by westbaer\nThanks to pod2g, tom3q, planetbeing, geohot and posixninja.\n\n");

	if(argc < 2) {
		irecv_usage();
		return -1;
	}

        if(!strcmp(argv[1], "-q")) {
                enter_recovery();

        } 

	struct usb_dev_handle* handle = irecv_init(RECV_MODE);

	if (handle == NULL) {
		handle = irecv_init(WTF_MODE);
		if (handle == NULL) {
			printf("No iPhone/iPod found.\n");
		    	return -1;
		    
		} else {
		   	printf("Found iPhone/iPod in DFU/WTF mode\n");

		}

	} else {
	    	printf("Found iPhone/iPod in Recovery mode\n");

	}

	if (((irecv_command(handle, 1, "setenv auto-boot true")) == -1) ||
            ((irecv_command(handle, 1, "saveenv")) == -1))
                printf("Failed to set auto-boot");

	if(!strcmp(argv[1], "-f")) {
	    	if(argc == 3) {
                	irecv_upload(handle, argv[2]);

            	}
            
	} else if(!strcmp(argv[1], "-c")) {
	   	if(argc >= 3) {
	            	irecv_command(handle, argc-2, &argv[2]);

	        } 

	} else if(!strcmp(argv[1], "-k")) {
	   	if(argc >= 3) {
	            	irecv_exploit(handle, argv[2]);
	        } else {
	            	irecv_exploit(handle, NULL);
	        }
	    
	} else if(!strcmp(argv[1], "-k")) {
	   	if(argc >= 3) {
	            	irecv_exploit(handle, argv[2]);
	        }

	} else if(!strcmp(argv[1], "-x40")) {
	   	if(argc >= 3) {
	            	irecv_sendrawusb0x40(handle, argv[2]);
	        }
	    
	} else if(!strcmp(argv[1], "-x21")) {
	   	if(argc >= 3) {
	            	irecv_sendrawusb0x21(handle, argv[2]);
	        }
	    
	} else if(!strcmp(argv[1], "-xA1")) {
	   	if(argc >= 3) {
	            	irecv_sendrawusb0xA1(handle, argv[2]);
	        }

	} else if(!strcmp(argv[1], "-s")) {
	   	if(argc >= 3) {
                    	irecv_console(handle, argv[2]);
	        } else {
	            	irecv_console(handle, NULL);
	        }
	    
	} else if(!strcmp(argv[1], "-r")) {
                irecv_reset(handle);

	} else if (!strcmp(argv[1], "-l")) {
	        irecv_list(handle, argv[2]);

	} else if (!strcmp(argv[1], "-x")) {
		if (argc == 3) {
		    	irecv_upload(handle, argv[2]);
		    	irecv_reset(handle);
		}

	}
	
	irecv_close(handle);
	return 0;
}