chg: Keep strict and generate attributes when needed

pull/804/head
Raphaël Vinot 2021-10-28 16:29:27 -04:00
parent 7e9490e12e
commit a16aa03872
6 changed files with 11 additions and 6 deletions

View File

@ -10,7 +10,7 @@ logger = logging.getLogger('pymisp')
class ASNObject(AbstractMISPObjectGenerator):
def __init__(self, parameters: dict, strict: bool = True, **kwargs):
super().__init__('asn', **kwargs)
super().__init__('asn', strict=strict, **kwargs)
self._parameters = parameters
self.generate_attributes()
@ -19,3 +19,4 @@ class ASNObject(AbstractMISPObjectGenerator):
self._parameters['first-seen'] = first
last = self._sanitize_timestamp(self._parameters.pop('last-seen', None))
self._parameters['last-seen'] = last
super().generate_attributes()

View File

@ -10,7 +10,7 @@ logger = logging.getLogger('pymisp')
class DomainIPObject(AbstractMISPObjectGenerator):
def __init__(self, parameters: dict, strict: bool = True, **kwargs):
super().__init__('domain-ip', **kwargs)
super().__init__('domain-ip', strict=strict, **kwargs)
self._parameters = parameters
self.generate_attributes()
@ -19,3 +19,4 @@ class DomainIPObject(AbstractMISPObjectGenerator):
self._parameters['first-seen'] = first
last = self._sanitize_timestamp(self._parameters.pop('last-seen', None))
self._parameters['last-seen'] = last
super().generate_attributes()

View File

@ -10,10 +10,11 @@ logger = logging.getLogger('pymisp')
class Fail2BanObject(AbstractMISPObjectGenerator):
def __init__(self, parameters: dict, strict: bool = True, **kwargs):
super().__init__('fail2ban', **kwargs)
super().__init__('fail2ban', strict=strict, **kwargs)
self._parameters = parameters
self.generate_attributes()
def generate_attributes(self):
timestamp = self._sanitize_timestamp(self._parameters.pop('processing-timestamp', None))
self._parameters['processing-timestamp'] = timestamp
super().generate_attributes()

View File

@ -10,7 +10,7 @@ logger = logging.getLogger('pymisp')
class GeolocationObject(AbstractMISPObjectGenerator):
def __init__(self, parameters: dict, strict: bool = True, **kwargs):
super().__init__('geolocation', **kwargs)
super().__init__('geolocation', strict=strict, **kwargs)
self._parameters = parameters
self.generate_attributes()
@ -19,3 +19,4 @@ class GeolocationObject(AbstractMISPObjectGenerator):
self._parameters['first-seen'] = first
last = self._sanitize_timestamp(self._parameters.pop('last-seen', None))
self._parameters['last-seen'] = last
super().generate_attributes()

View File

@ -10,7 +10,7 @@ logger = logging.getLogger('pymisp')
class GitVulnFinderObject(AbstractMISPObjectGenerator):
def __init__(self, parameters: dict, strict: bool = True, **kwargs):
super().__init__('git-vuln-finder', **kwargs)
super().__init__('git-vuln-finder', strict=strict, **kwargs)
self._parameters = parameters
self.generate_attributes()
@ -25,3 +25,4 @@ class GitVulnFinderObject(AbstractMISPObjectGenerator):
self._parameters['stats.deletions'] = stats.pop('deletions')
self._parameters['stats.lines'] = stats.pop('lines')
self._parameters['stats.files'] = stats.pop('files')
super().generate_attributes()

View File

@ -12,7 +12,7 @@ logger = logging.getLogger('pymisp')
class MicroblogObject(AbstractMISPObjectGenerator):
def __init__(self, parameters: dict, strict: bool = True, **kwargs):
super().__init__('microblog', **kwargs)
super().__init__('microblog', strict=strict, **kwargs)
self._parameters = parameters
self.generate_attributes()