Skip to content

Instantly share code, notes, and snippets.

@johnwunder
Last active December 8, 2017 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnwunder/c4e1cec0f835da44c35ce828fd2add7a to your computer and use it in GitHub Desktop.
Save johnwunder/c4e1cec0f835da44c35ce828fd2add7a to your computer and use it in GitHub Desktop.
Custom props
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