1# Copyright (c) 2017, The MITRE Corporation
2# For license information, see the LICENSE.txt file
3
4#: Namespace map of namespaces libtaxii knows about
5NS_MAP = {
6    'taxii': 'http://taxii.mitre.org/messages/taxii_xml_binding-1',
7    'taxii_11': 'http://taxii.mitre.org/messages/taxii_xml_binding-1.1',
8    'tdq': 'http://taxii.mitre.org/query/taxii_default_query-1',
9}
10
11#: alias for NS_MAP for backward compatibility
12ns_map = NS_MAP
13
14#: Constant identifying a Status Message
15MSG_STATUS_MESSAGE = 'Status_Message'
16#: Constant identifying a Discovery Request Message
17MSG_DISCOVERY_REQUEST = 'Discovery_Request'
18#: Constant identifying a Discovery Response Message
19MSG_DISCOVERY_RESPONSE = 'Discovery_Response'
20#: Constant identifying a Feed Information Request Message
21MSG_FEED_INFORMATION_REQUEST = 'Feed_Information_Request'
22#: Constant identifying a Feed Information Response Message
23MSG_FEED_INFORMATION_RESPONSE = 'Feed_Information_Response'
24#: Constant identifying a Subscription Management Request Message
25MSG_MANAGE_FEED_SUBSCRIPTION_REQUEST = 'Subscription_Management_Request'
26#: Constant identifying a Subscription Management Response Message
27MSG_MANAGE_FEED_SUBSCRIPTION_RESPONSE = 'Subscription_Management_Response'
28#: Constant identifying a Poll Request Message
29MSG_POLL_REQUEST = 'Poll_Request'
30#: Constant identifying a Poll Response Message
31MSG_POLL_RESPONSE = 'Poll_Response'
32#: Constant identifying a Inbox Message
33MSG_INBOX_MESSAGE = 'Inbox_Message'
34
35#: TAXII 1.0 Message Types
36MSG_TYPES_10 = (MSG_STATUS_MESSAGE, MSG_DISCOVERY_REQUEST, MSG_DISCOVERY_RESPONSE,
37                MSG_FEED_INFORMATION_REQUEST, MSG_FEED_INFORMATION_RESPONSE,
38                MSG_MANAGE_FEED_SUBSCRIPTION_REQUEST,
39                MSG_MANAGE_FEED_SUBSCRIPTION_RESPONSE, MSG_POLL_REQUEST,
40                MSG_POLL_RESPONSE, MSG_INBOX_MESSAGE)
41
42# New Message Types in TAXII 1.1
43
44#: Constant identifying a Status Message
45MSG_POLL_FULFILLMENT_REQUEST = 'Poll_Fulfillment'
46#: Constant identifying a Collection Information Request
47MSG_COLLECTION_INFORMATION_REQUEST = 'Collection_Information_Request'
48#: Constant identifying a Collection Information Response
49MSG_COLLECTION_INFORMATION_RESPONSE = 'Collection_Information_Response'
50#: Constant identifying a Subscription Request
51MSG_MANAGE_COLLECTION_SUBSCRIPTION_REQUEST = 'Subscription_Management_Request'
52#: Constant identifying a Subscription Response
53MSG_MANAGE_COLLECTION_SUBSCRIPTION_RESPONSE = 'Subscription_Management_Response'
54
55#: Tuple of all TAXII 1.1 Message Types
56MSG_TYPES_11 = (MSG_STATUS_MESSAGE, MSG_DISCOVERY_REQUEST, MSG_DISCOVERY_RESPONSE,
57                MSG_COLLECTION_INFORMATION_REQUEST, MSG_COLLECTION_INFORMATION_RESPONSE,
58                MSG_MANAGE_COLLECTION_SUBSCRIPTION_REQUEST,
59                MSG_MANAGE_COLLECTION_SUBSCRIPTION_RESPONSE, MSG_POLL_REQUEST,
60                MSG_POLL_RESPONSE, MSG_INBOX_MESSAGE, MSG_POLL_FULFILLMENT_REQUEST)
61
62# TAXII 1.0 Status Types
63
64#: Constant identifying a Status Type of Bad Message
65ST_BAD_MESSAGE = 'BAD_MESSAGE'
66#: Constant identifying a Status Type of Denied
67ST_DENIED = 'DENIED'
68#: Constant identifying a Status Type of Failure
69ST_FAILURE = 'FAILURE'
70#: Constant identifying a Status Type of Not Found
71ST_NOT_FOUND = 'NOT_FOUND'
72#: Constant identifying a Status Type of Polling Unsupported
73ST_POLLING_UNSUPPORTED = 'POLLING_UNSUPPORTED'
74#: Constant identifying a Status Type of Retry
75ST_RETRY = 'RETRY'
76#: Constant identifying a Status Type of Success
77ST_SUCCESS = 'SUCCESS'
78#: Constant identifying a Status Type of Unauthorized
79ST_UNAUTHORIZED = 'UNAUTHORIZED'
80#: Constant identifying a Status Type of Unsupported Message Binding
81ST_UNSUPPORTED_MESSAGE_BINDING = 'UNSUPPORTED_MESSAGE'
82#: Constant identifying a Status Type of Unsupported Content Binding
83ST_UNSUPPORTED_CONTENT_BINDING = 'UNSUPPORTED_CONTENT'
84#: Constant identifying a Status Type of Unsupported Protocol Binding
85ST_UNSUPPORTED_PROTOCOL = 'UNSUPPORTED_PROTOCOL'
86
87#: Tuple of all TAXII 1.0 Status Types
88ST_TYPES_10 = (ST_BAD_MESSAGE, ST_DENIED, ST_FAILURE, ST_NOT_FOUND,
89               ST_POLLING_UNSUPPORTED, ST_RETRY, ST_SUCCESS, ST_UNAUTHORIZED,
90               ST_UNSUPPORTED_MESSAGE_BINDING, ST_UNSUPPORTED_CONTENT_BINDING,
91               ST_UNSUPPORTED_PROTOCOL)
92
93# New Status Types in TAXII 1.1
94
95#: Constant identifying a Status Type of Asynchronous Poll Error
96ST_ASYNCHRONOUS_POLL_ERROR = 'ASYNCHRONOUS_POLL_ERROR'
97#: Constant identifying a Status Type of Destination Collection Error
98ST_DESTINATION_COLLECTION_ERROR = 'DESTINATION_COLLECTION_ERROR'
99#: Constant identifying a Status Type of Invalid Response Part
100ST_INVALID_RESPONSE_PART = 'INVALID_RESPONSE_PART'
101#: Constant identifying a Status Type of Network Error
102ST_NETWORK_ERROR = 'NETWORK_ERROR'
103#: Constant identifying a Status Type of Pending
104ST_PENDING = 'PENDING'
105#: Constant identifying a Status Type of Unsupported Query Format
106ST_UNSUPPORTED_QUERY = 'UNSUPPORTED_QUERY'
107
108#: Tuple of all TAXII 1.1 Status types
109ST_TYPES_11 = (ST_ASYNCHRONOUS_POLL_ERROR, ST_BAD_MESSAGE, ST_DENIED,
110               ST_DESTINATION_COLLECTION_ERROR, ST_FAILURE, ST_INVALID_RESPONSE_PART,
111               ST_NETWORK_ERROR, ST_NOT_FOUND, ST_PENDING, ST_POLLING_UNSUPPORTED,
112               ST_RETRY, ST_SUCCESS, ST_UNAUTHORIZED, ST_UNSUPPORTED_MESSAGE_BINDING,
113               ST_UNSUPPORTED_CONTENT_BINDING, ST_UNSUPPORTED_PROTOCOL,
114               ST_UNSUPPORTED_QUERY)
115
116# TAXII 1.0 Action Types
117
118#: Constant identifying an Action of Subscribe
119ACT_SUBSCRIBE = 'SUBSCRIBE'
120#: Constant identifying an Action of Unsubscribe
121ACT_UNSUBSCRIBE = 'UNSUBSCRIBE'
122#: Constant identifying an Action of Status
123ACT_STATUS = 'STATUS'
124
125#: Tuple of all TAXII 1.0 Action Types
126ACT_TYPES_10 = (ACT_SUBSCRIBE, ACT_UNSUBSCRIBE, ACT_STATUS)
127
128#: Constant identifying an Action of Pause
129ACT_PAUSE = 'PAUSE'
130#: Constant identifying an Action of Resume
131ACT_RESUME = 'RESUME'
132
133#: Tuple of all TAXII 1.1 Action types
134ACT_TYPES_11 = (ACT_SUBSCRIBE, ACT_PAUSE, ACT_RESUME, ACT_UNSUBSCRIBE, ACT_STATUS)
135
136# TAXII 1.0 Service Types
137
138#: Constant identifying a Service Type of Inbox
139SVC_INBOX = 'INBOX'
140#: Constant identifying a Service Type of Poll
141SVC_POLL = 'POLL'
142#: Constant identifying a Service Type of Feed Management
143SVC_FEED_MANAGEMENT = 'FEED_MANAGEMENT'
144#: Constant identifying a Service Type of Discovery
145SVC_DISCOVERY = 'DISCOVERY'
146
147#: Tuple of all TAXII 1.0 Service Types
148SVC_TYPES_10 = (SVC_INBOX, SVC_POLL, SVC_FEED_MANAGEMENT, SVC_DISCOVERY)
149
150# Renamed Status Types in TAXII 1.1
151#: Constant identifying a Service Type of Collection Management.
152#: "Feed Management" was renamed to "Collection Management" in TAXII 1.1.
153SVC_COLLECTION_MANAGEMENT = 'COLLECTION_MANAGEMENT'
154
155#: Tuple of all TAXII 1.1 Service Types
156SVC_TYPES_11 = (SVC_INBOX, SVC_POLL, SVC_COLLECTION_MANAGEMENT, SVC_DISCOVERY)
157
158# TAXII 1.1 Subscription Statuses
159
160#: Subscription Status of Active
161SS_ACTIVE = 'ACTIVE'
162#: Subscription Status of Paused
163SS_PAUSED = 'PAUSED'
164#: Subscription Status of Unsubscribed
165SS_UNSUBSCRIBED = 'UNSUBSCRIBED'
166
167#: Tuple of all TAXII 1.1 Subscription Statues
168SS_TYPES_11 = (SS_ACTIVE, SS_PAUSED, SS_UNSUBSCRIBED)
169
170# TAXII 1.1 Response Types
171
172#: Constant identifying a response type of Full
173RT_FULL = 'FULL'
174#: Constant identifying a response type of Count only
175RT_COUNT_ONLY = 'COUNT_ONLY'
176
177#: Tuple of all TAXII 1.1 Response Types
178RT_TYPES_11 = (RT_FULL, RT_COUNT_ONLY)
179
180# TAXII 1.1 Response Types
181
182#: Constant identifying a collection type of Data Feed
183CT_DATA_FEED = 'DATA_FEED'
184#: Constant identifying a collection type of Data Set
185CT_DATA_SET = 'DATA_SET'
186
187#: Tuple of all TAXII 1.1 Collection Types
188CT_TYPES_11 = (CT_DATA_FEED, CT_DATA_SET)
189
190# TAXII 1.1 Status Detail Keys
191
192#: Constant Identifying the Acceptable Destination Status Detail
193SD_ACCEPTABLE_DESTINATION = 'ACCEPTABLE_DESTINATION'
194#: Constant Identifying the Max Part Number Status Detail
195SD_MAX_PART_NUMBER = 'MAX_PART_NUMBER'
196#: Constant Identifying the Item Status Detail
197SD_ITEM = 'ITEM'
198#: Constant Identifying the Estimated Wait Status Detail
199SD_ESTIMATED_WAIT = 'ESTIMATED_WAIT'
200#: Constant Identifying the Result ID Status Detail
201SD_RESULT_ID = 'RESULT_ID'
202#: Constant Identifying the Will Push Status Detail
203SD_WILL_PUSH = 'WILL_PUSH'
204#: Constant Identifying the Supported Binding Status Detail
205SD_SUPPORTED_BINDING = 'SUPPORTED_BINDING'
206#: Constant Identifying the Supported Content Status Detail
207SD_SUPPORTED_CONTENT = 'SUPPORTED_CONTENT'
208#: Constant Identifying the Supported Protocol Status Detail
209SD_SUPPORTED_PROTOCOL = 'SUPPORTED_PROTOCOL'
210#: Constant Identifying the Supported Query Status Detail
211SD_SUPPORTED_QUERY = 'SUPPORTED_QUERY'
212
213#: Tuple of all TAXII 1.1 Status Detail Keys
214SD_TYPES_11 = (SD_ACCEPTABLE_DESTINATION, SD_MAX_PART_NUMBER, SD_ITEM,
215               SD_ESTIMATED_WAIT, SD_RESULT_ID, SD_WILL_PUSH,
216               SD_SUPPORTED_BINDING, SD_SUPPORTED_CONTENT, SD_SUPPORTED_PROTOCOL,
217               SD_SUPPORTED_QUERY)
218
219#: (For TAXII Default Query) Constant identifying supported Capability Modules
220SD_CAPABILITY_MODULE = 'CAPABILITY_MODULE'
221#: (For TAXII Default Query) Constant identifying Preferred Scopes
222SD_PREFERRED_SCOPE = 'PREFERRED_SCOPE'
223#: (For TAXII Default Query) Constant identifying Allowed Scopes
224SD_ALLOWED_SCOPE = 'ALLOWED_SCOPE'
225#: (For TAXII Default Query) Constant identifying supported Targeting Expression IDs
226SD_TARGETING_EXPRESSION_ID = 'TARGETING_EXPRESSION_ID'
227
228#: Format ID for this version of TAXII Default Query
229FID_TAXII_DEFAULT_QUERY_10 = 'urn:taxii.mitre.org:query:default:1.0'
230
231# Capability Module IDs
232#: Capability Module ID for Core
233CM_CORE = 'urn:taxii.mitre.org:query:capability:core-1'
234#: Capability Module ID for Regex
235CM_REGEX = 'urn:taxii.mitre.org:query:capability:regex-1'
236#: Capability Module ID for Timestamp
237CM_TIMESTAMP = 'urn:taxii.mitre.org:query:capability:timestamp-1'
238
239#: Tuple of all capability modules defined in TAXII Default Query 1.0
240CM_IDS = (CM_CORE, CM_REGEX, CM_TIMESTAMP)
241
242# Operators
243#: Operator OR
244OP_OR = 'OR'
245#: Operator AND
246OP_AND = 'AND'
247
248#: Tuple of all operators
249OP_TYPES = (OP_OR, OP_AND)
250
251
252#: Status Type indicating an unsupported capability module
253ST_UNSUPPORTED_CAPABILITY_MODULE = 'UNSUPPORTED_CAPABILITY_MODULE'
254#: Status Type indicating an unsupported targeting expression
255ST_UNSUPPORTED_TARGETING_EXPRESSION = 'UNSUPPORTED_TARGETING_EXPRESSION'
256#: Status Type indicating an unsupported targeting expression id
257ST_UNSUPPORTED_TARGETING_EXPRESSION_ID = 'UNSUPPORTED_TARGETING_EXPRESSION_ID'
258
259#: Parameter name: value
260P_VALUE = 'value'
261#: Parameter name: match_type
262P_MATCH_TYPE = 'match_type'
263#: Parameter name: case_sensitive
264P_CASE_SENSITIVE = 'case_sensitive'
265
266#: Tuple of all parameter names
267P_NAMES = (P_VALUE, P_MATCH_TYPE, P_CASE_SENSITIVE)
268
269#: Relationship name: equals
270R_EQUALS = 'equals'
271#: Relationship name: not_requals
272R_NOT_EQUALS = 'not_equals'
273#: Relationship name: greater_than
274R_GREATER_THAN = 'greater_than'
275#: Relationship name: greater_than_or_equal
276R_GREATER_THAN_OR_EQUAL = 'greater_than_or_equal'
277#: Relationship name: less_than
278R_LESS_THAN = 'less_than'
279#: Relationship name: less_than_or_equal
280R_LESS_THAN_OR_EQUAL = 'less_than_or_equal'
281#: Relationship name: does_not_exist
282R_DOES_NOT_EXIST = 'does_not_exist'
283#: Relationship name: exists
284R_EXISTS = 'exists'
285#: Relationship name: begins_with
286R_BEGINS_WITH = 'begins_with'
287#: Relationship name: ends_with
288R_ENDS_WITH = 'ends_with'
289#: Relationship name: contains
290R_CONTAINS = 'contains'
291#: Relationship name: matches
292R_MATCHES = 'matches'
293
294#: Tuple of all relationship names
295R_NAMES = (R_EQUALS, R_NOT_EQUALS, R_GREATER_THAN,
296           R_GREATER_THAN_OR_EQUAL, R_LESS_THAN,
297           R_LESS_THAN_OR_EQUAL, R_DOES_NOT_EXIST,
298           R_EXISTS, R_BEGINS_WITH, R_ENDS_WITH,
299           R_CONTAINS, R_MATCHES)
300
301# TAXII Version IDs #
302
303#: Version ID for the TAXII Services Specification 1.0
304VID_TAXII_SERVICES_10 = 'urn:taxii.mitre.org:services:1.0'
305#: Version ID for the TAXII Services Specification 1.1
306VID_TAXII_SERVICES_11 = 'urn:taxii.mitre.org:services:1.1'
307#: Version ID for the TAXII XML Message Binding Specification 1.0
308VID_TAXII_XML_10 = 'urn:taxii.mitre.org:message:xml:1.0'
309#: Version ID for the TAXII XML Message Binding Specification 1.1
310VID_TAXII_XML_11 = 'urn:taxii.mitre.org:message:xml:1.1'
311#: Version ID for the TAXII HTTP Protocol Binding Specification 1.0
312VID_TAXII_HTTP_10 = 'urn:taxii.mitre.org:protocol:http:1.0'
313#: Version ID for the TAXII HTTPS Protocol Binding Specification 1.0
314VID_TAXII_HTTPS_10 = 'urn:taxii.mitre.org:protocol:https:1.0'
315
316# Third Party Version IDs
317#: Version ID for the CERT EU JSON Message Binding
318VID_CERT_EU_JSON_10 = 'urn:cert.europa.eu:message:json:1.0'
319
320
321# TAXII Content Bindings #
322
323#: Content Binding ID for STIX XML 1.0
324CB_STIX_XML_10 = 'urn:stix.mitre.org:xml:1.0'
325#: Content Binding ID for STIX XML 1.0.1
326CB_STIX_XML_101 = 'urn:stix.mitre.org:xml:1.0.1'
327#: Content Binding ID for STIX XML 1.1
328CB_STIX_XML_11 = 'urn:stix.mitre.org:xml:1.1'
329#: Content Binding ID for STIX XML 1.1.1
330CB_STIX_XML_111 = 'urn:stix.mitre.org:xml:1.1.1'
331#: Content Binding ID for STIX XML 1.2
332CB_STIX_XML_12 = 'urn:stix.mitre.org:xml:1.2'
333#: Content Binding ID for CAP 1.1
334CB_CAP_11 = 'urn:oasis:names:tc:emergency:cap:1.1'
335#: Content Binding ID for XML Encryption
336CB_XENC_122002 = 'http://www.w3.org/2001/04/xmlenc#'
337#: Content Binding ID for SMIME
338CB_SMIME = 'application/x-pkcs7-mime'
339
340STD_INDENT = '  '  # A "Standard Indent" to use for to_text() methods
341