chg: Add tag, set distribution, add file and source (CSSE importer)

pull/551/head
Raphaël Vinot 2020-02-29 02:10:16 +01:00
parent 68a2352afd
commit 2cb90bc826
1 changed files with 5 additions and 0 deletions

View File

@ -8,6 +8,7 @@ from datetime import datetime
from dateutil.parser import parse
import json
from pymisp.tools import feed_meta_generator
from io import BytesIO
make_feed = False
@ -27,6 +28,8 @@ for p in path.glob('**/*.csv'):
event = MISPEvent()
event.info = f"[{d.isoformat()}] CSSE COVID-19 daily report"
event.date = d
event.distribution = 3
event.add_tag('tlp:white')
if make_feed:
event.orgc = org
else:
@ -34,6 +37,8 @@ for p in path.glob('**/*.csv'):
if e:
# Already added.
continue
event.add_attribute('attachment', p.name, data=BytesIO(p.open('rb').read()))
event.add_attribute('link', f'https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_daily_reports/{p.name}', comment='Source')
with p.open() as f:
reader = DictReader(f)
for row in reader: