MCPcopy Create free account
hub / github.com/STIXProject/python-stix / ExploitTarget

Class ExploitTarget

stix/exploit_target/__init__.py:21–110  ·  view source on GitHub ↗

Implementation of STIX Exploit Target. Args: id_ (optional): An identifier. If ``None``, a value will be generated via ``mixbox.idgen.create_id()``. If set, this will unset the ``idref`` property. idref (optional): An identifier reference. If set this wil

Source from the content-addressed store, hash-verified

19from stix.common import InformationSource
20
21class ExploitTarget(stix.BaseCoreComponent):
22 """Implementation of STIX Exploit Target.
23
24 Args:
25 id_ (optional): An identifier. If ``None``, a value will be generated
26 via ``mixbox.idgen.create_id()``. If set, this will unset the
27 ``idref`` property.
28 idref (optional): An identifier reference. If set this will unset the
29 ``id_`` property.
30 title (optional): A string title.
31 timestamp (optional): A timestamp value. Can be an instance of
32 ``datetime.datetime`` or ``str``.
33 description (optional): A string description.
34 short_description (optional): A string short description.
35
36 """
37 _binding = exploit_target_binding
38 _binding_class = _binding.ExploitTargetType
39 _namespace = "http://docs.oasis-open.org/cti/ns/stix/exploit-target-1"
40 _version = "1.2.1"
41 _ALL_VERSIONS = ("1.0", "1.0.1", "1.1", "1.1.1", "1.2", "1.2.1")
42 _ID_PREFIX = 'et'
43
44 potential_coas = fields.TypedField("Potential_COAs", type_="stix.exploit_target.PotentialCOAs")
45 related_exploit_targets = fields.TypedField("Related_Exploit_Targets", type_="stix.exploit_target.RelatedExploitTargets")
46 vulnerabilities = fields.TypedField("Vulnerability", Vulnerability, multiple=True, key_name="vulnerabilities")
47 weaknesses = fields.TypedField("Weakness", Weakness, multiple=True, key_name="weaknesses")
48 configuration = fields.TypedField("Configuration", Configuration, multiple=True)
49 related_packages = fields.TypedField("Related_Packages", RelatedPackageRefs)
50 information_source = fields.TypedField("Information_Source", InformationSource)
51
52 def __init__(self, id_=None, idref=None, timestamp=None, title=None,
53 description=None, short_description=None):
54
55 super(ExploitTarget, self).__init__(
56 id_=id_,
57 idref=idref,
58 timestamp=timestamp,
59 title=title,
60 description=description,
61 short_description=short_description
62 )
63
64 self.potential_coas = PotentialCOAs()
65 self.related_exploit_targets = RelatedExploitTargets()
66 self.related_packages = RelatedPackageRefs()
67
68 def add_vulnerability(self, value):
69 """Adds a vulnerability to the :attr:`vulnerabilities` list property.
70
71 Note:
72 If ``None`` is passed in no value is added
73
74 Args:
75 value: A :class:`.Vulnerability` object..
76
77 Raises:
78 ValueError: if the `value` param is of type :class:`.Vulnerability`

Callers 3

test_etMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_etMethod · 0.72