def list(self, attribute="run"):
        '''
        Finds all modules with the specified attribute.

        @attribute - The desired module attribute.

        Returns a list of modules that contain the specified attribute, in the order they should be executed.
        '''
        import binwalk.modules
        modules = {}

        for (name, module) in inspect.getmembers(binwalk.modules):
            if inspect.isclass(module) and hasattr(module, attribute):
                modules[module] = module.PRIORITY

        # user-defined modules
        import imp
        user_modules = binwalk.core.settings.Settings().user.modules
        for file_name in os.listdir(user_modules):
            if not file_name.endswith('.py'):
                continue
            module_name = file_name[:-3]
            try:
                user_module = imp.load_source(module_name, os.path.join(user_modules, file_name))
            except KeyboardInterrupt as e:
                raise e
            except Exception as e:
                binwalk.core.common.warning("Error loading module '%s': %s" % (file_name, str(e)))

            for (name, module) in inspect.getmembers(user_module):
                if inspect.isclass(module) and hasattr(module, attribute):
                    modules[module] = module.PRIORITY

        return sorted(modules, key=modules.get, reverse=True)
def list ( self , attribute = "run" ) : import binwalk . modules modules = { } for ( name , module ) in inspect . getmembers ( binwalk . modules ) : if inspect . isclass ( module ) and hasattr ( module , attribute ) : modules [ module ] = module . PRIORITY import imp user_modules = binwalk . core . settings . Settings ( ) . user . modules for file_name in os . listdir ( user_modules ) : if not file_name . endswith ( '.py' ) : continue module_name = file_name [ : - 3 ] try : user_module = imp . load_source ( module_name , os . path . join ( user_modules , file_name ) ) except KeyboardInterrupt as e : raise e except Exception as e : binwalk . core . common . warning ( "Error loading module '%s': %s" % ( file_name , str ( e ) ) ) for ( name , module ) in inspect . getmembers ( user_module ) : if inspect . isclass ( module ) and hasattr ( module , attribute ) : modules [ module ] = module . PRIORITY return sorted ( modules , key = modules . get , reverse = True )
Finds all modules with the specified attribute.

        @attribute - The desired module attribute.

        Returns a list of modules that contain the specified attribute, in the order they should be executed.