From 923d8168e5a5f9b57045ace8bc04cb73f9c51ae5 Mon Sep 17 00:00:00 2001 From: tihmstar Date: Sun, 3 Nov 2019 15:15:05 +0100 Subject: [PATCH] added option to ignore bad ramdisk hashes --- futurerestore/futurerestore.cpp | 15 ++++++++++++++- futurerestore/main.cpp | 15 ++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index 17955060..b3c57c88 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -670,7 +670,20 @@ void futurerestore::doRestore(const char *ipsw){ }else printf("Verified ECID in APTicket matches device ECID\n"); - plist_t ticketIdentity = img4tool::getBuildIdentityForIm4m({im4m.first,im4m.second}, buildmanifest); + plist_t ticketIdentity = NULL; + + try { + ticketIdentity = img4tool::getBuildIdentityForIm4m({im4m.first,im4m.second}, buildmanifest); + } catch (tihmstar::exception &e) { + // + } + + if (!ticketIdentity) { + printf("Failed to get exact match for build identity, using fallback to ignore certain values"); + ticketIdentity = img4tool::getBuildIdentityForIm4m({im4m.first,im4m.second}, buildmanifest, {"RestoreRamDisk","RestoreTrustCache"}); + } + + //TODO: make this nicer! //for now a simple pointercompare should be fine, because both plist_t should point into the same buildidentity inside the buildmanifest if (ticketIdentity != build_identity ){ diff --git a/futurerestore/main.cpp b/futurerestore/main.cpp index 0c1499b4..0c37ef71 100644 --- a/futurerestore/main.cpp +++ b/futurerestore/main.cpp @@ -280,14 +280,15 @@ error: } int main(int argc, const char * argv[]) { -//#ifdef DEBUG -// return main_r(argc, argv); -//#else +#ifdef DEBUG + return main_r(argc, argv); +#else try { return main_r(argc, argv); - } catch (std::exception &e) { - printf("%s: failed with exception (%s)\n",PACKAGE_NAME,e.what()); - return -1; + } catch (tihmstar::exception &e) { + printf("%s: failed with exception:\n",PACKAGE_NAME); + e.dump(); + return e.code(); } -//#endif +#endif }