From ee84c231a361ccb85f9eebc40a4c2e1551bcf010 Mon Sep 17 00:00:00 2001 From: Nicolas Haunold Date: Wed, 9 Mar 2011 20:14:12 +0100 Subject: Added irecv_get_srnm (serial number) and irecv_get_imei (imei) to libirecovery and /deviceinfo to the irecovery shell which displays basic device information. --- irecovery.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'irecovery.c') diff --git a/irecovery.c b/irecovery.c index 40e6021..a7d6429 100644 --- a/irecovery.c +++ b/irecovery.c @@ -46,6 +46,7 @@ void shell_usage() { printf("Usage:\n"); printf("\t/upload \tSend file to client.\n"); printf("\t/exploit [file]\tSend usb exploit with optional payload\n"); + printf("\t/deviceinfo\tShow device information (ECID, IMEI, etc.)\n"); printf("\t/help\t\tShow this help.\n"); printf("\t/exit\t\tExit interactive shell.\n"); } @@ -70,6 +71,38 @@ void parse_command(irecv_client_t client, unsigned char* command, unsigned int s } } else + if (!strcmp(cmd, "/deviceinfo")) { + int ret; + unsigned int cpid, bdid; + unsigned long long ecid; + unsigned char srnm[12], imei[15], bt[15]; + + ret = irecv_get_cpid(client, &cpid); + if(ret == IRECV_E_SUCCESS) { + printf("CPID: %d\n", cpid); + } + + ret = irecv_get_bdid(client, &bdid); + if(ret == IRECV_E_SUCCESS) { + printf("BDID: %d\n", bdid); + } + + ret = irecv_get_ecid(client, &ecid); + if(ret == IRECV_E_SUCCESS) { + printf("ECID: %lld\n", ecid); + } + + ret = irecv_get_srnm(client, srnm); + if(ret == IRECV_E_SUCCESS) { + printf("SRNM: %s\n", srnm); + } + + ret = irecv_get_imei(client, imei); + if(ret == IRECV_E_SUCCESS) { + printf("IMEI: %s\n", imei); + } + } else + if (!strcmp(cmd, "/exploit")) { char* filename = strtok(NULL, " "); debug("Sending exploit %s\n", filename); @@ -109,6 +142,7 @@ void init_shell(irecv_client_t client) { irecv_event_subscribe(client, IRECV_POSTCOMMAND, &postcommand_cb, NULL); while (!quit) { error = irecv_receive(client); + if (error != IRECV_E_SUCCESS) { debug("%s\n", irecv_strerror(error)); break; -- cgit v1.1-32-gdbae