mirror of https://github.com/MISP/PyMISP
Some more refactoring
parent
74037cb6fa
commit
b74e558f75
|
@ -10,7 +10,6 @@ import base64
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
import hashlib
|
import hashlib
|
||||||
import abc
|
|
||||||
import sys
|
import sys
|
||||||
import uuid
|
import uuid
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
@ -796,13 +795,3 @@ class MISPObject(AbstractMISP):
|
||||||
attribute.from_dict(object_relation, **value)
|
attribute.from_dict(object_relation, **value)
|
||||||
self.Attribute.append(attribute)
|
self.Attribute.append(attribute)
|
||||||
return attribute
|
return attribute
|
||||||
|
|
||||||
|
|
||||||
@six.add_metaclass(abc.ABCMeta) # Remove that line when discarding python2 support.
|
|
||||||
# Python3 way: class MISPObjectGenerator(metaclass=abc.ABCMeta):
|
|
||||||
class AbstractMISPObjectGenerator(MISPObject):
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def generate_attributes(self):
|
|
||||||
"""Contains the logic where all the values of the object are gathered"""
|
|
||||||
pass
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import abc
|
||||||
|
import six
|
||||||
|
from .. import MISPObject
|
||||||
|
|
||||||
|
|
||||||
|
@six.add_metaclass(abc.ABCMeta) # Remove that line when discarding python2 support.
|
||||||
|
# Python3 way: class MISPObjectGenerator(metaclass=abc.ABCMeta):
|
||||||
|
class AbstractMISPObjectGenerator(MISPObject):
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def generate_attributes(self):
|
||||||
|
"""Contains the logic where all the values of the object are gathered"""
|
||||||
|
pass
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from .. import AbstractMISPObjectGenerator
|
from .abstractgenerator import AbstractMISPObjectGenerator
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from hashlib import md5, sha1, sha256, sha512
|
from hashlib import md5, sha1, sha256, sha512
|
||||||
import warnings
|
import warnings
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from .. import AbstractMISPObjectGenerator
|
from .abstractgenerator import AbstractMISPObjectGenerator
|
||||||
import os
|
import os
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from hashlib import md5, sha1, sha256, sha512
|
from hashlib import md5, sha1, sha256, sha512
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from .. import AbstractMISPObjectGenerator
|
from .abstractgenerator import AbstractMISPObjectGenerator
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from hashlib import md5, sha1, sha256, sha512
|
from hashlib import md5, sha1, sha256, sha512
|
||||||
import warnings
|
import warnings
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from .. import AbstractMISPObjectGenerator
|
from .abstractgenerator import AbstractMISPObjectGenerator
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from hashlib import md5, sha1, sha256, sha512
|
from hashlib import md5, sha1, sha256, sha512
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
Loading…
Reference in New Issue