diff options
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | src/Makefile.am | 5 | ||||
-rw-r--r-- | src/idevicerestore.c | 27 |
3 files changed, 37 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 9c27a7b..98516b7 100644 --- a/configure.ac +++ b/configure.ac @@ -150,6 +150,16 @@ if test "$ac_cv_reverse_proxy" = "yes"; then AC_DEFINE(HAVE_REVERSE_PROXY, 1, [Define if libimobiledevice has a reverse proxy implementation]) fi +AC_ARG_WITH([limera1n], + [AS_HELP_STRING([--with-limera1n], + [build with support for limera1n exploit (default is yes)])], + [have_limera1n=$withval], + [have_limera1n=yes]) +if test "x$have_limera1n" = "xyes"; then + AC_DEFINE(HAVE_LIMERA1N, 1, [Define if limera1n support is available]) +fi +AM_CONDITIONAL([HAVE_LIMERA1N],[test "x$have_limera1n" = "xyes"]) + CFLAGS="$CACHED_CFLAGS" AC_SUBST(GLOBAL_CFLAGS) diff --git a/src/Makefile.am b/src/Makefile.am index 80f02f2..a717b45 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,10 +44,11 @@ idevicerestore_SOURCES = \ asr.c asr.h \ fdr.c fdr.h \ ace3.c ace3.h \ - limera1n_payload.h \ - limera1n.c limera1n.h \ download.c download.h \ locking.c locking.h +if HAVE_LIMERA1N +idevicerestore_SOURCES += limera1n_payload.h limera1n.c limera1n.h +endif idevicerestore_CFLAGS = $(AM_CFLAGS) idevicerestore_LDFLAGS = $(AM_LDFLAGS) idevicerestore_LDADD = $(AM_LDADD) diff --git a/src/idevicerestore.c b/src/idevicerestore.c index b8bb1d0..a61409a 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -54,13 +54,15 @@ #include "recovery.h" #include "idevicerestore.h" +#ifdef HAVE_LIMERA1N #include "limera1n.h" +#endif #include "locking.h" #define VERSION_XML "version.xml" -#ifndef IDEVICERESTORE_NOMAIN +#ifndef IDEVICERESTORE_NOMAIN static struct option longopts[] = { { "ecid", required_argument, NULL, 'i' }, { "udid", required_argument, NULL, 'u' }, @@ -73,7 +75,9 @@ static struct option longopts[] = { { "exclude", no_argument, NULL, 'x' }, { "shsh", no_argument, NULL, 't' }, { "keep-pers", no_argument, NULL, 'k' }, +#ifdef HAVE_LIMERA1N { "pwn", no_argument, NULL, 'p' }, +#endif { "no-action", no_argument, NULL, 'n' }, { "cache-path", required_argument, NULL, 'C' }, { "no-input", no_argument, NULL, 'y' }, @@ -90,6 +94,11 @@ static struct option longopts[] = { static void usage(int argc, char* argv[], int err) { +#ifdef HAVE_LIMERA1N +#define PWN_FLAG_LINE " -p, --pwn Put device in pwned DFU mode and exit (limera1n devices)\n" +#else +#define PWN_FLAG_LINE "" +#endif char* name = strrchr(argv[0], '/'); fprintf((err) ? stderr : stdout, "Usage: %s [OPTIONS] PATH\n" \ @@ -134,7 +143,7 @@ static void usage(int argc, char* argv[], int err) " -t, --shsh Fetch TSS record and save to .shsh file, then exit\n" \ " -z, --no-restore Do not restore and end after booting to the ramdisk\n" \ " -k, --keep-pers Write personalized components to files for debugging\n" \ - " -p, --pwn Put device in pwned DFU mode and exit (limera1n devices)\n" \ + PWN_FLAG_LINE \ " -P, --plain-progress Print progress as plain step and progress\n" \ " -R, --restore-mode Allow restoring from Restore mode\n" \ " -T, --ticket PATH Use file at PATH to send as AP ticket\n" \ @@ -501,6 +510,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client) info("Device Product Build: %s\n", (client->device_build) ? client->device_build : "N/A"); if (client->flags & FLAG_PWN) { +#ifdef HAVE_LIMERA1N recovery_client_free(client); if (client->mode != MODE_DFU) { @@ -530,6 +540,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client) error("ERROR: This device is not supported by the limera1n exploit"); return -1; } +#endif } if (client->flags & FLAG_LATEST) { @@ -1392,6 +1403,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client) // if the device is in DFU mode, place it into recovery mode dfu_client_free(client); recovery_client_free(client); +#ifdef HAVE_LIMERA1N if ((client->flags & FLAG_CUSTOM) && limera1n_is_supported(client->device)) { info("connecting to DFU\n"); if (dfu_client_new(client) < 0) { @@ -1406,6 +1418,7 @@ int idevicerestore_start(struct idevicerestore_client_t* client) dfu_client_free(client); info("exploited\n"); } +#endif if (dfu_enter_recovery(client, build_identity) < 0) { error("ERROR: Unable to place device into recovery mode from DFU mode\n"); if (client->tss) @@ -1765,7 +1778,13 @@ int main(int argc, char* argv[]) { client->flags |= FLAG_INTERACTIVE; } - while ((opt = getopt_long(argc, argv, "dhces:xtpli:u:nC:kyPRT:zv", longopts, &optindex)) > 0) { +#ifdef HAVE_LIMERA1N +#define P_FLAG "p" +#else +#define P_FLAG "" +#endif + + while ((opt = getopt_long(argc, argv, "dhces:xtli:u:nC:kyPRT:zv" P_FLAG, longopts, &optindex)) > 0) { switch (opt) { case 'h': usage(argc, argv, 0); @@ -1855,9 +1874,11 @@ int main(int argc, char* argv[]) { idevicerestore_keep_pers = 1; break; +#ifdef HAVE_LIMERA1N case 'p': client->flags |= FLAG_PWN; break; +#endif case 'n': client->flags |= FLAG_NOACTION; |