fix [exportpdf] update parameters for links generation

pull/278/head
Falconieri 2019-02-25 15:51:33 +01:00
parent 40cd32f1b8
commit a3a871f2fa
1 changed files with 11 additions and 2 deletions

View File

@ -18,7 +18,9 @@ moduleinfo = {'version': '2',
'module-type': ['export'], 'module-type': ['export'],
'require_standard_format': True} 'require_standard_format': True}
moduleconfig = [] # config fields that your code expects from the site admin
moduleconfig = ["MISP_base_url_for_dynamic_link", "MISP_name_for_metadata"]
mispattributes = {} mispattributes = {}
outputFileExtension = "pdf" outputFileExtension = "pdf"
@ -53,12 +55,19 @@ def handler(q=False):
if 'data' not in request: if 'data' not in request:
return False return False
config = {}
# Construct config object for reportlab_generator
for config_item in moduleconfig :
if (request.get('config')) and (request['config'].get(config_item) is not None):
config[config_item] = request['config'].get(config_item)
for evt in request['data']: for evt in request['data']:
misp_event = MISPEvent() misp_event = MISPEvent()
misp_event.load(evt) misp_event.load(evt)
pdf = reportlab_generator.get_base64_from_value(reportlab_generator.convert_event_in_pdf_buffer(misp_event)) pdf = reportlab_generator.get_base64_from_value(reportlab_generator.convert_event_in_pdf_buffer(misp_event, config))
return {'response': [], 'data': str(pdf, 'utf-8')} return {'response': [], 'data': str(pdf, 'utf-8')}