20/05/2018
In the evolving landscape of cyber threat intelligence, the ability to effectively share and consume machine-readable threat information is paramount. The Trusted Automated eXchange of Indicator Information (TAXII) standard, particularly its 2.X versions, plays a crucial role in facilitating this exchange. As organisations seek to integrate TAXII feeds into their security operations, a common question arises: is there a straightforward command-line client available for interacting with TAXII servers? This article delves into the current state of TAXII client tooling, specifically focusing on the widely used cti-taxii-client, and clarifies how users can best leverage it, even without a dedicated command-line interface.

While the allure of a simple command-line tool for quick interactions is understandable, the current primary method for programmatic interaction with TAXII 2.X servers, as provided by the OASIS Cyber Threat Intelligence (CTI) TC, is through a robust Python library. The cti-taxii-client is designed as a minimal client implementation for TAXII 2.X servers, offering a comprehensive set of functionalities through its Python API. This design choice caters to the needs of developers and security engineers who require flexible integration into existing scripts, automation pipelines, and larger applications, rather than standalone, one-off command-line operations.
- Understanding the cti-taxii-client: A Pythonic Approach
- Installation: Getting Started with taxii2-client
- Usage: Interacting with TAXII Servers via Python
- Why a Library Over a Command-Line Interface?
- Key TAXII 2.X API Services Supported by taxii2-client
- Governance and Community Contributions
- Frequently Asked Questions (FAQs)
- Q: Is there a command-line client for TAXII 2.X?
- Q: What is TAXII and why is it important for cybersecurity?
- Q: What is cti-taxii-client used for?
- Q: How do I install taxii2-client?
- Q: Can I use cti-taxii-client with both TAXII 2.0 and 2.1 servers?
- Q: How do I handle large datasets or many objects with cti-taxii-client?
- Q: What are the main classes provided by the taxii2-client?
- Conclusion
Understanding the cti-taxii-client: A Pythonic Approach
The cti-taxii-client is not a command-line application in itself. Instead, it serves as a powerful Python library that allows developers to programmatically interact with TAXII 2.X servers. This means that while you won't type commands directly into your terminal to fetch STIX objects, you can write Python scripts that utilise this library to achieve the same, or even more complex, tasks. This approach offers significant advantages in terms of automation, customisation, and integration with other security tools and platforms.
The library supports a wide array of TAXII 2.X API services, ensuring comprehensive coverage for most threat intelligence sharing scenarios. These services allow for everything from discovering server capabilities to adding and retrieving specific threat indicators. The core functionality revolves around interacting with TAXII servers, their API Roots, and the Collections within them.
Supported TAXII 2.X API Services
The cti-taxii-client provides programmatic access to the following essential TAXII 2.X API services:
- Server Discovery: Identifying available API Roots on a TAXII server.
- Get API Root Information: Retrieving metadata about a specific API Root.
- Get Status: Checking the status of asynchronous requests, such as object additions.
- Get Collections: Listing all available collections within an API Root.
- Get a Collection: Retrieving detailed information about a particular collection.
- Get Objects: Fetching STIX (Structured Threat Information Expression) objects from a collection. This is crucial for consuming threat intelligence.
- Add Objects: Submitting STIX objects to a collection, enabling organisations to share their own intelligence.
- Get an Object: Retrieving a specific STIX object by its ID.
- Delete an Object (TAXII 2.1 only): Removing an object from a collection. This functionality is specific to the newer TAXII 2.1 specification.
- Get Object Manifests: Obtaining metadata about objects in a collection, without fetching the full objects themselves.
- Get Object Versions (TAXII 2.1 only): Retrieving different versions of an object, another feature introduced in TAXII 2.1.
Installation: Getting Started with taxii2-client
Installing the cti-taxii-client is remarkably straightforward, leveraging Python's popular package installer, pip. If you have Python and pip installed on your system, you're just one command away from setting up the client:
$ pip install taxii2-clientThis command will download and install the necessary packages, making the taxii2-client library available for use in your Python scripts. The ease of installation contributes significantly to the library's accessibility for developers and security professionals.
Usage: Interacting with TAXII Servers via Python
As established, the taxii2-client is designed to be used as a Python library. It provides four primary classes that represent the core components of the TAXII data model and facilitate interactions:
Server: Represents a TAXII server and allows discovery of its API Roots.ApiRoot: Represents an API Root on a TAXII server, providing access to its collections.Collection: Represents a specific collection within an API Root, enabling operations like getting or adding STIX objects.Status: Represents the status of an asynchronous TAXII request.
Each of these classes can be instantiated by passing a URL, and optionally, user and password arguments for authentication. Once authenticated, the authorisation information is stored within the instance, meaning you don't need to explicitly supply credentials for every subsequent service request. By default, the library attempts to import the latest supported TAXII specification version (currently 2.1). However, if you need to work with a specific version, you can explicitly import it.
Instantiating and Exploring a Server
To begin, you typically instantiate a Server object, providing the server's base URL and your credentials:
from taxii2client.v21 import Server
server = Server('https://example.com/taxii2/', user='user_id', password='user_password')
print(server.title)
print(server.description)
print(server.api_roots)
Upon instantiation, the Server object intelligently loads and caches the server's metadata, including its title, description, and available API Roots. This lazy loading ensures efficiency, as information is fetched only when accessed.
Working with API Roots and Collections
Once you have a Server object, you can access its api_roots property, which is a list of ApiRoot objects. Each ApiRoot object contains its own metadata, such as title, description, and max_content_length, along with a list of Collection objects it contains:
api_root = server.api_roots[0] # Assuming there's at least one API Root
print(api_root.title)
collection = api_root.collections[0] # Assuming there's at least one Collection
print(collection.id)
print(collection.title)
print(collection.can_read)
# Adding STIX objects to a collection
# For example, stix_bundle would be a properly formatted STIX Bundle object
# collection.add_objects(stix_bundle)
A Collection object also has attributes corresponding to its metadata, such as id, title, description, alias (2.1 only), can_write, can_read, and media_types. These attributes provide essential information about the collection's purpose and capabilities.
Direct Collection Instantiation and Object Retrieval
For more direct access, or if you already know the specific URL of a collection, you can instantiate a Collection object directly. The library handles both TAXII 2.0 and 2.1 requests, allowing you to specify the version you intend to use:
Performing TAXII 2.0 Requests
from taxii2client.v20 import Collection, as_pages
collection = Collection('https://example.com/api1/collections/91a7b528-80eb-42ed-a74d-c6fbd5a26116')
# Get a specific object
print(collection.get_object('indicator--252c7c11-daf2-42bd-843b-be65edca9f61'))
# Get all objects (without pagination)
print(collection.get_objects())
print(collection.get_manifest())
# For pagination requests (recommended for large datasets)
for bundle in as_pages(collection.get_objects, per_request=50):
print(bundle)
for manifest_resource in as_pages(collection.get_manifest, per_request=50):
print(manifest_resource)
Performing TAXII 2.1 Requests
from taxii2client.v21 import Collection, as_pages
collection = Collection('https://example.com/api1/collections/91a7b528-80eb-42ed-a74d-c6fbd5a26116')
# Get a specific object
print(collection.get_object('indicator--252c7c11-daf2-42bd-843b-be65edca9f61'))
# Get all objects (without pagination)
print(collection.get_objects())
print(collection.get_manifest())
# For pagination requests (essential for large datasets)
for envelope in as_pages(collection.get_objects, per_request=50):
print(envelope)
for manifest_resource in as_pages(collection.get_manifest, per_request=50):
print(manifest_resource)
The as_pages function is particularly useful for handling large datasets by automatically managing pagination, fetching objects or manifests in chunks (e.g., 50 per request) until all data is retrieved. This prevents memory issues and improves performance when dealing with extensive threat intelligence feeds.
Refreshing Object Data
All classes within the taxii2-client library include a refresh() method. This method allows you to reload the URL corresponding to that specific resource, ensuring that the properties and attributes of your instantiated objects have the most up-to-date values from the TAXII server. This is useful in scenarios where server metadata or collection contents might change frequently.

Why a Library Over a Command-Line Interface?
The choice to implement cti-taxii-client as a Python library, rather than a direct command-line utility, is a deliberate one with several key advantages for users involved in threat intelligence operations:
- Automation and Integration: Libraries are inherently designed for integration into larger systems, scripts, and workflows. This allows organisations to automate the collection, processing, and dissemination of threat intelligence without manual intervention. A CLI would typically require wrapping in shell scripts, adding an extra layer of complexity for sophisticated automation.
- Flexibility and Customisation: Python offers immense flexibility. Users can build custom logic around the TAXII interactions, such as filtering STIX objects based on specific criteria, integrating with databases, sending alerts, or transforming data formats. A CLI would offer a fixed set of commands, limiting customisation.
- Error Handling and Robustness: Programmatic access allows for sophisticated error handling and retry mechanisms, making the intelligence fetching process more robust against network issues or server errors.
- Security and Authentication: Managing credentials securely within an application or script is often more manageable and less prone to exposure than passing them directly on the command line, especially in automated environments.
- Complex Workflows: Real-world threat intelligence scenarios often involve complex workflows that go beyond simple 'get' or 'add' operations. A library facilitates chaining multiple operations, decision-making, and dynamic interaction with the TAXII server based on previous responses.
Key TAXII 2.X API Services Supported by taxii2-client
To further illustrate the capabilities of the cti-taxii-client, here is a breakdown of the key TAXII 2.X API services it supports, along with their purpose and how they map to the client's methods:
| Service Name | Description | Client Method/Property | Purpose in Threat Intelligence |
|---|---|---|---|
| Server Discovery | Identify available API Roots on a TAXII server. | Server object properties (e.g., server.api_roots) | Initial reconnaissance of a TAXII server's offerings. |
| Get API Root Information | Retrieve comprehensive metadata about a specific API Root. | ApiRoot object properties (e.g., api_root.title) | Understanding the scope and purpose of an intelligence feed. |
| Get Status | Check the status of asynchronous operations (e.g., object addition). | Status object | Monitoring long-running processes for successful completion or errors. |
| Get Collections | List all available collections within an API Root. | ApiRoot.collections | Discovering specific feeds or datasets available from an intelligence provider. |
| Get a Collection | Retrieve detailed information about a particular collection. | Collection object instantiation and properties | Understanding a collection's characteristics (read/write access, media types). |
| Get Objects | Fetch STIX objects (e.g., Indicators, Malware) from a collection. | Collection.get_objects() | The primary method for consuming raw threat intelligence data. |
| Add Objects | Submit STIX objects to a collection. | Collection.add_objects(stix_bundle) | Sharing internally generated or curated threat intelligence. |
| Get an Object | Retrieve a specific STIX object by its unique ID. | Collection.get_object('object_id') | Targeted retrieval of specific indicators or threat information. |
| Delete an Object (2.1 only) | Remove an object from a collection. | Collection.delete_object('object_id') | Managing sensitive or outdated intelligence (TAXII 2.1 feature). |
| Get Object Manifests | Obtain metadata (e.g., ID, version, types) about objects without fetching full content. | Collection.get_manifest() | Efficiently checking for new or updated objects before full retrieval. |
| Get Object Versions (2.1 only) | Retrieve different versions of a specific object. | Collection.get_object_versions('object_id') | Tracking changes and evolution of threat intelligence (TAXII 2.1 feature). |
Governance and Community Contributions
It is worth noting that the cti-taxii-client is hosted as an OASIS TC Open Repository on GitHub. This signifies its development is supported by the OASIS Cyber Threat Intelligence (CTI) Technical Committee, an influential body in cybersecurity standards. Contributions to this repository are welcomed from all parties, whether affiliated with OASIS or not, under the BSD-3-Clause License. This open-source model fosters community involvement, ensuring the client remains robust, up-to-date, and responsive to the needs of the cybersecurity community. For those interested in contributing or providing feedback, GitHub issues and pull requests are the primary mechanisms, overseen by designated Maintainers.
Frequently Asked Questions (FAQs)
Q: Is there a command-line client for TAXII 2.X?
A: Currently, there is no standalone, dedicated command-line client provided by the cti-taxii-client project. The taxii2-client is designed and intended to be used as a Python library, which means you interact with TAXII servers by writing Python scripts that utilise the library's classes and methods. This approach offers greater flexibility for automation and integration into larger systems.
Q: What is TAXII and why is it important for cybersecurity?
A: TAXII stands for Trusted Automated eXchange of Indicator Information. It's an application-layer protocol that enables automated exchange of cyber threat intelligence (CTI) over HTTPS. It's crucial because it provides a standardised, machine-readable format for sharing threat indicators, attack patterns, malware, and other CTI data, allowing organisations to consume and act upon intelligence efficiently and at scale, improving their defensive posture.
Q: What is cti-taxii-client used for?
A: The cti-taxii-client is a Python library used for programmatic interaction with TAXII 2.X servers. Its primary uses include fetching STIX (Structured Threat Information Expression) objects from threat intelligence feeds, adding new STIX objects to collections for sharing, discovering server capabilities, and managing collection metadata. It's an essential tool for developers and security analysts looking to integrate TAXII feeds into their security operations, SIEMs, or custom applications.
Q: How do I install taxii2-client?
A: The easiest way to install the taxii2-client is by using Python's package installer, pip. Simply open your terminal or command prompt and run the command: pip install taxii2-client. Ensure you have Python and pip properly installed and configured on your system beforehand.
Q: Can I use cti-taxii-client with both TAXII 2.0 and 2.1 servers?
A: Yes, the cti-taxii-client supports both TAXII 2.0 and TAXII 2.1 specifications. By default, it imports the latest supported version (2.1). However, you can explicitly import classes from taxii2client.v20 or taxii2client.v21 if you need to ensure compatibility with a specific TAXII server version or to leverage version-specific features like object deletion or versioning in 2.1.
Q: How do I handle large datasets or many objects with cti-taxii-client?
A: For handling large datasets, the cti-taxii-client provides the as_pages helper function. This function automatically manages pagination when retrieving objects or manifests, fetching them in configurable chunks (e.g., 50 per request). This prevents memory overload and ensures efficient retrieval of extensive threat intelligence feeds. You would use it in a loop, as shown in the usage examples, to process data page by page.
Q: What are the main classes provided by the taxii2-client?
A: The library provides four core classes: Server, ApiRoot, Collection, and Status. The Server class represents a TAXII server, allowing discovery of API Roots. The ApiRoot class represents an API Root, providing access to collections. The Collection class represents a specific collection and is used for fetching, adding, or deleting STIX objects. The Status class is used to check the status of asynchronous operations.
Conclusion
While the immediate answer to 'Is there a command-line client for TAXII?' might be 'no' in the traditional sense, the cti-taxii-client Python library offers a far more powerful and flexible solution for interacting with TAXII 2.X servers. Its design caters to the sophisticated needs of modern threat intelligence operations, enabling seamless automation, deep integration, and customisable workflows. By embracing this programmatic approach, organisations can effectively leverage the wealth of threat information shared via TAXII, enhancing their cybersecurity defences and responsiveness. The ease of installation via pip and the comprehensive API make it an indispensable tool for anyone working with automated threat intelligence exchange.
If you want to read more articles similar to TAXII 2.X Client: CLI or Python Library?, you can visit the Taxis category.
