Last active
December 8, 2017 14:43
-
-
Save johnwunder/c4e1cec0f835da44c35ce828fd2add7a to your computer and use it in GitHub Desktop.
Custom props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from stix2 import CustomObject, properties, TAXIICollectionSource | |
from taxii2client import Collection | |
@CustomObject('opinion', [ | |
('description', properties.StringProperty()), | |
('authors', properties.StringProperty()), | |
('opinion', properties.EnumProperty(allowed=[ | |
'strongly-disagree', | |
'disagree', | |
'neutral', | |
'agree', | |
'strongly-agree' | |
], required=True)), | |
('object_refs', properties.ListProperty(properties.ReferenceProperty, required=True)) | |
]) | |
class Opinion(object): | |
pass | |
@CustomObject('note', [ | |
('description', properties.StringProperty()), | |
('authors', properties.StringProperty()), | |
('object_refs', properties.ListProperty(properties.ReferenceProperty, required=True)) | |
]) | |
class Note(object): | |
pass | |
collection = Collection("https://ubertaxii.com/perch/collections/eb92eba6-1d3e-4102-baa8-beeb8863bdb2/", user="ubertaxii", password="certain_players_want_a_pony") | |
# supply the TAXII2 collection to TAXIICollection | |
tc_source = TAXIICollectionSource(collection) | |
#retrieve the STIX objects | |
results = tc_source.query(allow_custom=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment