mirror of https://github.com/MISP/misp-modules
Add type per module
parent
598baa78a5
commit
78a0e661ba
|
@ -47,9 +47,11 @@ for module in os.listdir(modulesdir):
|
||||||
if ".py" not in module or ".pyc" in module:
|
if ".py" not in module or ".pyc" in module:
|
||||||
continue
|
continue
|
||||||
modulename = module.split(".")[0]
|
modulename = module.split(".")[0]
|
||||||
|
moduletype = os.path.split(modulesdir)[1]
|
||||||
modules.append(modulename)
|
modules.append(modulename)
|
||||||
log.info('MISP modules {0} imported'.format(modulename))
|
log.info('MISP modules {0} imported'.format(modulename))
|
||||||
mhandlers[modulename] = importlib.import_module('modules.expansion.'+modulename)
|
mhandlers[modulename] = importlib.import_module('modules.expansion.'+modulename)
|
||||||
|
mhandlers['type:'+modulename]= moduletype
|
||||||
|
|
||||||
class ListModules(tornado.web.RequestHandler):
|
class ListModules(tornado.web.RequestHandler):
|
||||||
def get(self):
|
def get(self):
|
||||||
|
@ -57,10 +59,13 @@ class ListModules(tornado.web.RequestHandler):
|
||||||
for module in modules:
|
for module in modules:
|
||||||
x = {}
|
x = {}
|
||||||
x['name'] = module
|
x['name'] = module
|
||||||
|
x['type'] = mhandlers['type:'+module]
|
||||||
x['mispattributes'] = mhandlers[module].introspection()
|
x['mispattributes'] = mhandlers[module].introspection()
|
||||||
|
x['version'] = mhandlers[module].version()
|
||||||
ret.append(x)
|
ret.append(x)
|
||||||
log.debug('MISP ListModules request')
|
log.debug('MISP ListModules request')
|
||||||
self.write(json.dumps(ret))
|
self.write(json.dumps(ret))
|
||||||
|
|
||||||
class QueryModule(tornado.web.RequestHandler):
|
class QueryModule(tornado.web.RequestHandler):
|
||||||
def post(self):
|
def post(self):
|
||||||
jsonpayload = self.request.body.decode('utf-8')
|
jsonpayload = self.request.body.decode('utf-8')
|
||||||
|
|
Loading…
Reference in New Issue