()
| 15 | |
| 16 | |
| 17 | def 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 | |
| 44 | if __name__ == '__main__': |
no test coverage detected