diff options
-rw-r--r-- | src/idevicerestore.c | 2 | ||||
-rw-r--r-- | src/idevicerestore.h | 1 | ||||
-rw-r--r-- | src/ipsw.c | 22 | ||||
-rw-r--r-- | src/ipsw.h | 2 |
4 files changed, 25 insertions, 2 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c index dde163d..6b3dee4 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -149,7 +149,7 @@ int main(int argc, char* argv[]) { // extract buildmanifest plist_t buildmanifest = NULL; info("Extracting BuildManifest from IPSW\n"); - if (extract_buildmanifest(client, ipsw, &buildmanifest) < 0) { + if (ipsw_extract_build_manifest(ipsw, &buildmanifest) < 0) { error("ERROR: Unable to extract BuildManifest from %s\n", ipsw); return -1; } diff --git a/src/idevicerestore.h b/src/idevicerestore.h index f42ed6f..27128a7 100644 --- a/src/idevicerestore.h +++ b/src/idevicerestore.h @@ -38,7 +38,6 @@ int get_build_count(plist_t buildmanifest); int get_ecid(struct idevicerestore_client_t* client, uint64_t* ecid); int get_bdid(struct idevicerestore_client_t* client, uint32_t* bdid); int get_cpid(struct idevicerestore_client_t* client, uint32_t* cpid); -int extract_buildmanifest(struct idevicerestore_client_t* client, const char* ipsw, plist_t* buildmanifest); plist_t get_build_identity(struct idevicerestore_client_t* client, plist_t buildmanifest, uint32_t identity); int get_shsh_blobs(struct idevicerestore_client_t* client, uint64_t ecid, plist_t build_identity, plist_t* tss); int extract_filesystem(struct idevicerestore_client_t* client, const char* ipsw, plist_t buildmanifest, char** filesystem); @@ -173,6 +173,28 @@ int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, return 0; } +int ipsw_extract_build_manifest(const char* ipsw, plist_t* buildmanifest) { + int size = 0; + char* data = NULL; + + /* older devices don't require personalized firmwares and use a BuildManifesto.plist */ + if (ipsw_extract_to_memory(ipsw, "BuildManifesto.plist", &data, &size) == 0) { + plist_from_xml(data, size, buildmanifest); + return 0; + } + + data = NULL; + size = 0; + + /* whereas newer devices do not require personalized firmwares and use a BuildManifest.plist */ + if (ipsw_extract_to_memory(ipsw, "BuildManifest.plist", &data, &size) == 0) { + plist_from_xml(data, size, buildmanifest); + return 0; + } + + return -1; +} + void ipsw_close(ipsw_archive* archive) { if (archive != NULL) { zip_unchange_all(archive->zip); @@ -28,6 +28,7 @@ extern "C" { #include <zip.h> #include <stdint.h> +#include <plist/plist.h> typedef struct { int index; @@ -37,6 +38,7 @@ typedef struct { } ipsw_file; int ipsw_extract_to_memory(const char* ipsw, const char* infile, char** pbuffer, uint32_t* psize); +int ipsw_extract_build_manifest(const char* ipsw, plist_t* buildmanifest); void ipsw_free_file(ipsw_file* file); #ifdef __cplusplus |