mirror of https://github.com/MISP/misp-modules
Merge remote-tracking branch 'MISP/master'
commit
b28d116787
|
@ -217,6 +217,7 @@ def main():
|
||||||
argParser.add_argument('-d', default=False, action='store_true', help='Enable debugging')
|
argParser.add_argument('-d', default=False, action='store_true', help='Enable debugging')
|
||||||
argParser.add_argument('-p', default=6666, help='misp-modules TCP port (default 6666)')
|
argParser.add_argument('-p', default=6666, help='misp-modules TCP port (default 6666)')
|
||||||
argParser.add_argument('-l', default='localhost', help='misp-modules listen address (default localhost)')
|
argParser.add_argument('-l', default='localhost', help='misp-modules listen address (default localhost)')
|
||||||
|
argParser.add_argument('-m', default=[], action='append', help='Register a custom module')
|
||||||
args = argParser.parse_args()
|
args = argParser.parse_args()
|
||||||
port = args.p
|
port = args.p
|
||||||
listen = args.l
|
listen = args.l
|
||||||
|
@ -232,6 +233,11 @@ def main():
|
||||||
helpersdir = 'helpers'
|
helpersdir = 'helpers'
|
||||||
load_helpers(helpersdir=helpersdir)
|
load_helpers(helpersdir=helpersdir)
|
||||||
mhandlers, loaded_modules = load_modules(modulesdir)
|
mhandlers, loaded_modules = load_modules(modulesdir)
|
||||||
|
|
||||||
|
for module in args.m:
|
||||||
|
mispmod = importlib.import_module(module)
|
||||||
|
mispmod.register(mhandlers, loaded_modules)
|
||||||
|
|
||||||
service = [(r'/modules', ListModules), (r'/query', QueryModule)]
|
service = [(r'/modules', ListModules), (r'/query', QueryModule)]
|
||||||
|
|
||||||
application = tornado.web.Application(service)
|
application = tornado.web.Application(service)
|
||||||
|
|
|
@ -19,8 +19,11 @@ def handler(q=False):
|
||||||
r = requests.get(cveapi_url + request.get('vulnerability'))
|
r = requests.get(cveapi_url + request.get('vulnerability'))
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
vulnerability = json.loads(r.text)
|
vulnerability = json.loads(r.text)
|
||||||
if vulnerability.get('summary'):
|
if vulnerability:
|
||||||
summary = vulnerability['summary']
|
if vulnerability.get('summary'):
|
||||||
|
summary = vulnerability['summary']
|
||||||
|
else:
|
||||||
|
summary = 'Non existing CVE'
|
||||||
else:
|
else:
|
||||||
misperrors['error'] = 'cve.circl.lu API not accessible'
|
misperrors['error'] = 'cve.circl.lu API not accessible'
|
||||||
return misperrors['error']
|
return misperrors['error']
|
||||||
|
|
|
@ -4,23 +4,20 @@ import base64
|
||||||
from pymisp.tools import openioc
|
from pymisp.tools import openioc
|
||||||
|
|
||||||
misperrors = {'error': 'Error'}
|
misperrors = {'error': 'Error'}
|
||||||
userConfig = {
|
userConfig = {'not save ioc': {'type': 'Boolean',
|
||||||
'not save ioc': {
|
'message': 'If you check this box, IOC file will not save as an attachment in MISP'
|
||||||
'type': 'Boolean',
|
},
|
||||||
'message': 'If you check this box, IOC file will not save as an attachment in MISP'
|
'default tag': {
|
||||||
},
|
'type': 'String',
|
||||||
'default tag': {
|
'message': 'Add tags spaced by a comma (tlp:white,misp:threat-level="no-risk")',
|
||||||
'type': 'String',
|
'validation': '0'}
|
||||||
'message': 'Add tags spaced by a comma (tlp:white,misp:threat-level="no-risk")',
|
}
|
||||||
'validation' : '0'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inputSource = ['file']
|
inputSource = ['file']
|
||||||
|
|
||||||
moduleinfo = {'version': '0.1', 'author': 'Raphaël Vinot',
|
moduleinfo = {'version': '0.1', 'author': 'Raphaël Vinot',
|
||||||
'description': 'Import OpenIOC package',
|
'description': 'Import OpenIOC package',
|
||||||
'module-type': ['import']}
|
'module-type': ['import']}
|
||||||
|
|
||||||
moduleconfig = []
|
moduleconfig = []
|
||||||
|
|
||||||
|
@ -47,27 +44,23 @@ def handler(q=False):
|
||||||
|
|
||||||
if q.get('config'):
|
if q.get('config'):
|
||||||
if q['config'].get('not save ioc') == "0":
|
if q['config'].get('not save ioc') == "0":
|
||||||
addFile = {
|
addFile = {"values": [q.get('filename')],
|
||||||
"values": [q.get('filename')],
|
"types": ['attachment'],
|
||||||
"types": ['attachment'],
|
"categories": ['Support Tool'],
|
||||||
"categories": ['Support Tool'],
|
"data": q.get('data')}
|
||||||
"data" : q.get('data'),
|
|
||||||
}
|
|
||||||
# add tag
|
# add tag
|
||||||
if q['config'].get('default tag') is not None:
|
if q['config'].get('default tag') is not None:
|
||||||
addFile["tags"] = q['config']['default tag'].split(",")
|
addFile["tags"] = q['config']['default tag'].split(",")
|
||||||
# add file as attachment
|
# add file as attachment
|
||||||
r["results"].append(addFile)
|
r["results"].append(addFile)
|
||||||
|
|
||||||
|
|
||||||
# return all attributes
|
# return all attributes
|
||||||
for attrib in pkg.attributes:
|
for attrib in pkg.attributes:
|
||||||
toAppend = {
|
toAppend = {
|
||||||
"values": [attrib.value],
|
"values": [attrib.value],
|
||||||
"types": [attrib.type],
|
"types": [attrib.type],
|
||||||
"categories": [attrib.category],
|
"categories": [attrib.category],
|
||||||
"comment":attrib.comment
|
"comment": getattr(attrib, 'comment', '')}
|
||||||
}
|
|
||||||
# add tag
|
# add tag
|
||||||
if q.get('config') and q['config'].get('default tag') is not None:
|
if q.get('config') and q['config'].get('default tag') is not None:
|
||||||
toAppend["tags"] = q['config']['default tag'].split(",")
|
toAppend["tags"] = q['config']['default tag'].split(",")
|
||||||
|
|
Loading…
Reference in New Issue