If filename add iocfilename as attachment

pull/121/head
Tristan METAYER 2017-05-02 14:41:22 +02:00
parent 3cb12d6962
commit 79f48eccfe
1 changed files with 17 additions and 1 deletions

View File

@ -33,8 +33,24 @@ def handler(q=False):
return json.dumps({"success": 0})
pkg = openioc.load_openioc(package)
# add origin file as attachment
if q.get("filename"):
r["results"].append({
"values": [q.get('filename')],
"types": ['attachment'],
"categories": ['Support Tool'],
"data" : q.get('data'),
})
# return all attributes
for attrib in pkg.attributes:
r["results"].append({"values": [attrib.value], "types": [attrib.type], "categories": [attrib.category]})
r["results"].append({
"values": [attrib.value],
"types": [attrib.type],
"categories": [attrib.category],
"comment":attrib.comment})
return r