nrdax 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. nrdax-0.1.0/.gitignore +37 -0
  2. nrdax-0.1.0/CHANGELOG.md +53 -0
  3. nrdax-0.1.0/DATA_LICENSE.md +44 -0
  4. nrdax-0.1.0/LICENSE +177 -0
  5. nrdax-0.1.0/NOTICE +25 -0
  6. nrdax-0.1.0/PKG-INFO +229 -0
  7. nrdax-0.1.0/README.md +186 -0
  8. nrdax-0.1.0/docs/api.md +173 -0
  9. nrdax-0.1.0/docs/cli.md +263 -0
  10. nrdax-0.1.0/docs/data-model.md +146 -0
  11. nrdax-0.1.0/docs/guides/build-a-dataset.md +59 -0
  12. nrdax-0.1.0/docs/guides/compare-changes.md +67 -0
  13. nrdax-0.1.0/docs/guides/create-a-citation.md +43 -0
  14. nrdax-0.1.0/docs/guides/export-for-a-paper.md +55 -0
  15. nrdax-0.1.0/docs/guides/import-into-another-tool.md +56 -0
  16. nrdax-0.1.0/docs/guides/map-a-finding.md +59 -0
  17. nrdax-0.1.0/docs/guides/retrieve-by-implementation.md +59 -0
  18. nrdax-0.1.0/docs/guides/work-offline.md +69 -0
  19. nrdax-0.1.0/docs/index.md +50 -0
  20. nrdax-0.1.0/examples/01_quickstart.py +29 -0
  21. nrdax-0.1.0/examples/02_search_and_filter.py +32 -0
  22. nrdax-0.1.0/examples/03_export_subset.py +36 -0
  23. nrdax-0.1.0/examples/04_citations.py +24 -0
  24. nrdax-0.1.0/examples/05_stix_export.py +33 -0
  25. nrdax-0.1.0/examples/06_relationships_and_coverage.py +30 -0
  26. nrdax-0.1.0/examples/07_offline_pinned.py +35 -0
  27. nrdax-0.1.0/examples/README.md +22 -0
  28. nrdax-0.1.0/pyproject.toml +135 -0
  29. nrdax-0.1.0/src/nrdax/__init__.py +114 -0
  30. nrdax-0.1.0/src/nrdax/_version.py +10 -0
  31. nrdax-0.1.0/src/nrdax/cache.py +141 -0
  32. nrdax-0.1.0/src/nrdax/changes.py +137 -0
  33. nrdax-0.1.0/src/nrdax/citations.py +179 -0
  34. nrdax-0.1.0/src/nrdax/cli/__init__.py +0 -0
  35. nrdax-0.1.0/src/nrdax/cli/formatting.py +215 -0
  36. nrdax-0.1.0/src/nrdax/cli/main.py +643 -0
  37. nrdax-0.1.0/src/nrdax/coverage.py +53 -0
  38. nrdax-0.1.0/src/nrdax/data/snapshot/SNAPSHOT.md +20 -0
  39. nrdax-0.1.0/src/nrdax/data/snapshot/coverage-matrix.json +2832 -0
  40. nrdax-0.1.0/src/nrdax/data/snapshot/families.json +120 -0
  41. nrdax-0.1.0/src/nrdax/data/snapshot/index.json +387 -0
  42. nrdax-0.1.0/src/nrdax/data/snapshot/registry.jsonl +381 -0
  43. nrdax-0.1.0/src/nrdax/errors.py +114 -0
  44. nrdax-0.1.0/src/nrdax/exporters/__init__.py +52 -0
  45. nrdax-0.1.0/src/nrdax/exporters/_fields.py +85 -0
  46. nrdax-0.1.0/src/nrdax/exporters/csv_exporter.py +69 -0
  47. nrdax-0.1.0/src/nrdax/exporters/json_exporter.py +44 -0
  48. nrdax-0.1.0/src/nrdax/exporters/stix_exporter.py +162 -0
  49. nrdax-0.1.0/src/nrdax/models.py +416 -0
  50. nrdax-0.1.0/src/nrdax/py.typed +0 -0
  51. nrdax-0.1.0/src/nrdax/queries/__init__.py +8 -0
  52. nrdax-0.1.0/src/nrdax/queries/filters.py +145 -0
  53. nrdax-0.1.0/src/nrdax/queries/search.py +125 -0
  54. nrdax-0.1.0/src/nrdax/registry.py +278 -0
  55. nrdax-0.1.0/src/nrdax/relationships.py +106 -0
  56. nrdax-0.1.0/src/nrdax/sources/__init__.py +50 -0
  57. nrdax-0.1.0/src/nrdax/sources/_http.py +58 -0
  58. nrdax-0.1.0/src/nrdax/sources/api.py +96 -0
  59. nrdax-0.1.0/src/nrdax/sources/bundled.py +46 -0
  60. nrdax-0.1.0/src/nrdax/sources/feed.py +136 -0
  61. nrdax-0.1.0/src/nrdax/sources/file.py +77 -0
  62. nrdax-0.1.0/src/nrdax/sources/memory.py +43 -0
  63. nrdax-0.1.0/src/nrdax/sources/stix.py +111 -0
  64. nrdax-0.1.0/src/nrdax/vocab.py +113 -0
  65. nrdax-0.1.0/tests/__init__.py +0 -0
  66. nrdax-0.1.0/tests/conftest.py +65 -0
  67. nrdax-0.1.0/tests/fixtures/feed/coverage-matrix.json +34 -0
  68. nrdax-0.1.0/tests/fixtures/feed/families.json +120 -0
  69. nrdax-0.1.0/tests/fixtures/feed/index.json +10 -0
  70. nrdax-0.1.0/tests/fixtures/feed/registry.jsonl +3 -0
  71. nrdax-0.1.0/tests/fixtures/feed/stix.json +95 -0
  72. nrdax-0.1.0/tests/fixtures/feed/techniques/NRDAX-T0001.json +44 -0
  73. nrdax-0.1.0/tests/fixtures/feed/techniques/NRDAX-T0002.json +25 -0
  74. nrdax-0.1.0/tests/fixtures/feed/techniques/NRDAX-T0003.json +25 -0
  75. nrdax-0.1.0/tests/test_cache.py +54 -0
  76. nrdax-0.1.0/tests/test_changes.py +62 -0
  77. nrdax-0.1.0/tests/test_citations.py +70 -0
  78. nrdax-0.1.0/tests/test_cli.py +169 -0
  79. nrdax-0.1.0/tests/test_coverage.py +30 -0
  80. nrdax-0.1.0/tests/test_exporters.py +78 -0
  81. nrdax-0.1.0/tests/test_filters.py +87 -0
  82. nrdax-0.1.0/tests/test_integration.py +42 -0
  83. nrdax-0.1.0/tests/test_models.py +105 -0
  84. nrdax-0.1.0/tests/test_package.py +39 -0
  85. nrdax-0.1.0/tests/test_registry.py +83 -0
  86. nrdax-0.1.0/tests/test_relationships.py +64 -0
  87. nrdax-0.1.0/tests/test_search.py +79 -0
  88. nrdax-0.1.0/tests/test_sources.py +105 -0
  89. nrdax-0.1.0/tests/test_stix.py +54 -0
nrdax-0.1.0/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ wheelhouse/
9
+ .venv/
10
+ venv/
11
+ env/
12
+
13
+ # Tooling caches
14
+ .pytest_cache/
15
+ .mypy_cache/
16
+ .ruff_cache/
17
+ .coverage
18
+ .coverage.*
19
+ htmlcov/
20
+ coverage.xml
21
+ .tox/
22
+
23
+ # Docs build
24
+ site/
25
+
26
+ # Editors / OS
27
+ .idea/
28
+ .vscode/
29
+ *.swp
30
+ .DS_Store
31
+
32
+ # Local nrdax cache (never commit fetched snapshots)
33
+ .nrdax-cache/
34
+
35
+ # Dataset validation output is generated locally, not committed (assess separately)
36
+ VALIDATION_REPORT.md
37
+ VALIDATION_REPORT*.md
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ All notable changes to `nrdax-python` are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the package version
5
+ follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ Note: the *package* version tracked here is independent of the *NRDAX dataset*
8
+ version and the *NRDAX schema* version. See `docs/data-model.md` for the
9
+ compatibility policy.
10
+
11
+ ## [Unreleased]
12
+
13
+ ## [0.1.0] - 2026-07-13
14
+
15
+ First public release: the standard open-source Python interface to NRDAX.
16
+
17
+ ### Added
18
+
19
+ - **Library (`nrdax`)**: the `NRDAX` facade with `load`, `get`, `search`, `filter`,
20
+ `related`, `coverage`, `families`, `instances`, `by_reference`, and serialization
21
+ helpers. Typed dataclass models that mirror the canonical schema, preserve unknown
22
+ fields, and validate leniently (or strictly).
23
+ - **Data sources**: bundled snapshot (offline default), static feed (directory or
24
+ URL), live read API (`api.nrdax.com`), local file (`.jsonl` / bundle / single
25
+ technique), STIX 2.1 bundle, and in-memory.
26
+ - **CLI (`nrdax`)**: `search`, `get`, `list`, `related`, `export`, `cite`,
27
+ `changes`, `info`, `version`, `update`, `cache`, `schema`. Table / JSON / CSV /
28
+ STIX output where meaningful; stable exit codes and structured JSON errors.
29
+ - **Deterministic search**: weighted, explainable field matching (no network, no
30
+ LLM).
31
+ - **Exporters**: JSON and CSV (with field projection), and STIX 2.1 that is
32
+ **byte-identical** to the canonical NRDAX emitter (identity round-trips).
33
+ - **Citations**: text, Markdown, BibTeX, and CSL-JSON. Never fabricates a DOI.
34
+ - **Changes**: `--since` (from `first_seen`) and a real snapshot-diff engine.
35
+ - **Offline / cache**: `nrdax update` writes a snapshot; `nrdax cache info|clear`.
36
+ - **Bundled dataset snapshot**: NRDAX `v0.1-import` (381 techniques), captured
37
+ 2026-07-13, for zero-config offline use.
38
+ - Docs, runnable examples, a comprehensive test suite, CI, and release automation.
39
+
40
+ ### Known limitations (documented, not simulated)
41
+
42
+ - NRDAX has no `implementation` or `surface` field; `--implementation` and related
43
+ search are derived text heuristics.
44
+ - NRDAX has no asserted technique-to-technique relationships; `related` is derived
45
+ (shared family / chain / reference).
46
+ - No historical versioned releases are published yet, so cross-version `changes`
47
+ requires two snapshots you supply; `--from-version/--to-version` is not available.
48
+ - No DOI is minted upstream; citations omit it.
49
+ - The static feed is not yet hosted at a stable public URL, so `nrdax update`
50
+ fetches from the live API by default.
51
+
52
+ [Unreleased]: https://github.com/NullRabbitLabs/nrdax-python/compare/v0.1.0...HEAD
53
+ [0.1.0]: https://github.com/NullRabbitLabs/nrdax-python/releases/tag/v0.1.0
@@ -0,0 +1,44 @@
1
+ # NRDAX data licensing
2
+
3
+ **Short version:** the *code* in this repository is Apache-2.0 (see `LICENSE`). The
4
+ *NRDAX dataset* is a separate NullRabbit product with its own terms, which this
5
+ repository does not set and does not grant.
6
+
7
+ ## Why this file exists
8
+
9
+ `nrdax-python` is open-source tooling that reads the public NRDAX dataset. Two
10
+ different things are licensed differently:
11
+
12
+ | Thing | License | Set by |
13
+ | --- | --- | --- |
14
+ | This library and CLI (the Python source) | Apache-2.0 | this repository (`LICENSE`) |
15
+ | The NRDAX dataset (technique records, the bundled snapshot, API responses) | Determined by NullRabbit, separately | NullRabbit Labs |
16
+
17
+ The bundled snapshot in `src/nrdax/data/snapshot/` is included purely as a
18
+ convenience for offline and reproducible use. Its presence in an Apache-2.0 code
19
+ repository does **not** place the NRDAX data under Apache-2.0.
20
+
21
+ ## Known limitation (please read)
22
+
23
+ At the time of writing, NullRabbit has **not published an explicit public license
24
+ for the NRDAX dataset**, and the sibling NullRabbit source repositories are marked
25
+ `UNLICENSED`. This tool therefore makes no claim about how you may redistribute or
26
+ reuse the *data*. If you intend to redistribute NRDAX records, build a derived
27
+ dataset, or use the data commercially, confirm the dataset terms with NullRabbit
28
+ first.
29
+
30
+ Maintainers: this ambiguity should be resolved by publishing a clear dataset
31
+ license (for example CC-BY-4.0 for attribution-required reuse) before the dataset
32
+ is widely redistributed. Until then, treat the data as "all rights reserved by
33
+ NullRabbit unless stated otherwise."
34
+
35
+ ## Citation
36
+
37
+ Whatever the eventual data license, please cite NRDAX records you rely on. The CLI
38
+ generates citations (`nrdax cite <id> --format bibtex|markdown|json`) using the
39
+ canonical URL and the dataset version. No DOI is minted yet, so citations omit it
40
+ rather than inventing one.
41
+
42
+ ## Contact
43
+
44
+ Questions about dataset licensing: opensource@nullrabbit.ai / https://nullrabbit.ai.
nrdax-0.1.0/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
nrdax-0.1.0/NOTICE ADDED
@@ -0,0 +1,25 @@
1
+ nrdax-python
2
+ Copyright 2026 NullRabbit Labs
3
+
4
+ This product includes software developed at NullRabbit Labs (https://nullrabbit.ai).
5
+
6
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
7
+ this software except in compliance with the License. You may obtain a copy of the
8
+ License in the accompanying LICENSE file or at
9
+ http://www.apache.org/licenses/LICENSE-2.0.
10
+
11
+ ---------------------------------------------------------------------------------
12
+ Data licensing (separate from this source code)
13
+ ---------------------------------------------------------------------------------
14
+
15
+ The Apache-2.0 license above covers the SOURCE CODE of this library and CLI only.
16
+
17
+ NRDAX (the NullRabbit Decentralised Attack indeX) is a NullRabbit product. The
18
+ NRDAX dataset - including the technique records distributed as a convenience
19
+ snapshot in `src/nrdax/data/snapshot/` and any data retrieved from NRDAX services -
20
+ is NOT licensed under Apache-2.0 and its terms are determined separately by
21
+ NullRabbit. Installing or using this tool grants no rights to the NRDAX dataset.
22
+ See DATA_LICENSE.md.
23
+
24
+ "NRDAX", "NullRabbit", and related names and logos are trademarks of NullRabbit
25
+ Labs. Trademark rights are not granted by the source-code license.
nrdax-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,229 @@
1
+ Metadata-Version: 2.4
2
+ Name: nrdax
3
+ Version: 0.1.0
4
+ Summary: Programmatic and command-line access to NRDAX, the NullRabbit Decentralised Attack indeX.
5
+ Project-URL: Homepage, https://nrdax.com
6
+ Project-URL: Documentation, https://github.com/NullRabbitLabs/nrdax-python/tree/main/docs
7
+ Project-URL: Repository, https://github.com/NullRabbitLabs/nrdax-python
8
+ Project-URL: Issues, https://github.com/NullRabbitLabs/nrdax-python/issues
9
+ Project-URL: Changelog, https://github.com/NullRabbitLabs/nrdax-python/blob/main/CHANGELOG.md
10
+ Author-email: NullRabbit Labs <opensource@nullrabbit.ai>
11
+ Maintainer-email: NullRabbit Labs <opensource@nullrabbit.ai>
12
+ License-Expression: Apache-2.0
13
+ License-File: LICENSE
14
+ License-File: NOTICE
15
+ Keywords: attack-techniques,blockchain,decentralised-infrastructure,nrdax,nullrabbit,security,stix,threat-intelligence
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Intended Audience :: Information Technology
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: License :: OSI Approved :: Apache Software License
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Topic :: Security
27
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
28
+ Classifier: Typing :: Typed
29
+ Requires-Python: >=3.10
30
+ Provides-Extra: dev
31
+ Requires-Dist: build>=1.2; extra == 'dev'
32
+ Requires-Dist: mypy>=1.10; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=5; extra == 'dev'
34
+ Requires-Dist: pytest>=8; extra == 'dev'
35
+ Requires-Dist: ruff>=0.5; extra == 'dev'
36
+ Requires-Dist: twine>=5; extra == 'dev'
37
+ Provides-Extra: docs
38
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
39
+ Requires-Dist: mkdocs>=1.6; extra == 'docs'
40
+ Provides-Extra: stix
41
+ Requires-Dist: stix2>=3.0; extra == 'stix'
42
+ Description-Content-Type: text/markdown
43
+
44
+ # nrdax-python
45
+
46
+ **Programmatic and command-line access to NRDAX - the NullRabbit Decentralised
47
+ Attack indeX.**
48
+
49
+ [![CI](https://github.com/NullRabbitLabs/nrdax-python/actions/workflows/ci.yml/badge.svg)](https://github.com/NullRabbitLabs/nrdax-python/actions/workflows/ci.yml)
50
+ [![PyPI](https://img.shields.io/pypi/v/nrdax.svg)](https://pypi.org/project/nrdax/)
51
+ [![Python](https://img.shields.io/pypi/pyversions/nrdax.svg)](https://pypi.org/project/nrdax/)
52
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
53
+
54
+ `nrdax` is the standard open-source Python interface to NRDAX. If you have used
55
+ MITRE's `mitreattack-python`, this will feel familiar - but it is designed for the
56
+ NRDAX schema and semantics, not forced into an ATT&CK model.
57
+
58
+ - **Reusable library** with typed models and a small, predictable API.
59
+ - **Practical CLI** (`nrdax`) for search, retrieval, filtering, relationships,
60
+ export, citation, change inspection, and offline use.
61
+ - **Zero required runtime dependencies** - the core library and CLI use only the
62
+ Python standard library, so it installs cleanly and starts fast.
63
+ - **Works offline out of the box** via a bundled dataset snapshot; refresh to the
64
+ live data when you want it.
65
+
66
+ ## What is NRDAX?
67
+
68
+ NRDAX is NullRabbit's canonical, chain-agnostic registry of **techniques for attacks
69
+ on decentralised infrastructure** - validators, nodes, RPC services, networking and
70
+ gossip layers, consensus implementations, and related systems. Each technique has a
71
+ permanent id (`NRDAX-Tnnnn`), a mechanism description, a family, and evidence in the
72
+ form of chain-specific *instances*, plus links to advisories, CVEs, and research.
73
+
74
+ The public website (https://nrdax.com) is for human exploration. This package is for
75
+ **machines and researchers**: retrieve, search, filter, compare, cite, export, and
76
+ monitor NRDAX data programmatically.
77
+
78
+ ## Install
79
+
80
+ ```bash
81
+ pip install nrdax
82
+ ```
83
+
84
+ Development version:
85
+
86
+ ```bash
87
+ git clone https://github.com/NullRabbitLabs/nrdax-python
88
+ cd nrdax-python
89
+ pip install -e ".[dev]"
90
+ ```
91
+
92
+ Python 3.10+ is supported.
93
+
94
+ ## Quick start (CLI)
95
+
96
+ ```bash
97
+ pip install nrdax
98
+ nrdax update # fetch the latest dataset into the cache
99
+ nrdax search "rpc resource exhaustion"
100
+ nrdax get NRDAX-T0006
101
+ nrdax related NRDAX-T0006
102
+ nrdax cite NRDAX-T0006 --format bibtex
103
+ nrdax export --implementation agave --format json --output agave-attacks.json
104
+ ```
105
+
106
+ Every command works offline against the bundled snapshot even before you run
107
+ `nrdax update`.
108
+
109
+ ## Quick start (Python)
110
+
111
+ ```python
112
+ from nrdax import NRDAX
113
+
114
+ registry = NRDAX.load() # bundled snapshot, offline, zero-config
115
+ technique = registry.get("NRDAX-T0006")
116
+ print(technique.display, technique.family, technique.chains)
117
+
118
+ results = registry.search("rpc exhaustion")
119
+ for r in results[:5]:
120
+ print(r.score, r.technique.id, r.technique.display)
121
+
122
+ related = registry.related("NRDAX-T0006") # derived: family, chain, shared refs
123
+ coverage = registry.coverage # technique x chain matrix
124
+ ```
125
+
126
+ ## Core CLI commands
127
+
128
+ | Command | Purpose |
129
+ | --- | --- |
130
+ | `nrdax search <query>` | Deterministic, explainable search across id/name/mechanism/chain/family/reference. |
131
+ | `nrdax get <id>` | One technique with instances, references, provenance (table / JSON / STIX). |
132
+ | `nrdax list [filters]` | Filter and list techniques (composable filters). |
133
+ | `nrdax related <id>` | Derived relationships (family siblings, shared chains, shared references). |
134
+ | `nrdax export [filters]` | Export a subset as JSON, CSV, or STIX 2.1. |
135
+ | `nrdax cite <id>` | Citation in text, Markdown, BibTeX, or CSL-JSON. |
136
+ | `nrdax changes` | Techniques since a date, or a diff between two dataset snapshots. |
137
+ | `nrdax info` | Dataset, source, and cache information. |
138
+ | `nrdax version` | CLI, library, and schema versions. |
139
+ | `nrdax update` | Fetch the latest dataset into the local cache. |
140
+ | `nrdax cache info|clear` | Inspect or clear the offline cache. |
141
+ | `nrdax schema` | The NRDAX vocabularies and field set. |
142
+
143
+ Full reference: [`docs/cli.md`](docs/cli.md).
144
+
145
+ ## Supported data sources
146
+
147
+ Domain operations are independent of where the data came from. Select a source with
148
+ `--source` (CLI) or a classmethod (library):
149
+
150
+ | Source | CLI | Library | Notes |
151
+ | --- | --- | --- | --- |
152
+ | Bundled snapshot | `--source bundled` | `NRDAX.bundled()` | Ships with the package; offline default. |
153
+ | Local cache | `--source cache` | `NRDAX.from_cache()` | Written by `nrdax update`. |
154
+ | Live API | `--source api[:URL]` | `NRDAX.from_api()` | `https://api.nrdax.com`. |
155
+ | Static feed | `--source feed:LOC` | `NRDAX.from_feed(loc)` | A directory or base URL of feed files. |
156
+ | Local file | `--source file:PATH` | `NRDAX.from_file(path)` | `registry.jsonl`, a bundle, or one technique. |
157
+ | STIX bundle | `--source stix:PATH` | `NRDAX.from_stix(path=...)` | Parses NRDAX STIX (lossy; see data-model). |
158
+ | In-memory | - | `NRDAX.from_memory([...])` | For tests and scripting. |
159
+
160
+ With no `--source`, the CLI uses the cached snapshot if present, otherwise the
161
+ bundled one. `nrdax info` always shows which source and version you are using.
162
+
163
+ ## Output formats
164
+
165
+ - **Terminal** tables and detail views (default).
166
+ - **JSON** (`--format json`) with stable field names.
167
+ - **CSV** (`--format csv`) where tabular output is meaningful.
168
+ - **STIX 2.1** (`--format stix`) for supported exports - byte-identical to the
169
+ canonical NRDAX emitter, so identities round-trip.
170
+
171
+ ## Versioning
172
+
173
+ Four versions are tracked independently:
174
+
175
+ - **Package version** (this repo, e.g. `0.1.0`).
176
+ - **CLI version** (equals the package version).
177
+ - **Dataset version** (from the loaded data, e.g. `v0.1-import`).
178
+ - **Schema version** (the NRDAX contract this client targets, e.g. `1.4`).
179
+
180
+ A package release does not imply the dataset changed, and vice versa. Pin an exact
181
+ dataset for reproducible research by keeping a feed snapshot and loading it with
182
+ `--source feed:/path`. See [`docs/data-model.md`](docs/data-model.md).
183
+
184
+ ## Honest limitations
185
+
186
+ This client never invents fields or fabricates data. Where NRDAX lacks a capability,
187
+ the limitation is isolated and documented:
188
+
189
+ - No `implementation` or `surface` field exists in NRDAX; `--implementation` and
190
+ surface search are **derived text heuristics**, clearly labelled as such.
191
+ - No asserted technique-to-technique relationships exist; `related` returns
192
+ **derived** links (shared family / chain / reference).
193
+ - No DOI is minted yet; citations omit it rather than inventing one.
194
+ - No historical versioned releases are published; cross-version `changes` needs two
195
+ snapshots you supply (`--from`/`--to`). `--since` works from `first_seen`.
196
+ - The static feed is not yet hosted at a stable public URL, so `nrdax update` pulls
197
+ from the live API by default.
198
+
199
+ You can validate any dataset yourself: loading reports schema and integrity issues
200
+ (`nrdax info` shows the count, `--strict` fails on the first), so problems in the
201
+ underlying data can be found and corrected separately - the client never fabricates
202
+ or silently normalises data.
203
+
204
+ ## Documentation
205
+
206
+ - [CLI reference](docs/cli.md)
207
+ - [Python API reference](docs/api.md)
208
+ - [Data-model guide](docs/data-model.md)
209
+ - Task guides: [`docs/guides/`](docs/guides/) - map a finding, retrieve by
210
+ implementation, build a research dataset, export for a paper, cite, compare
211
+ changes, import into another tool, work offline.
212
+ - Runnable [examples](examples/).
213
+
214
+ ## Contributing
215
+
216
+ See [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md), and
217
+ [GOVERNANCE.md](GOVERNANCE.md). Security issues: [SECURITY.md](SECURITY.md).
218
+
219
+ ## License
220
+
221
+ The **source code** in this repository is licensed under **Apache-2.0** (see
222
+ [LICENSE](LICENSE)).
223
+
224
+ The **NRDAX dataset** - including the bundled snapshot and any data retrieved from
225
+ NRDAX services - is a separate NullRabbit product with its own terms; this tool
226
+ grants no rights to the data. See [DATA_LICENSE.md](DATA_LICENSE.md) and
227
+ [NOTICE](NOTICE). "NRDAX" and "NullRabbit" are trademarks of NullRabbit Labs.
228
+
229
+ Maintained by [NullRabbit Labs](https://nullrabbit.ai).