PublicContentProviders

This is an autogenerated documentation file for the script: PublicContentProviders

Run it

$ ./androanalyze scripts_builtin/PublicContentProviders.py --package-names com.spotify.music

View the results

Non-Binary

$ ./androquery result -sn PublicContentProviders -pn com.spotify.music

 {
     "apk meta": {
         "package name": "com.spotify.music",
         "version name": "2.2.0.636",
         "sha256": "bbf2c7d7b8fbbce68a97a2f0fd7e854e29b1ea9e3836615e7e6a35095915a607",
         "import date": "2015-04-14T15:10:06.364000",
         "build_date": "2015-02-11T12:25:40",
         "path": "/mnt/stuff/btsync/apks_manual_downloads/02.03.2015_top_free_4/apps_topselling_free/MUSIC_AND_AUDIO/com.spotify.music.apk",
         "tag": null
     },
     "script meta": {
         "name": "PublicContentProviders",
         "sha256": "7e216f32317ead92ad2e43962b82a5eb460e691a47e46753632d3e8fe518f4fa",
         "analysis date": "2015-06-22T20:29:33.912000",
         "version": "0.1"
     },
     "public_content_providers": [
         "com.spotify.mobile.android.service.media.provider.MediaProvider"
     ]
 }

Binary

For the case that the result may exceed 16MB, it is stored in MongoDB’s gridFS. Therefore we need to use a different query syntax:

View the meta data:

$ ./androquery result -sn PublicContentProviders -pn com.spotify.music -nd

 Empty

View the raw data:

$ ./androquery result -sn PublicContentProviders -pn com.spotify.music -nd -r

 Empty

Source


# encoding: utf-8

__author__ = "Nils Tobias Schmidt"
__email__ = "schmidt89 at informatik.uni-marburg.de"

from androlyze.model.script.AndroScript import AndroScript

CAT = "public_content_providers"

class PublicContentProviders(AndroScript):
    ''' Lists all public content providers '''
    
    VERSION = "0.1"
        
    def register_structure(self, res):
        # register keys
        res.register_enum_keys([CAT])
        
    def _analyze(self, apk, dalvik_vm_format, vm_analysis, gvm_analysis, *args, **kwargs):
        '''
        Parameters
        ----------
        apk: EAndroApk
        dalvik_vm_format: DalvikVMFormat
            Parsed .dex file.
            Only available if `needs_dalvik_vm_format` returns True.
        vm_analysis: VMAnalysis
            Dex analyzer.
            Only available if `needs_vmanalysis` returns True.
        gvm_analysis : GVMAnalysis
        '''

        res = self.res
        self.register_structure(res)
        
        public_components = apk.get_manifest_public_components()
        for cp in apk.get_providers():
            if cp in public_components:
                res.log_append_to_enum(CAT, cp)
            
# testing code
if __name__ == '__main__':
    for res in AndroScript.test(PublicContentProviders, ["../../../../../../../androguard_playground/apks/sql_injection.apk", "../../../../../../../androguard_playground/apks/public_content_provider.apk"]):
        print res.write_to_json()