Example #1
0
def to_collection_entity(model):
    if not model:
        return
    return entities.CollectionEntity(
        id=model.id,
        name=model.name,
        available=model.available,
        type=model.type,
        description=model.description,
        accept_all_content=model.accept_all_content,
        supported_content=deserialize_content_bindings(model.bindings),
        # TODO: Explicit integer, pending: https://github.com/TAXIIProject/libtaxii/issues/191
        volume=int(model.volume))
Example #2
0
 def get_collections(self, service_id=None):
     log.info("TRACE: get_collections %s" % service_id)
     collections = []
     if service_id != "discovery" and context.account:
         for id, name in enumerate(
                 sorted(context.account.permissions.keys())):
             if name != "default":
                 description = "MISP collection for Tag: %s" % (self.tag %
                                                                name)
             else:
                 description = "Default MISP Collection"
             content_bindings = self.services[service_id].properties.get(
                 "supported_content", [])
             collections.append(
                 entities.CollectionEntity(
                     id=id,
                     name=name,
                     available=True,
                     description=description,
                     accept_all_content=False,
                     supported_content=content_bindings))
     return collections
Example #3
0
CONTENT = 'some-content'

CONTENT_BINDINGS_ONLY_STIX = [CB_STIX_XML_111]
CONTENT_BINDINGS_STIX_AND_CUSTOM = CONTENT_BINDINGS_ONLY_STIX + [
    CUSTOM_CONTENT_BINDING
]
CONTENT_BINDING_SUBTYPE = 'custom-subtype'

MESSAGE = 'test-message'

COLLECTION_OPEN = "collection_open"
COLLECTION_ONLY_STIX = "collection_only_stix"
COLLECTION_STIX_AND_CUSTOM = "collection_stix_and_custom"
COLLECTION_DISABLED = "collection_disabled"

COLLECTIONS_A = map(lambda x: entities.CollectionEntity(**x), [
    dict(name=COLLECTION_OPEN, available=True, accept_all_content=True),
])

COLLECTIONS_B = map(lambda x: entities.CollectionEntity(**x), [
    dict(name=COLLECTION_OPEN,
         available=True,
         accept_all_content=True,
         type=entities.CollectionEntity.TYPE_SET),
    dict(name=COLLECTION_ONLY_STIX,
         available=True,
         accept_all_content=False,
         supported_content=CONTENT_BINDINGS_ONLY_STIX),
    dict(name=COLLECTION_STIX_AND_CUSTOM,
         available=True,
         accept_all_content=False,
Example #4
0
CONTENT = 'some-content'

CONTENT_BINDINGS_ONLY_STIX = [CB_STIX_XML_12]
CONTENT_BINDINGS_STIX_AND_CUSTOM = (CONTENT_BINDINGS_ONLY_STIX +
                                    [CUSTOM_CONTENT_BINDING])
CONTENT_BINDING_SUBTYPE = 'custom-subtype'

MESSAGE = 'test-message'

COLLECTION_OPEN = "collection_open"
COLLECTION_ONLY_STIX = "collection_only_stix"
COLLECTION_STIX_AND_CUSTOM = "collection_stix_and_custom"
COLLECTION_DISABLED = "collection_disabled"

COLLECTIONS_A = [
    entities.CollectionEntity(**x) for x in [{
        'name': COLLECTION_OPEN,
        'available': True,
        'accept_all_content': True
    }]
]

COLLECTIONS_B = [
    entities.CollectionEntity(**x)
    for x in [{
        'name': COLLECTION_OPEN,
        'available': True,
        'accept_all_content': True,
        'type': entities.CollectionEntity.TYPE_SET
    }, {
        'name': COLLECTION_ONLY_STIX,