summaryrefslogtreecommitdiffstats
path: root/irecovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'irecovery.c')
-rw-r--r--irecovery.c34
1 files changed, 34 insertions, 0 deletions
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() {
46 printf("Usage:\n"); 46 printf("Usage:\n");
47 printf("\t/upload <file>\tSend file to client.\n"); 47 printf("\t/upload <file>\tSend file to client.\n");
48 printf("\t/exploit [file]\tSend usb exploit with optional payload\n"); 48 printf("\t/exploit [file]\tSend usb exploit with optional payload\n");
49 printf("\t/deviceinfo\tShow device information (ECID, IMEI, etc.)\n");
49 printf("\t/help\t\tShow this help.\n"); 50 printf("\t/help\t\tShow this help.\n");
50 printf("\t/exit\t\tExit interactive shell.\n"); 51 printf("\t/exit\t\tExit interactive shell.\n");
51} 52}
@@ -70,6 +71,38 @@ void parse_command(irecv_client_t client, unsigned char* command, unsigned int s
70 } 71 }
71 } else 72 } else
72 73
74 if (!strcmp(cmd, "/deviceinfo")) {
75 int ret;
76 unsigned int cpid, bdid;
77 unsigned long long ecid;
78 unsigned char srnm[12], imei[15], bt[15];
79
80 ret = irecv_get_cpid(client, &cpid);
81 if(ret == IRECV_E_SUCCESS) {
82 printf("CPID: %d\n", cpid);
83 }
84
85 ret = irecv_get_bdid(client, &bdid);
86 if(ret == IRECV_E_SUCCESS) {
87 printf("BDID: %d\n", bdid);
88 }
89
90 ret = irecv_get_ecid(client, &ecid);
91 if(ret == IRECV_E_SUCCESS) {
92 printf("ECID: %lld\n", ecid);
93 }
94
95 ret = irecv_get_srnm(client, srnm);
96 if(ret == IRECV_E_SUCCESS) {
97 printf("SRNM: %s\n", srnm);
98 }
99
100 ret = irecv_get_imei(client, imei);
101 if(ret == IRECV_E_SUCCESS) {
102 printf("IMEI: %s\n", imei);
103 }
104 } else
105
73 if (!strcmp(cmd, "/exploit")) { 106 if (!strcmp(cmd, "/exploit")) {
74 char* filename = strtok(NULL, " "); 107 char* filename = strtok(NULL, " ");
75 debug("Sending exploit %s\n", filename); 108 debug("Sending exploit %s\n", filename);
@@ -109,6 +142,7 @@ void init_shell(irecv_client_t client) {
109 irecv_event_subscribe(client, IRECV_POSTCOMMAND, &postcommand_cb, NULL); 142 irecv_event_subscribe(client, IRECV_POSTCOMMAND, &postcommand_cb, NULL);
110 while (!quit) { 143 while (!quit) {
111 error = irecv_receive(client); 144 error = irecv_receive(client);
145
112 if (error != IRECV_E_SUCCESS) { 146 if (error != IRECV_E_SUCCESS) {
113 debug("%s\n", irecv_strerror(error)); 147 debug("%s\n", irecv_strerror(error));
114 break; 148 break;