Skip to content

Extracting XML with the strings decoded #105

@videostormdev

Description

@videostormdev

I am trying to extract the APP_RESTRICTIONS from an APK

These are listed in the manifest as meta-data, pointing to an XML file (typically res/xml/app_restrictions.xml)

The following code is how I get the XML file using php-apk-parser (awesome tool btw)
However, the XML file still has the resource IDs instead of the corresponding strings for most fields (name, description, etc)

$metaconf = $manifest->getMetaData('android.content.APP_RESTRICTIONS');
if (($metaconf != null)&&(strlen($metaconf)>1)){
	// metaconf is the resource id for the xml file
	$managedconfig = 1;
	if ($getresource){
		$mcarr = $apk->getResources($metaconf);
		//error_log("Supports managedconfig, values = " . count($mcarr));
		$managedconfigxmlfile = $mcarr[0];
		//$managedconfigxml = stream_get_contents($apk->getStream($managedconfigxmlfile));
										
		// below works, but extracted xml has resource ids in it (not decoded)
		$mcstr = new \ApkParser\Stream($apk->getStream($managedconfigxmlfile));
		$mcxml = new \ApkParser\XmlParser($mcstr);
		$managedconfigxml = $mcxml->getXmlString();
         }
}

Is there a straightforward way to get the XML text with all resource strings decoded?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions