Exemple #1
0
    def _analyze(self, apk, dalvik_vm_format, vm_analysis, gvm_analysis, *args,
                 **kwargs):
        res = self.res

        # register static structure
        self._register_static_structure()

        # libs
        res.log(CAT_LIBS, apk.get_libraries(), CAT_APK_INFO)

        # files
        res.log(CAT_FILES, apk.get_files(), CAT_APK_INFO)

        # permissions
        res.log(CAT_PERMISSIONS, sorted(apk.get_permissions()), CAT_APK_INFO)

        components_cache = get_components_cache(apk)

        # activities
        res.log(CAT_ACTIVITIES_LISTING,
                sorted(components_cache[CAT_ACTIVITIES]), CAT_APK_INFO,
                CAT_COMPONENTS, CAT_ACTIVITIES)
        res.log(CAT_ACTIVITIES_MAIN, apk.get_main_activity(), CAT_APK_INFO,
                CAT_COMPONENTS, CAT_ACTIVITIES)

        # services
        res.log(CAT_SERVICES, components_cache[CAT_SERVICES], CAT_APK_INFO,
                CAT_COMPONENTS)

        # receivers
        res.log(CAT_RECEIVERS, components_cache[CAT_RECEIVERS], CAT_APK_INFO,
                CAT_COMPONENTS)

        # content providers
        res.log(CAT_PROVIDERS, components_cache[CAT_PROVIDERS], CAT_APK_INFO,
                CAT_COMPONENTS)

        # intents
        for k, package_names in components_cache.items():
            intents = {}
            for package_name in package_names:
                # get intent filter for activity, service or receiver
                intent_key = component_key_2_intent_key(k)
                package_intents = apk.get_intent_filters(
                    intent_key, package_name)
                if package_intents:
                    intents[package_name] = package_intents

            # we can also register the keys later for dynamic structures
            CAT = (CAT_APK_INFO, CAT_COMPONENTS, CAT_INTENTS)
            res.register_keys([k], *CAT)

            res.log(k, intents, *CAT)
Exemple #2
0
    def _analyze(self, apk, dalvik_vm_format, vm_analysis, gvm_analysis, *args, **kwargs):
        res = self.res

        # register static structure
        self._register_static_structure()

        # libs
        res.log(CAT_LIBS, apk.get_libraries(), CAT_APK_INFO)

        # files
        res.log(CAT_FILES, apk.get_files(), CAT_APK_INFO)

        # permissions
        res.log(CAT_PERMISSIONS, sorted(apk.get_permissions()), CAT_APK_INFO)

        components_cache = get_components_cache(apk)

        # activities
        res.log(
            CAT_ACTIVITIES_LISTING,
            sorted(components_cache[CAT_ACTIVITIES]),
            CAT_APK_INFO,
            CAT_COMPONENTS,
            CAT_ACTIVITIES,
        )
        res.log(CAT_ACTIVITIES_MAIN, apk.get_main_activity(), CAT_APK_INFO, CAT_COMPONENTS, CAT_ACTIVITIES)

        # services
        res.log(CAT_SERVICES, components_cache[CAT_SERVICES], CAT_APK_INFO, CAT_COMPONENTS)

        # receivers
        res.log(CAT_RECEIVERS, components_cache[CAT_RECEIVERS], CAT_APK_INFO, CAT_COMPONENTS)

        # content providers
        res.log(CAT_PROVIDERS, components_cache[CAT_PROVIDERS], CAT_APK_INFO, CAT_COMPONENTS)

        # intents
        for k, package_names in components_cache.items():
            intents = {}
            for package_name in package_names:
                # get intent filter for activity, service or receiver
                intent_key = component_key_2_intent_key(k)
                package_intents = apk.get_intent_filters(intent_key, package_name)
                if package_intents:
                    intents[package_name] = package_intents

            # we can also register the keys later for dynamic structures
            CAT = (CAT_APK_INFO, CAT_COMPONENTS, CAT_INTENTS)
            res.register_keys([k], *CAT)

            res.log(k, intents, *CAT)
Exemple #3
0
    def _analyze(self, apk, dalvik_vm_format, vm_analysis, gvm_analysis, *args, **kwargs):

        res = self.res

        components_cache = get_components_cache(apk)

        # intents
        for k, package_names in components_cache.items():
            intents = {}
            for package_name in package_names:
                # get intent filter for activity, service or receiver
                intent_key = component_key_2_intent_key(k)
                package_intents = apk.get_intent_filters(intent_key, package_name)
                if package_intents:
                    intents[package_name] = package_intents

            res.register_keys([k], CAT_INTENTS)

            res.log(k, intents, CAT_INTENTS)
Exemple #4
0
    def _analyze(self, apk, dalvik_vm_format, vm_analysis, gvm_analysis, *args,
                 **kwargs):

        res = self.res

        components_cache = get_components_cache(apk)

        # intents
        for k, package_names in components_cache.items():
            intents = {}
            for package_name in package_names:
                # get intent filter for activity, service or receiver
                intent_key = component_key_2_intent_key(k)
                package_intents = apk.get_intent_filters(
                    intent_key, package_name)
                if package_intents:
                    intents[package_name] = package_intents

            res.register_keys([k], CAT_INTENTS)

            res.log(k, intents, CAT_INTENTS)
Exemple #5
0
 def get_manifest_components_with_intent_filter(self):
     '''
     Get the package names which define an intent-filter.
     
     Returns
     -------
     set<str>
         Set of package names.
     '''
     res = set()
     # intents
     components_cache = get_components_cache(self)
 
     for k, package_names in components_cache.items():
         for package_name in package_names:
             # get intent filter for activity, service or receiver
             intent_key = component_key_2_intent_key(k)
             package_intents = self.get_intent_filters(intent_key, package_name) 
             if package_intents:
                 res.add(package_name)
                 
     return res
Exemple #6
0
    def get_manifest_components_with_intent_filter(self):
        '''
        Get the package names which define an intent-filter.
        
        Returns
        -------
        set<str>
            Set of package names.
        '''
        res = set()
        # intents
        components_cache = get_components_cache(self)

        for k, package_names in components_cache.items():
            for package_name in package_names:
                # get intent filter for activity, service or receiver
                intent_key = component_key_2_intent_key(k)
                package_intents = self.get_intent_filters(
                    intent_key, package_name)
                if package_intents:
                    res.add(package_name)

        return res