RCayre / mirage

Mirage is a powerful and modular framework dedicated to the security analysis of wireless communications.

Home Page:https://homepages.laas.fr/rcayre/mirage-documentation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

loadModule issue

tlechien opened this issue · comments

Hello,

Great repo,

I encounter an issue when trying to load a module:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/dist-packages/mirage-1.1-py3.7.egg/mirage/libs/utils.py", line 230, in loadModule
    return app.App.Instance.loader.load(name)
AttributeError: 'NoneType' object has no attribute 'loader'

Following the breadcrumbs I found out that there is an issue in the loader:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'mirage.modules' has no attribute '__modules__'

Cordially,

tlechien

Hi,
weird issue... can you provide me more details ? How are you running Mirage ? sudo ./mirage_launcher ? sudo mirage ? Are you trying to run a module directly from an external python script ?
Can you provide me a code snippet allowing to reproduce the issue ?
Thanks.

Hello,
I admit I could have been clearer.
I'm importing Mirage as a library. Tried both to call loadModule as a standalone function and in a new module. It seems there is sth going on with the loader and the paths ( generated in modules/init.py & libs/utils.py).
I modified init in mirage/core/loader.py with

                self.modulesList = {}
                modulesPath = next(iter(modules.__path__))
                mList = modules.generateModulesDictionary(modulesPath, modulesPath)
                for moduleName,module in mList.items():
                        current = module#__import__("modules."+module, fromlist=module)
                        moduleClass = getattr(current,moduleName)
                        self.modulesList[moduleName] = moduleClass

to fix it (and it works as long as i initialize app.App() beforehand) but it's more of a bandaid than an actual fix.

Cordially,

tlechien