• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

docs/H10-Sep-2020-365172

taxii2client/H10-Sep-2020-4,0503,074

.gitignoreH A D10-Sep-20201.1 KiB9777

.isort.cfgH A D10-Sep-2020170 1110

.pre-commit-config.yamlH A D10-Sep-2020413 1615

.travis.ymlH A D10-Sep-2020284 1918

CONTRIBUTING.mdH A D10-Sep-20207 KiB4327

LICENSEH A D10-Sep-20201.5 KiB2822

MANIFEST.inH A D10-Sep-202074 43

README.rstH A D10-Sep-20209.1 KiB246190

setup.cfgH A D10-Sep-2020250 1811

setup.pyH A D10-Sep-20202.2 KiB7464

tox.iniH A D10-Sep-2020828 5243

README.rst

1|Build_Status| |Coverage| |Version|
2
3cti-taxii-client
4================
5
6NOTE: This is an `OASIS TC Open Repository
7<https://www.oasis-open.org/resources/open-repositories/>`_. See the
8`Governance`_ section for more information.
9
10cti-taxii-client is a minimal client implementation for the TAXII 2.X server.
11It supports the following TAXII 2.X API services:
12
13- Server Discovery
14- Get API Root Information
15- Get Status
16- Get Collections
17- Get a Collection
18- Get Objects
19- Add Objects
20- Get an Object
21- Delete an Object (2.1 only)
22- Get Object Manifests
23- Get Object Versions (2.1 only)
24
25Installation
26------------
27
28The easiest way to install the TAXII client is with pip
29
30.. code-block:: bash
31
32   $ pip install taxii2-client
33
34Usage
35-----
36
37The TAXII client is intended to be used as a Python library.  There are no
38command line clients at this time.
39
40``taxii2-client`` provides four classes:
41
42- ``Server``
43- ``ApiRoot``
44- ``Collection``
45- ``Status``
46
47Each can be instantiated by passing a `url`, and (optional) `user` and
48`password` arguments. The authorization information is stored in the instance,
49so it need not be supplied explicitly when requesting services. By default, the
50latest version of the supported spec will be imported. If you need a specific
51version you can perform the following:
52
53.. code-block:: python
54
55   from taxii2client.v21 import Server
56   server = Server('https://example.com/taxii2/', user='user_id', password='user_password')
57
58Once you have instantiated a ``Server`` object, you can get all metadata about
59its contents via its properties:
60
61.. code-block:: python
62
63   print(server.title)
64
65This will lazily load and cache the server's information in the instance:
66
67- ``api_roots``
68- ``title``
69- ``description``
70- ``default`` (i.e. the default API root)
71- ``contact``
72
73You can follow references to ``ApiRoot`` objects,
74``Collection`` objects, and (STIX) objects in those collections.
75
76.. code-block:: python
77
78   api_root = server.api_roots[0]
79   collection = api_root.collections[0]
80   collection.add_objects(stix_bundle)
81
82Each ``ApiRoot`` has attributes corresponding to its meta data
83
84- ``title``
85- ``description``
86- ``max_content_length``
87- ``collections``
88
89Each ``Collection`` has attributes corresponding to its meta data:
90
91- ``id``
92- ``title``
93- ``description``
94- ``alias`` (2.1 only)
95- ``can_write``
96- ``can_read``
97- ``media_types``
98
99A ``Collection`` can also be instantiated directly:
100
101.. code-block:: python
102
103    # Performing TAXII 2.0 Requests
104    from taxii2client.v20 import Collection, as_pages
105
106    collection = Collection('https://example.com/api1/collections/91a7b528-80eb-42ed-a74d-c6fbd5a26116')
107    collection.get_object('indicator--252c7c11-daf2-42bd-843b-be65edca9f61')
108
109    # For normal (no pagination) requests
110    collection.get_objects()
111    collection.get_manifest()
112
113    # For pagination requests.
114    for bundle in as_pages(collection.get_objects, per_request=50):
115        print(bundle)
116
117    for manifest_resource in as_pages(collection.get_manifest, per_request=50):
118        print(manifest_resource)
119
120    # ---------------------------------------------------------------- #
121    # Performing TAXII 2.1 Requests
122    from taxii2client.v21 import Collection
123
124    collection = Collection('https://example.com/api1/collections/91a7b528-80eb-42ed-a74d-c6fbd5a26116')
125    collection.get_object('indicator--252c7c11-daf2-42bd-843b-be65edca9f61')
126
127    # For normal (no pagination) requests
128    collection.get_objects()
129    collection.get_manifest()
130
131    # For pagination requests.
132    envelope = collection.get_objects(limit=50)
133    while envelope.get("more", False):
134        envelope = collection.get_objects(limit=50, next=envelope.get("next", ""))
135
136    envelope = collection.get_manifest(limit=50)
137    while envelope.get("more", False):
138        envelope = collection.get_manifest(limit=50, next=envelope.get("next", ""))
139
140In addition to the object-specific properties and methods, all classes have a
141``refresh()`` method that reloads the URL corresponding to that resource, to
142ensure properties have the most up-to-date values.
143
144Governance
145----------
146
147This GitHub public repository (
148**https://github.com/oasis-open/cti-taxii-client** ) was created at the request
149of the `OASIS Cyber Threat Intelligence (CTI) TC
150<https://www.oasis-open.org/committees/cti/>`__ as an `OASIS TC Open Repository
151<https://www.oasis-open.org/resources/open-repositories/>`__ to support
152development of open source resources related to Technical Committee work.
153
154While this TC Open Repository remains associated with the sponsor TC, its
155development priorities, leadership, intellectual property terms, participation
156rules, and other matters of governance are `separate and distinct
157<https://github.com/oasis-open/cti-taxii-client/blob/master/CONTRIBUTING.md#governance-distinct-from-oasis-tc-process>`__
158from the OASIS TC Process and related policies.
159
160All contributions made to this TC Open Repository are subject to open source
161license terms expressed in the `BSD-3-Clause License
162<https://www.oasis-open.org/sites/www.oasis-open.org/files/BSD-3-Clause.txt>`__.
163That license was selected as the declared `"Applicable License"
164<https://www.oasis-open.org/resources/open-repositories/licenses>`__ when the
165TC Open Repository was created.
166
167As documented in `"Public Participation Invited
168<https://github.com/oasis-open/cti-taxii-client/blob/master/CONTRIBUTING.md#public-participation-invited>`__",
169contributions to this OASIS TC Open Repository are invited from all parties,
170whether affiliated with OASIS or not. Participants must have a GitHub account,
171but no fees or OASIS membership obligations are required. Participation is
172expected to be consistent with the `OASIS TC Open Repository Guidelines and
173Procedures
174<https://www.oasis-open.org/policies-guidelines/open-repositories>`__, the open
175source `LICENSE
176<https://github.com/oasis-open/cti-taxii-client/blob/master/LICENSE>`__
177designated for this particular repository, and the requirement for an
178`Individual Contributor License Agreement
179<https://www.oasis-open.org/resources/open-repositories/cla/individual-cla>`__
180that governs intellectual property.
181
182Maintainers
183-----------
184
185TC Open Repository `Maintainers
186<https://www.oasis-open.org/resources/open-repositories/maintainers-guide>`__
187are responsible for oversight of this project's community development
188activities, including evaluation of GitHub `pull requests
189<https://github.com/oasis-open/cti-taxii-client/blob/master/CONTRIBUTING.md#fork-and-pull-collaboration-model>`__
190and `preserving
191<https://www.oasis-open.org/policies-guidelines/open-repositories#repositoryManagement>`__
192open source principles of openness and fairness. Maintainers are recognized and
193trusted experts who serve to implement community goals and consensus design
194preferences.
195
196Initially, the associated TC members have designated one or more persons to
197serve as Maintainer(s); subsequently, participating community members may select
198additional or substitute Maintainers, per `consensus agreements
199<https://www.oasis-open.org/resources/open-repositories/maintainers-guide#additionalMaintainers>`__.
200
201Current Maintainers of this TC Open Repository
202~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
203
204-  `Chris Lenk <mailto:clenk@mitre.org>`__; GitHub ID:
205   https://github.com/clenk/; WWW: `MITRE
206   Corporation <https://www.mitre.org/>`__
207-  `Rich Piazza <mailto:rpiazza@mitre.org>`__; GitHub ID:
208   https://github.com/rpiazza/; WWW: `MITRE
209   Corporation <https://www.mitre.org/>`__
210-  `Emmanuelle Vargas-Gonzalez <mailto:emmanuelle@mitre.org>`__; GitHub ID:
211   https://github.com/emmanvg/; WWW: `MITRE
212   Corporation <https://www.mitre.org/>`__
213-  `Jason Keirstead <mailto:Jason.Keirstead@ca.ibm.com>`__; GitHub ID:
214   https://github.com/JasonKeirstead; WWW: `IBM <http://www.ibm.com/>`__
215
216About OASIS TC Open Repositories
217--------------------------------
218
219-  `TC Open Repositories: Overview and
220   Resources <https://www.oasis-open.org/resources/open-repositories/>`__
221-  `Frequently Asked
222   Questions <https://www.oasis-open.org/resources/open-repositories/faq>`__
223-  `Open Source
224   Licenses <https://www.oasis-open.org/resources/open-repositories/licenses>`__
225-  `Contributor License Agreements
226   (CLAs) <https://www.oasis-open.org/resources/open-repositories/cla>`__
227-  `Maintainers' Guidelines and
228   Agreement <https://www.oasis-open.org/resources/open-repositories/maintainers-guide>`__
229
230Feedback
231--------
232
233Questions or comments about this TC Open Repository's activities should be composed
234as GitHub issues or comments. If use of an issue/comment is not possible or
235appropriate, questions may be directed by email to the Maintainer(s) `listed
236above <#currentMaintainers>`__. Please send general questions about Open
237Repository participation to OASIS Staff at repository-admin@oasis-open.org and
238any specific CLA-related questions to repository-cla@oasis-open.org.
239
240.. |Build_Status| image:: https://travis-ci.org/oasis-open/cti-taxii-client.svg?branch=master
241   :target: https://travis-ci.org/oasis-open/cti-taxii-client
242.. |Coverage| image:: https://codecov.io/gh/oasis-open/cti-taxii-client/branch/master/graph/badge.svg
243   :target: https://codecov.io/gh/oasis-open/cti-taxii-client
244.. |Version| image:: https://img.shields.io/pypi/v/taxii2-client.svg?maxAge=3600
245   :target: https://pypi.python.org/pypi/taxii2-client/
246