mirror of https://github.com/MISP/misp-modules
Add a field for user to add tag for this import
parent
abf8b8989a
commit
ba1d715ad1
|
@ -8,6 +8,11 @@ userConfig = {
|
||||||
'not save ioc': {
|
'not save ioc': {
|
||||||
'type': 'Boolean',
|
'type': 'Boolean',
|
||||||
'message': 'If you check this box, IOC file will not save as an attachment in MISP'
|
'message': 'If you check this box, IOC file will not save as an attachment in MISP'
|
||||||
|
},
|
||||||
|
'default tag': {
|
||||||
|
'type': 'String',
|
||||||
|
'message': 'Add tags spaced by a comma (tlp:white,misp:threat-level="no-risk")',
|
||||||
|
'validation' : '0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,24 +47,32 @@ 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 = {
|
||||||
# add origin file as attachment
|
|
||||||
if q.get("filename"):
|
|
||||||
r["results"].append({
|
|
||||||
"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
|
||||||
|
if q['config'].get('default tag') is not None:
|
||||||
|
addFile["tags"] = q['config']['default tag'].split(",")
|
||||||
|
# add file as attachment
|
||||||
|
r["results"].append(addFile)
|
||||||
|
|
||||||
|
|
||||||
# return all attributes
|
# return all attributes
|
||||||
for attrib in pkg.attributes:
|
for attrib in pkg.attributes:
|
||||||
r["results"].append({
|
toAppend = {
|
||||||
"values": [attrib.value],
|
"values": [attrib.value],
|
||||||
"types": [attrib.type],
|
"types": [attrib.type],
|
||||||
"categories": [attrib.category],
|
"categories": [attrib.category],
|
||||||
"comment":attrib.comment})
|
"comment":attrib.comment
|
||||||
|
}
|
||||||
|
# add tag
|
||||||
|
if q['config'].get('default tag') is not None:
|
||||||
|
toAppend["tags"] = q['config']['default tag'].split(",")
|
||||||
|
|
||||||
|
r["results"].append(toAppend)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue