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