tanuki-ad 2.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 (51) hide show
  1. tanuki_ad-2.1.0/LICENSE +9 -0
  2. tanuki_ad-2.1.0/LICENSE-APACHE +176 -0
  3. tanuki_ad-2.1.0/LICENSE-MIT +21 -0
  4. tanuki_ad-2.1.0/PKG-INFO +191 -0
  5. tanuki_ad-2.1.0/README.md +163 -0
  6. tanuki_ad-2.1.0/pyproject.toml +42 -0
  7. tanuki_ad-2.1.0/setup.cfg +4 -0
  8. tanuki_ad-2.1.0/tanuki/__init__.py +44 -0
  9. tanuki_ad-2.1.0/tanuki/__main__.py +6 -0
  10. tanuki_ad-2.1.0/tanuki/adcs.py +578 -0
  11. tanuki_ad-2.1.0/tanuki/auth.py +1457 -0
  12. tanuki_ad-2.1.0/tanuki/blast.py +745 -0
  13. tanuki_ad-2.1.0/tanuki/cli.py +1979 -0
  14. tanuki_ad-2.1.0/tanuki/config.py +387 -0
  15. tanuki_ad-2.1.0/tanuki/doctor.py +1492 -0
  16. tanuki_ad-2.1.0/tanuki/fix.py +427 -0
  17. tanuki_ad-2.1.0/tanuki/kcm.py +408 -0
  18. tanuki_ad-2.1.0/tanuki/keytab.py +162 -0
  19. tanuki_ad-2.1.0/tanuki/ldap.py +887 -0
  20. tanuki_ad-2.1.0/tanuki/nhi.py +950 -0
  21. tanuki_ad-2.1.0/tanuki/pac.py +850 -0
  22. tanuki_ad-2.1.0/tanuki/protocol.py +307 -0
  23. tanuki_ad-2.1.0/tanuki/purge.py +291 -0
  24. tanuki_ad-2.1.0/tanuki/shadow.py +337 -0
  25. tanuki_ad-2.1.0/tanuki/telemetry.py +782 -0
  26. tanuki_ad-2.1.0/tanuki_ad.egg-info/PKG-INFO +191 -0
  27. tanuki_ad-2.1.0/tanuki_ad.egg-info/SOURCES.txt +49 -0
  28. tanuki_ad-2.1.0/tanuki_ad.egg-info/dependency_links.txt +1 -0
  29. tanuki_ad-2.1.0/tanuki_ad.egg-info/entry_points.txt +2 -0
  30. tanuki_ad-2.1.0/tanuki_ad.egg-info/top_level.txt +1 -0
  31. tanuki_ad-2.1.0/tests/test_adcs.py +275 -0
  32. tanuki_ad-2.1.0/tests/test_audit_fixes_14.py +1520 -0
  33. tanuki_ad-2.1.0/tests/test_auth.py +287 -0
  34. tanuki_ad-2.1.0/tests/test_blast.py +272 -0
  35. tanuki_ad-2.1.0/tests/test_config.py +566 -0
  36. tanuki_ad-2.1.0/tests/test_doctor.py +738 -0
  37. tanuki_ad-2.1.0/tests/test_fix.py +344 -0
  38. tanuki_ad-2.1.0/tests/test_kcm_parser.py +221 -0
  39. tanuki_ad-2.1.0/tests/test_keytab_inspector.py +269 -0
  40. tanuki_ad-2.1.0/tests/test_ldap.py +323 -0
  41. tanuki_ad-2.1.0/tests/test_live_investigation.py +473 -0
  42. tanuki_ad-2.1.0/tests/test_mesh.py +91 -0
  43. tanuki_ad-2.1.0/tests/test_nhi.py +446 -0
  44. tanuki_ad-2.1.0/tests/test_pac.py +252 -0
  45. tanuki_ad-2.1.0/tests/test_purge.py +175 -0
  46. tanuki_ad-2.1.0/tests/test_rust_compatibility.py +235 -0
  47. tanuki_ad-2.1.0/tests/test_security_audit.py +370 -0
  48. tanuki_ad-2.1.0/tests/test_shadow.py +200 -0
  49. tanuki_ad-2.1.0/tests/test_telemetry.py +360 -0
  50. tanuki_ad-2.1.0/tests/test_tgs.py +217 -0
  51. tanuki_ad-2.1.0/tests/test_unified_cli.py +305 -0
@@ -0,0 +1,9 @@
1
+ Tanuki Dual License
2
+
3
+ Tanuki is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
4
+
5
+ Users and contributors may choose to use this software under either:
6
+ - The MIT License (see LICENSE-MIT or https://opensource.org/licenses/MIT)
7
+ - The Apache License, Version 2.0 (see LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
8
+
9
+ Copyright (c) 2026 Mafifrizi <hazama3321@gmail.com>
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or exemplary damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mafifrizi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.4
2
+ Name: tanuki-ad
3
+ Version: 2.1.0
4
+ Summary: Deterministic Linux Active Directory & Kerberos Protocol Triage Engine
5
+ Author-email: Mafifrizi <hazama3321@gmail.com>
6
+ License-Expression: MIT OR Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Mafifrizi/tanuki
8
+ Project-URL: Repository, https://github.com/Mafifrizi/tanuki.git
9
+ Project-URL: Issues, https://github.com/Mafifrizi/tanuki/issues
10
+ Keywords: kerberos,keytab,active-directory,sssd,security,triage,identity,nhi
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Rust
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Topic :: System :: Systems Administration :: Authentication/Directory
21
+ Classifier: Topic :: Security
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ License-File: LICENSE-APACHE
26
+ License-File: LICENSE-MIT
27
+ Dynamic: license-file
28
+
29
+ <p align="center">
30
+ <picture>
31
+ <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.png">
32
+ <img src="assets/logo.png" alt="Tanuki Logo" width="220">
33
+ </picture>
34
+ </p>
35
+
36
+ <h1 align="center">Tanuki</h1>
37
+
38
+ <p align="center">
39
+ <strong>Non-Human Identity & Hybrid Active Directory Operator for Linux Workloads</strong><br>
40
+ <em>Protocol-first, zero root privileges, zero host configuration footprint, zero noise.</em>
41
+ </p>
42
+
43
+ <p align="center">
44
+ <img src="https://img.shields.io/badge/version-2.1.0-blue.svg" alt="Version 2.1.0">
45
+ <img src="https://img.shields.io/badge/rust-1.75+%20(1.8MB%20musl)-dea584.svg?logo=rust&logoColor=white" alt="Rust Systems Core">
46
+ <img src="https://img.shields.io/badge/python-3.10+%20(zero--dep)-3776ab.svg?logo=python&logoColor=white" alt="Python Reference Engine">
47
+ <img src="https://img.shields.io/badge/standards-RFC_4120%20%7C%20RFC_8693-orange.svg" alt="RFC Standards">
48
+ <img src="https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg" alt="License: MIT OR Apache-2.0">
49
+ </p>
50
+
51
+ <p align="center">
52
+ <a href="#overview">Overview</a> &bull;
53
+ <a href="#quick-start">Quick Start</a> &bull;
54
+ <a href="#commands">Commands</a> &bull;
55
+ <a href="docs/ARCHITECTURE.md">Architecture</a> &bull;
56
+ <a href="docs/VALIDATION.md">Validation</a> &bull;
57
+ <a href="#lineage--credits">Lineage & Credits</a>
58
+ </p>
59
+
60
+ ---
61
+
62
+ ## Overview
63
+
64
+ Modern cloud-native and on-premise environments increasingly run Linux workloads (Kubernetes pods, AI coding agents, CI/CD runners, containerized batch workers) that must authenticate to enterprise Active Directory domains without a full domain join, Kerberos daemons (`sssd` / `winbind`), or root privileges.
65
+
66
+ Tanuki is a protocol-first Active Directory operator built for unprivileged Linux userspace. It runs the full Purple Team lifecycle under human-in-the-loop control: pre-flight triage, cryptographic ticket negotiation, quantitative privilege tiering, closed-loop self-healing, and forensic audit telemetry. It is also agent-operable, exposing a structured skill manifest so tools like Claude Code, Cursor, and Google Antigravity can drive it one deterministic step at a time.
67
+
68
+ **Highlights:**
69
+
70
+ - **Living off the domain.** The Python engine uses only the 3.10+ standard library. Zero pip dependencies. The Rust core is a 1.8 MB static binary built with `#![forbid(unsafe_code)]`.
71
+ - **Strictly unprivileged (UID 1000).** No `sudo`, no root, no `CAP_SYS_TIME`, and no mutation of `/etc/krb5.conf` or system files.
72
+ - **Quantitative blast radius.** Scores identity risk (0-100), classifies Active Directory tiers, and emits deterministic PowerShell remediation recipes.
73
+ - **Deterministic and auditable.** Military-brief output, semantic exit codes, and in-memory clock skew healing clamped to the Kerberos standard 300 second maximum.
74
+
75
+ For the full engine comparison and subsystem map, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
76
+
77
+ <p align="center">
78
+ <img src="assets/04_tanuki_blast_radius.png" alt="Tanuki blast radius and privilege tiering" width="850">
79
+ </p>
80
+
81
+ ---
82
+
83
+ ## Quick Start
84
+
85
+ ### 1-line universal install
86
+
87
+ ```bash
88
+ # Detects the Rust musl binary or falls back to the Python standard engine
89
+ curl -sSfL https://raw.githubusercontent.com/Mafifrizi/tanuki/main/install.sh | bash
90
+ ```
91
+
92
+ ### Manual installation
93
+
94
+ ```bash
95
+ # Rust systems core
96
+ cargo install --path crates/tanuki-cli
97
+
98
+ # Python reference engine
99
+ pipx install git+https://github.com/Mafifrizi/tanuki.git
100
+ ```
101
+
102
+ ### Zero-install direct execution
103
+
104
+ ```bash
105
+ git clone https://github.com/Mafifrizi/tanuki.git
106
+ cd tanuki
107
+ python3 -m tanuki doctor --json
108
+ ```
109
+
110
+ ---
111
+
112
+ ## Commands
113
+
114
+ Both engines share the same command surface and flags. Full usage, every flag, and verified LDAPS examples are in [docs/USAGE.md](docs/USAGE.md).
115
+
116
+ | Command | Purpose |
117
+ | :--- | :--- |
118
+ | `tanuki doctor` | Pre-flight diagnostics across domain config, credentials, network, and OPSEC telemetry |
119
+ | `tanuki auth` | Unprivileged userspace TGT acquisition with in-memory clock skew healing |
120
+ | `tanuki tgs` | Kerberos service ticket acquisition for a target SPN |
121
+ | `tanuki blast` | Quantitative blast radius scoring, privilege tiering, and PowerShell remediation recipes |
122
+ | `tanuki ldap` | Unprivileged LDAP recon (`--query spn \| asreproast \| rbcd \| shadow \| unconstrained \| all`) |
123
+ | `tanuki adcs` | Passive AD CS template scanner for ESC1 through ESC11 |
124
+ | `tanuki config` | Zero-DNS unprivileged `krb5.conf` generator targeting the KDC by IP |
125
+ | `tanuki fix` | Idempotent closed-loop remediation (`--dry-run` to preview) |
126
+ | `tanuki purge` | NIST SP 800-88 cryptographic memory and credential-cache zeroization |
127
+ | `tanuki skill` | Export the agent skill manifest (`--json` for machine-actionable schema) |
128
+
129
+ Add `--json` to any command for structured output. Run `tanuki -i` for the interactive wizard.
130
+
131
+ ### The decision ladder
132
+
133
+ Tanuki follows a fixed 5-rung tactical decision ladder to prevent privilege escalation loops, reduce authentication noise, and keep every action forensically defensible. The model is documented in [references/tactical_ladder.md](references/tactical_ladder.md).
134
+
135
+ | Rung | Action | Description |
136
+ | :---: | :--- | :--- |
137
+ | **0** | `DIAGNOSE` | Pre-flight audit of credentials, enctypes, and network paths |
138
+ | **1** | `AUTHENTICATE` | Userspace AS-REQ TGT negotiation with clock skew tolerance |
139
+ | **2** | `AUTHORIZE` | TGS service ticket acquisition for verified SPN endpoints |
140
+ | **3** | `ASSESS` | Quantitative blast radius calculation and tier scoring |
141
+ | **4** | `PURGE` | Cryptographic memory zeroization (NIST SP 800-88) |
142
+
143
+ ---
144
+
145
+ ## Validation
146
+
147
+ Tanuki is validated against live hybrid infrastructure: an unprivileged Kali workstation (UID 1000) connecting directly to a Windows Server 2022 Domain Controller (`DC01.lab.local`), proving each rung end to end through to Blue Team forensic telemetry on the DC. It also ships 500+ Python unit tests and 39 Rust tests (library plus integration), all green.
148
+
149
+ See the full milestone walkthrough with terminal proofs in [docs/VALIDATION.md](docs/VALIDATION.md).
150
+
151
+ ---
152
+
153
+ ## Lineage & Credits
154
+
155
+ Tanuki is engineered by **Muhammad Afif Rizi** ([@Mafifrizi](https://github.com/Mafifrizi)) and **Muhamad Dian Alvito**.
156
+
157
+ Tanuki draws inspiration and tradecraft from two foundational projects:
158
+
159
+ - **Tim Brown ([@timb-machine](https://github.com/timb-machine))**: Created [Linikatz](https://github.com/CiscoCXSecurity/linikatz) and pioneered Linux Active Directory assessment techniques, keytab analysis, and credential cache harvesting.
160
+ - **Dietrich Gebert ([@dietrichayala](https://github.com/dietrichayala))**: Created [Ponytail](https://github.com/DietrichGebert/ponytail) and demonstrated how a disciplined decision ladder prevents AI agent hallucination and conversational bloat.
161
+
162
+ ### Technical Specifications Implemented
163
+
164
+ - **[RFC 4120]**: The Kerberos Network Authentication Service (V5)
165
+ - **[RFC 4511]**: Lightweight Directory Access Protocol (LDAP): The Protocol
166
+ - **[RFC 8693]**: OAuth 2.0 Token Exchange
167
+ - **[MS-KILE]**: Kerberos Protocol Extensions
168
+ - **[MS-PAC]**: Privilege Attribute Certificate Data Structure
169
+ - **[MS-DTYP]**: Windows Data Types & Security Descriptor Structures
170
+ - **[NIST SP 800-88]**: Guidelines for Media Sanitization (Rev. 1)
171
+
172
+ ---
173
+
174
+ ## Contributing
175
+
176
+ We welcome contributions from protocol researchers, systems engineers, and toolmakers. Tanuki enforces two hard invariants: zero external dependencies in the Python core, and `#![forbid(unsafe_code)]` in the Rust core.
177
+
178
+ - **Developer guide**: see [`CONTRIBUTING.md`](CONTRIBUTING.md) for local setup, testing commands, and PR guidelines.
179
+ - **Good first issues**: shell autocompletion (`bash` / `zsh` / `fish`), error dictionary expansion in `tanuki triage`, and SARIF or Markdown export formatters.
180
+ - **Reporting issues**: use the structured [issue templates](https://github.com/Mafifrizi/tanuki/issues/new/choose).
181
+
182
+ ---
183
+
184
+ ## License
185
+
186
+ Tanuki is dual-licensed under either:
187
+
188
+ - **MIT License** ([`LICENSE-MIT`](LICENSE-MIT) or http://opensource.org/licenses/MIT)
189
+ - **Apache License, Version 2.0** ([`LICENSE-APACHE`](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
190
+
191
+ You may choose either license.
@@ -0,0 +1,163 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.png">
4
+ <img src="assets/logo.png" alt="Tanuki Logo" width="220">
5
+ </picture>
6
+ </p>
7
+
8
+ <h1 align="center">Tanuki</h1>
9
+
10
+ <p align="center">
11
+ <strong>Non-Human Identity & Hybrid Active Directory Operator for Linux Workloads</strong><br>
12
+ <em>Protocol-first, zero root privileges, zero host configuration footprint, zero noise.</em>
13
+ </p>
14
+
15
+ <p align="center">
16
+ <img src="https://img.shields.io/badge/version-2.1.0-blue.svg" alt="Version 2.1.0">
17
+ <img src="https://img.shields.io/badge/rust-1.75+%20(1.8MB%20musl)-dea584.svg?logo=rust&logoColor=white" alt="Rust Systems Core">
18
+ <img src="https://img.shields.io/badge/python-3.10+%20(zero--dep)-3776ab.svg?logo=python&logoColor=white" alt="Python Reference Engine">
19
+ <img src="https://img.shields.io/badge/standards-RFC_4120%20%7C%20RFC_8693-orange.svg" alt="RFC Standards">
20
+ <img src="https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue.svg" alt="License: MIT OR Apache-2.0">
21
+ </p>
22
+
23
+ <p align="center">
24
+ <a href="#overview">Overview</a> &bull;
25
+ <a href="#quick-start">Quick Start</a> &bull;
26
+ <a href="#commands">Commands</a> &bull;
27
+ <a href="docs/ARCHITECTURE.md">Architecture</a> &bull;
28
+ <a href="docs/VALIDATION.md">Validation</a> &bull;
29
+ <a href="#lineage--credits">Lineage & Credits</a>
30
+ </p>
31
+
32
+ ---
33
+
34
+ ## Overview
35
+
36
+ Modern cloud-native and on-premise environments increasingly run Linux workloads (Kubernetes pods, AI coding agents, CI/CD runners, containerized batch workers) that must authenticate to enterprise Active Directory domains without a full domain join, Kerberos daemons (`sssd` / `winbind`), or root privileges.
37
+
38
+ Tanuki is a protocol-first Active Directory operator built for unprivileged Linux userspace. It runs the full Purple Team lifecycle under human-in-the-loop control: pre-flight triage, cryptographic ticket negotiation, quantitative privilege tiering, closed-loop self-healing, and forensic audit telemetry. It is also agent-operable, exposing a structured skill manifest so tools like Claude Code, Cursor, and Google Antigravity can drive it one deterministic step at a time.
39
+
40
+ **Highlights:**
41
+
42
+ - **Living off the domain.** The Python engine uses only the 3.10+ standard library. Zero pip dependencies. The Rust core is a 1.8 MB static binary built with `#![forbid(unsafe_code)]`.
43
+ - **Strictly unprivileged (UID 1000).** No `sudo`, no root, no `CAP_SYS_TIME`, and no mutation of `/etc/krb5.conf` or system files.
44
+ - **Quantitative blast radius.** Scores identity risk (0-100), classifies Active Directory tiers, and emits deterministic PowerShell remediation recipes.
45
+ - **Deterministic and auditable.** Military-brief output, semantic exit codes, and in-memory clock skew healing clamped to the Kerberos standard 300 second maximum.
46
+
47
+ For the full engine comparison and subsystem map, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
48
+
49
+ <p align="center">
50
+ <img src="assets/04_tanuki_blast_radius.png" alt="Tanuki blast radius and privilege tiering" width="850">
51
+ </p>
52
+
53
+ ---
54
+
55
+ ## Quick Start
56
+
57
+ ### 1-line universal install
58
+
59
+ ```bash
60
+ # Detects the Rust musl binary or falls back to the Python standard engine
61
+ curl -sSfL https://raw.githubusercontent.com/Mafifrizi/tanuki/main/install.sh | bash
62
+ ```
63
+
64
+ ### Manual installation
65
+
66
+ ```bash
67
+ # Rust systems core
68
+ cargo install --path crates/tanuki-cli
69
+
70
+ # Python reference engine
71
+ pipx install git+https://github.com/Mafifrizi/tanuki.git
72
+ ```
73
+
74
+ ### Zero-install direct execution
75
+
76
+ ```bash
77
+ git clone https://github.com/Mafifrizi/tanuki.git
78
+ cd tanuki
79
+ python3 -m tanuki doctor --json
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Commands
85
+
86
+ Both engines share the same command surface and flags. Full usage, every flag, and verified LDAPS examples are in [docs/USAGE.md](docs/USAGE.md).
87
+
88
+ | Command | Purpose |
89
+ | :--- | :--- |
90
+ | `tanuki doctor` | Pre-flight diagnostics across domain config, credentials, network, and OPSEC telemetry |
91
+ | `tanuki auth` | Unprivileged userspace TGT acquisition with in-memory clock skew healing |
92
+ | `tanuki tgs` | Kerberos service ticket acquisition for a target SPN |
93
+ | `tanuki blast` | Quantitative blast radius scoring, privilege tiering, and PowerShell remediation recipes |
94
+ | `tanuki ldap` | Unprivileged LDAP recon (`--query spn \| asreproast \| rbcd \| shadow \| unconstrained \| all`) |
95
+ | `tanuki adcs` | Passive AD CS template scanner for ESC1 through ESC11 |
96
+ | `tanuki config` | Zero-DNS unprivileged `krb5.conf` generator targeting the KDC by IP |
97
+ | `tanuki fix` | Idempotent closed-loop remediation (`--dry-run` to preview) |
98
+ | `tanuki purge` | NIST SP 800-88 cryptographic memory and credential-cache zeroization |
99
+ | `tanuki skill` | Export the agent skill manifest (`--json` for machine-actionable schema) |
100
+
101
+ Add `--json` to any command for structured output. Run `tanuki -i` for the interactive wizard.
102
+
103
+ ### The decision ladder
104
+
105
+ Tanuki follows a fixed 5-rung tactical decision ladder to prevent privilege escalation loops, reduce authentication noise, and keep every action forensically defensible. The model is documented in [references/tactical_ladder.md](references/tactical_ladder.md).
106
+
107
+ | Rung | Action | Description |
108
+ | :---: | :--- | :--- |
109
+ | **0** | `DIAGNOSE` | Pre-flight audit of credentials, enctypes, and network paths |
110
+ | **1** | `AUTHENTICATE` | Userspace AS-REQ TGT negotiation with clock skew tolerance |
111
+ | **2** | `AUTHORIZE` | TGS service ticket acquisition for verified SPN endpoints |
112
+ | **3** | `ASSESS` | Quantitative blast radius calculation and tier scoring |
113
+ | **4** | `PURGE` | Cryptographic memory zeroization (NIST SP 800-88) |
114
+
115
+ ---
116
+
117
+ ## Validation
118
+
119
+ Tanuki is validated against live hybrid infrastructure: an unprivileged Kali workstation (UID 1000) connecting directly to a Windows Server 2022 Domain Controller (`DC01.lab.local`), proving each rung end to end through to Blue Team forensic telemetry on the DC. It also ships 500+ Python unit tests and 39 Rust tests (library plus integration), all green.
120
+
121
+ See the full milestone walkthrough with terminal proofs in [docs/VALIDATION.md](docs/VALIDATION.md).
122
+
123
+ ---
124
+
125
+ ## Lineage & Credits
126
+
127
+ Tanuki is engineered by **Muhammad Afif Rizi** ([@Mafifrizi](https://github.com/Mafifrizi)) and **Muhamad Dian Alvito**.
128
+
129
+ Tanuki draws inspiration and tradecraft from two foundational projects:
130
+
131
+ - **Tim Brown ([@timb-machine](https://github.com/timb-machine))**: Created [Linikatz](https://github.com/CiscoCXSecurity/linikatz) and pioneered Linux Active Directory assessment techniques, keytab analysis, and credential cache harvesting.
132
+ - **Dietrich Gebert ([@dietrichayala](https://github.com/dietrichayala))**: Created [Ponytail](https://github.com/DietrichGebert/ponytail) and demonstrated how a disciplined decision ladder prevents AI agent hallucination and conversational bloat.
133
+
134
+ ### Technical Specifications Implemented
135
+
136
+ - **[RFC 4120]**: The Kerberos Network Authentication Service (V5)
137
+ - **[RFC 4511]**: Lightweight Directory Access Protocol (LDAP): The Protocol
138
+ - **[RFC 8693]**: OAuth 2.0 Token Exchange
139
+ - **[MS-KILE]**: Kerberos Protocol Extensions
140
+ - **[MS-PAC]**: Privilege Attribute Certificate Data Structure
141
+ - **[MS-DTYP]**: Windows Data Types & Security Descriptor Structures
142
+ - **[NIST SP 800-88]**: Guidelines for Media Sanitization (Rev. 1)
143
+
144
+ ---
145
+
146
+ ## Contributing
147
+
148
+ We welcome contributions from protocol researchers, systems engineers, and toolmakers. Tanuki enforces two hard invariants: zero external dependencies in the Python core, and `#![forbid(unsafe_code)]` in the Rust core.
149
+
150
+ - **Developer guide**: see [`CONTRIBUTING.md`](CONTRIBUTING.md) for local setup, testing commands, and PR guidelines.
151
+ - **Good first issues**: shell autocompletion (`bash` / `zsh` / `fish`), error dictionary expansion in `tanuki triage`, and SARIF or Markdown export formatters.
152
+ - **Reporting issues**: use the structured [issue templates](https://github.com/Mafifrizi/tanuki/issues/new/choose).
153
+
154
+ ---
155
+
156
+ ## License
157
+
158
+ Tanuki is dual-licensed under either:
159
+
160
+ - **MIT License** ([`LICENSE-MIT`](LICENSE-MIT) or http://opensource.org/licenses/MIT)
161
+ - **Apache License, Version 2.0** ([`LICENSE-APACHE`](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
162
+
163
+ You may choose either license.
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "tanuki-ad"
7
+ version = "2.1.0"
8
+ description = "Deterministic Linux Active Directory & Kerberos Protocol Triage Engine"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Mafifrizi", email = "hazama3321@gmail.com" }
12
+ ]
13
+ license = "MIT OR Apache-2.0"
14
+ license-files = ["LICENSE*", "LICENSE-MIT", "LICENSE-APACHE"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3 :: Only",
18
+ "Programming Language :: Python :: 3.8",
19
+ "Programming Language :: Python :: 3.9",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Rust",
24
+ "Operating System :: POSIX :: Linux",
25
+ "Topic :: System :: Systems Administration :: Authentication/Directory",
26
+ "Topic :: Security",
27
+ ]
28
+ keywords = ["kerberos", "keytab", "active-directory", "sssd", "security", "triage", "identity", "nhi"]
29
+ requires-python = ">=3.8"
30
+ dependencies = []
31
+
32
+ [project.scripts]
33
+ tanuki = "tanuki.cli:main"
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/Mafifrizi/tanuki"
37
+ Repository = "https://github.com/Mafifrizi/tanuki.git"
38
+ Issues = "https://github.com/Mafifrizi/tanuki/issues"
39
+
40
+ [tool.setuptools.packages.find]
41
+ where = ["."]
42
+ include = ["tanuki*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,44 @@
1
+ """Tanuki: Protocol-First Linux Active Directory & Kerberos Triage Engine."""
2
+
3
+ __version__ = "2.1.0"
4
+ __author__ = "Mafifrizi"
5
+ __all__ = [
6
+ "parse_keytab_bytes",
7
+ "parse_keytab_stream",
8
+ "parse_keytab_file",
9
+ "scan_for_ccache_blobs",
10
+ "try_parse_default_principal",
11
+ "find_error_resolution",
12
+ "ERROR_DICTIONARY",
13
+ "DECISION_LADDER",
14
+ "diagnose_system",
15
+ "DoctorReport",
16
+ "check_host_tools",
17
+ "generate_krb5_conf",
18
+ "format_telemetry_terminal",
19
+ "validate_jwt_workload",
20
+ "validate_token_exchange",
21
+ "acquire_tgt",
22
+ "acquire_tgt_via_ctypes",
23
+ "acquire_tgs",
24
+ "acquire_tgs_via_ctypes",
25
+ "classify_identity_tier",
26
+ "evaluate_blast_radius",
27
+ "run_blast",
28
+ "format_blast_report_terminal",
29
+ "parse_windows_sid",
30
+ "parse_rbcd_security_descriptor",
31
+ "parse_nt_security_descriptor",
32
+ ]
33
+
34
+ from .keytab import parse_keytab_bytes, parse_keytab_stream, parse_keytab_file
35
+ from .kcm import scan_for_ccache_blobs, try_parse_default_principal
36
+ from .protocol import find_error_resolution, ERROR_DICTIONARY, DECISION_LADDER
37
+ from .doctor import diagnose_system, DoctorReport, check_host_tools
38
+ from .config import generate_krb5_conf
39
+ from .telemetry import format_telemetry_terminal
40
+ from .nhi import validate_jwt_workload, validate_token_exchange
41
+ from .auth import acquire_tgt, acquire_tgt_via_ctypes, acquire_tgs, acquire_tgs_via_ctypes
42
+ from .blast import classify_identity_tier, evaluate_blast_radius, run_blast, format_blast_report_terminal
43
+ from .pac import parse_windows_sid, parse_rbcd_security_descriptor, parse_nt_security_descriptor
44
+
@@ -0,0 +1,6 @@
1
+ """Entry point for python -m tanuki."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()