libtaxii.messages_11
Module
Version: 1.1.119
Creating, handling, and parsing TAXII 1.1 messages.
Note
The examples on this page assume that you have run the equivalent of
import datetime
from dateutil.tz import tzutc
import libtaxii as t
import libtaxii.messages_11 as tm11
from libtaxii.constants import *
Status Message¶
- class libtaxii.messages_11.StatusMessage(message_id, in_response_to, extended_headers=None, status_type=None, status_detail=None, message=None)[source]¶
A TAXII Status message.
- Parameters:
message_id (str) – A value identifying this message. Required
in_response_to (str) – Contains the Message ID of the message to which this is a response. Required
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
status_type (str) – One of the defined Status Types or a third-party- defined Status Type. Required
status_detail (dict) – A field for additional information about this status in a machine-readable format. Required or Optional depending on
status_type
. See TAXII Specification for details.message (str) – Additional information for the status. There is no expectation that this field be interpretable by a machine; it is instead targeted to a human operator. Optional
Example:
sm03 = tm11.StatusMessage(
message_id='SM03',
in_response_to=tm11.generate_message_id(),
status_type=ST_DESTINATION_COLLECTION_ERROR,
status_detail={'ACCEPTABLE_DESTINATION': ['Collection1','Collection2']})
Discovery Request¶
- class libtaxii.messages_11.DiscoveryRequest(message_id, in_response_to=None, extended_headers=None)[source]¶
A TAXII Discovery Request message.
- Parameters:
message_id (str) – A value identifying this message. Required
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
Example:
headers={'ext_header1': 'value1', 'ext_header2': 'value2'}
discovery_request = tm11.DiscoveryRequest(
message_id=tm11.generate_message_id(),
extended_headers=headers)
Discovery Response¶
- class libtaxii.messages_11.DiscoveryResponse(message_id, in_response_to, extended_headers=None, service_instances=None)[source]¶
A TAXII Discovery Response message.
- Parameters:
message_id (str) – A value identifying this message. Required
in_response_to (str) – Contains the Message ID of the message to which this is a response. Optional
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
service_instances (list of ServiceInstance) – a list of service instances that this response contains. Optional
- class libtaxii.messages_11.ServiceInstance(service_type, services_version, protocol_binding, service_address, message_bindings, inbox_service_accepted_content=None, available=None, message=None, supported_query=None)[source]¶
The Service Instance component of a TAXII Discovery Response Message.
- Parameters:
service_type (string) – identifies the Service Type of this Service Instance. Required
services_version (string) – identifies the TAXII Services Specification to which this Service conforms. Required
protocol_binding (string) – identifies the protocol binding supported by this Service. Required
service_address (string) – identifies the network address of the TAXII Daemon that hosts this Service. Required
message_bindings (list of strings) – identifies the message bindings supported by this Service instance. Required
inbox_service_accepted_content (list of ContentBinding objects) – identifies content bindings that this Inbox Service is willing to accept. Optional
available (boolean) – indicates whether the identity of the requester (authenticated or otherwise) is allowed to access this TAXII Service. Optional
message (string) – contains a message regarding this Service instance. Optional
supported_query (SupportedQuery) – contains a structure indicating a supported query. Optional
The
message_bindings
list must contain at least one value. Thesupported_query
parameter is optional whenservice_type
isSVC_POLL
.
Example:
discovery_response = tm11.DiscoveryResponse(
message_id=tm11.generate_message_id(),
in_response_to=discovery_request.message_id)
service_instance = tm11.ServiceInstance(
service_type=SVC_POLL,
services_version=VID_TAXII_SERVICES_11,
protocol_binding=VID_TAXII_HTTP_10,
service_address='http://example.com/poll/',
message_bindings=[VID_TAXII_XML_11],
available=True,
message='This is a message.',
#supported_query=[tdq1],
)
discovery_response.service_instances.append(service_instance)
# Alternatively, you could define the service instance(s) first and use the
# following:
service_instance_list = [service_instance]
discovery_response = tm11.DiscoveryResponse(
message_id=tm11.generate_message_id(),
in_response_to=discovery_request.message_id,
service_instances=service_instance_list)
Collection Information Request¶
- class libtaxii.messages_11.CollectionInformationRequest(message_id, in_response_to=None, extended_headers=None)[source]¶
A TAXII Collection Information Request message.
- Parameters:
message_id (str) – A value identifying this message. Required
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
Example:
ext_headers = {'name1': 'val1', 'name2': 'val2'}
collection_information_request = tm11.CollectionInformationRequest(
message_id='CIReq01',
extended_headers=ext_headers)
Collection Information Response¶
- class libtaxii.messages_11.CollectionInformationResponse(message_id, in_response_to, extended_headers=None, collection_informations=None)[source]¶
A TAXII Collection Information Response message.
- Parameters:
message_id (str) – A value identifying this message. Required
in_response_to (str) – Contains the Message ID of the message to which this is a response. Optional
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
collection_informations (list of CollectionInformation objects) – A list of CollectionInformation objects to be contained in this response. Optional
- class libtaxii.messages_11.CollectionInformation(collection_name, collection_description, supported_contents=None, available=None, push_methods=None, polling_service_instances=None, subscription_methods=None, collection_volume=None, collection_type='DATA_FEED', receiving_inbox_services=None)[source]¶
The Collection Information component of a TAXII Collection Information Response Message.
- Parameters:
collection_name (str) – the name by which this TAXII Data Collection is identified. Required
collection_description (str) – a prose description of this TAXII Data Collection. Required
supported_contents (list of str) – Content Binding IDs indicating which types of content are currently expressed in this TAXII Data Collection. Optional
available (boolean) – whether the identity of the requester (authenticated or otherwise) is allowed to access this TAXII Service. Optional Default:
None
, indicating “unknown”push_methods (list of PushMethod objects) – the protocols that can be used to push content via a subscription. Optional
polling_service_instances (list of PollingServiceInstance objects) – the bindings and address a Consumer can use to interact with a Poll Service instance that supports this TAXII Data Collection. Optional
subscription_methods (list of SubscriptionMethod objects) – the protocol and address of the TAXII Daemon hosting the Collection Management Service that can process subscriptions for this TAXII Data Collection. Optional
collection_volume (int) – the typical number of messages per day. Optional
collection_type (str) – the type ofo this collection. Optional, defaults to
CT_DATA_FEED
.receiving_inbox_services (list of ReceivingInboxService objects) – TODO: FILL THIS IN. Optional
If
supported_contents
is omitted, then the collection supports all content bindings. The absense ofpush_methods
indicates no push methods. The absense ofpolling_service_instances
indicates no polling services. The absense ofsubscription_methods
indicates no subscription services. The absense ofreceiving_inbox_services
indicates no receiving inbox services.
- class libtaxii.messages_11.PushMethod(push_protocol, push_message_bindings)[source]¶
The Push Method component of a TAXII Collection Information component.
- Parameters:
push_protocol (str) – a protocol binding that can be used to push content to an Inbox Service instance. Required
push_message_bindings (list of str) – the message bindings that can be used to push content to an Inbox Service instance using the protocol identified in the Push Protocol field. Required
- class libtaxii.messages_11.PollingServiceInstance(poll_protocol, poll_address, poll_message_bindings)[source]¶
The Polling Service Instance component of a TAXII Collection Information component.
- Parameters:
poll_protocol (str) – the protocol binding supported by this Poll Service instance. Required
poll_address (str) – the address of the TAXII Daemon hosting this Poll Service instance. Required
poll_message_bindings (list of str) – the message bindings supported by this Poll Service instance. Required
- class libtaxii.messages_11.SubscriptionMethod(subscription_protocol, subscription_address, subscription_message_bindings)[source]¶
The Subscription Method component of a TAXII Collection Information component.
- Parameters:
subscription_protocol (str) – the protocol binding supported by this Collection Management Service instance. Required
subscription_address (str) – the address of the TAXII Daemon hosting this Collection Management Service instance. Required.
subscription_message_bindings (list of str) – the message bindings supported by this Collection Management Service Instance. Required
- class libtaxii.messages_11.ReceivingInboxService(inbox_protocol, inbox_address, inbox_message_bindings, supported_contents=None)[source]¶
The Receiving Inbox Service component of a TAXII Collection Information component.
- Parameters:
inbox_protocol (str) – Indicates the protocol this Inbox Service uses. Required
address (inbox) – Indicates the address of this Inbox Service. Required
inbox_message_bindings (list of str) – Each string indicates a message binding that this inbox service uses. Required
supported_contents (list of ContentBinding objects) – Each object indicates a Content Binding this inbox service can receive. Optional. Setting to
None
means that all Content Bindings are supported.
Example:
push_method1 = tm11.PushMethod(
push_protocol=VID_TAXII_HTTP_10,
push_message_bindings=[VID_TAXII_XML_11])
poll_service1 = tm11.PollingServiceInstance(
poll_protocol=VID_TAXII_HTTPS_10,
poll_address='https://example.com/PollService1',
poll_message_bindings=[VID_TAXII_XML_11])
poll_service2 = tm11.PollingServiceInstance(
poll_protocol=VID_TAXII_HTTPS_10,
poll_address='https://example.com/PollService2',
poll_message_bindings=[VID_TAXII_XML_11])
subs_method1 = tm11.SubscriptionMethod(
subscription_protocol=VID_TAXII_HTTPS_10,
subscription_address='https://example.com/SubscriptionService',
subscription_message_bindings=[VID_TAXII_XML_11])
inbox_service1 = tm11.ReceivingInboxService(
inbox_protocol=VID_TAXII_HTTPS_10,
inbox_address='https://example.com/InboxService',
inbox_message_bindings=[VID_TAXII_XML_11],
supported_contents=None)
collection1 = tm11.CollectionInformation(
collection_name='collection1',
collection_description='This is a collection',
supported_contents=[tm11.ContentBinding(CB_STIX_XML_101)],
available=False,
push_methods=[push_method1],
polling_service_instances=[poll_service1, poll_service2],
subscription_methods=[subs_method1],
collection_volume=4,
collection_type=CT_DATA_FEED,
receiving_inbox_services=[inbox_service1])
collection_response1 = tm11.CollectionInformationResponse(
message_id='CIR01',
in_response_to='0',
collection_informations=[collection1])
Manage Collection Subscription Request¶
- class libtaxii.messages_11.ManageCollectionSubscriptionRequest(message_id, extended_headers=None, collection_name=None, action=None, subscription_id=None, subscription_parameters=None, push_parameters=None)[source]¶
A TAXII Manage Collection Subscription Request message.
- Parameters:
message_id (str) – A value identifying this message. Required
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
collection_name (str) – the name of the TAXII Data Collection to which the action applies. Required
action (str) – the requested action to take. Required
subscription_id (str) – the ID of a previously created subscription. Probibited if
action==
ACT_SUBSCRIBE
, else Requiredsubscription_parameters (SubscriptionParameters) – The parameters for this subscription. Optional
push_parameters (list of PushParameter) – the push parameters for this request. Optional Absence means push is not requested.
Example:
subscription_parameters1 = tm11.SubscriptionParameters()
push_parameters1 = tm11.PushParameters("", "", "")
subs_req1 = tm11.ManageCollectionSubscriptionRequest(
message_id='SubsReq01',
action=ACT_SUBSCRIBE,
collection_name='collection1',
subscription_parameters=subscription_parameters1,
push_parameters=push_parameters1)
Manage Collection Subscription Response¶
- class libtaxii.messages_11.ManageCollectionSubscriptionResponse(message_id, in_response_to, extended_headers=None, collection_name=None, message=None, subscription_instances=None)[source]¶
A TAXII Manage Collection Subscription Response message.
- Parameters:
message_id (str) – A value identifying this message. Required
in_response_to (str) – Contains the Message ID of the message to which this is a response. Required
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
collection_name (str) – the name of the TAXII Data Collection to which the action applies. Required
message (str) – additional information for the message recipient. Optional
subscription_instances (list of SubscriptionInstance) – Optional
- class libtaxii.messages_11.SubscriptionInstance(subscription_id, status='ACTIVE', subscription_parameters=None, push_parameters=None, poll_instances=None)[source]¶
The Subscription Instance component of the Manage Collection Subscription Response message.
- Parameters:
subscription_id (str) – the id of the subscription. Required
status (str) – One of
SS_ACTIVE
,SS_PAUSED
, orSS_UNSUBSCRIBED
. Optional, defaults to “ACTIVE”subscription_parameters (SubscriptionParameters) – the parameters for this subscription. Optional If provided, should match the request.
push_parameters (PushParameters) – the push parameters for this subscription. Optional If provided, should match the request.
poll_instances (list of PollInstance) – The Poll Services that can be polled to fulfill this subscription. Optional
- class libtaxii.messages_11.PollInstance(poll_protocol, poll_address, poll_message_bindings=None)[source]¶
The Poll Instance component of the Manage Collection Subscription Response message.
- Parameters:
poll_protocol (str) – The protocol binding supported by this instance of a Polling Service. Required
poll_address (str) – the address of the TAXII Daemon hosting this Poll Service. Required
poll_message_bindings (list of str) – one or more message bindings that can be used when interacting with this Poll Service instance. Required
Example:
subscription_parameters1 = tm11.SubscriptionParameters()
push_parameters1 = tm11.PushParameters("", "", "")
poll_instance1 = tm11.PollInstance(
poll_protocol=VID_TAXII_HTTPS_10,
poll_address='https://example.com/poll1/',
poll_message_bindings=[VID_TAXII_XML_11])
subs1 = tm11.SubscriptionInstance(
subscription_id='Subs001',
status=SS_ACTIVE,
subscription_parameters=subscription_parameters1,
push_parameters=push_parameters1,
poll_instances=[poll_instance1])
subs_resp1 = tm11.ManageCollectionSubscriptionResponse(
message_id='SubsResp01',
in_response_to='xyz',
collection_name='abc123',
message='Hullo!',
subscription_instances=[subs1])
Poll Request¶
- class libtaxii.messages_11.PollRequest(message_id, extended_headers=None, collection_name=None, exclusive_begin_timestamp_label=None, inclusive_end_timestamp_label=None, subscription_id=None, poll_parameters=None)[source]¶
A TAXII Poll Request message.
- Parameters:
message_id (str) – A value identifying this message. Required
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
collection_name (str) – the name of the TAXII Data Collection that is being polled. Required
exclusive_begin_timestamp_label (datetime) – a Timestamp Label indicating the beginning of the range of TAXII Data Feed content the requester wishes to receive. Optional for a Data Feed, Prohibited for a Data Set
inclusive_end_timestamp_label (datetime) – a Timestamp Label indicating the end of the range of TAXII Data Feed content the requester wishes to receive. Optional for a Data Feed, Probited for a Data Set
subscription_id (str) – the existing subscription the Consumer wishes to poll. Optional
poll_parameters (list of PollParameters objects) – the poll parameters for this request. Optional
Exactly one of
subscription_id
andpoll_parameters
is Required.
- class libtaxii.messages_11.PollParameters(response_type='FULL', content_bindings=None, query=None, allow_asynch=False, delivery_parameters=None)[source]¶
The Poll Parameters component of a TAXII Poll Request message.
- Parameters:
response_type (str) – The requested response type. Must be either
RT_FULL
orRT_COUNT_ONLY
. Optional, defaults toRT_FULL
content_bindings (list of ContentBinding objects) – A list of Content Bindings acceptable in response. Optional
query (Query) – The query for this poll parameters. Optional
allow_asynch (bool) – Indicates whether the client supports asynchronous polling. Optional, defaults to
False
delivery_parameters (libtaxii.messages_11.DeliveryParameters) – The requested delivery parameters for this object. Optional
If
content_bindings
in not provided, this indicates that all bindings are accepted as a response.
Example:
delivery_parameters1 = tm11.DeliveryParameters(
inbox_protocol=VID_TAXII_HTTPS_10,
inbox_address='https://example.com/inboxAddress/',
delivery_message_binding=VID_TAXII_XML_11)
poll_params1 = tm11.PollParameters(
allow_asynch=False,
response_type=RT_COUNT_ONLY,
content_bindings=[tm11.ContentBinding(binding_id=CB_STIX_XML_11)],
#query=query1,
delivery_parameters=delivery_parameters1)
poll_req3 = tm11.PollRequest(
message_id='PollReq03',
collection_name='collection100',
exclusive_begin_timestamp_label=datetime.datetime.now(tzutc()),
inclusive_end_timestamp_label=datetime.datetime.now(tzutc()),
poll_parameters=poll_params1)
Poll Response¶
- class libtaxii.messages_11.PollResponse(message_id, in_response_to, extended_headers=None, collection_name=None, exclusive_begin_timestamp_label=None, inclusive_end_timestamp_label=None, subscription_id=None, message=None, content_blocks=None, more=False, result_id=None, result_part_number=1, record_count=None)[source]¶
A TAXII Poll Response message.
- Parameters:
message_id (str) – A value identifying this message. Required
in_response_to (str) – Contains the Message ID of the message to which this is a response. Optional
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
collection_name (str) – the name of the TAXII Data Collection that was polled. Required
exclusive_begin_timestamp_label (datetime) – a Timestamp Label indicating the beginning of the range this response covers. Optional for a Data Feed, Prohibited for a Data Set
inclusive_end_timestamp_label (datetime) – a Timestamp Label indicating the end of the range this response covers. Optional for a Data Feed, Prohibited for a Data Set
subscription_id (str) – the Subscription ID for which this content is being provided. Optional
message (str) – additional information for the message recipient. Optional
content_blocks (list of ContentBlock) – piece of content and additional information related to the content. Optional
more (bool) – Whether there are more result parts. Optional, defaults to
False
result_id (str) – The ID of this result. Optional
result_part_number (int) – The result part number of this response. Optional
record_count (RecordCount) – The number of records and whether the count is a lower bound. Optional
Example:
cb1 = tm11.ContentBlock(CB_STIX_XML_11, "")
cb2 = tm11.ContentBlock(CB_STIX_XML_11, "")
count = tm11.RecordCount(record_count=22, partial_count=False)
poll_resp1 = tm11.PollResponse(
message_id='PollResp1',
in_response_to='tmp',
collection_name='blah',
exclusive_begin_timestamp_label=datetime.datetime.now(tzutc()),
inclusive_end_timestamp_label=datetime.datetime.now(tzutc()),
subscription_id='24',
message='This is a test message',
content_blocks=[cb1, cb2],
more=True,
result_id='123',
result_part_number=1,
record_count=count)
Inbox Message¶
- class libtaxii.messages_11.InboxMessage(message_id, in_response_to=None, extended_headers=None, message=None, result_id=None, destination_collection_names=None, subscription_information=None, record_count=None, content_blocks=None)[source]¶
A TAXII Inbox message.
- Parameters:
message_id (str) – A value identifying this message. Required
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
message (str) – prose information for the message recipient. Optional
result_id (str) – the result id. Optional
destination_collection_names (list of str) – Each string indicates a destination collection name. Optional
subscription_information (libtaxii.messages_11.SubscriptionInformation) – This field is only present if this message is being sent to provide content in accordance with an existing TAXII Data Collection subscription. Optional
record_count (RecordCount) – The number of records and whether the count is a lower bound. Optional
content_blocks (list of ContentBlock) – Inbox content. Optional
- class libtaxii.messages_11.SubscriptionInformation(collection_name, subscription_id, exclusive_begin_timestamp_label=None, inclusive_end_timestamp_label=None)[source]¶
The Subscription Information component of a TAXII Inbox message.
- Parameters:
collection_name (str) – the name of the TAXII Data Collection from which this content is being provided. Required
subscription_id (str) – the Subscription ID for which this content is being provided. Required
exclusive_begin_timestamp_label (datetime) – a Timestamp Label indicating the beginning of the time range this Inbox Message covers. Optional for a Data Feed, Prohibited for a Data Set
inclusive_end_timestamp_label (datetime) – a Timestamp Label indicating the end of the time range this Inbox Message covers. Optional for a Data Feed, Prohibited for a Data Set
Example:
cb1 = tm11.ContentBlock(CB_STIX_XML_11, "")
cb2 = tm11.ContentBlock(CB_STIX_XML_11, "")
subs_info1 = tm11.SubscriptionInformation(
collection_name='SomeCollectionName',
subscription_id='SubsId021',
exclusive_begin_timestamp_label=datetime.datetime.now(tzutc()),
inclusive_end_timestamp_label=datetime.datetime.now(tzutc()))
inbox1 = tm11.InboxMessage(
message_id='Inbox1',
result_id='123',
destination_collection_names=['collection1','collection2'],
message='Hello!',
subscription_information=subs_info1,
record_count=tm11.RecordCount(22, partial_count=True),
content_blocks=[cb1, cb2])
Poll Fulfillment Request¶
- class libtaxii.messages_11.PollFulfillmentRequest(message_id, extended_headers=None, collection_name=None, result_id=None, result_part_number=None)[source]¶
A TAXII Poll Fulfillment Request message.
- Parameters:
message_id (str) – A value identifying this message. Required
extended_headers (dict) – A dictionary of name/value pairs for use as Extended Headers. Optional
collection_name (str) – the name of the TAXII Data Collection to which the action applies. Required
result_id (str) – The result id of the requested result. Required
result_part_number (int) – The part number being requested. Required
Example:
pf1 = tm11.PollFulfillmentRequest(
message_id='pf1',
collection_name='1-800-collection',
result_id='123',
result_part_number=1)
Other Classes¶
- class libtaxii.messages_11.TAXIIMessage(message_id, in_response_to=None, extended_headers=None)[source]¶
Encapsulate properties common to all TAXII Messages (such as headers).
This class is extended by each Message Type (e.g., DiscoveryRequest), with each subclass containing subclass-specific information
- class libtaxii.messages_11.ContentBinding(binding_id, subtype_ids=None)[source]¶
TAXII Content Binding component
- Parameters:
binding_id (str) – The content binding ID. Required
subtype_ids (list of str) – the subtype IDs. Required
- class libtaxii.messages_11.ContentBlock(content_binding, content, timestamp_label=None, padding=None, message=None)[source]¶
A TAXII Content Block.
- Parameters:
content_binding (ContentBinding) – a Content Binding ID or nesting expression indicating the type of content contained in the Content field of this Content Block. Required
content (string or etree) – a piece of content of the type specified by the Content Binding. Required
timestamp_label (datetime) – the Timestamp Label associated with this Content Block. Optional
padding (string) – an arbitrary amount of padding for this Content Block. Optional
message (string) – a message associated with this ContentBlock. Optional
Example:
cb001 = tm11.ContentBlock(
content_binding=tm11.ContentBinding(CB_STIX_XML_11),
content='<stix:STIX_Package xmlns:stix="http://stix.mitre.org/stix-1"/>',
timestamp_label=datetime.datetime.now(tzutc()),
message='Hullo!',
padding='The quick brown fox jumped over the lazy dogs.')
- class libtaxii.messages_11.DeliveryParameters(inbox_protocol, inbox_address, delivery_message_binding)[source]¶
Set up Delivery Parameters.
- Parameters:
inbox_protocol (str) – identifies the protocol to be used when pushing TAXII Data Collection content to a Consumer’s TAXII Inbox Service implementation. Required
inbox_address (str) – identifies the address of the TAXII Daemon hosting the Inbox Service to which the Consumer requests content for this TAXII Data Collection to be delivered. Required
delivery_message_binding (str) – identifies the message binding to be used to send pushed content for this subscription. Required
- class libtaxii.messages_11.PushParameters(inbox_protocol, inbox_address, delivery_message_binding)[source]¶
Set up Push Parameters.
- Parameters:
inbox_protocol (str) – identifies the protocol to be used when pushing TAXII Data Collection content to a Consumer’s TAXII Inbox Service implementation. Required
inbox_address (str) – identifies the address of the TAXII Daemon hosting the Inbox Service to which the Consumer requests content for this TAXII Data Collection to be delivered. Required
delivery_message_binding (str) – identifies the message binding to be used to send pushed content for this subscription. Required
- class libtaxii.messages_11.RecordCount(record_count, partial_count=False)[source]¶
Information summarizing the number of records.
- Parameters:
record_count (int) – The number of records
partial_count (bool) – Whether the number of records is a partial count
- class libtaxii.messages_11.SubscriptionParameters(response_type='FULL', content_bindings=None, query=None)[source]¶
TAXII Subscription Parameters.
- Parameters:
response_type (str) – The requested response type. Must be either
RT_FULL
orRT_COUNT_ONLY
. Optional, defaults toRT_FULL
content_bindings (list of ContentBinding objects) – A list of Content Bindings acceptable in response. Optional
query (Query) – The query for this poll parameters. Optional
Functions¶
- libtaxii.messages_11.generate_message_id(maxlen=5, version='urn:taxii.mitre.org:services:1.0')[source]¶
Generate a TAXII Message ID.
- Parameters:
maxlen (int) – maximum length of the ID, in characters
Example
msg_id = tm11.generate_message_id() message = tm11.DiscoveryRequest(msg_id) # Or... message = tm11.DiscoveryRequest(tm11.generate_message_id())
- libtaxii.messages_11.validate_xml(xml_string)[source]¶
Note that this function has been deprecated. Please see libtaxii.validators.SchemaValidator.
Validate XML with the TAXII XML Schema 1.1.
- Parameters:
xml_string (str) – The XML to validate.
Example
is_valid = tm11.validate_xml(message.to_xml())
- libtaxii.messages_11.get_message_from_xml(xml_string, encoding='utf_8')[source]¶
Create a TAXIIMessage object from an XML string.
This function automatically detects which type of Message should be created based on the XML.
- Parameters:
xml_string (str) – The XML to parse into a TAXII message.
encoding (str) – The encoding of the string; defaults to UTF-8
Example
message_xml = message.to_xml() new_message = tm11.get_message_from_xml(message_xml)
- libtaxii.messages_11.get_message_from_dict(d)[source]¶
Create a TAXIIMessage object from a dictonary.
This function automatically detects which type of Message should be created based on the ‘message_type’ key in the dictionary.
- Parameters:
d (dict) – The dictionary to build the TAXII message from.
Example
message_dict = message.to_dict() new_message = tm11.get_message_from_dict(message_dict)