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.
Files changed (76) hide show
  1. package/dist/common/asset.js +47 -58
  2. package/dist/common/connectionType.js +3 -2
  3. package/dist/common/executor/abstract.executor.js +51 -0
  4. package/dist/common/executor/docker.executor.js +57 -31
  5. package/dist/common/executor/jsonrpc.executor.js +123 -0
  6. package/dist/common/executor/{k8s.executor.js → kubernetes.executor.js} +56 -33
  7. package/dist/common/interface.js +4 -0
  8. package/dist/common/memorizer/abstract.memorizer.js +49 -0
  9. package/dist/common/memorizer/asset.memorizer.js +16 -0
  10. package/dist/common/memorizer/general.memorizer.js +17 -0
  11. package/dist/common/memorizer/storage/redis.storage.js +71 -0
  12. package/dist/common/proxy/abstract.proxy.js +4 -0
  13. package/dist/common/proxy/executor.proxy.js +50 -0
  14. package/dist/common/proxy/memorizer.proxy.js +51 -0
  15. package/dist/common/proxy/runner.proxy.js +60 -0
  16. package/dist/common/runner/container.runner.js +93 -108
  17. package/dist/common/runner/decorator/assetRunner.js +26 -0
  18. package/dist/common/runner/decorator/index.js +20 -0
  19. package/dist/common/runner/decorator/onlySuccess.js +20 -0
  20. package/dist/common/runner/{priority.js → decorator/priority.js} +16 -8
  21. package/dist/common/runner/priority.runner.js +6 -7
  22. package/dist/common/runner/runner.js +10 -29
  23. package/dist/constants/image.js +11 -0
  24. package/dist/credentials/SoarRunner/SoarRunner.credentials.js +73 -0
  25. package/dist/credentials/SoarRunner/icon.svg +8 -0
  26. package/dist/credentials/VulboxApi/VulboxApi.credentials.js +157 -0
  27. package/dist/credentials/VulboxApi/vulbox.svg +18 -0
  28. package/dist/nodes/Collector/Collector.node.js +56 -47
  29. package/dist/nodes/EmptyCheck/EmptyCheck.node.js +69 -0
  30. package/dist/nodes/Executor/DockerExecutor/DockerExecutor.node.js +80 -3
  31. package/dist/nodes/Executor/JsonRpcExecutor/JsonRpcExecutor.node.js +69 -0
  32. package/dist/nodes/Executor/JsonRpcExecutor/icon.svg +8 -0
  33. package/dist/nodes/Executor/KubernetesExecutor/KubernetesExecutor.node.js +112 -4
  34. package/dist/nodes/Fofa/Fofa.node.js +23 -14
  35. package/dist/nodes/Memorizer/Redis/RedisMemorizer.node.js +127 -0
  36. package/dist/nodes/Memorizer/Redis/redis.svg +1 -0
  37. package/dist/nodes/Platform/Vulbox/Vulbox.node.js +166 -0
  38. package/dist/nodes/Platform/Vulbox/api.js +211 -0
  39. package/dist/nodes/Platform/Vulbox/methods.js +124 -0
  40. package/dist/nodes/Platform/Vulbox/properties.js +403 -0
  41. package/dist/nodes/Platform/Vulbox/vulbox.svg +18 -0
  42. package/dist/nodes/Runner/Cmd/Cmd.node.js +105 -0
  43. package/dist/nodes/Runner/Dns/Dns.node.js +38 -22
  44. package/dist/nodes/Runner/Httpx/Httpx.node.js +147 -18
  45. package/dist/nodes/Runner/IcpLookup/IcpLookup.node.js +166 -0
  46. package/dist/nodes/Runner/IcpLookup/icp.svg +3 -0
  47. package/dist/nodes/Runner/Katana/Katana.node.js +42 -29
  48. package/dist/nodes/Runner/Masscan/Masscan.node.js +51 -29
  49. package/dist/nodes/Runner/Naabu/Naabu.node.js +35 -17
  50. package/dist/nodes/Runner/Nuclei/Nuclei.node.js +32 -14
  51. package/dist/nodes/Runner/Priority/Priority.node.js +2 -1
  52. package/dist/nodes/Runner/Subfinder/Subfinder.node.js +38 -15
  53. package/dist/nodes/Runner/Unauthor/Unauthor.node.js +32 -14
  54. package/dist/utils/decorator.js +22 -0
  55. package/package.json +19 -5
  56. package/dist/common/executor/executor.js +0 -48
  57. package/dist/nodes/Asset/SplitAsset/SplitAsset.node.js +0 -110
  58. package/dist/nodes/Asset/SplitAsset/split.svg +0 -13
  59. package/dist/nodes/Cdncheck/Cdncheck.node.js +0 -229
  60. package/dist/nodes/Httpx/Httpx.node.js +0 -754
  61. package/dist/nodes/Katana/Katana.node.js +0 -456
  62. package/dist/nodes/Katana/Katana.node.json +0 -9
  63. package/dist/nodes/Nuclei/Nuclei.node.js +0 -1024
  64. package/dist/nodes/Nuclei/Nuclei.node.json +0 -9
  65. package/dist/nodes/Runner/Katana/a.json +0 -30
  66. package/dist/nodes/Runner/Nuclei/a.json +0 -48
  67. package/dist/nodes/Runner/PriorityAdd/PriorityAdd.node.js +0 -97
  68. package/dist/nodes/Runner/Router/SwitchRouter/SwitchRouter.node.js +0 -101
  69. package/dist/nodes/Tshark/Tshark.node.js +0 -104
  70. package/dist/nodes/Tshark/Tshark.node.json +0 -9
  71. package/dist/nodes/Tshark/tshark.svg +0 -64
  72. package/dist/nodes/Unauthor/Unauthor.node.js +0 -135
  73. package/dist/nodes/Unauthor/Unauthor.node.json +0 -9
  74. package/dist/nodes/Unauthor/unauthor.svg +0 -7
  75. package/dist/nodes/Uncover/Uncover.node.js +0 -280
  76. package/dist/nodes/Uncover/Uncover.node.json +0 -9
@@ -8,9 +8,12 @@ Object.defineProperty(exports, "Httpx", {
8
8
  return Httpx;
9
9
  }
10
10
  });
11
+ const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
12
+ const _nodeurl = /*#__PURE__*/ _interop_require_default(require("node:url"));
11
13
  const _connectionType = require("../../../common/connectionType");
14
+ const _runnerproxy = require("../../../common/proxy/runner.proxy");
12
15
  const _containerrunner = require("../../../common/runner/container.runner");
13
- const _priority = require("../../../common/runner/priority");
16
+ const _decorator = require("../../../common/runner/decorator");
14
17
  function _define_property(obj, key, value) {
15
18
  if (key in obj) {
16
19
  Object.defineProperty(obj, key, {
@@ -24,17 +27,30 @@ function _define_property(obj, key, value) {
24
27
  }
25
28
  return obj;
26
29
  }
27
- class HttpxRunner extends _containerrunner.ContainerRunner {
28
- cmd(assets) {
29
- const path = this.func.getNodeParameter("path", this.itemIndex);
30
- return [
30
+ function _interop_require_default(obj) {
31
+ return obj && obj.__esModule ? obj : {
32
+ default: obj
33
+ };
34
+ }
35
+ function _ts_decorate(decorators, target, key, desc) {
36
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
37
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
38
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
39
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
40
+ }
41
+ let HttpxRunner = class HttpxRunner extends _containerrunner.ContainerRunner {
42
+ async run(collector, inputs) {
43
+ const assets = inputs.map((n)=>n.json);
44
+ const urlPath = this.func.getNodeParameter("path", this.itemIndex);
45
+ const uploadResult = this.func.getNodeParameter("uploadResult", this.itemIndex);
46
+ const cmd = [
31
47
  "httpx",
32
48
  "-disable-update-check",
33
49
  "-json",
34
50
  "-silent",
35
51
  "-target",
36
- assets.map((a)=>`${a.getHostAndPort()}${path}`).join(","),
37
- ...this.collectGeneratedOptions([
52
+ assets.map((a)=>`${a.getHostAndPort()}${urlPath}`).join(","),
53
+ ...this.collectGeneratedCmdOptions([
38
54
  "options.probes",
39
55
  "options.headless",
40
56
  "options.matchers",
@@ -47,29 +63,83 @@ class HttpxRunner extends _containerrunner.ContainerRunner {
47
63
  "options.optimizations"
48
64
  ])
49
65
  ];
50
- }
51
- process(rawAssets, stdout) {
52
- const path = this.func.getNodeParameter("path", this.itemIndex);
66
+ const { stdout } = await this.runCmd(collector, cmd, this.getOptions());
53
67
  const result = new Map();
54
- for (const line of stdout.trim().split("\n")){
55
- const json = JSON.parse(line);
68
+ for (const json of stdout.trim().split("\n").filter(Boolean).map((n)=>JSON.parse(n))){
69
+ if (uploadResult) {
70
+ const urlPrefix = this.func.getNodeParameter("urlPrefix", this.itemIndex);
71
+ if (json.stored_response_path) {
72
+ const filePath = json.stored_response_path;
73
+ json.stored_response_url = _nodeurl.default.resolve(urlPrefix, _nodepath.default.join("response", _nodepath.default.basename(_nodepath.default.dirname(filePath)), _nodepath.default.basename(filePath)));
74
+ }
75
+ if (json.screenshot_path) {
76
+ const filePath = json.screenshot_path;
77
+ json.screenshot_url = _nodeurl.default.resolve(urlPrefix, _nodepath.default.join("screenshot", _nodepath.default.basename(_nodepath.default.dirname(filePath)), _nodepath.default.basename(filePath)));
78
+ }
79
+ }
56
80
  result.set(json.input, json);
57
81
  }
58
- return rawAssets.map((a)=>{
59
- const response = result.get(`${a.getHostAndPort()}${path}`);
82
+ if (uploadResult) {
83
+ const credentials = await this.func.getCredentials("s3");
84
+ const bucket = this.func.getNodeParameter("bucket", this.itemIndex);
85
+ await this.runCmd(collector, [
86
+ "rclone",
87
+ "copy",
88
+ "--s3-access-key-id",
89
+ credentials.accessKeyId,
90
+ "--s3-secret-access-key",
91
+ credentials.secretAccessKey,
92
+ "--s3-provider",
93
+ "Other",
94
+ "--s3-region",
95
+ credentials.region,
96
+ "--s3-endpoint",
97
+ credentials.endpoint,
98
+ credentials.forcePathStyle ? "--s3-force-path-style" : "",
99
+ "--s3-no-check-bucket",
100
+ "/output/",
101
+ `remote:${bucket}`
102
+ ], this.getOptions());
103
+ }
104
+ return Promise.all(inputs.map(async (a)=>{
105
+ const response = result.get(`${a.json.getHostAndPort()}${urlPath}`);
60
106
  if (response) {
61
- a.response = response;
107
+ if (response.headless_body) {
108
+ var _a;
109
+ (_a = a).binary ?? (_a.binary = {});
110
+ a.binary["response"] = {
111
+ data: Buffer.from(response.headless_body).toString("base64"),
112
+ mimeType: response.content_type,
113
+ fileName: "response.txt"
114
+ };
115
+ delete response.headless_body;
116
+ }
117
+ if (response.screenshot_bytes) {
118
+ var _a1;
119
+ (_a1 = a).binary ?? (_a1.binary = {});
120
+ a.binary["screenshot"] = {
121
+ data: response.screenshot_bytes,
122
+ mimeType: "image/png",
123
+ fileName: "screenshot.png"
124
+ };
125
+ delete response.screenshot_bytes;
126
+ }
127
+ a.json.response = response;
62
128
  a.success = true;
63
129
  }
64
130
  return a;
65
- });
131
+ }));
66
132
  }
67
- }
133
+ };
134
+ HttpxRunner = _ts_decorate([
135
+ (0, _decorator.Priority)(_decorator.APP_RUNNER_PRIORITY),
136
+ _decorator.AssetRunner
137
+ ], HttpxRunner);
68
138
  class Httpx {
69
139
  async supplyData(itemIndex) {
70
140
  return {
71
141
  response: [
72
- new HttpxRunner("httpx", _priority.APP_RUNNER_PRIORITY, this, itemIndex)
142
+ (0, _runnerproxy.proxyRunner)(new HttpxRunner(this, itemIndex))
73
143
  ]
74
144
  };
75
145
  }
@@ -106,6 +176,12 @@ class Httpx {
106
176
  defaults: {
107
177
  name: "Httpx"
108
178
  },
179
+ credentials: [
180
+ {
181
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-credentials-name-unsuffixed
182
+ name: "s3"
183
+ }
184
+ ],
109
185
  // eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
110
186
  inputs: [],
111
187
  // eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
@@ -119,6 +195,41 @@ class Httpx {
119
195
  type: "boolean",
120
196
  default: true
121
197
  },
198
+ {
199
+ displayName: "Upload Result",
200
+ name: "uploadResult",
201
+ type: "boolean",
202
+ default: false,
203
+ required: true
204
+ },
205
+ {
206
+ displayName: "Bucket",
207
+ name: "bucket",
208
+ type: "string",
209
+ default: "",
210
+ required: true,
211
+ displayOptions: {
212
+ show: {
213
+ uploadResult: [
214
+ true
215
+ ]
216
+ }
217
+ }
218
+ },
219
+ {
220
+ displayName: "URL Prefix",
221
+ name: "urlPrefix",
222
+ type: "string",
223
+ default: "",
224
+ required: true,
225
+ displayOptions: {
226
+ show: {
227
+ uploadResult: [
228
+ true
229
+ ]
230
+ }
231
+ }
232
+ },
122
233
  {
123
234
  displayName: "Path",
124
235
  name: "path",
@@ -313,6 +424,16 @@ class Httpx {
313
424
  name: "System Chrome",
314
425
  value: "-system-chrome",
315
426
  description: "Enable using local installed chrome for screenshot"
427
+ },
428
+ {
429
+ name: "Exclude Screenshot Bytes",
430
+ value: "-exclude-screenshot-bytes",
431
+ description: "Enable excluding screenshot bytes from JSON output"
432
+ },
433
+ {
434
+ name: "Exclude Headless Body",
435
+ value: "-exclude-headless-body",
436
+ description: "Enable excluding headless header from JSON output"
316
437
  }
317
438
  ]
318
439
  }
@@ -823,6 +944,14 @@ class Httpx {
823
944
  ]
824
945
  }
825
946
  ]
947
+ },
948
+ ..._containerrunner.advancedOptions,
949
+ {
950
+ displayName: "Debug Mode",
951
+ name: "debug",
952
+ type: "boolean",
953
+ default: false,
954
+ description: "Whether open to see more information in node input & output"
826
955
  }
827
956
  ]
828
957
  });
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "IcpLookup", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return IcpLookup;
9
+ }
10
+ });
11
+ const _n8nworkflow = require("n8n-workflow");
12
+ const _connectionType = require("../../../common/connectionType");
13
+ const _runnerproxy = require("../../../common/proxy/runner.proxy");
14
+ const _decorator = require("../../../common/runner/decorator");
15
+ const _runner = require("../../../common/runner/runner");
16
+ function _define_property(obj, key, value) {
17
+ if (key in obj) {
18
+ Object.defineProperty(obj, key, {
19
+ value: value,
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true
23
+ });
24
+ } else {
25
+ obj[key] = value;
26
+ }
27
+ return obj;
28
+ }
29
+ function _ts_decorate(decorators, target, key, desc) {
30
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
31
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
32
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
33
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
34
+ }
35
+ let IcpLookupRunner = class IcpLookupRunner extends _runner.AbstractRunner {
36
+ async run(collector, inputs) {
37
+ const assets = inputs.map((n)=>n.json);
38
+ const api = this.func.getNodeParameter("api", this.itemIndex);
39
+ const rootDomains = assets.map((n)=>{
40
+ if (typeof n.metadata?.rootDomain === "string") {
41
+ return n.metadata.rootDomain;
42
+ } else {
43
+ const host = n.getDomain().split(".");
44
+ const result = [];
45
+ result.push(host.pop()); // last one must be
46
+ const valid_suffix = [
47
+ "com",
48
+ "cn",
49
+ "edu",
50
+ "org",
51
+ "gov"
52
+ ];
53
+ while(true){
54
+ const last = host.pop() ?? "";
55
+ result.push(last);
56
+ if (!valid_suffix.includes(last)) {
57
+ break;
58
+ }
59
+ }
60
+ return result.reverse().join(".");
61
+ }
62
+ });
63
+ const resp = await this.func.helpers.httpRequest.bind(this.func)({
64
+ method: "POST",
65
+ url: api,
66
+ body: {
67
+ host: Array.from(new Set(rootDomains)).join(",")
68
+ }
69
+ });
70
+ if (resp.code !== 0) {
71
+ throw new _n8nworkflow.NodeApiError(this.func.getNode(), resp);
72
+ }
73
+ const result = {};
74
+ resp.data.forEach((n)=>{
75
+ result[n.host] = n;
76
+ });
77
+ const ignorePersonal = this.func.getNodeParameter("ignorePersonal", this.itemIndex);
78
+ return inputs.map((n, index)=>{
79
+ const host = rootDomains[index];
80
+ const res = result[host];
81
+ if (res && res.typ !== "INVALID" && (!ignorePersonal || res.typ !== "个人")) {
82
+ n.json.metadata = {
83
+ ...n.json.metadata,
84
+ icp: res
85
+ };
86
+ n.success = true;
87
+ }
88
+ return n;
89
+ });
90
+ }
91
+ };
92
+ IcpLookupRunner = _ts_decorate([
93
+ (0, _decorator.Priority)(_decorator.BANNER_RUNNER_PRIORITY),
94
+ _decorator.AssetRunner
95
+ ], IcpLookupRunner);
96
+ class IcpLookup {
97
+ async supplyData(itemIndex) {
98
+ return {
99
+ response: [
100
+ (0, _runnerproxy.proxyRunner)(new IcpLookupRunner(this, itemIndex))
101
+ ]
102
+ };
103
+ }
104
+ constructor(){
105
+ _define_property(this, "description", {
106
+ displayName: "Runner: IcpLookup",
107
+ name: "icpLookup",
108
+ icon: "file:icp.svg",
109
+ group: [
110
+ "transform"
111
+ ],
112
+ codex: {
113
+ alias: [
114
+ "IcpLookup"
115
+ ],
116
+ categories: [
117
+ "SOAR"
118
+ ],
119
+ subcategories: {
120
+ SOAR: [
121
+ "runner"
122
+ ]
123
+ }
124
+ },
125
+ version: 1,
126
+ description: "lookup icp for asset",
127
+ defaults: {
128
+ name: "Icp Lookup"
129
+ },
130
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
131
+ inputs: [],
132
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-outputs-wrong
133
+ outputs: [
134
+ _connectionType.NodeConnectionType.Runner
135
+ ],
136
+ properties: [
137
+ {
138
+ displayName: "Only Success",
139
+ name: "onlySuccess",
140
+ type: "boolean",
141
+ default: true
142
+ },
143
+ {
144
+ displayName: "Icp API",
145
+ name: "api",
146
+ type: "string",
147
+ default: "",
148
+ required: true
149
+ },
150
+ {
151
+ displayName: "Ignore Personal",
152
+ name: "ignorePersonal",
153
+ type: "boolean",
154
+ default: true
155
+ },
156
+ {
157
+ displayName: "Debug Mode",
158
+ name: "debug",
159
+ type: "boolean",
160
+ default: false,
161
+ description: "Whether open to see more information in node input & output"
162
+ }
163
+ ]
164
+ });
165
+ }
166
+ }