cantarella-framework 0.0.0-stage → 0.6.0

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 (74) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +202 -0
  3. package/README.md +72 -2
  4. package/SECURITY.md +13 -0
  5. package/docs/installation.md +28 -0
  6. package/docs/module-contract.md +64 -0
  7. package/docs/module-ecosystem.md +31 -0
  8. package/docs/security-model.md +11 -0
  9. package/docs/writing-modules.md +33 -0
  10. package/modules/blue-team-log-analyzer/index.mjs +44 -0
  11. package/modules/blue-team-log-analyzer/module.json +14 -0
  12. package/modules/hello-module/index.mjs +17 -0
  13. package/modules/hello-module/module.json +1 -0
  14. package/modules/network-port-scanner/index.mjs +58 -0
  15. package/modules/network-port-scanner/module.json +27 -0
  16. package/modules/recon-subdomain-finder/index.mjs +49 -0
  17. package/modules/recon-subdomain-finder/module.json +21 -0
  18. package/modules/threat-intel-ioc-extractor/index.mjs +32 -0
  19. package/modules/threat-intel-ioc-extractor/module.json +14 -0
  20. package/modules/wrapper-nmap/index.mjs +56 -0
  21. package/modules/wrapper-nmap/module.json +28 -0
  22. package/package.json +54 -3
  23. package/packages/cli/dist/banner.d.ts +2 -0
  24. package/packages/cli/dist/banner.js +18 -0
  25. package/packages/cli/dist/banner.js.map +1 -0
  26. package/packages/cli/dist/cli.d.ts +2 -0
  27. package/packages/cli/dist/cli.js +286 -0
  28. package/packages/cli/dist/cli.js.map +1 -0
  29. package/packages/cli/dist/index.d.ts +2 -0
  30. package/packages/cli/dist/index.js +3 -0
  31. package/packages/cli/dist/index.js.map +1 -0
  32. package/packages/cli/dist/menu.d.ts +5 -0
  33. package/packages/cli/dist/menu.js +117 -0
  34. package/packages/cli/dist/menu.js.map +1 -0
  35. package/packages/core/dist/categories.d.ts +6 -0
  36. package/packages/core/dist/categories.js +29 -0
  37. package/packages/core/dist/categories.js.map +1 -0
  38. package/packages/core/dist/correlate.d.ts +41 -0
  39. package/packages/core/dist/correlate.js +115 -0
  40. package/packages/core/dist/correlate.js.map +1 -0
  41. package/packages/core/dist/index.d.ts +8 -0
  42. package/packages/core/dist/index.js +9 -0
  43. package/packages/core/dist/index.js.map +1 -0
  44. package/packages/core/dist/install.d.ts +17 -0
  45. package/packages/core/dist/install.js +111 -0
  46. package/packages/core/dist/install.js.map +1 -0
  47. package/packages/core/dist/modules.d.ts +7 -0
  48. package/packages/core/dist/modules.js +37 -0
  49. package/packages/core/dist/modules.js.map +1 -0
  50. package/packages/core/dist/report.d.ts +2 -0
  51. package/packages/core/dist/report.js +74 -0
  52. package/packages/core/dist/report.js.map +1 -0
  53. package/packages/core/dist/runner.d.ts +11 -0
  54. package/packages/core/dist/runner.js +105 -0
  55. package/packages/core/dist/runner.js.map +1 -0
  56. package/packages/core/dist/scaffold.d.ts +2 -0
  57. package/packages/core/dist/scaffold.js +89 -0
  58. package/packages/core/dist/scaffold.js.map +1 -0
  59. package/packages/core/dist/store.d.ts +17 -0
  60. package/packages/core/dist/store.js +87 -0
  61. package/packages/core/dist/store.js.map +1 -0
  62. package/packages/gui/README.md +10 -0
  63. package/packages/gui/dist/index.d.ts +1 -0
  64. package/packages/gui/dist/index.js +2 -0
  65. package/packages/gui/dist/index.js.map +1 -0
  66. package/packages/gui/dist/page.d.ts +1 -0
  67. package/packages/gui/dist/page.js +126 -0
  68. package/packages/gui/dist/page.js.map +1 -0
  69. package/packages/gui/dist/server.d.ts +3 -0
  70. package/packages/gui/dist/server.js +159 -0
  71. package/packages/gui/dist/server.js.map +1 -0
  72. package/packages/module-sdk/dist/index.d.ts +59 -0
  73. package/packages/module-sdk/dist/index.js +38 -0
  74. package/packages/module-sdk/dist/index.js.map +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ ## 0.6.0
4
+
5
+ - Public-release preparation: npm package metadata, install and security documentation, changelog, and a workspace that defaults to the current directory for global installs.
6
+
7
+ ## 0.5.0
8
+
9
+ - Phase 4: result correlation with a target map, run diffs, log analyzer and IOC extractor modules, and report templates.
10
+
11
+ ## 0.4.0
12
+
13
+ - Phase 3: third-party module installation from folders and npm, SHA-256 checksums, and TypeScript/Python/Go module templates.
14
+
15
+ ## 0.3.0
16
+
17
+ - Phase 2: local web GUI sharing the CLI engine.
18
+
19
+ ## 0.2.0
20
+
21
+ - Phase 1: CLI MVP with history, reports, SQLite index, native port scanner, native subdomain finder, and Nmap wrapper.
22
+
23
+ ## 0.1.0
24
+
25
+ - Phase 0: monorepo scaffold, module contract, hello module, and interactive CLI.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
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
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,73 @@
1
- # Temporary Holding Version
1
+ # Cantarella Framework
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Cantarella is a modular security framework with a clean interactive CLI and a local GUI. The core manages modules, targets, runs, results, and reports. Modules do the actual work, either as native modules or as wrappers around mature external tools.
4
+
5
+ > Phase 5 public-release preparation: the npm package is installable globally as `canta`, with install/security documentation and a changelog. Publishing to npm is the remaining release step.
6
+
7
+ ## Quick start
8
+
9
+ ```bash
10
+ npm install
11
+ npm run build
12
+ npm start
13
+ ```
14
+
15
+ Direct commands:
16
+
17
+ ```bash
18
+ node packages/cli/dist/cli.js modules list
19
+ node packages/cli/dist/cli.js modules info hello
20
+ node packages/cli/dist/cli.js run hello --target example.com
21
+ node packages/cli/dist/cli.js doctor
22
+ node packages/cli/dist/cli.js run network/port-scanner --target 127.0.0.1 --ports 22,80,443
23
+ node packages/cli/dist/cli.js run recon/subdomain-finder --target example.com
24
+ node packages/cli/dist/cli.js run network/nmap --target 127.0.0.1
25
+ node packages/cli/dist/cli.js history
26
+ node packages/cli/dist/cli.js report
27
+ node packages/cli/dist/cli.js report --format html
28
+ node packages/cli/dist/cli.js update tools
29
+ node packages/cli/dist/cli.js gui
30
+ node packages/cli/dist/cli.js modules create recon/my-module --template python
31
+ node packages/cli/dist/cli.js modules install ./path/to/module
32
+ node packages/cli/dist/cli.js modules install npm:some-cantarella-module
33
+ node packages/cli/dist/cli.js modules verify
34
+ node packages/cli/dist/cli.js correlate
35
+ node packages/cli/dist/cli.js diff
36
+ node packages/cli/dist/cli.js report --template pentest
37
+ node packages/cli/dist/cli.js run blue-team/log-analyzer --target ./auth.log
38
+ node packages/cli/dist/cli.js run threat-intel/ioc-extractor --target ./notes.txt
39
+ ```
40
+
41
+ Run results are saved as human-readable JSON under `.cantarella/runs/`, indexed in `.cantarella/index.sqlite`, with the raw module output kept beside them as evidence. Reports are written to `.cantarella/reports/`.
42
+
43
+ ## CLI
44
+
45
+ Running `canta` without arguments opens the interactive console. Use number keys, the up and down arrow keys, `j`/`k`, and Enter to choose. Press `q` to exit.
46
+
47
+ All user-facing text is in English.
48
+
49
+ ## Layout
50
+
51
+ ```text
52
+ packages/
53
+ core/ module discovery, validation, runner, categories
54
+ cli/ the canta command
55
+ gui/ local web GUI
56
+ module-sdk/ manifest types and contract helpers
57
+ modules/
58
+ hello-module/
59
+ network-port-scanner/
60
+ recon-subdomain-finder/
61
+ wrapper-nmap/
62
+ docs/
63
+ module-contract.md
64
+ tests/
65
+ ```
66
+
67
+ ## Safety
68
+
69
+ Use Cantarella only on systems you own or are authorized to test. Risky branches carry an informative risk label in the CLI and GUI.
70
+
71
+ ## License
72
+
73
+ Apache-2.0. See [LICENSE](LICENSE).
package/SECURITY.md ADDED
@@ -0,0 +1,13 @@
1
+ # Security Policy
2
+
3
+ Cantarella is a security tool. Use it only on systems you own or are authorized to test.
4
+
5
+ ## Reporting a vulnerability in Cantarella
6
+
7
+ Please report vulnerabilities in Cantarella itself privately through GitHub Security Advisories for this repository, or by opening an issue that asks for a private contact channel without including exploit details.
8
+
9
+ Include the Cantarella version, your operating system and Node.js version, the module involved, and clear reproduction steps. Do not include credentials, private target data, or third-party personal information.
10
+
11
+ ## Supported versions
12
+
13
+ Before 1.0, only the latest published version receives security fixes.
@@ -0,0 +1,28 @@
1
+ # Installation
2
+
3
+ Cantarella requires Node.js 22 or newer.
4
+
5
+ ## From npm
6
+
7
+ ```bash
8
+ npm install -g cantarella-framework
9
+ canta doctor
10
+ canta
11
+ ```
12
+
13
+ ## From source
14
+
15
+ ```bash
16
+ git clone https://github.com/21xthSerenade/cantarella-framework.git
17
+ cd cantarella-framework
18
+ npm install
19
+ npm run build
20
+ node packages/cli/dist/cli.js doctor
21
+ ```
22
+
23
+ ## Linux notes
24
+
25
+ - Debian, Ubuntu, Kali, and Parrot: install Node.js from your distribution or NodeSource, then use the npm or source route above. External tools such as Nmap come from your system package manager; `canta doctor` reports what is missing.
26
+ - Arch and BlackArch: install `nodejs` and `npm` with pacman, then use the same routes. External tools are detected from your PATH.
27
+
28
+ Run results are stored under `.cantarella/` in the current directory, or in `CANTA_HOME` when that environment variable is set.
@@ -0,0 +1,64 @@
1
+ # Module Contract
2
+
3
+ Every module lives in its own folder with a `module.json` manifest and an entry file.
4
+
5
+ ## Manifest
6
+
7
+ ```json
8
+ {
9
+ "schema_version": 1,
10
+ "id": "hello",
11
+ "name": "Hello Module",
12
+ "version": "0.1.0",
13
+ "category": "lab",
14
+ "kind": "native",
15
+ "risk": "info",
16
+ "description": "Example module that proves the manifest and JSON contract.",
17
+ "entry": "index.mjs",
18
+ "core_api": "^0.1.0",
19
+ "maintenance": "active",
20
+ "options": []
21
+ }
22
+ ```
23
+
24
+ Required fields: `schema_version`, `id`, `name`, `version`, `category`, `kind`, `risk`, `description`, `entry`, and `core_api`.
25
+
26
+ - `kind` is `native` for modules written for Cantarella, or `wrapper` for modules that run an external tool and normalize its output.
27
+ - `risk` is one of `info`, `low`, `medium`, `high`, or `critical`. Risk labels are informative in the CLI and GUI.
28
+ - Wrapper modules declare their external tools in `external_tools` so `canta doctor` can detect them. External tools are updated by the user or the system package manager, never by Cantarella.
29
+
30
+ ## Run request
31
+
32
+ The core starts the module as a separate process and sends one JSON object on stdin:
33
+
34
+ ```json
35
+ {
36
+ "schema_version": 1,
37
+ "run_id": "2026-12-02T12-33-03-000Z-abc123",
38
+ "module_id": "hello",
39
+ "target": "example.com",
40
+ "options": {},
41
+ "workspace": "/path/to/.cantarella"
42
+ }
43
+ ```
44
+
45
+ ## Module events
46
+
47
+ The module writes JSON Lines on stdout, one event per line:
48
+
49
+ ```json
50
+ {"type":"progress","message":"Working.","percent":50}
51
+ {"type":"result","summary":"Hello, example.com.","data":{"target":"example.com"}}
52
+ {"type":"done","summary":"Finished."}
53
+ ```
54
+
55
+ Event types: `progress`, `result`, `finding`, `done`, and `error`.
56
+
57
+ ## Results
58
+
59
+ The core saves each run under `.cantarella/runs/<run-id>/`:
60
+
61
+ - `results.json` — human-readable structured results with stable field names.
62
+ - `raw-output.txt` — the module's raw stdout and stderr, kept as evidence.
63
+
64
+ Later phases add a SQLite index over the same results, plus export to JSON, CSV, Markdown, HTML, DOCX, PDF, and SARIF from one report model.
@@ -0,0 +1,31 @@
1
+ # Module Ecosystem
2
+
3
+ Third-party modules use the same [module contract](module-contract.md) as built-in modules. A module package is a folder containing `module.json` and its entry file. For npm packages, `module.json` may sit at the package root or in a `cantarella/` folder inside the package.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ canta modules install ./path/to/module
9
+ canta modules install npm:some-cantarella-module
10
+ ```
11
+
12
+ Installed modules live under `.cantarella/modules/` and are recorded in `.cantarella/installed.json` with their source and a SHA-256 checksum of the installed files.
13
+
14
+ ## Verify
15
+
16
+ ```bash
17
+ canta modules verify
18
+ canta modules verify recon/my-module
19
+ ```
20
+
21
+ Verification recomputes the checksum and reports `OK` or `MISMATCH`.
22
+
23
+ ## Create from a template
24
+
25
+ ```bash
26
+ canta modules create recon/my-module --template typescript
27
+ canta modules create recon/my-module --template python
28
+ canta modules create recon/my-module --template go
29
+ ```
30
+
31
+ Templates are created under `modules/` and run through the same JSON contract. Python entries run with `python3`, Go entries with `go run`, and JavaScript/TypeScript entries with Node.js.
@@ -0,0 +1,11 @@
1
+ # Security Model
2
+
3
+ Cantarella runs modules as local child processes. A module receives one JSON run request on stdin and emits JSON Lines events on stdout. Modules are code: only install modules you trust, and verify installed checksums with `canta modules verify`.
4
+
5
+ External tools are detected on the user's system and are never bundled or updated by Cantarella. Internal tools update through the Update Tools flow; the core updates only when the core itself changes.
6
+
7
+ The GUI is local-only: it binds to `127.0.0.1` and rejects non-local Host headers, cross-origin requests, and non-JSON run requests, so a website the user visits cannot trigger module runs through the browser. Do not expose or deploy the GUI publicly.
8
+
9
+ Risk labels and banners are informative. They tell the user what a category or module can do without adding blocking steps.
10
+
11
+ Use Cantarella only on systems you own or are authorized to test. Keep run results and raw evidence private; they can contain sensitive target data.
@@ -0,0 +1,33 @@
1
+ # Writing Modules
2
+
3
+ A module is a folder under `modules/` with two files:
4
+
5
+ ```text
6
+ modules/my-module/
7
+ module.json
8
+ index.mjs
9
+ ```
10
+
11
+ `module.json` follows the [module contract](module-contract.md). The entry file can be written in any language as long as it reads one JSON run request from stdin and writes JSON Lines events to stdout. Native modules in this repository use Node.js; wrapper modules run an external tool, declare it in `external_tools`, and normalize its output.
12
+
13
+ Minimal entry:
14
+
15
+ ```js
16
+ let input = "";
17
+ process.stdin.setEncoding("utf8");
18
+ process.stdin.on("data", (chunk) => (input += chunk));
19
+ process.stdin.on("end", () => {
20
+ const request = JSON.parse(input || "{}");
21
+ const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
22
+ emit({ type: "result", summary: `Checked ${request.target}.`, data: {} });
23
+ emit({ type: "done", summary: "Finished." });
24
+ });
25
+ ```
26
+
27
+ Check your module with:
28
+
29
+ ```bash
30
+ node packages/cli/dist/cli.js modules list
31
+ node packages/cli/dist/cli.js doctor
32
+ node packages/cli/dist/cli.js run <module-id> --target <target>
33
+ ```
@@ -0,0 +1,44 @@
1
+ import { readFile } from "node:fs/promises";
2
+
3
+ let input = "";
4
+ process.stdin.setEncoding("utf8");
5
+ process.stdin.on("data", (chunk) => (input += chunk));
6
+ process.stdin.on("end", async () => {
7
+ const request = JSON.parse(input || "{}");
8
+ const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
9
+ try {
10
+ const text = await readFile(request.target, "utf8");
11
+ const lines = text.split("\n").filter(Boolean);
12
+ const ips = new Map();
13
+ let failedLogins = 0;
14
+ let successfulLogins = 0;
15
+ for (const line of lines) {
16
+ for (const match of line.matchAll(/\b(?:\d{1,3}\.){3}\d{1,3}\b/g)) {
17
+ ips.set(match[0], (ips.get(match[0]) ?? 0) + 1);
18
+ }
19
+ if (/failed password|authentication failure|login failed/i.test(line)) failedLogins += 1;
20
+ if (/accepted password|login successful|session opened/i.test(line)) successfulLogins += 1;
21
+ }
22
+ const topIps = [...ips.entries()]
23
+ .map(([ip, count]) => ({ ip, count }))
24
+ .sort((a, b) => b.count - a.count)
25
+ .slice(0, 20);
26
+ if (failedLogins >= 10) {
27
+ emit({
28
+ type: "finding",
29
+ title: "Repeated failed logins in log file",
30
+ severity: "medium",
31
+ description: `${failedLogins} failed login events were found.`,
32
+ });
33
+ }
34
+ emit({
35
+ type: "result",
36
+ summary: `Analyzed ${lines.length} log lines: ${failedLogins} failed logins, ${successfulLogins} successful logins, ${ips.size} source IPs.`,
37
+ data: { lines: lines.length, failed_logins: failedLogins, successful_logins: successfulLogins, top_ips: topIps },
38
+ });
39
+ emit({ type: "done", summary: `Log analysis finished: ${failedLogins} failed logins, ${successfulLogins} successful logins.` });
40
+ } catch (error) {
41
+ emit({ type: "error", message: `Could not read log file: ${error.message}` });
42
+ process.exitCode = 1;
43
+ }
44
+ });
@@ -0,0 +1,14 @@
1
+ {
2
+ "schema_version": 1,
3
+ "id": "blue-team/log-analyzer",
4
+ "name": "Log Analyzer",
5
+ "version": "0.1.0",
6
+ "category": "blue-team",
7
+ "kind": "native",
8
+ "risk": "low",
9
+ "description": "Analyzes a local log file for failed logins, source IPs, and indicators.",
10
+ "entry": "index.mjs",
11
+ "core_api": "^0.1.0",
12
+ "maintenance": "active",
13
+ "options": []
14
+ }
@@ -0,0 +1,17 @@
1
+ let input = "";
2
+ process.stdin.setEncoding("utf8");
3
+ process.stdin.on("data", (chunk) => {
4
+ input += chunk;
5
+ });
6
+ process.stdin.on("end", () => {
7
+ const request = JSON.parse(input || "{}");
8
+ const target = request.target || "world";
9
+ const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
10
+ emit({ type: "progress", message: "Hello module started.", percent: 50 });
11
+ emit({
12
+ type: "result",
13
+ summary: `Hello, ${target}.`,
14
+ data: { target, message: "The module contract works." },
15
+ });
16
+ emit({ type: "done", summary: `Hello module finished for ${target}.` });
17
+ });
@@ -0,0 +1 @@
1
+ {"category":"lab","core_api":"^0.1.0","description":"Example module that proves the manifest and JSON contract.","entry":"index.mjs","id":"hello","kind":"native","maintenance":"active","name":"Hello Module","options":[],"risk":"info","schema_version":1,"version":"0.1.0"}
@@ -0,0 +1,58 @@
1
+ import net from "node:net";
2
+
3
+ let input = "";
4
+ process.stdin.setEncoding("utf8");
5
+ process.stdin.on("data", (chunk) => (input += chunk));
6
+ process.stdin.on("end", async () => {
7
+ const request = JSON.parse(input || "{}");
8
+ const emit = (event) => process.stdout.write(`${JSON.stringify(event)}\n`);
9
+ const target = request.target;
10
+ if (!target) {
11
+ emit({ type: "error", message: "A target host is required." });
12
+ process.exitCode = 1;
13
+ return;
14
+ }
15
+ const ports = parsePorts(String(request.options?.ports ?? "22,80,443"));
16
+ const timeout = Number(request.options?.timeout ?? 800);
17
+ emit({ type: "progress", message: `Scanning ${ports.length} ports on ${target}.`, percent: 10 });
18
+ const open = [];
19
+ await Promise.all(
20
+ ports.map(
21
+ (port) =>
22
+ new Promise((resolve) => {
23
+ const socket = net.createConnection({ host: target, port });
24
+ const finish = (isOpen) => {
25
+ if (isOpen) open.push(port);
26
+ socket.destroy();
27
+ resolve();
28
+ };
29
+ socket.setTimeout(timeout);
30
+ socket.once("connect", () => finish(true));
31
+ socket.once("timeout", () => finish(false));
32
+ socket.once("error", () => finish(false));
33
+ }),
34
+ ),
35
+ );
36
+ open.sort((a, b) => a - b);
37
+ emit({
38
+ type: "result",
39
+ summary: open.length ? `Open ports on ${target}: ${open.join(", ")}.` : `No open ports found on ${target}.`,
40
+ data: { target, open_ports: open, scanned_ports: ports.length },
41
+ });
42
+ emit({ type: "done", summary: `Port scan finished for ${target}: ${open.length} open.` });
43
+ });
44
+
45
+ function parsePorts(value) {
46
+ const ports = new Set();
47
+ for (const part of value.split(",")) {
48
+ const range = part.trim().match(/^(\d+)-(\d+)$/);
49
+ if (range) {
50
+ const start = Number(range[1]);
51
+ const end = Math.min(Number(range[2]), start + 4095);
52
+ for (let port = start; port <= end; port += 1) ports.add(port);
53
+ } else if (/^\d+$/.test(part.trim())) {
54
+ ports.add(Number(part.trim()));
55
+ }
56
+ }
57
+ return [...ports].filter((port) => port >= 1 && port <= 65535).sort((a, b) => a - b);
58
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "schema_version": 1,
3
+ "id": "network/port-scanner",
4
+ "name": "TCP Port Scanner",
5
+ "version": "0.1.0",
6
+ "category": "network",
7
+ "kind": "native",
8
+ "risk": "medium",
9
+ "description": "Native TCP connect scanner for a small set of ports.",
10
+ "entry": "index.mjs",
11
+ "core_api": "^0.1.0",
12
+ "maintenance": "active",
13
+ "options": [
14
+ {
15
+ "name": "ports",
16
+ "type": "string",
17
+ "description": "Comma-separated ports or ranges, for example 22,80,443 or 1-1024.",
18
+ "default": "21,22,25,53,80,110,143,443,993,995,3306,3389,5432,8080,8443"
19
+ },
20
+ {
21
+ "name": "timeout",
22
+ "type": "number",
23
+ "description": "Connection timeout in milliseconds.",
24
+ "default": 800
25
+ }
26
+ ]
27
+ }