Skip to content

Commit 58480eb

Browse files
committed
Updated for coherency w/ python-cybox vocabulary updates
1 parent 28e8f12 commit 58480eb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/api_vs_bindings/api_snippet.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# Import the required APIs
44
from maec.bundle import Bundle, MalwareAction
55
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
77
from cybox.objects.file_object import File
8+
from cybox.common import VocabString
89
910
# Instantiate the MAEC/CybOX Entities
1011
set_id_method(IDGenerator.METHOD_INT)
@@ -16,12 +17,13 @@
1617
ao.properties = File()
1718
ao.properties.file_name = "badware.exe"
1819
ao.properties.size_in_bytes = "123456"
19-
ao.association_type = AssociationType()
20+
ao.association_type = VocabString()
2021
ao.association_type.value = 'output'
2122
ao.association_type.xsi_type = 'maecVocabs:ActionObjectAssociationTypeVocab-1.0'
2223
2324
# 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'
2527
a.name.xsi_type = 'maecVocabs:FileActionNameVocab-1.0'
2628
a.associated_objects = AssociatedObjects()
2729
a.associated_objects.append(ao)
@@ -30,4 +32,4 @@
3032
b.add_action(a)
3133
3234
# Output the Bundle to stdout
33-
print b.to_xml(include_namespaces = False)
35+
print b.to_xml(include_namespaces = False)

0 commit comments

Comments
 (0)