2018-03-27 15:18:50 +02:00
|
|
|
#!/usr/bin/env python
|
2024-01-17 13:13:14 +01:00
|
|
|
|
|
|
|
from __future__ import annotations
|
2018-03-27 15:18:50 +02:00
|
|
|
|
|
|
|
import logging
|
|
|
|
|
2024-01-31 15:20:31 +01:00
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
from .abstractgenerator import AbstractMISPObjectGenerator
|
|
|
|
|
2018-03-27 15:18:50 +02:00
|
|
|
logger = logging.getLogger('pymisp')
|
|
|
|
|
|
|
|
|
|
|
|
class DomainIPObject(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]
|
2021-10-28 22:29:27 +02:00
|
|
|
super().__init__('domain-ip', strict=strict, **kwargs)
|
2018-03-27 15:18:50 +02:00
|
|
|
self._parameters = parameters
|
|
|
|
self.generate_attributes()
|
|
|
|
|
2024-01-31 15:20:31 +01:00
|
|
|
def generate_attributes(self) -> None:
|
2018-03-27 15:19:52 +02:00
|
|
|
first = self._sanitize_timestamp(self._parameters.pop('first-seen', None))
|
2018-03-27 15:18:50 +02:00
|
|
|
self._parameters['first-seen'] = first
|
2018-03-27 15:19:52 +02:00
|
|
|
last = self._sanitize_timestamp(self._parameters.pop('last-seen', None))
|
2018-03-27 15:18:50 +02:00
|
|
|
self._parameters['last-seen'] = last
|
2021-10-28 22:29:27 +02:00
|
|
|
super().generate_attributes()
|