tidy: Remove old dead export code

pull/278/head
Falconieri 4 years ago
parent a93b34208f
commit 40cd32f1b8
  1. 78
      misp_modules/modules/export_mod/pdfexport.py

@ -7,8 +7,6 @@ import shlex
import subprocess
import base64
print("test PDF pdf export (reportlab generator import)")
from pymisp import MISPEvent
from pymisp.tools import reportlab_generator
@ -46,62 +44,6 @@ class ReportGenerator():
self.misp_event = MISPEvent()
self.misp_event.load(event)
'''
def attributes(self):
if not self.misp_event.attributes:
return ''
list_attributes = []
for attribute in self.misp_event.attributes:
if attribute.type in types_to_attach:
list_attributes.append("* {}".format(attribute.value))
for obj in self.misp_event.Object:
if obj.name in objects_to_attach:
for attribute in obj.Attribute:
if attribute.type in types_to_attach:
list_attributes.append("* {}".format(attribute.value))
return attributes.format(list_attributes="\n".join(list_attributes))
def _get_tag_info(self, machinetag):
return self.taxonomies.revert_machinetag(machinetag)
def report_headers(self):
content = {'org_name': 'name',
'date': date.today().isoformat()}
self.report += headers.format(**content)
def event_level_tags(self):
if not self.misp_event.Tag:
return ''
for tag in self.misp_event.Tag:
# Only look for TLP for now
if tag['name'].startswith('tlp'):
tax, predicate = self._get_tag_info(tag['name'])
return self.event_level_tags.format(value=predicate.predicate.upper(), expanded=predicate.expanded)
def title(self):
internal_id = ''
summary = ''
# Get internal refs for report
if not hasattr(self.misp_event, 'Object'):
return ''
for obj in self.misp_event.Object:
if obj.name != 'report':
continue
for a in obj.Attribute:
if a.object_relation == 'case-number':
internal_id = a.value
if a.object_relation == 'summary':
summary = a.value
return title.format(internal_id=internal_id, title=self.misp_event.info,
summary=summary)
def asciidoc(self, lang='en'):
self.report += self.title()
self.report += self.event_level_tags()
self.report += self.attributes()
'''
def handler(q=False):
if q is False:
return False
@ -113,21 +55,6 @@ def handler(q=False):
for evt in request['data']:
'''
print(" DATA ")
print(request['data'])
reportlab_generator.
report = ReportGenerator()
report.report_headers()
report.from_event(evt)
report.asciidoc()
print(" REPORT : ")
print(report)
'''
misp_event = MISPEvent()
misp_event.load(evt)
@ -165,8 +92,3 @@ def introspection():
def version():
moduleinfo['config'] = moduleconfig
return moduleinfo
import pprint
if __name__ == "__main__":
pprint.pprint("test")
Loading…
Cancel
Save