Skip to content

Instantly share code, notes, and snippets.

@rickmark
Created April 7, 2020 23:06
Show Gist options
  • Save rickmark/d48425baf2e994603488c457654e25a0 to your computer and use it in GitHub Desktop.
Save rickmark/d48425baf2e994603488c457654e25a0 to your computer and use it in GitHub Desktop.
no_recovery
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index 03e4811..ffd5363 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -76,6 +76,7 @@ static struct option longopts[] = {
{ "plain-progress", no_argument, NULL, 'P' },
{ "restore-mode", no_argument, NULL, 'R' },
{ "ticket", required_argument, NULL, 'T' },
+ { "no-restore", no_argument, NULL, 'z'},
{ NULL, 0, NULL, 0 }
};
@@ -118,6 +119,7 @@ static void usage(int argc, char* argv[], int err)
" -s, --cydia Use Cydia's signature service instead of Apple's\n" \
" -x, --exclude Exclude nor/baseband upgrade\n" \
" -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 only)\n" \
" -P, --plain-progress Print progress as plain step and progress\n" \
@@ -1189,6 +1191,11 @@ int idevicerestore_start(struct idevicerestore_client_t* client)
return -2;
}
} else if (client->mode->index == MODE_RECOVERY) {
+ if ((client->flags & FLAGS_NO_RESTORE_MODE) != 0) {
+ info("Device is now in restore mode. Exiting as requested.");
+ return 0;
+ }
+
// device is in recovery mode
if ((client->build_major > 8) && !(client->flags & FLAG_CUSTOM)) {
if (!client->image4supported) {
@@ -1638,6 +1645,10 @@ int main(int argc, char* argv[]) {
client->flags |= FLAG_ALLOW_RESTORE_MODE;
break;
+ case 'z':
+ client->flags |= FLAG_NO_RESTORE_MODE;
+ break;
+
case 'T': {
size_t root_ticket_len = 0;
unsigned char* root_ticket = NULL;
diff --git a/src/idevicerestore.h b/src/idevicerestore.h
index 7d7fa53..bb0f4de 100644
--- a/src/idevicerestore.h
+++ b/src/idevicerestore.h
@@ -44,6 +44,7 @@ extern "C" {
#define FLAG_LATEST (1 << 8)
#define FLAG_INTERACTIVE (1 << 9)
#define FLAG_ALLOW_RESTORE_MODE (1 << 10)
+#define FLAG_NO_RESTORE_MODE (1 << 11)
struct idevicerestore_client_t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment