()
| 20 | |
| 21 | |
| 22 | def main(): |
| 23 | # Create a CybOX File Object with a contained hash |
| 24 | f = File() |
| 25 | f.add_hash("4EC0027BEF4D7E1786A04D021FA8A67F") |
| 26 | |
| 27 | # Create an Indicator with the File Hash Object created above. |
| 28 | indicator = Indicator() |
| 29 | indicator.title = "File Hash Example" |
| 30 | indicator.description = ( |
| 31 | "An indicator containing a File observable with an associated hash" |
| 32 | ) |
| 33 | indicator.set_producer_identity("The MITRE Corporation") |
| 34 | indicator.set_produced_time(utils.dates.now()) |
| 35 | |
| 36 | # Add The File Object to the Indicator. This will promote the CybOX Object |
| 37 | # to a CybOX Observable internally. |
| 38 | indicator.add_object(f) |
| 39 | |
| 40 | # Build our STIX CIQ Identity object |
| 41 | party_name = stix_ciq.PartyName( |
| 42 | name_lines=("Foo", "Bar"), |
| 43 | person_names=("John Smith", "Jill Smith"), |
| 44 | organisation_names=("Foo Inc.", "Bar Corp.") |
| 45 | ) |
| 46 | ident_spec = stix_ciq.STIXCIQIdentity3_0(party_name=party_name) |
| 47 | ident_spec.add_electronic_address_identifier("jsmith@example.com") |
| 48 | ident_spec.add_free_text_line("Demonstrating Free Text!") |
| 49 | ident_spec.add_contact_number("555-555-5555") |
| 50 | ident_spec.add_contact_number("555-555-5556") |
| 51 | |
| 52 | # Build and add a CIQ Address |
| 53 | addr = stix_ciq.Address( |
| 54 | free_text_address='1234 Example Lane.', |
| 55 | country='USA', |
| 56 | administrative_area='An Admin Area' |
| 57 | ) |
| 58 | ident_spec.add_address(addr) |
| 59 | |
| 60 | # Build and add a nationality |
| 61 | nationality = stix_ciq.Country("Norway") |
| 62 | ident_spec.add_nationality(nationality) |
| 63 | |
| 64 | identity = stix_ciq.CIQIdentity3_0Instance(specification=ident_spec) |
| 65 | |
| 66 | # Set the Indicator producer identity to our CIQ Identity |
| 67 | indicator.set_producer_identity(identity) |
| 68 | |
| 69 | # Build our STIX Package |
| 70 | stix_package = STIXPackage() |
| 71 | |
| 72 | # Build a STIX Header and add a description |
| 73 | stix_header = STIXHeader() |
| 74 | stix_header.description = "STIX CIQ Identity Extension Example" |
| 75 | |
| 76 | # Set the STIX Header on our STIX Package |
| 77 | stix_package.stix_header = stix_header |
| 78 | |
| 79 | # Add our Indicator object. The add() method will inspect the input and |
no test coverage detected