mirror of https://github.com/MISP/PyMISP
chg: Cleanup new sbsignature generator
parent
cb4d464526
commit
e2bb66d01c
|
@ -11,7 +11,6 @@ a = [(x['name'], x['description']) for x in a["signatures"]]
|
||||||
b = SBSignatureObject(a)
|
b = SBSignatureObject(a)
|
||||||
|
|
||||||
|
|
||||||
template_id = [x['ObjectTemplate']['id'] for x in pymisp.get_object_templates_list(
|
template_id = [x['ObjectTemplate']['id'] for x in pymisp.get_object_templates_list() if x['ObjectTemplate']['name'] == 'sb-signature'][0]
|
||||||
) if x['ObjectTemplate']['name'] == 'sb-signature'][0]
|
|
||||||
|
|
||||||
pymisp.add_object(234111, template_id, b)
|
pymisp.add_object(234111, template_id, b)
|
|
@ -1,26 +1,21 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import re
|
|
||||||
import requests
|
|
||||||
from .abstractgenerator import AbstractMISPObjectGenerator
|
from .abstractgenerator import AbstractMISPObjectGenerator
|
||||||
from .. import InvalidMISPObject
|
|
||||||
|
|
||||||
class SBSignatureObject(AbstractMISPObjectGenerator):
|
class SBSignatureObject(AbstractMISPObjectGenerator):
|
||||||
'''
|
'''
|
||||||
Sandbox Analyzer
|
Sandbox Analyzer
|
||||||
'''
|
'''
|
||||||
def __init__(self, report, software, parsed=None, filepath=None, pseudofile=None, standalone=True, **kwargs):
|
def __init__(self, software, report, standalone=True, **kwargs):
|
||||||
# PY3 way:
|
|
||||||
# super().__init__("virustotal-report")
|
|
||||||
super(SBSignatureObject, self).__init__("sb-signature", **kwargs)
|
super(SBSignatureObject, self).__init__("sb-signature", **kwargs)
|
||||||
self._report = report
|
|
||||||
self._software = software
|
self._software = software
|
||||||
|
self._report = report
|
||||||
self.generate_attributes()
|
self.generate_attributes()
|
||||||
|
|
||||||
def generate_attributes(self):
|
def generate_attributes(self):
|
||||||
''' Parse the report for relevant attributes '''
|
''' Parse the report for relevant attributes '''
|
||||||
self.add_attribute("software", value=self._software, type="text")
|
self.add_attribute("software", value=self._software)
|
||||||
for (name, description) in self._report:
|
for (signature_name, description) in self._report:
|
||||||
self.add_attribute("signature", value=name, comment=description, type="text")
|
self.add_attribute("signature", value=signature_name, comment=description)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue