|
3 | 3 | # Import the required APIs |
4 | 4 | from maec.bundle import Bundle, MalwareAction |
5 | 5 | from maec.utils import IDGenerator, set_id_method |
6 | | - from cybox.core import Object, AssociatedObjects, AssociatedObject, AssociationType |
| 6 | + from cybox.core import Object, AssociatedObjects, AssociatedObject |
7 | 7 | from cybox.objects.file_object import File |
| 8 | + from cybox.common import VocabString |
8 | 9 | |
9 | 10 | # Instantiate the MAEC/CybOX Entities |
10 | 11 | set_id_method(IDGenerator.METHOD_INT) |
|
16 | 17 | ao.properties = File() |
17 | 18 | ao.properties.file_name = "badware.exe" |
18 | 19 | ao.properties.size_in_bytes = "123456" |
19 | | - ao.association_type = AssociationType() |
| 20 | + ao.association_type = VocabString() |
20 | 21 | ao.association_type.value = 'output' |
21 | 22 | ao.association_type.xsi_type = 'maecVocabs:ActionObjectAssociationTypeVocab-1.0' |
22 | 23 | |
23 | 24 | # Build the Action and add the Associated Object to it |
24 | | - a.name = 'create file' |
| 25 | + a.name = VocabString() |
| 26 | + a.name.value = 'create file' |
25 | 27 | a.name.xsi_type = 'maecVocabs:FileActionNameVocab-1.0' |
26 | 28 | a.associated_objects = AssociatedObjects() |
27 | 29 | a.associated_objects.append(ao) |
|
30 | 32 | b.add_action(a) |
31 | 33 | |
32 | 34 | # Output the Bundle to stdout |
33 | | - print b.to_xml(include_namespaces = False) |
| 35 | + print b.to_xml(include_namespaces = False) |
0 commit comments