diff options
| author | 2010-07-09 15:58:25 +0200 | |
|---|---|---|
| committer | 2010-07-09 15:58:25 +0200 | |
| commit | d80d5b462061022fac7e1a57d6a05c54499e042d (patch) | |
| tree | 6fdde20491dcd16598b725d66e15b09ad69fdd10 | |
| parent | 15010f466a4a6437b5c46a37625386565e1e5091 (diff) | |
| download | idevicerestore-d80d5b462061022fac7e1a57d6a05c54499e042d.tar.gz idevicerestore-d80d5b462061022fac7e1a57d6a05c54499e042d.tar.bz2 | |
Add helper functions to dump information from a manifest of the IPSW
| -rw-r--r-- | src/idevicerestore.c | 73 | ||||
| -rw-r--r-- | src/idevicerestore.h | 2 | 
2 files changed, 75 insertions, 0 deletions
| diff --git a/src/idevicerestore.c b/src/idevicerestore.c index b5d4858..dde163d 100644 --- a/src/idevicerestore.c +++ b/src/idevicerestore.c @@ -154,6 +154,9 @@ int main(int argc, char* argv[]) {  		return -1;  	} +	/* print iOS information from the manifest */ +	build_manifest_print_information(buildmanifest); +  	// devices are listed in order from oldest to newest  	// so we'll need their ECID  	if (client->device->index > DEVICE_IPOD2G) { @@ -188,6 +191,9 @@ int main(int argc, char* argv[]) {  		}  	} +	/* print information about current build identity */ +	build_identity_print_information(buildidentity); +  	if (client->flags & FLAG_CUSTOM > 0) {  		if (client->device->index > DEVICE_IPOD2G) {  			if (get_shsh_blobs(client, ecid, build_identity, &client->tss) < 0) { @@ -616,6 +622,73 @@ int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* path,  	return 0;  } +void build_manifest_print_information(plist_t build_manifest) { +	char* value = NULL; +	plist_t node = NULL; + +	node = plist_dict_get_item(build_manifest, "ProductVersion"); +	if (!node || plist_get_node_type(node) != PLIST_STRING) { +		error("ERROR: Unable to find ProductVersion node\n"); +		return; +	} +	plist_get_string_val(node, &value); + +	info("Product Version: %s\n", value); +	free(value); + +	node = plist_dict_get_item(build_manifest, "ProductBuildVersion"); +	if (!node || plist_get_node_type(node) != PLIST_STRING) { +		error("ERROR: Unable to find ProductBuildVersion node\n"); +		return; +	} +	plist_get_string_val(node, &value); + +	info("Product Build: %s\n", value); +	free(value); + +	node = NULL; +} + +void build_identity_print_information(plist_t build_identity) { +	char* value = NULL; +	plist_t info_node = NULL; +	plist_t node = NULL; + +	info_node = plist_dict_get_item(build_identity, "Info"); +	if (!info_node || plist_get_node_type(info_node) != PLIST_DICT) { +		error("ERROR: Unable to find Info node\n"); +		return; +	} + +	node = plist_dict_get_item(info_node, "Variant"); +	if (!node || plist_get_node_type(node) != PLIST_STRING) { +		error("ERROR: Unable to find Variant node\n"); +		return; +	} +	plist_get_string_val(node, &value); + +	info("Variant: %s\n", value); +	free(value); + +	node = plist_dict_get_item(info_node, "RestoreBehavior"); +	if (!node || plist_get_node_type(node) != PLIST_STRING) { +		error("ERROR: Unable to find RestoreBehavior node\n"); +		return; +	} +	plist_get_string_val(node, &value); + +	if (!strcmp(value, "Erase")) +		info("This restore will erase your device data.\n"); + +	if (!strcmp(value, "Update")) +		info("This restore will update your device without loosing data.\n"); + +	free(value); + +	info_node = NULL; +	node = NULL; +} +  int build_identity_get_component_path(plist_t build_identity, const char* component, char** path) {  	char* filename = NULL; diff --git a/src/idevicerestore.h b/src/idevicerestore.h index f529b5b..f42ed6f 100644 --- a/src/idevicerestore.h +++ b/src/idevicerestore.h @@ -43,6 +43,8 @@ plist_t get_build_identity(struct idevicerestore_client_t* client, plist_t build  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);  int ipsw_get_component_by_path(const char* ipsw, plist_t tss, const char* path, char** data, uint32_t* size); +void build_manifest_print_information(plist_t build_manifest); +void build_identity_print_information(plist_t build_identity);  int build_identity_get_component_path(plist_t build_identity, const char* component, char** path);  #ifdef __cplusplus | 
