mirror of https://github.com/MISP/PyMISP
Properly support CDATA fields in OpenIOC files.
parent
34acc6152b
commit
be0c8a1f8c
|
@ -93,7 +93,7 @@ def load_openioc(openioc):
|
||||||
if not has_bs4:
|
if not has_bs4:
|
||||||
raise Exception('You need to install BeautifulSoup: pip install bs4')
|
raise Exception('You need to install BeautifulSoup: pip install bs4')
|
||||||
misp_event = MISPEvent()
|
misp_event = MISPEvent()
|
||||||
iocreport = BeautifulSoup(openioc, "lxml")
|
iocreport = BeautifulSoup(openioc, "html.parser")
|
||||||
# Set event fields
|
# Set event fields
|
||||||
info = extract_field(iocreport, 'short_description')
|
info = extract_field(iocreport, 'short_description')
|
||||||
if info:
|
if info:
|
||||||
|
@ -104,7 +104,12 @@ def load_openioc(openioc):
|
||||||
# Set special attributes
|
# Set special attributes
|
||||||
description = extract_field(iocreport, 'description')
|
description = extract_field(iocreport, 'description')
|
||||||
if description:
|
if description:
|
||||||
misp_event.add_attribute('comment', description)
|
if not misp_event.info:
|
||||||
|
misp_event.info = description
|
||||||
|
else:
|
||||||
|
misp_event.add_attribute('comment', description)
|
||||||
|
if not misp_event.info:
|
||||||
|
misp_event.info = 'OpenIOC import'
|
||||||
author = extract_field(iocreport, 'authored_by')
|
author = extract_field(iocreport, 'authored_by')
|
||||||
if author:
|
if author:
|
||||||
misp_event.add_attribute('comment', author)
|
misp_event.add_attribute('comment', author)
|
||||||
|
|
Loading…
Reference in New Issue