@mlabsh/n8n-nodes-mlab 0.1.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.
- package/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/credentials/MlabApi.credentials.d.ts +9 -0
- package/dist/credentials/MlabApi.credentials.js +45 -0
- package/dist/credentials/MlabApi.credentials.js.map +1 -0
- package/dist/nodes/MlabCore/MlabCore.node.d.ts +5 -0
- package/dist/nodes/MlabCore/MlabCore.node.js +348 -0
- package/dist/nodes/MlabCore/MlabCore.node.js.map +1 -0
- package/dist/nodes/MlabCore/mlab.svg +9 -0
- package/dist/nodes/MlabCve/MlabCve.node.d.ts +5 -0
- package/dist/nodes/MlabCve/MlabCve.node.js +161 -0
- package/dist/nodes/MlabCve/MlabCve.node.js.map +1 -0
- package/dist/nodes/MlabCve/mlab.svg +9 -0
- package/dist/nodes/MlabThreatActors/MlabThreatActors.node.d.ts +5 -0
- package/dist/nodes/MlabThreatActors/MlabThreatActors.node.js +167 -0
- package/dist/nodes/MlabThreatActors/MlabThreatActors.node.js.map +1 -0
- package/dist/nodes/MlabThreatActors/mlab.svg +9 -0
- package/dist/nodes/shared/GenericFunctions.d.ts +6 -0
- package/dist/nodes/shared/GenericFunctions.js +75 -0
- package/dist/nodes/shared/GenericFunctions.js.map +1 -0
- package/package.json +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mlab.sh
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# @mlabsh/n8n-nodes-mlab
|
|
2
|
+
|
|
3
|
+
n8n community nodes for [**mlab.sh**](https://mlab.sh) — bring core scanning, CVE
|
|
4
|
+
vulnerability intelligence and threat-actor data into your n8n workflows.
|
|
5
|
+
|
|
6
|
+
This package ships three nodes:
|
|
7
|
+
|
|
8
|
+
| Node | Service | Auth |
|
|
9
|
+
|------|---------|------|
|
|
10
|
+
| **mlab.sh Core** | `mlab.sh/api/v1` — domain / IP / crypto / file scans | API key |
|
|
11
|
+
| **mlab.sh CVE** | `vuln.mlab.sh/api/v1` — CVE search & details | none (public) |
|
|
12
|
+
| **mlab.sh Threat Actors** | `actors.mlab.sh/api/v1` — threat-actor intel | none (public) |
|
|
13
|
+
|
|
14
|
+
[Installation](#installation) · [Credentials](#credentials) · [Operations](#operations) · [Local development](#local-development) · [Publishing to npm](#publishing-to-npm) · [Becoming a verified / official node](#becoming-a-verified--official-node)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
### From the n8n UI (recommended)
|
|
21
|
+
|
|
22
|
+
1. In n8n, go to **Settings → Community Nodes → Install**.
|
|
23
|
+
2. Enter the npm package name: `@mlabsh/n8n-nodes-mlab`.
|
|
24
|
+
3. Agree to the risk prompt and install.
|
|
25
|
+
|
|
26
|
+
> Community nodes require `N8N_COMMUNITY_PACKAGES_ENABLED=true` (the default on self-hosted instances). On **n8n Cloud**, only *verified* community nodes can be installed (see below).
|
|
27
|
+
|
|
28
|
+
### Manually (self-hosted)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cd ~/.n8n/nodes # or your N8N_CUSTOM_EXTENSIONS path
|
|
32
|
+
npm install @mlabsh/n8n-nodes-mlab
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Restart n8n afterwards.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Credentials
|
|
40
|
+
|
|
41
|
+
Only the **Core** node needs credentials.
|
|
42
|
+
|
|
43
|
+
1. Create an API key at **mlab.sh → Account → Settings → API Keys** (it starts with `mlab_`).
|
|
44
|
+
2. In n8n, add a new **mlab.sh API** credential and paste the key.
|
|
45
|
+
3. The node sends it as `Authorization: token mlab_...`. The credential's *Test* button hits `GET /limit/ip` to validate the key.
|
|
46
|
+
|
|
47
|
+
The **CVE** and **Threat Actors** nodes call public, unauthenticated APIs — no credential required.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Operations
|
|
52
|
+
|
|
53
|
+
### mlab.sh Core
|
|
54
|
+
|
|
55
|
+
- **Domain → Scan** — launches `POST /scan/domain`. With *Wait for Completion* on (default) it polls `/scan/domain/status` and returns the full `/scan/domain/results` payload (subdomains, DNS, SSL, security.txt…).
|
|
56
|
+
- **Domain → Get Status** / **Get Results** — for managing an async scan yourself.
|
|
57
|
+
- **IP → Lookup** — `GET /scan/ip` (geolocation, ASN, ownership).
|
|
58
|
+
- **Crypto → Lookup** — `GET /scan/crypto` (sanctions, labels, risk score). Chain auto-detected or forced.
|
|
59
|
+
- **File → Upload** — `POST /upload/file` from an input binary field (max 10MB) and returns the `sha256`.
|
|
60
|
+
- **File → Get Results** — `GET /scan/file/results?sha256=…`.
|
|
61
|
+
- **Quota → Get** — remaining daily quota for a scan type (`GET /limit/{type}`).
|
|
62
|
+
|
|
63
|
+
### mlab.sh CVE
|
|
64
|
+
|
|
65
|
+
- **Search** — `GET /cve?q=…` with optional `severity`, `dateStart`, `exact`, `kev` filters.
|
|
66
|
+
- **Get** — `GET /cve/CVE-XXXX-XXXX` (full detail incl. EPSS & KEV).
|
|
67
|
+
- **Get Latest** — `GET /cve/latest` (last 7 days).
|
|
68
|
+
|
|
69
|
+
### mlab.sh Threat Actors
|
|
70
|
+
|
|
71
|
+
- **List / Search** — `GET /actors` with `origin`, `motivation`, `sector`, `limit`, `offset`.
|
|
72
|
+
- **Get** — `GET /actors/:slug` (aliases, tools, CVEs, techniques).
|
|
73
|
+
- **Get by CVE** — `GET /cves/CVE-XXXX-XXXX/actors` (reverse lookup).
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Local development
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install
|
|
81
|
+
npm run build # compiles TS → dist/ and copies icons
|
|
82
|
+
npm run lint # n8n-nodes-base lint rules
|
|
83
|
+
|
|
84
|
+
# Link into a local n8n for testing:
|
|
85
|
+
npm link
|
|
86
|
+
cd ~/.n8n/nodes && npm link @mlabsh/n8n-nodes-mlab
|
|
87
|
+
n8n start
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Requires Node ≥ 20.15 (same as n8n).
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Publishing to npm
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm login # scope @mlabsh must exist / you must own it
|
|
98
|
+
npm run build
|
|
99
|
+
npm publish --access public # scoped packages are private by default
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`prepublishOnly` re-runs the build + lint, and `.npmignore` ships only `dist/`, `package.json`, `README.md` and `LICENSE`.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Becoming a verified / official node
|
|
107
|
+
|
|
108
|
+
n8n has three tiers. This package starts at tier 1.
|
|
109
|
+
|
|
110
|
+
1. **Community node (now).** Any package named `n8n-nodes-*` (or scoped `@scope/n8n-nodes-*`) published to npm with the `n8n-community-node-package` keyword. Installable on self-hosted n8n immediately after `npm publish`.
|
|
111
|
+
|
|
112
|
+
2. **Verified community node** (installable on n8n Cloud). Submit the package for n8n's review. Requirements:
|
|
113
|
+
- Package name matches `n8n-nodes-*` / `@scope/n8n-nodes-*` ✅
|
|
114
|
+
- `package.json` declares `n8n.n8nNodesApiVersion`, `nodes`, `credentials` ✅
|
|
115
|
+
- Passes `eslint-plugin-n8n-nodes-base` with **zero errors** on the `community`, `nodes` and `credentials` rulesets — run `npm run lint` ✅ (a few opinionated rules are relaxed in `.eslintrc.js`; tighten them before submitting)
|
|
116
|
+
- No runtime dependencies beyond `n8n-workflow` (this package has none) ✅
|
|
117
|
+
- Icons, `description`, `documentationUrl`, codex/category metadata present
|
|
118
|
+
- Submit via the form linked from n8n's docs: **Creating nodes → Submit community nodes for verification** (<https://docs.n8n.io/integrations/creating-nodes/deploy/submit-community-nodes/>). n8n reviews the source and, once approved, the node appears in the in-app nodes panel and is installable on Cloud.
|
|
119
|
+
|
|
120
|
+
3. **Official / built-in node** (ships inside n8n core). This is owned by n8n, not by package authors. The realistic path:
|
|
121
|
+
- Get adoption + verification first (tier 2).
|
|
122
|
+
- Open a discussion/issue on <https://github.com/n8n-io/n8n> proposing the integration, or contact n8n's partnerships team (integrations are often prioritised via the partner program).
|
|
123
|
+
- If accepted, the node source is contributed into the `n8n-nodes-base` package via PR following n8n's contribution guide. From then on n8n maintains it and the community package can be deprecated.
|
|
124
|
+
|
|
125
|
+
**Recommended sequence:** publish this package → gather usage → submit for verification (tier 2) → propose upstreaming to n8n core (tier 3).
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
[MIT](LICENSE) · Threat-actor data is sourced from ETDA under CC BY-NC-SA 4.0.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class MlabApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
authenticate: IAuthenticateGeneric;
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MlabApi = void 0;
|
|
4
|
+
class MlabApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'mlabApi';
|
|
7
|
+
this.displayName = 'mlab.sh API';
|
|
8
|
+
this.documentationUrl = 'https://mlab.sh/developer/documentation';
|
|
9
|
+
this.properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'API Key',
|
|
12
|
+
name: 'apiKey',
|
|
13
|
+
type: 'string',
|
|
14
|
+
typeOptions: { password: true },
|
|
15
|
+
default: '',
|
|
16
|
+
required: true,
|
|
17
|
+
description: 'Your mlab.sh API key (starts with "mlab_"). Generate one under Account → Settings → API Keys.',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Base URL',
|
|
21
|
+
name: 'baseUrl',
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: 'https://mlab.sh/api/v1',
|
|
24
|
+
description: 'Base URL of the mlab.sh core API. Only change this for self-hosted instances.',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
this.authenticate = {
|
|
28
|
+
type: 'generic',
|
|
29
|
+
properties: {
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: '=token {{$credentials.apiKey}}',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
this.test = {
|
|
36
|
+
request: {
|
|
37
|
+
baseURL: '={{$credentials.baseUrl}}',
|
|
38
|
+
url: '/limit/ip',
|
|
39
|
+
method: 'GET',
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.MlabApi = MlabApi;
|
|
45
|
+
//# sourceMappingURL=MlabApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MlabApi.credentials.js","sourceRoot":"","sources":["../../credentials/MlabApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,OAAO;IAApB;QACC,SAAI,GAAG,SAAS,CAAC;QAEjB,gBAAW,GAAG,aAAa,CAAC;QAE5B,qBAAgB,GAAG,yCAAyC,CAAC;QAE7D,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EACV,+FAA+F;aAChG;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,wBAAwB;gBACjC,WAAW,EAAE,+EAA+E;aAC5F;SACD,CAAC;QAGF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,gCAAgC;iBAC/C;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,2BAA2B;gBACpC,GAAG,EAAE,WAAW;gBAChB,MAAM,EAAE,KAAK;aACb;SACD,CAAC;IACH,CAAC;CAAA;AA5CD,0BA4CC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class MlabCore implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MlabCore = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const GenericFunctions_1 = require("../shared/GenericFunctions");
|
|
6
|
+
class MlabCore {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.description = {
|
|
9
|
+
displayName: 'mlab.sh Core',
|
|
10
|
+
name: 'mlabCore',
|
|
11
|
+
icon: 'file:mlab.svg',
|
|
12
|
+
group: ['transform'],
|
|
13
|
+
version: 1,
|
|
14
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
15
|
+
description: 'Run mlab.sh core scans: domain, IP, crypto address, and file analysis',
|
|
16
|
+
defaults: {
|
|
17
|
+
name: 'mlab.sh Core',
|
|
18
|
+
},
|
|
19
|
+
inputs: ['main'],
|
|
20
|
+
outputs: ['main'],
|
|
21
|
+
credentials: [
|
|
22
|
+
{
|
|
23
|
+
name: 'mlabApi',
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
properties: [
|
|
28
|
+
{
|
|
29
|
+
displayName: 'Resource',
|
|
30
|
+
name: 'resource',
|
|
31
|
+
type: 'options',
|
|
32
|
+
noDataExpression: true,
|
|
33
|
+
options: [
|
|
34
|
+
{ name: 'Crypto Address', value: 'crypto' },
|
|
35
|
+
{ name: 'Domain', value: 'domain' },
|
|
36
|
+
{ name: 'File', value: 'file' },
|
|
37
|
+
{ name: 'IP Address', value: 'ip' },
|
|
38
|
+
{ name: 'Quota', value: 'quota' },
|
|
39
|
+
],
|
|
40
|
+
default: 'domain',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Operation',
|
|
44
|
+
name: 'operation',
|
|
45
|
+
type: 'options',
|
|
46
|
+
noDataExpression: true,
|
|
47
|
+
displayOptions: { show: { resource: ['domain'] } },
|
|
48
|
+
options: [
|
|
49
|
+
{
|
|
50
|
+
name: 'Scan',
|
|
51
|
+
value: 'scan',
|
|
52
|
+
action: 'Scan a domain',
|
|
53
|
+
description: 'Launch a domain scan and (optionally) wait for the results',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Get Status',
|
|
57
|
+
value: 'status',
|
|
58
|
+
action: 'Get the status of a domain scan',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Get Results',
|
|
62
|
+
value: 'results',
|
|
63
|
+
action: 'Get the results of a domain scan',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
default: 'scan',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Domain',
|
|
70
|
+
name: 'domain',
|
|
71
|
+
type: 'string',
|
|
72
|
+
required: true,
|
|
73
|
+
default: '',
|
|
74
|
+
placeholder: 'example.com',
|
|
75
|
+
displayOptions: { show: { resource: ['domain'] } },
|
|
76
|
+
description: 'The domain to scan (without protocol)',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Wait for Completion',
|
|
80
|
+
name: 'waitForCompletion',
|
|
81
|
+
type: 'boolean',
|
|
82
|
+
default: true,
|
|
83
|
+
displayOptions: { show: { resource: ['domain'], operation: ['scan'] } },
|
|
84
|
+
description: 'Whether to poll until the scan finishes and return the full results. If disabled, only the job acknowledgement is returned.',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
displayName: 'Timeout (Seconds)',
|
|
88
|
+
name: 'timeout',
|
|
89
|
+
type: 'number',
|
|
90
|
+
default: 120,
|
|
91
|
+
typeOptions: { minValue: 10 },
|
|
92
|
+
displayOptions: {
|
|
93
|
+
show: { resource: ['domain'], operation: ['scan'], waitForCompletion: [true] },
|
|
94
|
+
},
|
|
95
|
+
description: 'How long to wait for the scan to complete before giving up',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
displayName: 'Operation',
|
|
99
|
+
name: 'operation',
|
|
100
|
+
type: 'options',
|
|
101
|
+
noDataExpression: true,
|
|
102
|
+
displayOptions: { show: { resource: ['ip'] } },
|
|
103
|
+
options: [
|
|
104
|
+
{
|
|
105
|
+
name: 'Lookup',
|
|
106
|
+
value: 'lookup',
|
|
107
|
+
action: 'Look up an IP address',
|
|
108
|
+
description: 'Resolve geolocation, ASN and ownership for an IP address',
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
default: 'lookup',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
displayName: 'IP Address',
|
|
115
|
+
name: 'ip',
|
|
116
|
+
type: 'string',
|
|
117
|
+
required: true,
|
|
118
|
+
default: '',
|
|
119
|
+
placeholder: '8.8.8.8',
|
|
120
|
+
displayOptions: { show: { resource: ['ip'] } },
|
|
121
|
+
description: 'IPv4 or IPv6 address to look up',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
displayName: 'Operation',
|
|
125
|
+
name: 'operation',
|
|
126
|
+
type: 'options',
|
|
127
|
+
noDataExpression: true,
|
|
128
|
+
displayOptions: { show: { resource: ['crypto'] } },
|
|
129
|
+
options: [
|
|
130
|
+
{
|
|
131
|
+
name: 'Lookup',
|
|
132
|
+
value: 'lookup',
|
|
133
|
+
action: 'Look up a crypto address',
|
|
134
|
+
description: 'Check sanctions, labels and risk score for a crypto address',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
default: 'lookup',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
displayName: 'Address',
|
|
141
|
+
name: 'address',
|
|
142
|
+
type: 'string',
|
|
143
|
+
required: true,
|
|
144
|
+
default: '',
|
|
145
|
+
placeholder: '0x...',
|
|
146
|
+
displayOptions: { show: { resource: ['crypto'] } },
|
|
147
|
+
description: 'The crypto address to look up',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
displayName: 'Chain',
|
|
151
|
+
name: 'chain',
|
|
152
|
+
type: 'options',
|
|
153
|
+
default: '',
|
|
154
|
+
displayOptions: { show: { resource: ['crypto'] } },
|
|
155
|
+
description: 'Blockchain of the address. Leave on "Auto-detect" when unsure.',
|
|
156
|
+
options: [
|
|
157
|
+
{ name: 'Arbitrum', value: 'arbitrum' },
|
|
158
|
+
{ name: 'Auto-Detect', value: '' },
|
|
159
|
+
{ name: 'Avalanche', value: 'avax' },
|
|
160
|
+
{ name: 'Base', value: 'base' },
|
|
161
|
+
{ name: 'Bitcoin', value: 'btc' },
|
|
162
|
+
{ name: 'BSC', value: 'bsc' },
|
|
163
|
+
{ name: 'Dogecoin', value: 'doge' },
|
|
164
|
+
{ name: 'Ethereum', value: 'eth' },
|
|
165
|
+
{ name: 'Optimism', value: 'optimism' },
|
|
166
|
+
{ name: 'Polygon', value: 'polygon' },
|
|
167
|
+
{ name: 'Solana', value: 'sol' },
|
|
168
|
+
{ name: 'TON', value: 'ton' },
|
|
169
|
+
{ name: 'Tron', value: 'trx' },
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
displayName: 'Operation',
|
|
174
|
+
name: 'operation',
|
|
175
|
+
type: 'options',
|
|
176
|
+
noDataExpression: true,
|
|
177
|
+
displayOptions: { show: { resource: ['file'] } },
|
|
178
|
+
options: [
|
|
179
|
+
{
|
|
180
|
+
name: 'Upload',
|
|
181
|
+
value: 'upload',
|
|
182
|
+
action: 'Upload a file for analysis',
|
|
183
|
+
description: 'Upload a file (max 10MB) and launch analysis',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'Get Results',
|
|
187
|
+
value: 'results',
|
|
188
|
+
action: 'Get file analysis results',
|
|
189
|
+
description: 'Fetch analysis results by SHA-256 hash',
|
|
190
|
+
},
|
|
191
|
+
],
|
|
192
|
+
default: 'upload',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
displayName: 'Input Binary Field',
|
|
196
|
+
name: 'binaryPropertyName',
|
|
197
|
+
type: 'string',
|
|
198
|
+
default: 'data',
|
|
199
|
+
required: true,
|
|
200
|
+
hint: 'The name of the input binary field containing the file to upload',
|
|
201
|
+
displayOptions: { show: { resource: ['file'], operation: ['upload'] } },
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
displayName: 'SHA-256',
|
|
205
|
+
name: 'sha256',
|
|
206
|
+
type: 'string',
|
|
207
|
+
required: true,
|
|
208
|
+
default: '',
|
|
209
|
+
displayOptions: { show: { resource: ['file'], operation: ['results'] } },
|
|
210
|
+
description: 'SHA-256 hash returned by the upload operation',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
displayName: 'Operation',
|
|
214
|
+
name: 'operation',
|
|
215
|
+
type: 'options',
|
|
216
|
+
noDataExpression: true,
|
|
217
|
+
displayOptions: { show: { resource: ['quota'] } },
|
|
218
|
+
options: [
|
|
219
|
+
{
|
|
220
|
+
name: 'Get',
|
|
221
|
+
value: 'get',
|
|
222
|
+
action: 'Get remaining quota',
|
|
223
|
+
description: 'Get the remaining daily quota for a scan type',
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
default: 'get',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
displayName: 'Scan Type',
|
|
230
|
+
name: 'scanType',
|
|
231
|
+
type: 'options',
|
|
232
|
+
default: 'domain',
|
|
233
|
+
displayOptions: { show: { resource: ['quota'] } },
|
|
234
|
+
options: [
|
|
235
|
+
{ name: 'Domain', value: 'domain' },
|
|
236
|
+
{ name: 'IP', value: 'ip' },
|
|
237
|
+
{ name: 'File', value: 'file' },
|
|
238
|
+
{ name: 'Crypto', value: 'crypto' },
|
|
239
|
+
],
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
async execute() {
|
|
245
|
+
var _a;
|
|
246
|
+
const items = this.getInputData();
|
|
247
|
+
const returnData = [];
|
|
248
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
249
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
250
|
+
for (let i = 0; i < items.length; i++) {
|
|
251
|
+
try {
|
|
252
|
+
let responseData = {};
|
|
253
|
+
if (resource === 'domain') {
|
|
254
|
+
const domain = this.getNodeParameter('domain', i);
|
|
255
|
+
if (operation === 'scan') {
|
|
256
|
+
const waitForCompletion = this.getNodeParameter('waitForCompletion', i);
|
|
257
|
+
const launch = (await GenericFunctions_1.mlabCoreApiRequest.call(this, 'POST', '/scan/domain', {
|
|
258
|
+
domain,
|
|
259
|
+
}));
|
|
260
|
+
if (waitForCompletion) {
|
|
261
|
+
const timeout = this.getNodeParameter('timeout', i);
|
|
262
|
+
const intervalMs = 4000;
|
|
263
|
+
const maxAttempts = Math.max(1, Math.ceil((timeout * 1000) / intervalMs));
|
|
264
|
+
responseData = await GenericFunctions_1.pollDomainScan.call(this, domain, maxAttempts, intervalMs);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
responseData = launch;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
else if (operation === 'status') {
|
|
271
|
+
responseData = (await GenericFunctions_1.mlabCoreApiRequest.call(this, 'GET', '/scan/domain/status', {}, {
|
|
272
|
+
domain,
|
|
273
|
+
}));
|
|
274
|
+
}
|
|
275
|
+
else if (operation === 'results') {
|
|
276
|
+
responseData = (await GenericFunctions_1.mlabCoreApiRequest.call(this, 'GET', '/scan/domain/results', {}, {
|
|
277
|
+
domain,
|
|
278
|
+
}));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
else if (resource === 'ip') {
|
|
282
|
+
const ip = this.getNodeParameter('ip', i);
|
|
283
|
+
responseData = (await GenericFunctions_1.mlabCoreApiRequest.call(this, 'GET', '/scan/ip', {}, {
|
|
284
|
+
ip,
|
|
285
|
+
}));
|
|
286
|
+
}
|
|
287
|
+
else if (resource === 'crypto') {
|
|
288
|
+
const address = this.getNodeParameter('address', i);
|
|
289
|
+
const chain = this.getNodeParameter('chain', i);
|
|
290
|
+
const qs = { address };
|
|
291
|
+
if (chain)
|
|
292
|
+
qs.chain = chain;
|
|
293
|
+
responseData = (await GenericFunctions_1.mlabCoreApiRequest.call(this, 'GET', '/scan/crypto', {}, qs));
|
|
294
|
+
}
|
|
295
|
+
else if (resource === 'file') {
|
|
296
|
+
if (operation === 'upload') {
|
|
297
|
+
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i);
|
|
298
|
+
const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName);
|
|
299
|
+
const buffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
|
300
|
+
responseData = (await GenericFunctions_1.mlabCoreApiRequest.call(this, 'POST', '/upload/file', {}, {}, {
|
|
301
|
+
body: {
|
|
302
|
+
file: {
|
|
303
|
+
value: buffer,
|
|
304
|
+
options: {
|
|
305
|
+
filename: (_a = binaryData.fileName) !== null && _a !== void 0 ? _a : 'file',
|
|
306
|
+
contentType: binaryData.mimeType,
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
311
|
+
json: false,
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
else if (operation === 'results') {
|
|
315
|
+
const sha256 = this.getNodeParameter('sha256', i);
|
|
316
|
+
responseData = (await GenericFunctions_1.mlabCoreApiRequest.call(this, 'GET', '/scan/file/results', {}, {
|
|
317
|
+
sha256,
|
|
318
|
+
}));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else if (resource === 'quota') {
|
|
322
|
+
const scanType = this.getNodeParameter('scanType', i);
|
|
323
|
+
responseData = (await GenericFunctions_1.mlabCoreApiRequest.call(this, 'GET', `/limit/${scanType}`));
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource "${resource}"`, {
|
|
327
|
+
itemIndex: i,
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
331
|
+
returnData.push(...executionData);
|
|
332
|
+
}
|
|
333
|
+
catch (error) {
|
|
334
|
+
if (this.continueOnFail()) {
|
|
335
|
+
returnData.push({
|
|
336
|
+
json: { error: error.message },
|
|
337
|
+
pairedItem: { item: i },
|
|
338
|
+
});
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
throw error;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return [returnData];
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
exports.MlabCore = MlabCore;
|
|
348
|
+
//# sourceMappingURL=MlabCore.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MlabCore.node.js","sourceRoot":"","sources":["../../../nodes/MlabCore/MlabCore.node.ts"],"names":[],"mappings":";;;AAOA,+CAAkD;AAElD,iEAAgF;AAEhF,MAAa,QAAQ;IAArB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,cAAc;YAC3B,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EAAE,uEAAuE;YACpF,QAAQ,EAAE;gBACT,IAAI,EAAE,cAAc;aACpB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,SAAS;oBACf,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAA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AAO,EAAE,CAAC;oBACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAW,CAAC;oBAChE,YAAY,GAAG,CAAC,MAAM,qCAAkB,CAAC,IAAI,CAC5C,IAAI,EACJ,KAAK,EACL,UAAU,QAAQ,EAAE,CACpB,CAAgB,CAAC;gBACnB,CAAC;qBAAM,CAAC;oBACP,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,qBAAqB,QAAQ,GAAG,EAAE;wBAC9E,SAAS,EAAE,CAAC;qBACZ,CAAC,CAAC;gBACJ,CAAC;gBAED,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAC5D,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAA2C,CAAC,EACzE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CACzB,CAAC;gBACF,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAjXD,4BAiXC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="none">
|
|
2
|
+
<g fill="#000000" stroke="#ffffff" stroke-width="2.5" stroke-linejoin="round" paint-order="stroke fill">
|
|
3
|
+
<polygon points="257.93,24.96 117.83,161.85 307.41,352.4 195.27,426.3 255.04,487.04 395.46,348.22 204.91,155.75 230.29,129.72 254.07,151.25 318.34,86.66"/>
|
|
4
|
+
<polygon points="87.3,192.38 24.0,256.96 88.91,319.62 151.89,255.04"/>
|
|
5
|
+
<polygon points="423.73,193.34 361.4,256.96 425.66,318.98 488.0,254.71"/>
|
|
6
|
+
<polygon points="185.95,283.63 118.15,349.83 164.1,396.74 231.9,330.55"/>
|
|
7
|
+
<polygon points="350.15,116.86 284.28,180.81 330.55,228.04 396.42,164.1"/>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MlabCve = void 0;
|
|
4
|
+
const GenericFunctions_1 = require("../shared/GenericFunctions");
|
|
5
|
+
class MlabCve {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'mlab.sh CVE',
|
|
9
|
+
name: 'mlabCve',
|
|
10
|
+
icon: 'file:mlab.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
14
|
+
description: 'Search and retrieve CVE vulnerability data from vuln.mlab.sh',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'mlab.sh CVE',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
properties: [
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Operation',
|
|
23
|
+
name: 'operation',
|
|
24
|
+
type: 'options',
|
|
25
|
+
noDataExpression: true,
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
name: 'Search',
|
|
29
|
+
value: 'search',
|
|
30
|
+
action: 'Search vulnerabilities',
|
|
31
|
+
description: 'Search vulnerabilities by keyword, vendor or product',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Get',
|
|
35
|
+
value: 'get',
|
|
36
|
+
action: 'Get a CVE by ID',
|
|
37
|
+
description: 'Retrieve full details for a CVE (including EPSS and KEV data)',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Get Latest',
|
|
41
|
+
value: 'latest',
|
|
42
|
+
action: 'Get latest vulnerabilities',
|
|
43
|
+
description: 'Fetch vulnerabilities from the last 7 days',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
default: 'search',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
displayName: 'CVE ID',
|
|
50
|
+
name: 'cveId',
|
|
51
|
+
type: 'string',
|
|
52
|
+
required: true,
|
|
53
|
+
default: '',
|
|
54
|
+
placeholder: 'CVE-2024-3094',
|
|
55
|
+
displayOptions: { show: { operation: ['get'] } },
|
|
56
|
+
description: 'The CVE identifier to retrieve',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Query',
|
|
60
|
+
name: 'query',
|
|
61
|
+
type: 'string',
|
|
62
|
+
required: true,
|
|
63
|
+
default: '',
|
|
64
|
+
placeholder: 'openssl',
|
|
65
|
+
displayOptions: { show: { operation: ['search'] } },
|
|
66
|
+
description: 'Keyword, vendor or product name to search for',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Filters',
|
|
70
|
+
name: 'filters',
|
|
71
|
+
type: 'collection',
|
|
72
|
+
placeholder: 'Add Filter',
|
|
73
|
+
default: {},
|
|
74
|
+
displayOptions: { show: { operation: ['search'] } },
|
|
75
|
+
options: [
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Severity',
|
|
78
|
+
name: 'severity',
|
|
79
|
+
type: 'options',
|
|
80
|
+
default: 'CRITICAL',
|
|
81
|
+
options: [
|
|
82
|
+
{ name: 'Critical', value: 'CRITICAL' },
|
|
83
|
+
{ name: 'High', value: 'HIGH' },
|
|
84
|
+
{ name: 'Medium', value: 'MEDIUM' },
|
|
85
|
+
{ name: 'Low', value: 'LOW' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Published After',
|
|
90
|
+
name: 'dateStart',
|
|
91
|
+
type: 'dateTime',
|
|
92
|
+
default: '',
|
|
93
|
+
description: 'Only return CVEs published on or after this date',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
displayName: 'Exact Match',
|
|
97
|
+
name: 'exact',
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
default: false,
|
|
100
|
+
description: 'Whether to perform an exact-match search instead of fuzzy',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
displayName: 'Known Exploited Only (KEV)',
|
|
104
|
+
name: 'kev',
|
|
105
|
+
type: 'boolean',
|
|
106
|
+
default: false,
|
|
107
|
+
description: 'Whether to only return CVEs in the CISA Known Exploited Vulnerabilities catalog',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async execute() {
|
|
115
|
+
const items = this.getInputData();
|
|
116
|
+
const returnData = [];
|
|
117
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
118
|
+
for (let i = 0; i < items.length; i++) {
|
|
119
|
+
try {
|
|
120
|
+
let responseData = {};
|
|
121
|
+
if (operation === 'get') {
|
|
122
|
+
const cveId = this.getNodeParameter('cveId', i).trim().toUpperCase();
|
|
123
|
+
responseData = (await GenericFunctions_1.mlabPublicApiRequest.call(this, GenericFunctions_1.MLAB_CVE_BASE_URL, 'GET', `/cve/${encodeURIComponent(cveId)}`));
|
|
124
|
+
}
|
|
125
|
+
else if (operation === 'latest') {
|
|
126
|
+
responseData = (await GenericFunctions_1.mlabPublicApiRequest.call(this, GenericFunctions_1.MLAB_CVE_BASE_URL, 'GET', '/cve/latest'));
|
|
127
|
+
}
|
|
128
|
+
else if (operation === 'search') {
|
|
129
|
+
const query = this.getNodeParameter('query', i);
|
|
130
|
+
const filters = this.getNodeParameter('filters', i, {});
|
|
131
|
+
const qs = { q: query };
|
|
132
|
+
if (filters.severity)
|
|
133
|
+
qs.severity = filters.severity;
|
|
134
|
+
if (filters.exact)
|
|
135
|
+
qs.exact = 1;
|
|
136
|
+
if (filters.kev)
|
|
137
|
+
qs.kev = 1;
|
|
138
|
+
if (filters.dateStart) {
|
|
139
|
+
qs.dateStart = filters.dateStart.slice(0, 10);
|
|
140
|
+
}
|
|
141
|
+
responseData = (await GenericFunctions_1.mlabPublicApiRequest.call(this, GenericFunctions_1.MLAB_CVE_BASE_URL, 'GET', '/cve', qs));
|
|
142
|
+
}
|
|
143
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
144
|
+
returnData.push(...executionData);
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (this.continueOnFail()) {
|
|
148
|
+
returnData.push({
|
|
149
|
+
json: { error: error.message },
|
|
150
|
+
pairedItem: { item: i },
|
|
151
|
+
});
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return [returnData];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.MlabCve = MlabCve;
|
|
161
|
+
//# sourceMappingURL=MlabCve.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MlabCve.node.js","sourceRoot":"","sources":["../../../nodes/MlabCve/MlabCve.node.ts"],"names":[],"mappings":";;;AAQA,iEAAqF;AAErF,MAAa,OAAO;IAApB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8BAA8B;YACxC,WAAW,EAAE,8DAA8D;YAC3E,QAAQ,EAAE;gBACT,IAAI,EAAE,aAAa;aACnB;Y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AE,CAAC,SAAS,GAAI,OAAO,CAAC,SAAoB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC3D,CAAC;oBAED,YAAY,GAAG,CAAC,MAAM,uCAAoB,CAAC,IAAI,CAC9C,IAAI,EACJ,oCAAiB,EACjB,KAAK,EACL,MAAM,EACN,EAAE,CACF,CAAgB,CAAC;gBACnB,CAAC;gBAED,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAC5D,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,YAA2C,CAAC,EACzE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,CACzB,CAAC;gBACF,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAtLD,0BAsLC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="none">
|
|
2
|
+
<g fill="#000000" stroke="#ffffff" stroke-width="2.5" stroke-linejoin="round" paint-order="stroke fill">
|
|
3
|
+
<polygon points="257.93,24.96 117.83,161.85 307.41,352.4 195.27,426.3 255.04,487.04 395.46,348.22 204.91,155.75 230.29,129.72 254.07,151.25 318.34,86.66"/>
|
|
4
|
+
<polygon points="87.3,192.38 24.0,256.96 88.91,319.62 151.89,255.04"/>
|
|
5
|
+
<polygon points="423.73,193.34 361.4,256.96 425.66,318.98 488.0,254.71"/>
|
|
6
|
+
<polygon points="185.95,283.63 118.15,349.83 164.1,396.74 231.9,330.55"/>
|
|
7
|
+
<polygon points="350.15,116.86 284.28,180.81 330.55,228.04 396.42,164.1"/>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class MlabThreatActors implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MlabThreatActors = void 0;
|
|
4
|
+
const GenericFunctions_1 = require("../shared/GenericFunctions");
|
|
5
|
+
class MlabThreatActors {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.description = {
|
|
8
|
+
displayName: 'mlab.sh Threat Actors',
|
|
9
|
+
name: 'mlabThreatActors',
|
|
10
|
+
icon: 'file:mlab.svg',
|
|
11
|
+
group: ['transform'],
|
|
12
|
+
version: 1,
|
|
13
|
+
subtitle: '={{$parameter["operation"]}}',
|
|
14
|
+
description: 'Look up cyber threat actor intelligence from actors.mlab.sh',
|
|
15
|
+
defaults: {
|
|
16
|
+
name: 'mlab.sh Threat Actors',
|
|
17
|
+
},
|
|
18
|
+
inputs: ['main'],
|
|
19
|
+
outputs: ['main'],
|
|
20
|
+
properties: [
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Operation',
|
|
23
|
+
name: 'operation',
|
|
24
|
+
type: 'options',
|
|
25
|
+
noDataExpression: true,
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
name: 'List / Search',
|
|
29
|
+
value: 'list',
|
|
30
|
+
action: 'List or search threat actors',
|
|
31
|
+
description: 'List actors with optional filters (origin, motivation, sector)',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'Get',
|
|
35
|
+
value: 'get',
|
|
36
|
+
action: 'Get a threat actor',
|
|
37
|
+
description: 'Get a single actor by slug, including aliases, tools, CVEs and techniques',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Get by CVE',
|
|
41
|
+
value: 'byCve',
|
|
42
|
+
action: 'Get actors that exploit a CVE',
|
|
43
|
+
description: 'Reverse lookup: which actors are known to exploit a given CVE',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
default: 'list',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
displayName: 'Actor Slug',
|
|
50
|
+
name: 'slug',
|
|
51
|
+
type: 'string',
|
|
52
|
+
required: true,
|
|
53
|
+
default: '',
|
|
54
|
+
placeholder: 'apt28',
|
|
55
|
+
displayOptions: { show: { operation: ['get'] } },
|
|
56
|
+
description: 'The slug of the actor to retrieve',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
displayName: 'CVE ID',
|
|
60
|
+
name: 'cveId',
|
|
61
|
+
type: 'string',
|
|
62
|
+
required: true,
|
|
63
|
+
default: '',
|
|
64
|
+
placeholder: 'CVE-2021-44228',
|
|
65
|
+
displayOptions: { show: { operation: ['byCve'] } },
|
|
66
|
+
description: 'The CVE identifier to reverse-lookup actors for',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Filters',
|
|
70
|
+
name: 'filters',
|
|
71
|
+
type: 'collection',
|
|
72
|
+
placeholder: 'Add Filter',
|
|
73
|
+
default: {},
|
|
74
|
+
displayOptions: { show: { operation: ['list'] } },
|
|
75
|
+
options: [
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Origin',
|
|
78
|
+
name: 'origin',
|
|
79
|
+
type: 'string',
|
|
80
|
+
default: '',
|
|
81
|
+
description: 'Filter by country of origin (e.g. "China", "Russia")',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
displayName: 'Motivation',
|
|
85
|
+
name: 'motivation',
|
|
86
|
+
type: 'string',
|
|
87
|
+
default: '',
|
|
88
|
+
placeholder: 'Espionage',
|
|
89
|
+
description: 'Filter by motivation type',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Sector',
|
|
93
|
+
name: 'sector',
|
|
94
|
+
type: 'string',
|
|
95
|
+
default: '',
|
|
96
|
+
placeholder: 'Government',
|
|
97
|
+
description: 'Filter by targeted sector',
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
displayName: 'Limit',
|
|
103
|
+
name: 'limit',
|
|
104
|
+
type: 'number',
|
|
105
|
+
typeOptions: { minValue: 1 },
|
|
106
|
+
default: 50,
|
|
107
|
+
displayOptions: { show: { operation: ['list'] } },
|
|
108
|
+
description: 'Max number of results to return',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
displayName: 'Offset',
|
|
112
|
+
name: 'offset',
|
|
113
|
+
type: 'number',
|
|
114
|
+
default: 0,
|
|
115
|
+
displayOptions: { show: { operation: ['list'] } },
|
|
116
|
+
description: 'Number of results to skip (for pagination)',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
async execute() {
|
|
122
|
+
const items = this.getInputData();
|
|
123
|
+
const returnData = [];
|
|
124
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
125
|
+
for (let i = 0; i < items.length; i++) {
|
|
126
|
+
try {
|
|
127
|
+
let responseData = {};
|
|
128
|
+
if (operation === 'get') {
|
|
129
|
+
const slug = this.getNodeParameter('slug', i).trim();
|
|
130
|
+
responseData = (await GenericFunctions_1.mlabPublicApiRequest.call(this, GenericFunctions_1.MLAB_ACTORS_BASE_URL, 'GET', `/actors/${encodeURIComponent(slug)}`));
|
|
131
|
+
}
|
|
132
|
+
else if (operation === 'byCve') {
|
|
133
|
+
const cveId = this.getNodeParameter('cveId', i).trim().toUpperCase();
|
|
134
|
+
responseData = (await GenericFunctions_1.mlabPublicApiRequest.call(this, GenericFunctions_1.MLAB_ACTORS_BASE_URL, 'GET', `/cves/${encodeURIComponent(cveId)}/actors`));
|
|
135
|
+
}
|
|
136
|
+
else if (operation === 'list') {
|
|
137
|
+
const filters = this.getNodeParameter('filters', i, {});
|
|
138
|
+
const limit = this.getNodeParameter('limit', i);
|
|
139
|
+
const offset = this.getNodeParameter('offset', i);
|
|
140
|
+
const qs = { limit, offset };
|
|
141
|
+
if (filters.origin)
|
|
142
|
+
qs.origin = filters.origin;
|
|
143
|
+
if (filters.motivation)
|
|
144
|
+
qs.motivation = filters.motivation;
|
|
145
|
+
if (filters.sector)
|
|
146
|
+
qs.sector = filters.sector;
|
|
147
|
+
responseData = (await GenericFunctions_1.mlabPublicApiRequest.call(this, GenericFunctions_1.MLAB_ACTORS_BASE_URL, 'GET', '/actors', qs));
|
|
148
|
+
}
|
|
149
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
150
|
+
returnData.push(...executionData);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
if (this.continueOnFail()) {
|
|
154
|
+
returnData.push({
|
|
155
|
+
json: { error: error.message },
|
|
156
|
+
pairedItem: { item: i },
|
|
157
|
+
});
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return [returnData];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
exports.MlabThreatActors = MlabThreatActors;
|
|
167
|
+
//# sourceMappingURL=MlabThreatActors.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MlabThreatActors.node.js","sourceRoot":"","sources":["../../../nodes/MlabThreatActors/MlabThreatActors.node.ts"],"names":[],"mappings":";;;AAQA,iEAAwF;AAExF,MAAa,gBA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CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA/LD,4CA+LC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="none">
|
|
2
|
+
<g fill="#000000" stroke="#ffffff" stroke-width="2.5" stroke-linejoin="round" paint-order="stroke fill">
|
|
3
|
+
<polygon points="257.93,24.96 117.83,161.85 307.41,352.4 195.27,426.3 255.04,487.04 395.46,348.22 204.91,155.75 230.29,129.72 254.07,151.25 318.34,86.66"/>
|
|
4
|
+
<polygon points="87.3,192.38 24.0,256.96 88.91,319.62 151.89,255.04"/>
|
|
5
|
+
<polygon points="423.73,193.34 361.4,256.96 425.66,318.98 488.0,254.71"/>
|
|
6
|
+
<polygon points="185.95,283.63 118.15,349.83 164.1,396.74 231.9,330.55"/>
|
|
7
|
+
<polygon points="350.15,116.86 284.28,180.81 330.55,228.04 396.42,164.1"/>
|
|
8
|
+
</g>
|
|
9
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IExecuteFunctions, IDataObject, IHttpRequestMethods, IHttpRequestOptions, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare const MLAB_CVE_BASE_URL = "https://vuln.mlab.sh/api/v1";
|
|
3
|
+
export declare const MLAB_ACTORS_BASE_URL = "https://actors.mlab.sh/api/v1";
|
|
4
|
+
export declare function mlabCoreApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, resource: string, body?: IDataObject, qs?: IDataObject, option?: Partial<IHttpRequestOptions>): Promise<any>;
|
|
5
|
+
export declare function mlabPublicApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, baseUrl: string, method: IHttpRequestMethods, resource: string, qs?: IDataObject, option?: Partial<IHttpRequestOptions>): Promise<any>;
|
|
6
|
+
export declare function pollDomainScan(this: IExecuteFunctions, domain: string, maxAttempts?: number, intervalMs?: number): Promise<IDataObject>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MLAB_ACTORS_BASE_URL = exports.MLAB_CVE_BASE_URL = void 0;
|
|
4
|
+
exports.mlabCoreApiRequest = mlabCoreApiRequest;
|
|
5
|
+
exports.mlabPublicApiRequest = mlabPublicApiRequest;
|
|
6
|
+
exports.pollDomainScan = pollDomainScan;
|
|
7
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
|
+
exports.MLAB_CVE_BASE_URL = 'https://vuln.mlab.sh/api/v1';
|
|
9
|
+
exports.MLAB_ACTORS_BASE_URL = 'https://actors.mlab.sh/api/v1';
|
|
10
|
+
async function mlabCoreApiRequest(method, resource, body = {}, qs = {}, option = {}) {
|
|
11
|
+
const credentials = await this.getCredentials('mlabApi');
|
|
12
|
+
const baseUrl = (credentials.baseUrl || 'https://mlab.sh/api/v1').replace(/\/$/, '');
|
|
13
|
+
const options = {
|
|
14
|
+
method,
|
|
15
|
+
url: `${baseUrl}${resource}`,
|
|
16
|
+
json: true,
|
|
17
|
+
};
|
|
18
|
+
if (Object.keys(body).length > 0) {
|
|
19
|
+
options.body = body;
|
|
20
|
+
}
|
|
21
|
+
if (Object.keys(qs).length > 0) {
|
|
22
|
+
options.qs = qs;
|
|
23
|
+
}
|
|
24
|
+
Object.assign(options, option);
|
|
25
|
+
try {
|
|
26
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, 'mlabApi', options);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function mlabPublicApiRequest(baseUrl, method, resource, qs = {}, option = {}) {
|
|
33
|
+
const options = {
|
|
34
|
+
method,
|
|
35
|
+
url: `${baseUrl.replace(/\/$/, '')}${resource}`,
|
|
36
|
+
json: true,
|
|
37
|
+
};
|
|
38
|
+
if (Object.keys(qs).length > 0) {
|
|
39
|
+
options.qs = qs;
|
|
40
|
+
}
|
|
41
|
+
Object.assign(options, option);
|
|
42
|
+
try {
|
|
43
|
+
return await this.helpers.httpRequest(options);
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function pollDomainScan(domain, maxAttempts = 30, intervalMs = 4000) {
|
|
50
|
+
var _a;
|
|
51
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
52
|
+
const status = (await mlabCoreApiRequest.call(this, 'GET', '/scan/domain/status', {}, {
|
|
53
|
+
domain,
|
|
54
|
+
}));
|
|
55
|
+
const state = ((_a = status.status) !== null && _a !== void 0 ? _a : status.state);
|
|
56
|
+
if (state === 'success') {
|
|
57
|
+
return (await mlabCoreApiRequest.call(this, 'GET', '/scan/domain/results', {}, {
|
|
58
|
+
domain,
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
if (state === 'error') {
|
|
62
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), status, {
|
|
63
|
+
message: `Domain scan failed for "${domain}"`,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
await sleep(intervalMs);
|
|
67
|
+
}
|
|
68
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: 'timeout' }, {
|
|
69
|
+
message: `Domain scan for "${domain}" did not finish within ${(maxAttempts * intervalMs) / 1000}s. Try the "Get Results" operation later.`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function sleep(ms) {
|
|
73
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -0,0 +1 @@
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MAAM,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,sBAAsB,EAAE,EAAE,EAAE;gBAC9E,MAAM;aACN,CAAC,CAAgB,CAAC;QACpB,CAAC;QACD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;YACvB,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAoB,EAAE;gBAC5D,OAAO,EAAE,2BAA2B,MAAM,GAAG;aAC7C,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IAED,MAAM,IAAI,2BAAY,CACrB,IAAI,CAAC,OAAO,EAAE,EACd,EAAE,OAAO,EAAE,SAAS,EAAE,EACtB;QACC,OAAO,EAAE,oBAAoB,MAAM,2BAClC,CAAC,WAAW,GAAG,UAAU,CAAC,GAAG,IAC9B,2CAA2C;KAC3C,CACD,CAAC;AACH,CAAC;AAED,SAAS,KAAK,CAAC,EAAU;IACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mlabsh/n8n-nodes-mlab",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "n8n community nodes for mlab.sh — core scanning (domain/IP/crypto/file), CVE vulnerability search, and threat actor intelligence.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"n8n-community-node-package",
|
|
7
|
+
"n8n",
|
|
8
|
+
"mlab",
|
|
9
|
+
"mlab.sh",
|
|
10
|
+
"security",
|
|
11
|
+
"cve",
|
|
12
|
+
"vulnerability",
|
|
13
|
+
"threat-intelligence",
|
|
14
|
+
"threat-actor",
|
|
15
|
+
"osint",
|
|
16
|
+
"scanner"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"homepage": "https://mlab.sh",
|
|
20
|
+
"author": {
|
|
21
|
+
"name": "mlab.sh",
|
|
22
|
+
"email": "support@mlab.sh"
|
|
23
|
+
},
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/mlab-sh/n8n-nodes-mlab.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/mlab-sh/n8n-nodes-mlab/issues"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=20.15"
|
|
33
|
+
},
|
|
34
|
+
"main": "index.js",
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "npx rimraf dist .tsbuildinfo && tsc && gulp build:icons",
|
|
37
|
+
"dev": "tsc --watch",
|
|
38
|
+
"format": "prettier nodes credentials --write",
|
|
39
|
+
"lint": "eslint nodes credentials package.json",
|
|
40
|
+
"lintfix": "eslint nodes credentials package.json --fix",
|
|
41
|
+
"prepublishOnly": "npm run build && npm run lint -- --quiet"
|
|
42
|
+
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist"
|
|
45
|
+
],
|
|
46
|
+
"n8n": {
|
|
47
|
+
"n8nNodesApiVersion": 1,
|
|
48
|
+
"credentials": [
|
|
49
|
+
"dist/credentials/MlabApi.credentials.js"
|
|
50
|
+
],
|
|
51
|
+
"nodes": [
|
|
52
|
+
"dist/nodes/MlabCore/MlabCore.node.js",
|
|
53
|
+
"dist/nodes/MlabCve/MlabCve.node.js",
|
|
54
|
+
"dist/nodes/MlabThreatActors/MlabThreatActors.node.js"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/node": "^20.19.42",
|
|
59
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
60
|
+
"eslint": "^8.57.0",
|
|
61
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.3",
|
|
62
|
+
"gulp": "^5.0.0",
|
|
63
|
+
"jsonc-eslint-parser": "^2.4.2",
|
|
64
|
+
"n8n-workflow": "*",
|
|
65
|
+
"prettier": "^3.3.0",
|
|
66
|
+
"rimraf": "^5.0.0",
|
|
67
|
+
"typescript": "^5.5.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"n8n-workflow": "*"
|
|
71
|
+
}
|
|
72
|
+
}
|