n8n-nodes-soar 0.1.21 → 0.1.23
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/dist/common/asset.js +47 -58
- package/dist/common/connectionType.js +3 -2
- package/dist/common/executor/abstract.executor.js +51 -0
- package/dist/common/executor/docker.executor.js +57 -31
- package/dist/common/executor/jsonrpc.executor.js +123 -0
- package/dist/common/executor/{k8s.executor.js → kubernetes.executor.js} +56 -33
- package/dist/common/interface.js +4 -0
- package/dist/common/memorizer/abstract.memorizer.js +49 -0
- package/dist/common/memorizer/asset.memorizer.js +16 -0
- package/dist/common/memorizer/general.memorizer.js +17 -0
- package/dist/common/memorizer/storage/redis.storage.js +71 -0
- package/dist/common/proxy/abstract.proxy.js +4 -0
- package/dist/common/proxy/executor.proxy.js +50 -0
- package/dist/common/proxy/memorizer.proxy.js +51 -0
- package/dist/common/proxy/runner.proxy.js +60 -0
- package/dist/common/runner/container.runner.js +93 -108
- package/dist/common/runner/decorator/assetRunner.js +26 -0
- package/dist/common/runner/decorator/index.js +20 -0
- package/dist/common/runner/decorator/onlySuccess.js +20 -0
- package/dist/common/runner/{priority.js → decorator/priority.js} +16 -8
- package/dist/common/runner/priority.runner.js +6 -7
- package/dist/common/runner/runner.js +10 -29
- package/dist/constants/image.js +11 -0
- package/dist/credentials/SoarRunner/SoarRunner.credentials.js +73 -0
- package/dist/credentials/SoarRunner/icon.svg +8 -0
- package/dist/credentials/VulboxApi/VulboxApi.credentials.js +157 -0
- package/dist/credentials/VulboxApi/vulbox.svg +18 -0
- package/dist/nodes/Collector/Collector.node.js +56 -47
- package/dist/nodes/EmptyCheck/EmptyCheck.node.js +69 -0
- package/dist/nodes/Executor/DockerExecutor/DockerExecutor.node.js +80 -3
- package/dist/nodes/Executor/JsonRpcExecutor/JsonRpcExecutor.node.js +69 -0
- package/dist/nodes/Executor/JsonRpcExecutor/icon.svg +8 -0
- package/dist/nodes/Executor/KubernetesExecutor/KubernetesExecutor.node.js +112 -4
- package/dist/nodes/Fofa/Fofa.node.js +23 -14
- package/dist/nodes/Memorizer/Redis/RedisMemorizer.node.js +127 -0
- package/dist/nodes/Memorizer/Redis/redis.svg +1 -0
- package/dist/nodes/Platform/Vulbox/Vulbox.node.js +166 -0
- package/dist/nodes/Platform/Vulbox/api.js +211 -0
- package/dist/nodes/Platform/Vulbox/methods.js +124 -0
- package/dist/nodes/Platform/Vulbox/properties.js +403 -0
- package/dist/nodes/Platform/Vulbox/vulbox.svg +18 -0
- package/dist/nodes/Runner/Cmd/Cmd.node.js +105 -0
- package/dist/nodes/Runner/Dns/Dns.node.js +38 -22
- package/dist/nodes/Runner/Httpx/Httpx.node.js +147 -18
- package/dist/nodes/Runner/IcpLookup/IcpLookup.node.js +166 -0
- package/dist/nodes/Runner/IcpLookup/icp.svg +3 -0
- package/dist/nodes/Runner/Katana/Katana.node.js +42 -29
- package/dist/nodes/Runner/Masscan/Masscan.node.js +51 -29
- package/dist/nodes/Runner/Naabu/Naabu.node.js +35 -17
- package/dist/nodes/Runner/Nuclei/Nuclei.node.js +32 -14
- package/dist/nodes/Runner/Priority/Priority.node.js +2 -1
- package/dist/nodes/Runner/Subfinder/Subfinder.node.js +38 -15
- package/dist/nodes/Runner/Unauthor/Unauthor.node.js +32 -14
- package/dist/utils/decorator.js +22 -0
- package/package.json +19 -5
- package/dist/common/executor/executor.js +0 -48
- package/dist/nodes/Asset/SplitAsset/SplitAsset.node.js +0 -110
- package/dist/nodes/Asset/SplitAsset/split.svg +0 -13
- package/dist/nodes/Cdncheck/Cdncheck.node.js +0 -229
- package/dist/nodes/Httpx/Httpx.node.js +0 -754
- package/dist/nodes/Katana/Katana.node.js +0 -456
- package/dist/nodes/Katana/Katana.node.json +0 -9
- package/dist/nodes/Nuclei/Nuclei.node.js +0 -1024
- package/dist/nodes/Nuclei/Nuclei.node.json +0 -9
- package/dist/nodes/Runner/Katana/a.json +0 -30
- package/dist/nodes/Runner/Nuclei/a.json +0 -48
- package/dist/nodes/Runner/PriorityAdd/PriorityAdd.node.js +0 -97
- package/dist/nodes/Runner/Router/SwitchRouter/SwitchRouter.node.js +0 -101
- package/dist/nodes/Tshark/Tshark.node.js +0 -104
- package/dist/nodes/Tshark/Tshark.node.json +0 -9
- package/dist/nodes/Tshark/tshark.svg +0 -64
- package/dist/nodes/Unauthor/Unauthor.node.js +0 -135
- package/dist/nodes/Unauthor/Unauthor.node.json +0 -9
- package/dist/nodes/Unauthor/unauthor.svg +0 -7
- package/dist/nodes/Uncover/Uncover.node.js +0 -280
- package/dist/nodes/Uncover/Uncover.node.json +0 -9
@@ -0,0 +1,73 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "SoarRunner", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return SoarRunner;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
function _define_property(obj, key, value) {
|
12
|
+
if (key in obj) {
|
13
|
+
Object.defineProperty(obj, key, {
|
14
|
+
value: value,
|
15
|
+
enumerable: true,
|
16
|
+
configurable: true,
|
17
|
+
writable: true
|
18
|
+
});
|
19
|
+
} else {
|
20
|
+
obj[key] = value;
|
21
|
+
}
|
22
|
+
return obj;
|
23
|
+
}
|
24
|
+
class SoarRunner {
|
25
|
+
constructor(){
|
26
|
+
_define_property(this, "name", "soarRunnerApi");
|
27
|
+
_define_property(this, "displayName", "Soar Runner");
|
28
|
+
_define_property(this, "documentationUrl", "https://github.com/yoshino-s/n8n-nodes-soar");
|
29
|
+
_define_property(this, "icon", "file:icon.svg");
|
30
|
+
_define_property(this, "properties", [
|
31
|
+
{
|
32
|
+
displayName: "URL",
|
33
|
+
name: "url",
|
34
|
+
type: "string",
|
35
|
+
placeholder: "https://soar.example.com",
|
36
|
+
default: "",
|
37
|
+
required: true
|
38
|
+
},
|
39
|
+
{
|
40
|
+
displayName: "Username",
|
41
|
+
name: "username",
|
42
|
+
type: "string",
|
43
|
+
default: "",
|
44
|
+
required: true
|
45
|
+
},
|
46
|
+
{
|
47
|
+
displayName: "Password",
|
48
|
+
name: "password",
|
49
|
+
type: "string",
|
50
|
+
typeOptions: {
|
51
|
+
password: true
|
52
|
+
},
|
53
|
+
default: "",
|
54
|
+
required: true
|
55
|
+
}
|
56
|
+
]);
|
57
|
+
_define_property(this, "authenticate", {
|
58
|
+
type: "generic",
|
59
|
+
properties: {
|
60
|
+
auth: {
|
61
|
+
username: "={{$credentials.username}}",
|
62
|
+
password: "={{$credentials.password}}"
|
63
|
+
}
|
64
|
+
}
|
65
|
+
});
|
66
|
+
_define_property(this, "test", {
|
67
|
+
request: {
|
68
|
+
baseURL: "={{$credentials.url}}",
|
69
|
+
url: "/metrics"
|
70
|
+
}
|
71
|
+
});
|
72
|
+
}
|
73
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="-1 -1 130 130">
|
3
|
+
<circle cx="64" cy="32" r="32" fill="none" stroke="#025d02" stroke-width="2" />
|
4
|
+
<circle cx="64" cy="96" r="32" fill="none" stroke="#025d02" stroke-width="2" />
|
5
|
+
<circle cx="32" cy="64" r="32" fill="none" stroke="#025d02" stroke-width="2" />
|
6
|
+
<circle cx="96" cy="64" r="32" fill="none" stroke="#025d02" stroke-width="2" />
|
7
|
+
<path d="M 64,32 L 32,64 L 64,96 L 96,64 Z" fill="#01ae01" fill-rule="nonzero" />
|
8
|
+
</svg>
|
@@ -0,0 +1,157 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "VulboxApi", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return VulboxApi;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _asynclock = /*#__PURE__*/ _interop_require_default(require("async-lock"));
|
12
|
+
const _lodash = require("lodash");
|
13
|
+
function _define_property(obj, key, value) {
|
14
|
+
if (key in obj) {
|
15
|
+
Object.defineProperty(obj, key, {
|
16
|
+
value: value,
|
17
|
+
enumerable: true,
|
18
|
+
configurable: true,
|
19
|
+
writable: true
|
20
|
+
});
|
21
|
+
} else {
|
22
|
+
obj[key] = value;
|
23
|
+
}
|
24
|
+
return obj;
|
25
|
+
}
|
26
|
+
function _interop_require_default(obj) {
|
27
|
+
return obj && obj.__esModule ? obj : {
|
28
|
+
default: obj
|
29
|
+
};
|
30
|
+
}
|
31
|
+
const vulboxLoginCache = new Map();
|
32
|
+
const lock = new _asynclock.default();
|
33
|
+
class VulboxApi {
|
34
|
+
async authenticate(credentials, requestOptions) {
|
35
|
+
return await lock.acquire("vulboxLogin", async ()=>{
|
36
|
+
function checkJwtExpired(jwt) {
|
37
|
+
const jwtPayload = JSON.parse(atob(jwt.split(".")[1]));
|
38
|
+
return jwtPayload.exp * 1000 < Date.now();
|
39
|
+
}
|
40
|
+
let jwtToken = "";
|
41
|
+
if (credentials.mode === "jwt") {
|
42
|
+
jwtToken = credentials.jwt;
|
43
|
+
} else {
|
44
|
+
const cachedToken = vulboxLoginCache.get(`${credentials.username} ${credentials.password}`);
|
45
|
+
if (cachedToken && !checkJwtExpired(cachedToken)) {
|
46
|
+
jwtToken = cachedToken;
|
47
|
+
} else {
|
48
|
+
const result = await fetch("https://vapi.vulbox.com/openapi/account/login/by", {
|
49
|
+
method: "POST",
|
50
|
+
headers: {
|
51
|
+
uuid: Math.random().toString(36).slice(2),
|
52
|
+
"Content-Type": "application/json",
|
53
|
+
origin: "https://www.vulbox.com",
|
54
|
+
referer: "https://www.vulbox.com"
|
55
|
+
},
|
56
|
+
body: JSON.stringify({
|
57
|
+
login_by: "username",
|
58
|
+
username: credentials.username.toString(),
|
59
|
+
password: btoa(credentials.password.toString())
|
60
|
+
})
|
61
|
+
}).then((res)=>res.json());
|
62
|
+
if (result.code !== 200) {
|
63
|
+
throw new Error(result.msg);
|
64
|
+
}
|
65
|
+
jwtToken = result.data.token;
|
66
|
+
vulboxLoginCache.set(`${credentials.username} ${credentials.password}`, jwtToken);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
const options = (0, _lodash.cloneDeep)(requestOptions);
|
70
|
+
(0, _lodash.set)(options, "headers.Authorization", `Bearer ${jwtToken}`);
|
71
|
+
return options;
|
72
|
+
});
|
73
|
+
}
|
74
|
+
constructor(){
|
75
|
+
_define_property(this, "name", "vulboxApi");
|
76
|
+
_define_property(this, "displayName", "Vulbox API Credentials");
|
77
|
+
_define_property(this, "documentationUrl", "https://www.vulbox.com");
|
78
|
+
_define_property(this, "icon", "file:vulbox.svg");
|
79
|
+
_define_property(this, "properties", [
|
80
|
+
{
|
81
|
+
displayName: "Mode",
|
82
|
+
name: "mode",
|
83
|
+
type: "options",
|
84
|
+
default: "email",
|
85
|
+
options: [
|
86
|
+
{
|
87
|
+
name: "Email+Password",
|
88
|
+
value: "email"
|
89
|
+
},
|
90
|
+
{
|
91
|
+
name: "JWT",
|
92
|
+
value: "jwt"
|
93
|
+
}
|
94
|
+
]
|
95
|
+
},
|
96
|
+
{
|
97
|
+
displayName: "Vulbox Email/Username/Phone",
|
98
|
+
name: "username",
|
99
|
+
type: "string",
|
100
|
+
default: "",
|
101
|
+
displayOptions: {
|
102
|
+
show: {
|
103
|
+
mode: [
|
104
|
+
"email"
|
105
|
+
]
|
106
|
+
}
|
107
|
+
}
|
108
|
+
},
|
109
|
+
{
|
110
|
+
displayName: "Vulbox Password",
|
111
|
+
name: "password",
|
112
|
+
type: "string",
|
113
|
+
typeOptions: {
|
114
|
+
password: true
|
115
|
+
},
|
116
|
+
default: "",
|
117
|
+
required: true,
|
118
|
+
displayOptions: {
|
119
|
+
show: {
|
120
|
+
mode: [
|
121
|
+
"email"
|
122
|
+
]
|
123
|
+
}
|
124
|
+
}
|
125
|
+
},
|
126
|
+
{
|
127
|
+
displayName: "Vulbox JWT",
|
128
|
+
name: "jwt",
|
129
|
+
type: "string",
|
130
|
+
default: "",
|
131
|
+
displayOptions: {
|
132
|
+
show: {
|
133
|
+
mode: [
|
134
|
+
"jwt"
|
135
|
+
]
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
]);
|
140
|
+
_define_property(this, "test", {
|
141
|
+
request: {
|
142
|
+
method: "GET",
|
143
|
+
url: "https://user.vulbox.com/api/hacker/user/account/info"
|
144
|
+
},
|
145
|
+
rules: [
|
146
|
+
{
|
147
|
+
type: "responseSuccessBody",
|
148
|
+
properties: {
|
149
|
+
key: "code",
|
150
|
+
value: 401,
|
151
|
+
message: "Invalid credentials!"
|
152
|
+
}
|
153
|
+
}
|
154
|
+
]
|
155
|
+
});
|
156
|
+
}
|
157
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<svg width="32px" height="32px" viewBox="-2.835 0 29.165 32" version="1.1" xmlns="http://www.w3.org/2000/svg"
|
2
|
+
xmlns:xlink="http://www.w3.org/1999/xlink" style="display:inline-block;vertical-align:middle;" data-v-2f95c8dd="">
|
3
|
+
<polygon id="Fill-1" fill="#2A98CC"
|
4
|
+
points="13.1114323 4.03361345e-05 0.0227870968 8.01671261 13.1114323 15.8635697 26.3147871 7.91573782">
|
5
|
+
</polygon>
|
6
|
+
<polygon id="Fill-2" fill="#1D7EB7"
|
7
|
+
points="0 23.9524437 13.1114839 31.9430319 13.1114839 15.8650487 0.0227096774 8.01671261"></polygon>
|
8
|
+
<polygon id="Fill-3" fill="#1366A3"
|
9
|
+
points="13.1114323 15.863637 13.1114323 31.961116 26.3147871 24.0056202 26.3147871 7.91567059"></polygon>
|
10
|
+
<polygon id="Fill-4" fill="#AFDAEB"
|
11
|
+
points="20.4230194 11.5270588 20.4230194 20.4123025 13.1320516 24.8051765 13.1320516 15.9160336">
|
12
|
+
</polygon>
|
13
|
+
<polyline id="Fill-5" fill="#C4E2F0"
|
14
|
+
points="5.90436129 11.5831261 5.8915871 20.3823193 13.1321032 24.7953613 13.1321032 15.916437"></polyline>
|
15
|
+
<polygon id="Fill-6" fill="#FEFEFE"
|
16
|
+
points="13.1320645 7.15599328 5.90432258 11.5831529 13.1320645 15.9160605 20.4230323 11.5270857">
|
17
|
+
</polygon>
|
18
|
+
</svg>
|
@@ -8,11 +8,10 @@ Object.defineProperty(exports, "Collector", {
|
|
8
8
|
return Collector;
|
9
9
|
}
|
10
10
|
});
|
11
|
-
const _classtransformer = require("class-transformer");
|
12
11
|
const _n8nworkflow = require("n8n-workflow");
|
13
|
-
const _asset = require("../../common/asset");
|
14
12
|
const _collector = require("../../common/collector");
|
15
13
|
const _connectionType = require("../../common/connectionType");
|
14
|
+
const _decorator = require("../../common/runner/decorator");
|
16
15
|
function _define_property(obj, key, value) {
|
17
16
|
if (key in obj) {
|
18
17
|
Object.defineProperty(obj, key, {
|
@@ -28,47 +27,52 @@ function _define_property(obj, key, value) {
|
|
28
27
|
}
|
29
28
|
class Collector {
|
30
29
|
async execute() {
|
31
|
-
|
32
|
-
const
|
33
|
-
|
34
|
-
const
|
35
|
-
const
|
30
|
+
const inputs = this.getInputData();
|
31
|
+
const collector = new _collector.Collector();
|
32
|
+
const run = async (inputs, idx)=>{
|
33
|
+
const outputs = [];
|
34
|
+
const executor = await this.getInputConnectionData(_connectionType.NodeConnectionType.Executor, idx);
|
36
35
|
collector.setExecutor(executor);
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
const memorizer = await this.getInputConnectionData(_connectionType.NodeConnectionType.Memorizer, idx);
|
37
|
+
const ignoreMemorizedData = this.getNodeParameter("ignoreMemorizedData", idx);
|
38
|
+
if (memorizer) {
|
39
|
+
const cachedOutput = await memorizer.batchLoad(inputs);
|
40
|
+
inputs = inputs.filter((i, idx)=>!cachedOutput[idx]);
|
41
|
+
if (!ignoreMemorizedData) {
|
42
|
+
outputs.push(...cachedOutput.filter((o)=>o !== null).flat());
|
43
|
+
}
|
44
|
+
inputs.forEach((i, idx)=>{
|
45
|
+
i.sourceInputIndex = idx;
|
46
|
+
});
|
41
47
|
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
];
|
47
|
-
} else {
|
48
|
-
const results = [];
|
49
|
-
for(let idx = 0; idx < assets.length; idx++){
|
50
|
-
const asset = assets[idx];
|
51
|
-
let currentAssets = [
|
52
|
-
asset
|
53
|
-
];
|
54
|
-
const executor = await this.getInputConnectionData(_connectionType.NodeConnectionType.Executor, idx);
|
55
|
-
const collector = new _collector.Collector();
|
56
|
-
collector.setExecutor(executor);
|
57
|
-
let runners = (await this.getInputConnectionData(_connectionType.NodeConnectionType.Runner, 0)).flat();
|
58
|
-
runners = runners.sort((a, b)=>a.priority - b.priority);
|
48
|
+
if (inputs.length !== 0) {
|
49
|
+
let runners = (await this.getInputConnectionData(_connectionType.NodeConnectionType.Runner, idx)).flat();
|
50
|
+
runners = runners.sort((a, b)=>(0, _decorator.getPriority)(b) - (0, _decorator.getPriority)(a));
|
51
|
+
let runOutputs = inputs;
|
59
52
|
for (const runner of runners){
|
60
|
-
|
53
|
+
runOutputs = await runner.run(collector, runOutputs);
|
61
54
|
}
|
62
|
-
|
63
|
-
|
64
|
-
|
55
|
+
if (memorizer) {
|
56
|
+
const paired = inputs.map(()=>[]);
|
57
|
+
for (const output of runOutputs){
|
58
|
+
if (output.sourceInputIndex !== -1) {
|
59
|
+
console.log(output);
|
60
|
+
paired[output.sourceInputIndex].push(output);
|
61
|
+
}
|
65
62
|
}
|
66
|
-
|
63
|
+
await memorizer.batchSave(inputs, paired);
|
64
|
+
}
|
65
|
+
outputs.push(...runOutputs);
|
67
66
|
}
|
68
|
-
return
|
69
|
-
|
70
|
-
|
71
|
-
|
67
|
+
return outputs;
|
68
|
+
};
|
69
|
+
return [
|
70
|
+
this.helpers.returnJsonArray(await run(inputs.map((n, idx)=>({
|
71
|
+
json: n.json,
|
72
|
+
binary: n.binary,
|
73
|
+
sourceInputIndex: idx
|
74
|
+
})), 0))
|
75
|
+
];
|
72
76
|
}
|
73
77
|
constructor(){
|
74
78
|
_define_property(this, "description", {
|
@@ -79,7 +83,7 @@ class Collector {
|
|
79
83
|
"transform"
|
80
84
|
],
|
81
85
|
version: 1,
|
82
|
-
description: "A collector to collect all info about
|
86
|
+
description: "A collector to collect all info about assets",
|
83
87
|
defaults: {
|
84
88
|
name: "Collector",
|
85
89
|
color: "#D8EF40"
|
@@ -89,9 +93,15 @@ class Collector {
|
|
89
93
|
_n8nworkflow.NodeConnectionType.Main,
|
90
94
|
{
|
91
95
|
displayName: "Executor",
|
92
|
-
maxConnections: 1,
|
93
96
|
type: _connectionType.NodeConnectionType.Executor,
|
94
|
-
required: true
|
97
|
+
required: true,
|
98
|
+
maxConnections: 1
|
99
|
+
},
|
100
|
+
{
|
101
|
+
displayName: "Memorizer",
|
102
|
+
type: _connectionType.NodeConnectionType.Memorizer,
|
103
|
+
required: false,
|
104
|
+
maxConnections: 1
|
95
105
|
},
|
96
106
|
{
|
97
107
|
displayName: "Collector",
|
@@ -103,19 +113,18 @@ class Collector {
|
|
103
113
|
outputs: [
|
104
114
|
_n8nworkflow.NodeConnectionType.Main
|
105
115
|
],
|
106
|
-
credentials: [],
|
107
116
|
properties: [
|
108
|
-
{
|
109
|
-
displayName: "Batch",
|
110
|
-
name: "batch",
|
111
|
-
type: "boolean",
|
112
|
-
default: true
|
113
|
-
},
|
114
117
|
{
|
115
118
|
displayName: "Asset",
|
116
119
|
name: "asset",
|
117
120
|
type: "json",
|
118
121
|
default: "={{ $json }}"
|
122
|
+
},
|
123
|
+
{
|
124
|
+
displayName: "Ignore Memorized Data",
|
125
|
+
name: "ignoreMemorizedData",
|
126
|
+
type: "boolean",
|
127
|
+
default: false
|
119
128
|
}
|
120
129
|
]
|
121
130
|
});
|
@@ -0,0 +1,69 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "EmptyCheck", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return EmptyCheck;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
function _define_property(obj, key, value) {
|
12
|
+
if (key in obj) {
|
13
|
+
Object.defineProperty(obj, key, {
|
14
|
+
value: value,
|
15
|
+
enumerable: true,
|
16
|
+
configurable: true,
|
17
|
+
writable: true
|
18
|
+
});
|
19
|
+
} else {
|
20
|
+
obj[key] = value;
|
21
|
+
}
|
22
|
+
return obj;
|
23
|
+
}
|
24
|
+
class EmptyCheck {
|
25
|
+
async execute() {
|
26
|
+
const all = this.getInputData();
|
27
|
+
if (all.length === 1 && JSON.stringify(all[0].json) === "{}" && all[0].binary === undefined) {
|
28
|
+
return [
|
29
|
+
[],
|
30
|
+
all
|
31
|
+
];
|
32
|
+
} else {
|
33
|
+
return [
|
34
|
+
all,
|
35
|
+
[]
|
36
|
+
];
|
37
|
+
}
|
38
|
+
}
|
39
|
+
constructor(){
|
40
|
+
_define_property(this, "description", {
|
41
|
+
displayName: "Empty Check",
|
42
|
+
name: "emptyCheck",
|
43
|
+
group: [
|
44
|
+
"transform"
|
45
|
+
],
|
46
|
+
version: 1,
|
47
|
+
icon: "fa:dot-circle",
|
48
|
+
description: "Check if previous node returned empty result",
|
49
|
+
defaults: {
|
50
|
+
name: "Empty Check",
|
51
|
+
color: "#FF0000"
|
52
|
+
},
|
53
|
+
inputs: [
|
54
|
+
"main"
|
55
|
+
],
|
56
|
+
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
57
|
+
outputs: [
|
58
|
+
"main",
|
59
|
+
"main"
|
60
|
+
],
|
61
|
+
outputNames: [
|
62
|
+
"Result",
|
63
|
+
"IsEmpty"
|
64
|
+
],
|
65
|
+
credentials: [],
|
66
|
+
properties: []
|
67
|
+
});
|
68
|
+
}
|
69
|
+
}
|
@@ -10,6 +10,8 @@ Object.defineProperty(exports, "DockerExecutor", {
|
|
10
10
|
});
|
11
11
|
const _connectionType = require("../../../common/connectionType");
|
12
12
|
const _dockerexecutor = require("../../../common/executor/docker.executor");
|
13
|
+
const _executorproxy = require("../../../common/proxy/executor.proxy");
|
14
|
+
const _image = require("../../../constants/image");
|
13
15
|
function _define_property(obj, key, value) {
|
14
16
|
if (key in obj) {
|
15
17
|
Object.defineProperty(obj, key, {
|
@@ -25,8 +27,17 @@ function _define_property(obj, key, value) {
|
|
25
27
|
}
|
26
28
|
class DockerExecutor {
|
27
29
|
async supplyData(itemIndex) {
|
30
|
+
const stateless = this.getNodeParameter("stateless", itemIndex);
|
31
|
+
const executor = new _dockerexecutor.DockerExecutor(this.getNodeParameter("image", itemIndex), await this.getCredentials("dockerApi", itemIndex), this);
|
32
|
+
if (stateless) {
|
33
|
+
executor.setContainer(await executor.prepareContainer());
|
34
|
+
} else {
|
35
|
+
const { value } = this.getNodeParameter("container", itemIndex);
|
36
|
+
const container = await executor.findContainerByID(value);
|
37
|
+
executor.setContainer(container);
|
38
|
+
}
|
28
39
|
return {
|
29
|
-
response:
|
40
|
+
response: (0, _executorproxy.proxyExecutor)(executor)
|
30
41
|
};
|
31
42
|
}
|
32
43
|
constructor(){
|
@@ -50,10 +61,76 @@ class DockerExecutor {
|
|
50
61
|
],
|
51
62
|
credentials: [
|
52
63
|
{
|
53
|
-
name: "dockerApi"
|
64
|
+
name: "dockerApi",
|
65
|
+
required: true
|
54
66
|
}
|
55
67
|
],
|
56
|
-
properties: [
|
68
|
+
properties: [
|
69
|
+
{
|
70
|
+
displayName: "Image",
|
71
|
+
name: "image",
|
72
|
+
type: "string",
|
73
|
+
default: _image.IMAGE,
|
74
|
+
required: true,
|
75
|
+
description: "Docker image to use"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
displayName: "Stateless",
|
79
|
+
name: "stateless",
|
80
|
+
type: "boolean",
|
81
|
+
default: true,
|
82
|
+
description: "Whether to use a stateless container, which mean we will use any container that is available. If false, we will use the same container for all executions."
|
83
|
+
},
|
84
|
+
{
|
85
|
+
displayName: "Container",
|
86
|
+
name: "container",
|
87
|
+
type: "resourceLocator",
|
88
|
+
default: {
|
89
|
+
mode: "list",
|
90
|
+
value: ""
|
91
|
+
},
|
92
|
+
required: true,
|
93
|
+
modes: [
|
94
|
+
{
|
95
|
+
displayName: "Container",
|
96
|
+
name: "list",
|
97
|
+
type: "list",
|
98
|
+
placeholder: "Select a container...",
|
99
|
+
typeOptions: {
|
100
|
+
searchListMethod: "containerSearch"
|
101
|
+
}
|
102
|
+
}
|
103
|
+
],
|
104
|
+
displayOptions: {
|
105
|
+
show: {
|
106
|
+
stateless: [
|
107
|
+
false
|
108
|
+
]
|
109
|
+
}
|
110
|
+
}
|
111
|
+
},
|
112
|
+
{
|
113
|
+
displayName: "Debug Mode",
|
114
|
+
name: "debug",
|
115
|
+
type: "boolean",
|
116
|
+
default: false,
|
117
|
+
description: "Whether open to see more information in node input & output"
|
118
|
+
}
|
119
|
+
]
|
120
|
+
});
|
121
|
+
_define_property(this, "methods", {
|
122
|
+
listSearch: {
|
123
|
+
async containerSearch (_filter) {
|
124
|
+
const executor = new _dockerexecutor.DockerExecutor(this.getNodeParameter("image"), await this.getCredentials("dockerApi"), this);
|
125
|
+
const containers = await executor.listContainers();
|
126
|
+
return {
|
127
|
+
results: containers.map((c)=>({
|
128
|
+
name: c.Names.join(","),
|
129
|
+
value: c.Id
|
130
|
+
}))
|
131
|
+
};
|
132
|
+
}
|
133
|
+
}
|
57
134
|
});
|
58
135
|
}
|
59
136
|
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "JsonRpcExecutor", {
|
6
|
+
enumerable: true,
|
7
|
+
get: function() {
|
8
|
+
return JsonRpcExecutor;
|
9
|
+
}
|
10
|
+
});
|
11
|
+
const _connectionType = require("../../../common/connectionType");
|
12
|
+
const _jsonrpcexecutor = require("../../../common/executor/jsonrpc.executor");
|
13
|
+
const _executorproxy = require("../../../common/proxy/executor.proxy");
|
14
|
+
function _define_property(obj, key, value) {
|
15
|
+
if (key in obj) {
|
16
|
+
Object.defineProperty(obj, key, {
|
17
|
+
value: value,
|
18
|
+
enumerable: true,
|
19
|
+
configurable: true,
|
20
|
+
writable: true
|
21
|
+
});
|
22
|
+
} else {
|
23
|
+
obj[key] = value;
|
24
|
+
}
|
25
|
+
return obj;
|
26
|
+
}
|
27
|
+
class JsonRpcExecutor {
|
28
|
+
async supplyData(itemIndex) {
|
29
|
+
return {
|
30
|
+
response: (0, _executorproxy.proxyExecutor)(new _jsonrpcexecutor.JSONRPCExecutor(await this.getCredentials("soarRunnerApi", itemIndex), this))
|
31
|
+
};
|
32
|
+
}
|
33
|
+
constructor(){
|
34
|
+
_define_property(this, "description", {
|
35
|
+
displayName: "JSONRPC Executor",
|
36
|
+
name: "jsonRpcExecutor",
|
37
|
+
icon: "file:icon.svg",
|
38
|
+
group: [
|
39
|
+
"transform"
|
40
|
+
],
|
41
|
+
version: 1,
|
42
|
+
description: "Execute with JSONRPC",
|
43
|
+
defaults: {
|
44
|
+
name: "JSONRPC"
|
45
|
+
},
|
46
|
+
// eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
|
47
|
+
inputs: [],
|
48
|
+
// eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
|
49
|
+
outputs: [
|
50
|
+
_connectionType.NodeConnectionType.Executor
|
51
|
+
],
|
52
|
+
credentials: [
|
53
|
+
{
|
54
|
+
name: "soarRunnerApi",
|
55
|
+
required: true
|
56
|
+
}
|
57
|
+
],
|
58
|
+
properties: [
|
59
|
+
{
|
60
|
+
displayName: "Debug Mode",
|
61
|
+
name: "debug",
|
62
|
+
type: "boolean",
|
63
|
+
default: false,
|
64
|
+
description: "Whether open to see more information in node input & output"
|
65
|
+
}
|
66
|
+
]
|
67
|
+
});
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" ?>
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="-1 -1 130 130">
|
3
|
+
<circle cx="64" cy="32" r="32" fill="none" stroke="#025d02" stroke-width="2" />
|
4
|
+
<circle cx="64" cy="96" r="32" fill="none" stroke="#025d02" stroke-width="2" />
|
5
|
+
<circle cx="32" cy="64" r="32" fill="none" stroke="#025d02" stroke-width="2" />
|
6
|
+
<circle cx="96" cy="64" r="32" fill="none" stroke="#025d02" stroke-width="2" />
|
7
|
+
<path d="M 64,32 L 32,64 L 64,96 L 96,64 Z" fill="#01ae01" fill-rule="nonzero" />
|
8
|
+
</svg>
|