PyMISP/pymisp/tools/asnobject.py

27 lines
836 B
Python
Raw Permalink Normal View History

2018-03-28 10:27:02 +02:00
#!/usr/bin/env python
from __future__ import annotations
2018-03-28 10:27:02 +02:00
import logging
from typing import Any
from .abstractgenerator import AbstractMISPObjectGenerator
2018-03-28 10:27:02 +02:00
logger = logging.getLogger('pymisp')
class ASNObject(AbstractMISPObjectGenerator):
2024-01-31 15:20:31 +01:00
def __init__(self, parameters: dict[str, Any], strict: bool = True, **kwargs) -> None: # type: ignore[no-untyped-def]
super().__init__('asn', strict=strict, **kwargs)
2018-03-28 10:27:02 +02:00
self._parameters = parameters
self.generate_attributes()
2024-01-31 15:20:31 +01:00
def generate_attributes(self) -> None:
2018-03-28 10:27:02 +02:00
first = self._sanitize_timestamp(self._parameters.pop('first-seen', None))
self._parameters['first-seen'] = first
last = self._sanitize_timestamp(self._parameters.pop('last-seen', None))
self._parameters['last-seen'] = last
super().generate_attributes()