cyntrisec 0.1.7__py3-none-any.whl

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 (65) hide show
  1. cyntrisec/__init__.py +3 -0
  2. cyntrisec/__main__.py +6 -0
  3. cyntrisec/aws/__init__.py +6 -0
  4. cyntrisec/aws/collectors/__init__.py +17 -0
  5. cyntrisec/aws/collectors/ec2.py +30 -0
  6. cyntrisec/aws/collectors/iam.py +116 -0
  7. cyntrisec/aws/collectors/lambda_.py +45 -0
  8. cyntrisec/aws/collectors/network.py +70 -0
  9. cyntrisec/aws/collectors/rds.py +38 -0
  10. cyntrisec/aws/collectors/s3.py +68 -0
  11. cyntrisec/aws/collectors/usage.py +188 -0
  12. cyntrisec/aws/credentials.py +153 -0
  13. cyntrisec/aws/normalizers/__init__.py +17 -0
  14. cyntrisec/aws/normalizers/ec2.py +115 -0
  15. cyntrisec/aws/normalizers/iam.py +182 -0
  16. cyntrisec/aws/normalizers/lambda_.py +83 -0
  17. cyntrisec/aws/normalizers/network.py +225 -0
  18. cyntrisec/aws/normalizers/rds.py +130 -0
  19. cyntrisec/aws/normalizers/s3.py +184 -0
  20. cyntrisec/aws/relationship_builder.py +1359 -0
  21. cyntrisec/aws/scanner.py +303 -0
  22. cyntrisec/cli/__init__.py +5 -0
  23. cyntrisec/cli/analyze.py +747 -0
  24. cyntrisec/cli/ask.py +412 -0
  25. cyntrisec/cli/can.py +307 -0
  26. cyntrisec/cli/comply.py +226 -0
  27. cyntrisec/cli/cuts.py +231 -0
  28. cyntrisec/cli/diff.py +332 -0
  29. cyntrisec/cli/errors.py +105 -0
  30. cyntrisec/cli/explain.py +348 -0
  31. cyntrisec/cli/main.py +114 -0
  32. cyntrisec/cli/manifest.py +893 -0
  33. cyntrisec/cli/output.py +117 -0
  34. cyntrisec/cli/remediate.py +643 -0
  35. cyntrisec/cli/report.py +462 -0
  36. cyntrisec/cli/scan.py +207 -0
  37. cyntrisec/cli/schemas.py +391 -0
  38. cyntrisec/cli/serve.py +164 -0
  39. cyntrisec/cli/setup.py +260 -0
  40. cyntrisec/cli/validate.py +101 -0
  41. cyntrisec/cli/waste.py +323 -0
  42. cyntrisec/core/__init__.py +31 -0
  43. cyntrisec/core/business_config.py +110 -0
  44. cyntrisec/core/business_logic.py +131 -0
  45. cyntrisec/core/compliance.py +437 -0
  46. cyntrisec/core/cost_estimator.py +301 -0
  47. cyntrisec/core/cuts.py +360 -0
  48. cyntrisec/core/diff.py +361 -0
  49. cyntrisec/core/graph.py +202 -0
  50. cyntrisec/core/paths.py +830 -0
  51. cyntrisec/core/schema.py +317 -0
  52. cyntrisec/core/simulator.py +371 -0
  53. cyntrisec/core/waste.py +309 -0
  54. cyntrisec/mcp/__init__.py +5 -0
  55. cyntrisec/mcp/server.py +862 -0
  56. cyntrisec/storage/__init__.py +7 -0
  57. cyntrisec/storage/filesystem.py +344 -0
  58. cyntrisec/storage/memory.py +113 -0
  59. cyntrisec/storage/protocol.py +92 -0
  60. cyntrisec-0.1.7.dist-info/METADATA +672 -0
  61. cyntrisec-0.1.7.dist-info/RECORD +65 -0
  62. cyntrisec-0.1.7.dist-info/WHEEL +4 -0
  63. cyntrisec-0.1.7.dist-info/entry_points.txt +2 -0
  64. cyntrisec-0.1.7.dist-info/licenses/LICENSE +190 -0
  65. cyntrisec-0.1.7.dist-info/licenses/NOTICE +5 -0
@@ -0,0 +1,672 @@
1
+ Metadata-Version: 2.4
2
+ Name: cyntrisec
3
+ Version: 0.1.7
4
+ Summary: AWS capability graph analysis and attack path discovery CLI
5
+ Author: CyntriSec
6
+ License: Apache License
7
+ Version 2.0, January 2004
8
+ http://www.apache.org/licenses/
9
+
10
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
11
+
12
+ 1. Definitions.
13
+
14
+ "License" shall mean the terms and conditions for use, reproduction,
15
+ and distribution as defined by Sections 1 through 9 of this document.
16
+
17
+ "Licensor" shall mean the copyright owner or entity authorized by
18
+ the copyright owner that is granting the License.
19
+
20
+ "Legal Entity" shall mean the union of the acting entity and all
21
+ other entities that control, are controlled by, or are under common
22
+ control with that entity. For the purposes of this definition,
23
+ "control" means (i) the power, direct or indirect, to cause the
24
+ direction or management of such entity, whether by contract or
25
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
26
+ outstanding shares, or (iii) beneficial ownership of such entity.
27
+
28
+ "You" (or "Your") shall mean an individual or Legal Entity
29
+ exercising permissions granted by this License.
30
+
31
+ "Source" form shall mean the preferred form for making modifications,
32
+ including but not limited to software source code, documentation
33
+ source, and configuration files.
34
+
35
+ "Object" form shall mean any form resulting from mechanical
36
+ transformation or translation of a Source form, including but
37
+ not limited to compiled object code, generated documentation,
38
+ and conversions to other media types.
39
+
40
+ "Work" shall mean the work of authorship, whether in Source or
41
+ Object form, made available under the License, as indicated by a
42
+ copyright notice that is included in or attached to the work
43
+ (an example is provided in the Appendix below).
44
+
45
+ "Derivative Works" shall mean any work, whether in Source or Object
46
+ form, that is based on (or derived from) the Work and for which the
47
+ editorial revisions, annotations, elaborations, or other modifications
48
+ represent, as a whole, an original work of authorship. For the purposes
49
+ of this License, Derivative Works shall not include works that remain
50
+ separable from, or merely link (or bind by name) to the interfaces of,
51
+ the Work and Derivative Works thereof.
52
+
53
+ "Contribution" shall mean any work of authorship, including
54
+ the original version of the Work and any modifications or additions
55
+ to that Work or Derivative Works thereof, that is intentionally
56
+ submitted to Licensor for inclusion in the Work by the copyright owner
57
+ or by an individual or Legal Entity authorized to submit on behalf of
58
+ the copyright owner. For the purposes of this definition, "submitted"
59
+ means any form of electronic, verbal, or written communication sent
60
+ to the Licensor or its representatives, including but not limited to
61
+ communication on electronic mailing lists, source code control systems,
62
+ and issue tracking systems that are managed by, or on behalf of, the
63
+ Licensor for the purpose of discussing and improving the Work, but
64
+ excluding communication that is conspicuously marked or otherwise
65
+ designated in writing by the copyright owner as "Not a Contribution."
66
+
67
+ "Contributor" shall mean Licensor and any individual or Legal Entity
68
+ on behalf of whom a Contribution has been received by Licensor and
69
+ subsequently incorporated within the Work.
70
+
71
+ 2. Grant of Copyright License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ copyright license to reproduce, prepare Derivative Works of,
75
+ publicly display, publicly perform, sublicense, and distribute the
76
+ Work and such Derivative Works in Source or Object form.
77
+
78
+ 3. Grant of Patent License. Subject to the terms and conditions of
79
+ this License, each Contributor hereby grants to You a perpetual,
80
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
81
+ (except as stated in this section) patent license to make, have made,
82
+ use, offer to sell, sell, import, and otherwise transfer the Work,
83
+ where such license applies only to those patent claims licensable
84
+ by such Contributor that are necessarily infringed by their
85
+ Contribution(s) alone or by combination of their Contribution(s)
86
+ with the Work to which such Contribution(s) was submitted. If You
87
+ institute patent litigation against any entity (including a
88
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
89
+ or a Contribution incorporated within the Work constitutes direct
90
+ or contributory patent infringement, then any patent licenses
91
+ granted to You under this License for that Work shall terminate
92
+ as of the date such litigation is filed.
93
+
94
+ 4. Redistribution. You may reproduce and distribute copies of the
95
+ Work or Derivative Works thereof in any medium, with or without
96
+ modifications, and in Source or Object form, provided that You
97
+ meet the following conditions:
98
+
99
+ (a) You must give any other recipients of the Work or
100
+ Derivative Works a copy of this License; and
101
+
102
+ (b) You must cause any modified files to carry prominent notices
103
+ stating that You changed the files; and
104
+
105
+ (c) You must retain, in the Source form of any Derivative Works
106
+ that You distribute, all copyright, patent, trademark, and
107
+ attribution notices from the Source form of the Work,
108
+ excluding those notices that do not pertain to any part of
109
+ the Derivative Works; and
110
+
111
+ (d) If the Work includes a "NOTICE" text file as part of its
112
+ distribution, then any Derivative Works that You distribute must
113
+ include a readable copy of the attribution notices contained
114
+ within such NOTICE file, excluding those notices that do not
115
+ pertain to any part of the Derivative Works, in at least one
116
+ of the following places: within a NOTICE text file distributed
117
+ as part of the Derivative Works; within the Source form or
118
+ documentation, if provided along with the Derivative Works; or,
119
+ within a display generated by the Derivative Works, if and
120
+ wherever such third-party notices normally appear. The contents
121
+ of the NOTICE file are for informational purposes only and
122
+ do not modify the License. You may add Your own attribution
123
+ notices within Derivative Works that You distribute, alongside
124
+ or as an addendum to the NOTICE text from the Work, provided
125
+ that such additional attribution notices cannot be construed
126
+ as modifying the License.
127
+
128
+ You may add Your own copyright statement to Your modifications and
129
+ may provide additional or different license terms and conditions
130
+ for use, reproduction, or distribution of Your modifications, or
131
+ for any such Derivative Works as a whole, provided Your use,
132
+ reproduction, and distribution of the Work otherwise complies with
133
+ the conditions stated in this License.
134
+
135
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
136
+ any Contribution intentionally submitted for inclusion in the Work
137
+ by You to the Licensor shall be under the terms and conditions of
138
+ this License, without any additional terms or conditions.
139
+ Notwithstanding the above, nothing herein shall supersede or modify
140
+ the terms of any separate license agreement you may have executed
141
+ with Licensor regarding such Contributions.
142
+
143
+ 6. Trademarks. This License does not grant permission to use the trade
144
+ names, trademarks, service marks, or product names of the Licensor,
145
+ except as required for reasonable and customary use in describing the
146
+ origin of the Work and reproducing the content of the NOTICE file.
147
+
148
+ 7. Disclaimer of Warranty. Unless required by applicable law or
149
+ agreed to in writing, Licensor provides the Work (and each
150
+ Contributor provides its Contributions) on an "AS IS" BASIS,
151
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
152
+ implied, including, without limitation, any warranties or conditions
153
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
154
+ PARTICULAR PURPOSE. You are solely responsible for determining the
155
+ appropriateness of using or redistributing the Work and assume any
156
+ risks associated with Your exercise of permissions under this License.
157
+
158
+ 8. Limitation of Liability. In no event and under no legal theory,
159
+ whether in tort (including negligence), contract, or otherwise,
160
+ unless required by applicable law (such as deliberate and grossly
161
+ negligent acts) or agreed to in writing, shall any Contributor be
162
+ liable to You for damages, including any direct, indirect, special,
163
+ incidental, or consequential damages of any character arising as a
164
+ result of this License or out of the use or inability to use the
165
+ Work (including but not limited to damages for loss of goodwill,
166
+ work stoppage, computer failure or malfunction, or any and all
167
+ other commercial damages or losses), even if such Contributor
168
+ has been advised of the possibility of such damages.
169
+
170
+ 9. Accepting Warranty or Additional Liability. While redistributing
171
+ the Work or Derivative Works thereof, You may choose to offer,
172
+ and charge a fee for, acceptance of support, warranty, indemnity,
173
+ or other liability obligations and/or rights consistent with this
174
+ License. However, in accepting such obligations, You may act only
175
+ on Your own behalf and on Your sole responsibility, not on behalf
176
+ of any other Contributor, and only if You agree to indemnify,
177
+ defend, and hold each Contributor harmless for any liability
178
+ incurred by, or claims asserted against, such Contributor by reason
179
+ of your accepting any such warranty or additional liability.
180
+
181
+ END OF TERMS AND CONDITIONS
182
+
183
+ Copyright 2026 CyntriSec
184
+
185
+ Licensed under the Apache License, Version 2.0 (the "License");
186
+ you may not use this file except in compliance with the License.
187
+ You may obtain a copy of the License at
188
+
189
+ http://www.apache.org/licenses/LICENSE-2.0
190
+
191
+ Unless required by applicable law or agreed to in writing, software
192
+ distributed under the License is distributed on an "AS IS" BASIS,
193
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194
+ See the License for the specific language governing permissions and
195
+ limitations under the License.
196
+ License-File: LICENSE
197
+ License-File: NOTICE
198
+ Keywords: attack-path,aws,cli,cost-optimization,security
199
+ Classifier: Development Status :: 3 - Alpha
200
+ Classifier: Environment :: Console
201
+ Classifier: Intended Audience :: Developers
202
+ Classifier: Intended Audience :: System Administrators
203
+ Classifier: License :: OSI Approved :: Apache Software License
204
+ Classifier: Operating System :: OS Independent
205
+ Classifier: Programming Language :: Python :: 3
206
+ Classifier: Programming Language :: Python :: 3.11
207
+ Classifier: Programming Language :: Python :: 3.12
208
+ Classifier: Topic :: Security
209
+ Requires-Python: >=3.11
210
+ Requires-Dist: boto3>=1.34
211
+ Requires-Dist: pydantic>=2.4
212
+ Requires-Dist: pyyaml>=6.0
213
+ Requires-Dist: rich>=13.0
214
+ Requires-Dist: typer>=0.9.0
215
+ Provides-Extra: dev
216
+ Requires-Dist: moto>=5.0; extra == 'dev'
217
+ Requires-Dist: mypy>=1.0; extra == 'dev'
218
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
219
+ Requires-Dist: pytest>=7.0; extra == 'dev'
220
+ Requires-Dist: ruff>=0.1; extra == 'dev'
221
+ Requires-Dist: types-pyyaml; extra == 'dev'
222
+ Provides-Extra: mcp
223
+ Requires-Dist: mcp>=1.0.0; extra == 'mcp'
224
+ Description-Content-Type: text/markdown
225
+
226
+ # Cyntrisec CLI
227
+
228
+ [![PyPI](https://img.shields.io/pypi/v/cyntrisec?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/cyntrisec/)
229
+ [![Website](https://img.shields.io/badge/website-cyntrisec.com-4285F4?style=flat-square&logo=google-chrome&logoColor=white)](https://cyntrisec.com/)
230
+ [![X](https://img.shields.io/badge/-%40cyntrisec-000000?style=flat-square&logo=x&logoColor=white)](https://x.com/cyntrisec)
231
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)](LICENSE)
232
+ [![Status](https://img.shields.io/badge/status-beta-orange?style=flat-square)](https://pypi.org/project/cyntrisec/)
233
+
234
+ ![image-download](https://github.com/user-attachments/assets/83a8b7d2-23c8-4e6e-a471-2e6a0a6f93e7)
235
+
236
+ > [!CAUTION]
237
+ > **Beta Software Disclaimer**: This tool is currently in **BETA**. It is provided "as is", without warranty of any kind.
238
+ > While Cyntrisec is a read-only analysis tool by default, the user assumes all responsibility for any actions taken based on its findings.
239
+ > **Always review** generated remediation plans and Terraform code before application.
240
+
241
+ AWS capability graph analysis and attack path discovery.
242
+
243
+ A read-only CLI tool that:
244
+ - Scans AWS infrastructure via AssumeRole
245
+ - Builds a capability graph (IAM, network, dependencies)
246
+ - Discovers attack paths from internet to sensitive targets
247
+ - Prioritizes fixes by ROI (security impact + cost savings)
248
+ - Identifies unused capabilities (blast radius reduction)
249
+ - Outputs deterministic JSON with proof chains
250
+
251
+ ## Architecture
252
+
253
+ ```text
254
+ +----------------------------------------------------------------------------------+
255
+ | CYNTRISEC CLI |
256
+ +----------------------------------------------------------------------------------+
257
+ | CLI Layer (Typer) |
258
+ | scan analyze cuts waste report comply can diff serve ... |
259
+ +-----------------------------+----------------------------------------------------+
260
+ | Core Engine | Storage (local) |
261
+ | - AWS collectors | ~/.cyntrisec/scans/<scan_id>/ |
262
+ | - Normalization/schema | snapshot.json, assets.json, relationships.json |
263
+ | - GraphBuilder -> AwsGraph | findings.json, attack_paths.json |
264
+ | - Path search -> paths | ~/.cyntrisec/scans/latest -> <scan_id> |
265
+ | - Min-cut + Cost (ROI) | (Windows fallback: latest is a file) |
266
+ +-----------------------------+----------------------------------------------------+
267
+ | Outputs: JSON/agent, HTML report, remediation plan + Terraform hints |
268
+ +----------------------------------------------------------------------------------+
269
+ ```
270
+
271
+ <!-- Legacy Unicode diagram (kept for reference; may render oddly in some environments) -->
272
+ <!--
273
+ ```
274
+ ┌─────────────────────────────────────────────────────────────────────────────┐
275
+ │ CYNTRISEC CLI │
276
+ ├─────────────────────────────────────────────────────────────────────────────┤
277
+ │ │
278
+ │ ┌─────────────────────────────────────────────────────────────────────┐ │
279
+ │ │ CLI Layer (typer) │ │
280
+ │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
281
+ │ │ │ scan │ │ analyze │ │ cuts │ │ waste │ │ report │ ... │ │
282
+ │ │ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘ │ │
283
+ │ └───────┼──────────┼──────────┼──────────┼──────────┼─────────────────┘ │
284
+ │ │ │ │ │ │ │
285
+ │ ┌───────▼──────────▼──────────▼──────────▼──────────▼────────────────┐ │
286
+ │ │ Core Engine │ │
287
+ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
288
+ │ │ │ Graph │ │ Paths │ │ Compliance │ │ │
289
+ │ │ │ (AwsGraph) │ │ (BFS/DFS) │ │ (CIS/SOC2) │ │ │
290
+ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │
291
+ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
292
+ │ │ │ Cuts │ │ Waste │ │ Simulator │ │ │
293
+ │ │ │ (ROI/Min) │ │ (Unused) │ │ (IAM Eval) │ │ │
294
+ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │
295
+ │ │ ┌──────────────┐ │ │
296
+ │ │ │ Cost Engine │ │ │
297
+ │ │ │ (Estimator) │ │ │
298
+ │ │ └──────────────┘ │ │
299
+ │ └────────────────────────────────────────────────────────────────────┘ │
300
+ │ │ │
301
+ │ ┌───────▼────────────────────────────────────────────────────────────┐ │
302
+ │ │ AWS Layer │ │
303
+ │ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
304
+ │ │ │ Collectors │ │ Normalizers │ │ Relationship │ │ │
305
+ │ │ │ (EC2, IAM, │ │ (Asset → │ │ Builder │ │ │
306
+ │ │ │ RDS, ...) │ │ Schema) │ │ │ │ │
307
+ │ │ └──────────────┘ └──────────────┘ └──────────────┘ │ │
308
+ │ └────────────────────────────────────────────────────────────────────┘ │
309
+ │ │ │ │
310
+ │ ┌───────▼──────────────────────┐ ┌──────────────▼──────────────────┐ │
311
+ │ │ Storage Layer │ │ MCP Server │ │
312
+ │ │ ┌────────────┐ ┌─────────┐ │ │ ┌──────────────────────────┐ │ │
313
+ │ │ │ Filesystem │ │ Memory │ │ │ │ Tools: get_scan_summary │ │ │
314
+ │ │ │ (~/.cyntri │ │ (tests) │ │ │ │ get_attack_paths, ... │ │ │
315
+ │ │ │ sec/) │ │ │ │ │ └──────────────────────────┘ │ │
316
+ │ │ └────────────┘ └─────────┘ │ │ │ │
317
+ │ └──────────────────────────────┘ └─────────────────────────────────┘ │
318
+ │ │
319
+ └─────────────────────────────────────────────────────────────────────────────┘
320
+
321
+
322
+ ┌─────────────────────────────────────────────────────────────────────────────┐
323
+ │ AWS Account │
324
+ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
325
+ │ │ IAM │ │ EC2 │ │ RDS │ │ S3 │ ... │
326
+ │ │ (Roles, │ │ (Instances, │ │ (Databases) │ │ (Buckets) │ │
327
+ │ │ Policies) │ │ SGs, VPCs) │ │ │ │ │ │
328
+ │ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │
329
+ └─────────────────────────────────────────────────────────────────────────────┘
330
+ ```
331
+ -->
332
+
333
+ ### Data Flow
334
+
335
+ ```text
336
+ CLI (scan) --AssumeRole--> AWS Session --Describe/Get/List--> AWS APIs (read-only)
337
+ |
338
+ v
339
+ Collectors -> normalize -> Assets + Relationships -> AwsGraph
340
+ |
341
+ v
342
+ Attack path search (BFS/DFS)
343
+ |
344
+ v
345
+ Min-cut (remediation cuts)
346
+ |
347
+ v
348
+ Cost engine (ROI)
349
+
350
+ Local artifacts: ~/.cyntrisec/scans/<scan_id>/*.json
351
+ ```
352
+
353
+ <!-- Legacy Unicode diagram (kept for reference; may render oddly in some environments) -->
354
+ <!--
355
+ ```
356
+ ┌──────────┐ AssumeRole ┌──────────┐ Describe/Get/List ┌─────────┐
357
+ │ CLI │ ─────────────────▶│ AWS │ ◀─────────────────────▶│ APIs │
358
+ │ (scan) │ │ Session │ │(read-only)
359
+ └────┬─────┘ └──────────┘ └─────────┘
360
+
361
+
362
+ ┌──────────┐ normalize ┌──────────┐ build edges ┌──────────────┐
363
+ │Collectors│ ─────────────────▶│ Assets │ ─────────────────▶│Relationships│
364
+ └──────────┘ └──────────┘ └──────┬───────┘
365
+
366
+ ┌───────────────────────────────────────────────────────────────┐
367
+
368
+ ┌──────────┐ BFS/DFS ┌──────────┐ min-cut ┌──────────────┐
369
+ │ AwsGraph │ ─────────────────▶│ Attack │ ─────────────────▶│ Remediation │
370
+ │ │ │ Paths │ │ Cuts │
371
+ └──────────┘ └──────────┘ └──▲───────────┘
372
+ │ (ROI)
373
+ ┌──────┴───────┐
374
+ │ Cost Engine │
375
+ └──────────────┘
376
+ ```
377
+ -->
378
+
379
+ ## Installation
380
+
381
+ ```bash
382
+ pip install cyntrisec
383
+ ```
384
+
385
+ ### Windows PATH Fix
386
+
387
+ If you see "cyntrisec is not recognized", the Scripts folder isn't on PATH:
388
+
389
+ ```powershell
390
+ # Option 1: Run with python -m
391
+ python -m cyntrisec --help
392
+
393
+ # Option 2: Add to PATH for current session
394
+ $env:PATH += ";$env:APPDATA\Python\Python311\Scripts"
395
+ ```
396
+
397
+ ## Quick Start
398
+
399
+ > **Prerequisite**: Ensure you have [AWS CLI](https://aws.amazon.com/cli/) installed and configured with credentials (e.g., `aws configure`) or environment variables set. `terraform` is required for the setup step.
400
+
401
+ ```bash
402
+ # 1. Create the read-only IAM role in your account
403
+ cyntrisec setup iam 123456789012 --output role.tf
404
+
405
+ # 2. Apply the Terraform
406
+ cd your-infra && terraform apply
407
+
408
+ # 3. Run a scan
409
+ cyntrisec scan --role-arn arn:aws:iam::123456789012:role/CyntrisecReadOnly
410
+
411
+ # 4. View attack paths
412
+ cyntrisec analyze paths --min-risk 0.5
413
+
414
+ # 5. Find minimal fixes (prioritized by ROI)
415
+ cyntrisec cuts --format json
416
+
417
+ # 6. Generate HTML report
418
+ cyntrisec report --output report.html
419
+ ```
420
+
421
+ ## Commands
422
+
423
+ ### Core Analysis
424
+
425
+ | Command | Description |
426
+ |---------|-------------|
427
+ | `scan` | Scan AWS infrastructure |
428
+ | `analyze paths` | View attack paths |
429
+ | `analyze findings` | View security findings |
430
+ | `analyze stats` | View scan statistics |
431
+ | `analyze business` | Business entrypoint analysis |
432
+ | `report` | Generate HTML/JSON report |
433
+
434
+ ### Setup & Validation
435
+
436
+ | Command | Description |
437
+ |---------|-------------|
438
+ | `setup iam` | Generate IAM role Terraform |
439
+ | `validate-role` | Validate IAM role permissions |
440
+
441
+ ### Remediation
442
+
443
+ | Command | Description |
444
+ |---------|-------------|
445
+ | `cuts` | Find minimal fixes (Cost & ROI prioritized) |
446
+ | `waste` | Find unused IAM permissions |
447
+ | `remediate` | Generate or optionally apply Terraform plans (gated) |
448
+
449
+ ### Policy Testing
450
+
451
+ | Command | Description |
452
+ |---------|-------------|
453
+ | `can` | Test "can X access Y?" |
454
+ | `diff` | Compare scan snapshots |
455
+ | `comply` | Check CIS AWS / SOC2 compliance |
456
+
457
+ ### Agentic Interface
458
+
459
+ | Command | Description |
460
+ |---------|-------------|
461
+ | `manifest` | Output machine-readable capabilities |
462
+ | `explain` | Natural language explanations |
463
+ | `ask` | Query scans in plain English |
464
+ | `serve` | Run as MCP server for AI agents |
465
+
466
+ ## MCP Server Mode
467
+
468
+ Run Cyntrisec as an MCP server for AI agent integration:
469
+
470
+ ```bash
471
+ # Install with MCP support
472
+ pip install "cyntrisec[mcp]"
473
+ ```
474
+
475
+ ```bash
476
+ cyntrisec serve # Start stdio server
477
+ cyntrisec serve --list-tools # List available tools
478
+ ```
479
+
480
+ ### MCP Tools (15)
481
+
482
+ | Category | Tool | Description |
483
+ |----------|------|-------------|
484
+ | **Discovery** | `list_tools` | List all available tools |
485
+ | | `set_session_snapshot` | Set active snapshot for session |
486
+ | | `get_scan_summary` | Get summary of latest AWS scan |
487
+ | **Assets** | `get_assets` | Get assets with type/name filtering |
488
+ | | `get_relationships` | Get relationships between assets |
489
+ | | `get_findings` | Get security findings with severity filtering |
490
+ | **Attack Paths** | `get_attack_paths` | Get attack paths with risk scores |
491
+ | | `explain_path` | Detailed hop-by-hop path breakdown |
492
+ | | `explain_finding` | Detailed finding explanation |
493
+ | **Remediation** | `get_remediations` | Find optimal fixes for attack paths |
494
+ | | `get_terraform_snippet` | Generate Terraform code for remediation |
495
+ | **Access** | `check_access` | Test if principal can access resource |
496
+ | | `get_unused_permissions` | Find unused IAM permissions |
497
+ | **Compliance** | `check_compliance` | Check CIS AWS or SOC 2 compliance |
498
+ | | `compare_scans` | Compare scan snapshots |
499
+
500
+ ### Claude Desktop
501
+
502
+ **MacOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
503
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
504
+
505
+ ```json
506
+ {
507
+ "mcpServers": {
508
+ "cyntrisec": {
509
+ "command": "python",
510
+ "args": ["-m", "cyntrisec", "serve"]
511
+ }
512
+ }
513
+ }
514
+ ```
515
+
516
+ ### Claude Code (CLI)
517
+
518
+ Run the following command to configure the server:
519
+
520
+ ```bash
521
+ claude mcp add cyntrisec -- python -m cyntrisec serve
522
+ ```
523
+
524
+ ### Google Gemini / Antigravity
525
+
526
+ Locate your agent configuration (e.g., `~/.gemini/antigravity/mcp_config.json`) and add:
527
+
528
+ ```json
529
+ {
530
+ "mcpServers": {
531
+ "cyntrisec": {
532
+ "command": "python",
533
+ "args": ["-m", "cyntrisec", "serve"]
534
+ }
535
+ }
536
+ }
537
+ ```
538
+
539
+ ## Trust & Safety
540
+
541
+ ### Read-Only Guarantees
542
+
543
+ This tool makes **read-only API calls** to your AWS account. The IAM role
544
+ should have only `Describe*`, `Get*`, `List*` permissions.
545
+
546
+ ### No Data Exfiltration
547
+
548
+ All data stays on your local machine. Nothing is sent to external servers.
549
+ Scan results are stored in `~/.cyntrisec/scans/`.
550
+
551
+ ### No Auto-Remediation (Default Safe Mode)
552
+
553
+ By default, Cyntrisec is **read-only** and **does not modify** your AWS infrastructure.
554
+
555
+ - It **analyzes** your account using read-only APIs.
556
+ - It can **generate** remediation artifacts (e.g., Terraform modules) for you to review.
557
+ - It does **not** apply changes automatically.
558
+
559
+ ### Optional Remediation Execution (Explicit Opt-In)
560
+
561
+ Cyntrisec includes an **explicitly gated** path that can execute Terraform **only if you intentionally enable it**.
562
+
563
+ This mode is:
564
+ - **Disabled by default**
565
+ - Requires `--enable-unsafe-write-mode`
566
+ - Requires an additional explicit flag (e.g. `--execute-terraform`) to run Terraform
567
+ - Intended for controlled environments (sandbox / CI with approvals), not unattended production
568
+
569
+ If you do not pass these flags, Cyntrisec will never run `terraform apply`.
570
+
571
+ ### Write Operations
572
+
573
+ Cyntrisec makes **no AWS write API calls** during scanning and analysis.
574
+
575
+ The only supported "write" behavior is optional execution of Terraform **locally on your machine**, and only when explicitly enabled via unsafe flags.
576
+
577
+ Every AWS API call is logged in CloudTrail under session name `cyntrisec-cli`.
578
+
579
+ ## Trust & Permissions
580
+
581
+ Cyntrisec runs with a read-only IAM role. Generate the recommended policy with
582
+ `cyntrisec setup iam <ACCOUNT_ID>` and keep permissions to `Describe*`, `Get*`,
583
+ and `List*`. Live modes (`waste --live`, `can --live`) require extra IAM
584
+ permissions; the generated policy and docs cover those additions.
585
+
586
+ ## Output Format
587
+
588
+ Primary output is JSON to stdout. When stdout is not a TTY, the CLI automatically switches to JSON:
589
+
590
+ ```bash
591
+ cyntrisec analyze paths --format json | jq '.paths[] | select(.risk_score > 0.7)'
592
+ ```
593
+
594
+ Agent-friendly output wraps results in a structured envelope:
595
+
596
+ ```bash
597
+ cyntrisec analyze paths --format agent
598
+ ```
599
+
600
+ ```json
601
+ {
602
+ "schema_version": "1.0",
603
+ "status": "success",
604
+ "data": {...},
605
+ "artifact_paths": {...},
606
+ "suggested_actions": [...]
607
+ }
608
+ ```
609
+
610
+ ## Exit Codes
611
+
612
+ | Code | Meaning |
613
+ |------|---------|
614
+ | 0 | Success / compliant |
615
+ | 1 | Findings / regressions / denied |
616
+ | 2 | Usage error |
617
+ | 3 | Transient error (retry) |
618
+ | 4 | Internal error |
619
+
620
+ Use in CI/CD:
621
+
622
+ ```bash
623
+ cyntrisec scan --role-arn $ROLE_ARN || exit 1
624
+ cyntrisec diff || echo "Regressions detected"
625
+ ```
626
+
627
+ ## Storage
628
+
629
+ Scan results are stored locally:
630
+
631
+ ```text
632
+ ~/.cyntrisec/
633
+ |-- scans/
634
+ | |-- 2026-01-17_123456_123456789012/
635
+ | | |-- snapshot.json
636
+ | | |-- assets.json
637
+ | | |-- relationships.json
638
+ | | |-- findings.json
639
+ | | `-- attack_paths.json
640
+ | `-- latest -> 2026-01-17_...
641
+ `-- config.yaml
642
+ ```
643
+
644
+ <!-- Legacy Unicode tree (kept for reference; may render oddly in some environments) -->
645
+ <!--
646
+ ```
647
+ ~/.cyntrisec/
648
+ ├── scans/
649
+ │ ├── 2026-01-17_123456_123456789012/
650
+ │ │ ├── snapshot.json
651
+ │ │ ├── assets.json
652
+ │ │ ├── relationships.json
653
+ │ │ ├── findings.json
654
+ │ │ └── attack_paths.json
655
+ │ └── latest -> 2026-01-17_...
656
+ └── config.yaml
657
+ ```
658
+ -->
659
+
660
+ ## Versioning
661
+
662
+ This project follows Semantic Versioning. See `CHANGELOG.md` for release notes.
663
+
664
+ ## License
665
+
666
+ Apache-2.0
667
+
668
+ ## Links
669
+
670
+ - [PyPI Package](https://pypi.org/project/cyntrisec/)
671
+ - [Website](https://cyntrisec.com/)
672
+ - [Twitter/X](https://x.com/cyntrisec)