diff options
Diffstat (limited to 'tools/irecovery.c')
| -rw-r--r-- | tools/irecovery.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/tools/irecovery.c b/tools/irecovery.c index 48a69f6..fd53925 100644 --- a/tools/irecovery.c +++ b/tools/irecovery.c | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <stdlib.h> | 27 | #include <stdlib.h> |
| 28 | #include <unistd.h> | 28 | #include <unistd.h> |
| 29 | #include <string.h> | 29 | #include <string.h> |
| 30 | #include <getopt.h> | ||
| 30 | #include <inttypes.h> | 31 | #include <inttypes.h> |
| 31 | #include <libirecovery.h> | 32 | #include <libirecovery.h> |
| 32 | #include <readline/readline.h> | 33 | #include <readline/readline.h> |
| @@ -358,24 +359,39 @@ static void print_usage(int argc, char **argv) { | |||
| 358 | printf("Interact with an iOS device in DFU or recovery mode.\n"); | 359 | printf("Interact with an iOS device in DFU or recovery mode.\n"); |
| 359 | printf("\n"); | 360 | printf("\n"); |
| 360 | printf("OPTIONS:\n"); | 361 | printf("OPTIONS:\n"); |
| 361 | printf(" -i ECID\tconnect to specific device by its ECID\n"); | 362 | printf(" -i, --ecid ECID\tconnect to specific device by its ECID\n"); |
| 362 | printf(" -c CMD\trun CMD on device\n"); | 363 | printf(" -c, --command CMD\trun CMD on device\n"); |
| 363 | printf(" -m\t\tprint current device mode\n"); | 364 | printf(" -m, --mode\t\tprint current device mode\n"); |
| 364 | printf(" -f FILE\tsend file to device\n"); | 365 | printf(" -f, --file FILE\tsend file to device\n"); |
| 365 | printf(" -k FILE\tsend limera1n usb exploit payload from FILE\n"); | 366 | printf(" -k, --payload FILE\tsend limera1n usb exploit payload from FILE\n"); |
| 366 | printf(" -r\t\treset client\n"); | 367 | printf(" -r, --reset\t\treset client\n"); |
| 367 | printf(" -n\t\treboot device into normal mode (exit recovery loop)\n"); | 368 | printf(" -n, --normal\t\treboot device into normal mode (exit recovery loop)\n"); |
| 368 | printf(" -e FILE\texecutes recovery script from FILE\n"); | 369 | printf(" -e, --script FILE\texecutes recovery script from FILE\n"); |
| 369 | printf(" -s\t\tstart an interactive shell\n"); | 370 | printf(" -s, --shell\t\tstart an interactive shell\n"); |
| 370 | printf(" -q\t\tquery device info\n"); | 371 | printf(" -q, --query\t\tquery device info\n"); |
| 371 | printf(" -v\t\tenable verbose output, repeat for higher verbosity\n"); | 372 | printf(" -v, --verbose\t\tenable verbose output, repeat for higher verbosity\n"); |
| 372 | printf(" -h\t\tprints this usage information\n"); | 373 | printf(" -h, --help\t\tprints this usage information\n"); |
| 373 | printf("\n"); | 374 | printf("\n"); |
| 374 | printf("Homepage: <" PACKAGE_URL ">\n"); | 375 | printf("Homepage: <" PACKAGE_URL ">\n"); |
| 375 | printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); | 376 | printf("Bug Reports: <" PACKAGE_BUGREPORT ">\n"); |
| 376 | } | 377 | } |
| 377 | 378 | ||
| 378 | int main(int argc, char* argv[]) { | 379 | int main(int argc, char* argv[]) { |
| 380 | static struct option longopts[] = { | ||
| 381 | { "ecid", required_argument, NULL, 'i' }, | ||
| 382 | { "command", required_argument, NULL, 'c' }, | ||
| 383 | { "mode", no_argument, NULL, 'm' }, | ||
| 384 | { "file", required_argument, NULL, 'f' }, | ||
| 385 | { "payload", required_argument, NULL, 'k' }, | ||
| 386 | { "reset", no_argument, NULL, 'r' }, | ||
| 387 | { "normal", no_argument, NULL, 'n' }, | ||
| 388 | { "script", required_argument, NULL, 'e' }, | ||
| 389 | { "shell", no_argument, NULL, 's' }, | ||
| 390 | { "query", no_argument, NULL, 'q' }, | ||
| 391 | { "verbose", no_argument, NULL, 'v' }, | ||
| 392 | { "help", no_argument, NULL, 'h' }, | ||
| 393 | { NULL, 0, NULL, 0 } | ||
| 394 | }; | ||
| 379 | int i = 0; | 395 | int i = 0; |
| 380 | int opt = 0; | 396 | int opt = 0; |
| 381 | int action = kNoAction; | 397 | int action = kNoAction; |
| @@ -392,7 +408,7 @@ int main(int argc, char* argv[]) { | |||
| 392 | return 0; | 408 | return 0; |
| 393 | } | 409 | } |
| 394 | 410 | ||
| 395 | while ((opt = getopt(argc, argv, "i:vhrsmnc:f:e:k::q")) > 0) { | 411 | while ((opt = getopt_long(argc, argv, "i:vhrsmnc:f:e:k:q", longopts, NULL)) > 0) { |
| 396 | switch (opt) { | 412 | switch (opt) { |
| 397 | case 'i': | 413 | case 'i': |
| 398 | if (optarg) { | 414 | if (optarg) { |
