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

Function main

examples/indicator-simplehash.py:17–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15
16
17def main():
18 # Create our CybOX Simple Hash Value
19 shv = Hash()
20 shv.simple_hash_value = "4EC0027BEF4D7E1786A04D021FA8A67F"
21
22 # Create a CybOX File Object and add the Hash we created above.
23 f = File()
24 h = Hash(shv, Hash.TYPE_MD5)
25 f.add_hash(h)
26
27 # Create the STIX Package
28 stix_package = STIXPackage()
29
30 # Create the STIX Header and add a description.
31 stix_header = STIXHeader()
32 stix_header.description = "Simple File Hash Observable Example"
33 stix_package.stix_header = stix_header
34
35 # Add the File Hash Observable to the STIX Package. The add() method will
36 # inspect the input and add it to the top-level stix_package.observables
37 # collection.
38 stix_package.add(f)
39
40 # Print the XML!
41 print(stix_package.to_xml())
42
43
44if __name__ == '__main__':

Callers 1

Calls 4

addMethod · 0.95
STIXPackageClass · 0.90
STIXHeaderClass · 0.90
to_xmlMethod · 0.45

Tested by

no test coverage detected