Exemple #1
0
class KillChainPhase(stix.Entity):
    _binding = common_binding
    _namespace = 'http://stix.mitre.org/common-1'
    _binding_class = _binding.KillChainPhaseType

    phase_id = fields.TypedField("phase_id")
    name = fields.TypedField("name")
    ordinality = fields.IntegerField("ordinality")

    def __init__(self, phase_id=None, name=None, ordinality=None):
        super(KillChainPhase, self).__init__()

        self.phase_id = phase_id
        self.name = name
        self.ordinality = ordinality

    def __eq__(self, other):
        if other is self:
            return True

        if not isinstance(other, KillChainPhase):
            return False

        return other.to_dict() == self.to_dict()

    def __ne__(self, other):
        return not self.__eq__(other)

    def __hash__(self):
        # TODO (bworrell): Is all the tuple(sorted(...))) needed?
        return hash(tuple(sorted(self.to_dict().items())))
class KillChainPhase(stix.Entity):
    __hash__ = entities.Entity.__hash__

    _binding = common_binding
    _namespace = 'http://stix.mitre.org/common-1'
    _binding_class = _binding.KillChainPhaseType

    phase_id = fields.TypedField("phase_id")
    name = fields.TypedField("name")
    ordinality = fields.IntegerField("ordinality")

    def __init__(self, phase_id=None, name=None, ordinality=None):
        super(KillChainPhase, self).__init__()

        self.phase_id = phase_id
        self.name = name
        self.ordinality = ordinality

    def __eq__(self, other):
        if other is self:
            return True

        if not isinstance(other, KillChainPhase):
            return False

        return other.to_dict() == self.to_dict()

    def __ne__(self, other):
        return not self.__eq__(other)
Exemple #3
0
class Declassification(stix.Entity):
    _binding = cyber_profile
    _binding_class = _binding.DeclassificationType
    _namespace = 'urn:edm:edh:cyber:v3'

    declass_exemption = fields.TypedField("declassExemption", key_name="declass_exemption", preset_hook=validate_token)
    declass_period = fields.IntegerField("declassPeriod", key_name="declass_period")
    declass_date = fields.DateField("declassDate", key_name="declass_date")
    declass_event = fields.TypedField("declassEvent", key_name="declass_event", preset_hook=validate_token)

    def __init__(self):
        super(Declassification, self).__init__()
class AssetType(VocabString):
    _namespace = "http://stix.mitre.org/Incident-1"
    _binding = incident_binding
    _binding_class = incident_binding.AssetTypeType

    count_affected = fields.IntegerField("count_affected")

    def __init__(self, value=None, count_affected=None):
        super(AssetType, self).__init__(value)
        self.count_affected = count_affected

    def is_plain(self):
        """Override VocabString.is_plain()"""
        return False