androidxmlapkandroguard

How can I get actual value in AndroidManifest.xml using Androguard?


I tried to use androguard to analyze apk files, but some apk's AndroidManifest.xml do not show value directly, for example

<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@7F0A02D1">

How can I retrieve the value of "@7F0A02D1" with androguard?

Please help, thanks.


Solution

  • I find a way to get this value:

    from androguard.core.bytecodes.apk import APK
    
    a = APK(path_to_apk)    
    r = a.get_android_resources()
    location = int('7F0A02D1', 16)
    resolved_strings = r.get_resolved_strings()
    package_name = a.get_package()
    value = resolved_strings.get(package_name, {}).get('DEFAULT', {}).get(location, '')
    

    'DEFAULT' could be other values, check it out for yourself.