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
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "RedisStorage", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return RedisStorage;
9
+ }
10
+ });
11
+ const _n8nworkflow = require("n8n-workflow");
12
+ const _redis = require("redis");
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
+ class RedisStorage {
27
+ async connect() {
28
+ await this.connectPromise;
29
+ }
30
+ async set(key, value) {
31
+ await this.connect();
32
+ if (this.ttl > 0) {
33
+ this.client.setEx(`${this.key}:${key}`, this.ttl, JSON.stringify(value));
34
+ } else {
35
+ this.client.set(`${this.key}:${key}`, JSON.stringify(value));
36
+ }
37
+ }
38
+ async get(key) {
39
+ await this.connect();
40
+ const resp = await this.client.get(`${this.key}:${key}`);
41
+ if (!resp) {
42
+ return null;
43
+ } else {
44
+ return JSON.parse(resp);
45
+ }
46
+ }
47
+ constructor(func, credentials, key, ttl){
48
+ _define_property(this, "key", void 0);
49
+ _define_property(this, "ttl", void 0);
50
+ _define_property(this, "client", void 0);
51
+ _define_property(this, "connectPromise", void 0);
52
+ this.key = key;
53
+ this.ttl = ttl;
54
+ const redisOptions = {
55
+ socket: {
56
+ host: credentials.host,
57
+ port: credentials.port
58
+ },
59
+ database: credentials.database
60
+ };
61
+ if (credentials.password) {
62
+ redisOptions.password = credentials.password;
63
+ }
64
+ this.client = (0, _redis.createClient)(redisOptions);
65
+ this.client.on("error", async (error)=>{
66
+ await this.client.quit();
67
+ throw new _n8nworkflow.NodeOperationError(func.getNode(), "Redis Error: " + error.message);
68
+ });
69
+ this.connectPromise = this.client.connect();
70
+ }
71
+ }
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "proxyExecutor", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return proxyExecutor;
9
+ }
10
+ });
11
+ const _connectionType = require("../connectionType");
12
+ const proxyExecutor = (i)=>{
13
+ return new Proxy(i, {
14
+ get: (target, prop, receiver)=>{
15
+ if ([
16
+ "run",
17
+ "readFile",
18
+ "writeFile"
19
+ ].includes(prop)) {
20
+ const f = Reflect.get(target, prop, receiver);
21
+ const func = Reflect.get(target, "func", receiver);
22
+ const itemIndex = Reflect.get(target, "itemIndex", receiver);
23
+ const debugMode = func.getNodeParameter("debug", itemIndex, false);
24
+ async function wrap(...args) {
25
+ let index = 0;
26
+ if (debugMode) {
27
+ index = func.addInputData(_connectionType.NodeConnectionType.Executor, [
28
+ func.helpers.returnJsonArray({
29
+ call: prop.toString(),
30
+ arguments: args
31
+ })
32
+ ]).index;
33
+ func.logger.debug(`Input: ${index} ${prop.toString()} ${JSON.stringify(args)}`);
34
+ }
35
+ const resp = await f.apply(this, args);
36
+ if (debugMode) {
37
+ func.addOutputData(_connectionType.NodeConnectionType.Executor, index, [
38
+ func.helpers.returnJsonArray(resp)
39
+ ]);
40
+ func.logger.debug(`Output: ${index} ${prop.toString()} ${JSON.stringify(resp)}`);
41
+ }
42
+ return resp;
43
+ }
44
+ return wrap.bind(target);
45
+ } else {
46
+ return Reflect.get(target, prop, receiver);
47
+ }
48
+ }
49
+ });
50
+ };
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "proxyMemorizer", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return proxyMemorizer;
9
+ }
10
+ });
11
+ const _connectionType = require("../connectionType");
12
+ const proxyMemorizer = (i)=>{
13
+ return new Proxy(i, {
14
+ get: (target, prop, receiver)=>{
15
+ if ([
16
+ "load",
17
+ "save",
18
+ "batchLoad",
19
+ "batchSave"
20
+ ].includes(prop.toString())) {
21
+ const f = Reflect.get(target, prop, receiver);
22
+ const func = Reflect.get(target, "func", receiver);
23
+ const itemIndex = Reflect.get(target, "itemIndex", receiver);
24
+ const debugMode = func.getNodeParameter("debug", itemIndex, false);
25
+ async function wrap(...args) {
26
+ let index = 0;
27
+ if (debugMode) {
28
+ index = func.addInputData(_connectionType.NodeConnectionType.Executor, [
29
+ func.helpers.returnJsonArray({
30
+ call: prop.toString(),
31
+ arguments: args
32
+ })
33
+ ]).index;
34
+ func.logger.debug(`Input: ${index} ${prop.toString()} ${JSON.stringify(args)}`);
35
+ }
36
+ const resp = await f.apply(target, args);
37
+ if (debugMode) {
38
+ func.addOutputData(_connectionType.NodeConnectionType.Executor, index, [
39
+ func.helpers.returnJsonArray(resp)
40
+ ]);
41
+ func.logger.debug(`Output: ${index} ${prop.toString()} ${JSON.stringify(resp)}`);
42
+ }
43
+ return resp;
44
+ }
45
+ return wrap.bind(target);
46
+ } else {
47
+ return Reflect.get(target, prop, receiver);
48
+ }
49
+ }
50
+ });
51
+ };
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "proxyRunner", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return proxyRunner;
9
+ }
10
+ });
11
+ const _classtransformer = require("class-transformer");
12
+ const _asset = require("../asset");
13
+ const _connectionType = require("../connectionType");
14
+ const _decorator = require("../runner/decorator");
15
+ const proxyRunner = (i)=>{
16
+ return new Proxy(i, {
17
+ get: (target, prop, receiver)=>{
18
+ if (prop === "run") {
19
+ const f = Reflect.get(target, prop, receiver);
20
+ const func = Reflect.get(target, "func", receiver);
21
+ const itemIndex = Reflect.get(target, "itemIndex", receiver);
22
+ const onlySuccess = func.getNodeParameter("onlySuccess", itemIndex, false);
23
+ const debugMode = func.getNodeParameter("debug", itemIndex, false);
24
+ async function wrap(collector, inputs) {
25
+ let index = 0;
26
+ if (debugMode) {
27
+ index = func.addInputData(_connectionType.NodeConnectionType.Runner, [
28
+ func.helpers.returnJsonArray((0, _classtransformer.instanceToPlain)(inputs))
29
+ ]).index;
30
+ func.logger.debug(`Input: ${index} ${JSON.stringify(inputs.map((n)=>n.json))}`);
31
+ }
32
+ if ((0, _decorator.getAssetRunner)(this)) {
33
+ inputs.forEach((n)=>{
34
+ n.json = _asset.Asset.fromPlain(n.json);
35
+ });
36
+ }
37
+ if ((0, _decorator.getOnlySuccess)(this.constructor) && onlySuccess) {
38
+ inputs.forEach((a)=>{
39
+ a.success = false;
40
+ });
41
+ }
42
+ let resp = await f.call(this, collector, inputs);
43
+ if ((0, _decorator.getOnlySuccess)(this.constructor) && onlySuccess) {
44
+ resp = resp.filter((a)=>a.success);
45
+ }
46
+ if (debugMode) {
47
+ func.addOutputData(_connectionType.NodeConnectionType.Runner, index, [
48
+ resp
49
+ ]);
50
+ func.logger.debug(`Output: ${index} ${JSON.stringify(resp.map((n)=>n.json))}`);
51
+ }
52
+ return resp;
53
+ }
54
+ return wrap.bind(target);
55
+ } else {
56
+ return Reflect.get(target, prop, receiver);
57
+ }
58
+ }
59
+ });
60
+ };
@@ -12,85 +12,75 @@ _export(exports, {
12
12
  ContainerRunner: function() {
13
13
  return ContainerRunner;
14
14
  },
15
- IMAGE: function() {
16
- return IMAGE;
17
- },
18
- injectCommonProperties: function() {
19
- return injectCommonProperties;
15
+ advancedOptions: function() {
16
+ return advancedOptions;
20
17
  }
21
18
  });
22
19
  const _n8nworkflow = require("n8n-workflow");
23
20
  const _runner = require("./runner");
24
- const IMAGE = {
25
- DEFAULT: "registry.yoshino-s.xyz/yoshino-s/soar-image:dev",
26
- SCRIPT: "registry.yoshino-s.xyz/yoshino-s/soar-image/script:dev"
27
- };
28
- const injectCommonProperties = (p)=>{
29
- return [
30
- ...p,
31
- {
32
- displayName: "Advanced Config",
33
- name: "advanced",
34
- type: "fixedCollection",
35
- default: {},
36
- typeOptions: {
37
- multipleValues: true
21
+ const advancedOptions = [
22
+ {
23
+ displayName: "Advanced Config",
24
+ name: "advanced",
25
+ type: "fixedCollection",
26
+ default: {},
27
+ typeOptions: {
28
+ multipleValues: true
29
+ },
30
+ options: [
31
+ {
32
+ name: "envs",
33
+ displayName: "Envs",
34
+ values: [
35
+ {
36
+ displayName: "Key",
37
+ name: "key",
38
+ type: "string",
39
+ default: ""
40
+ },
41
+ {
42
+ displayName: "Value",
43
+ name: "value",
44
+ type: "string",
45
+ default: ""
46
+ }
47
+ ]
38
48
  },
39
- options: [
40
- {
41
- name: "envs",
42
- displayName: "Envs",
43
- values: [
44
- {
45
- displayName: "Key",
46
- name: "key",
47
- type: "string",
48
- default: ""
49
- },
50
- {
51
- displayName: "Value",
52
- name: "value",
53
- type: "string",
54
- default: ""
55
- }
56
- ]
57
- },
58
- {
59
- name: "Files",
60
- displayName: "Files",
61
- values: [
62
- {
63
- displayName: "Name",
64
- name: "name",
65
- type: "string",
66
- default: ""
67
- },
68
- {
69
- displayName: "Content",
70
- name: "content",
71
- type: "string",
72
- default: ""
73
- }
74
- ]
75
- },
76
- {
77
- displayName: "Collect Files",
78
- name: "collectFiles",
79
- values: [
80
- {
81
- displayName: "Name",
82
- name: "name",
83
- type: "string",
84
- default: ""
85
- }
86
- ]
87
- }
88
- ]
89
- }
90
- ];
91
- };
92
- class ContainerRunner extends _runner.Runner {
93
- collectGeneratedOptions(extraArgParameters) {
49
+ {
50
+ name: "Files",
51
+ displayName: "Files",
52
+ values: [
53
+ {
54
+ displayName: "Name",
55
+ name: "name",
56
+ type: "string",
57
+ default: ""
58
+ },
59
+ {
60
+ displayName: "Content",
61
+ name: "content",
62
+ type: "string",
63
+ default: ""
64
+ }
65
+ ]
66
+ },
67
+ {
68
+ displayName: "Collect Files",
69
+ name: "collectFiles",
70
+ values: [
71
+ {
72
+ displayName: "Name",
73
+ name: "name",
74
+ type: "string",
75
+ default: ""
76
+ }
77
+ ]
78
+ }
79
+ ]
80
+ }
81
+ ];
82
+ class ContainerRunner extends _runner.AbstractRunner {
83
+ collectGeneratedCmdOptions(extraArgParameters) {
94
84
  const cmdline = [];
95
85
  for (const parameter of extraArgParameters){
96
86
  const value = this.func.getNodeParameter(parameter, this.itemIndex, null);
@@ -114,8 +104,7 @@ class ContainerRunner extends _runner.Runner {
114
104
  }
115
105
  return cmdline;
116
106
  }
117
- options(assets) {
118
- assets;
107
+ getOptions() {
119
108
  const options = {
120
109
  envs: {},
121
110
  files: {},
@@ -135,40 +124,36 @@ class ContainerRunner extends _runner.Runner {
135
124
  options.collectFiles = _collectFiles.map(({ name })=>name);
136
125
  return options;
137
126
  }
138
- async __run(collector, assets) {
139
- if (collector.executor === undefined) {
140
- throw new _n8nworkflow.NodeOperationError(this.func.getNode(), "Executor is not set");
141
- }
142
- const options = this.options(assets);
143
- const cmd = this.cmd(assets);
144
- let cmdline = [
145
- "/usr/local/bin/runner"
146
- ];
147
- if (options.files) {
148
- for (const [key, value] of Object.entries(options.files)){
149
- cmdline.push("--files", `${key}:${value}`);
150
- }
151
- }
152
- if (options.collectFiles) {
153
- for (const key of options.collectFiles){
154
- cmdline.push("--collect-files", key);
155
- }
156
- }
157
- if (options.ignoreStdout) {
158
- cmdline.push("--ignore-stdout");
159
- }
160
- if (options.ignoreStderr) {
161
- cmdline.push("--ignore-stderr");
162
- }
163
- cmdline.push("--");
164
- cmdline = cmdline.concat(cmd);
165
- const { stdout, stderr, error, files: resultFiles } = await collector.executor.run(cmdline, options.image ?? IMAGE.DEFAULT, options.envs);
166
- if (error) {
167
- throw new _n8nworkflow.NodeOperationError(this.func.getNode(), new Error(error));
127
+ async runCmd(collector, cmd, options) {
128
+ const executor = collector.executor;
129
+ if (executor === undefined) {
130
+ throw new _n8nworkflow.NodeOperationError(this.func.getNode(), new Error("Executor is not set"));
168
131
  }
132
+ await Promise.all(Object.entries(options.files).map(([k, v])=>{
133
+ return executor.writeFile(k, v);
134
+ }));
135
+ const { stdout, stderr } = await executor.run(cmd, {
136
+ env: Object.entries(options.envs).map(([k, v])=>`${k}=${v}`),
137
+ ignoreStderr: options.ignoreStderr,
138
+ ignoreStdout: options.ignoreStdout
139
+ });
169
140
  if (stderr) {
170
- this.func.logger.warn(stderr);
141
+ throw new _n8nworkflow.NodeOperationError(this.func.getNode(), new Error(`stderr: ${stderr}`));
171
142
  }
172
- return this.process(assets, stdout, resultFiles ?? {});
143
+ const resultFiles = (await Promise.all(options.collectFiles.map(async (n)=>{
144
+ const content = await executor.readFile(n);
145
+ return [
146
+ n,
147
+ content
148
+ ];
149
+ }))).reduce((acc, [k, v])=>{
150
+ acc[k] = v;
151
+ return acc;
152
+ }, {});
153
+ return {
154
+ stdout,
155
+ stderr,
156
+ files: resultFiles
157
+ };
173
158
  }
174
159
  }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ AssetRunner: function() {
13
+ return AssetRunner;
14
+ },
15
+ getAssetRunner: function() {
16
+ return getAssetRunner;
17
+ }
18
+ });
19
+ const _onlySuccess = require("./onlySuccess");
20
+ const _decorator = require("../../../utils/decorator");
21
+ const [_AssetRunner, _getAssetRunner] = (0, _decorator.declareClassDecorator)("assetRunner", false);
22
+ const AssetRunner = (t)=>{
23
+ _AssetRunner(true)(t);
24
+ (0, _onlySuccess.OnlySuccess)(true)(t);
25
+ };
26
+ const getAssetRunner = _getAssetRunner;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ _export_star(require("./assetRunner"), exports);
6
+ _export_star(require("./onlySuccess"), exports);
7
+ _export_star(require("./priority"), exports);
8
+ function _export_star(from, to) {
9
+ Object.keys(from).forEach(function(k) {
10
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
11
+ Object.defineProperty(to, k, {
12
+ enumerable: true,
13
+ get: function() {
14
+ return from[k];
15
+ }
16
+ });
17
+ }
18
+ });
19
+ return from;
20
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ OnlySuccess: function() {
13
+ return OnlySuccess;
14
+ },
15
+ getOnlySuccess: function() {
16
+ return getOnlySuccess;
17
+ }
18
+ });
19
+ const _decorator = require("../../../utils/decorator");
20
+ const [OnlySuccess, getOnlySuccess] = (0, _decorator.declareClassDecorator)("onlySuccess", false);
@@ -32,13 +32,21 @@ _export(exports, {
32
32
  },
33
33
  PORT_RUNNER_PRIORITY: function() {
34
34
  return PORT_RUNNER_PRIORITY;
35
+ },
36
+ Priority: function() {
37
+ return Priority;
38
+ },
39
+ getPriority: function() {
40
+ return getPriority;
35
41
  }
36
42
  });
37
- const DEFAULT_PRIORITY = 100;
38
- const DOMAIN_RUNNER_PRIORITY = 10;
39
- const DNS_RUNNER_PRIORITY = 20;
40
- const IP_RUNNER_PRIORITY = 30;
41
- const PORT_RUNNER_PRIORITY = 40;
42
- const BANNER_RUNNER_PRIORITY = 50;
43
- const APP_RUNNER_PRIORITY = 60;
44
- const EXPLOIT_RUNNER_PRIORITY = 70;
43
+ const _decorator = require("../../../utils/decorator");
44
+ const DEFAULT_PRIORITY = 0;
45
+ const DOMAIN_RUNNER_PRIORITY = 100;
46
+ const DNS_RUNNER_PRIORITY = 90;
47
+ const IP_RUNNER_PRIORITY = 80;
48
+ const PORT_RUNNER_PRIORITY = 70;
49
+ const BANNER_RUNNER_PRIORITY = 60;
50
+ const APP_RUNNER_PRIORITY = 50;
51
+ const EXPLOIT_RUNNER_PRIORITY = 40;
52
+ const [Priority, getPriority] = (0, _decorator.declareClassDecorator)("priority", DEFAULT_PRIORITY);
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "PriorityRunner", {
8
8
  return PriorityRunner;
9
9
  }
10
10
  });
11
+ const _decorator = require("./decorator");
11
12
  const _runner = require("./runner");
12
13
  function _define_property(obj, key, value) {
13
14
  if (key in obj) {
@@ -22,17 +23,15 @@ function _define_property(obj, key, value) {
22
23
  }
23
24
  return obj;
24
25
  }
25
- class PriorityRunner extends _runner.Runner {
26
- __run(collector, assets) {
27
- return assets;
28
- }
29
- run(collector, assets) {
26
+ class PriorityRunner extends _runner.AbstractRunner {
27
+ async run(collector, inputs) {
30
28
  // bypass set input/output in priority runner node
31
- return this.parentRunner.run(collector, assets);
29
+ return this.parentRunner.run(collector, inputs);
32
30
  }
33
31
  constructor(parentRunner, priority){
34
- super(parentRunner.name, priority, parentRunner.func, parentRunner.itemIndex);
32
+ super(parentRunner.func, parentRunner.itemIndex);
35
33
  _define_property(this, "parentRunner", void 0);
36
34
  this.parentRunner = parentRunner;
35
+ (0, _decorator.Priority)(priority)(this.constructor);
37
36
  }
38
37
  }
@@ -2,15 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "Runner", {
5
+ Object.defineProperty(exports, "AbstractRunner", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return Runner;
8
+ return AbstractRunner;
9
9
  }
10
10
  });
11
- const _classtransformer = require("class-transformer");
12
- const _connectionType = require("../connectionType");
13
- const _priority = require("./priority");
14
11
  function _define_property(obj, key, value) {
15
12
  if (key in obj) {
16
13
  Object.defineProperty(obj, key, {
@@ -24,33 +21,17 @@ function _define_property(obj, key, value) {
24
21
  }
25
22
  return obj;
26
23
  }
27
- class Runner {
28
- async run(collector, assets) {
29
- assets.forEach((a)=>a.success = false);
30
- const { index } = this.func.addInputData(_connectionType.NodeConnectionType.Runner, [
31
- assets.map((a)=>({
32
- json: (0, _classtransformer.instanceToPlain)(a)
33
- }))
34
- ]);
35
- let resp = await this.__run(collector, assets);
36
- const onlySuccess = this.func.getNodeParameter("onlySuccess", index, true);
37
- if (onlySuccess) {
38
- resp = resp.filter((a)=>a.success);
39
- }
40
- this.func.addOutputData(_connectionType.NodeConnectionType.Runner, index, [
41
- resp.map((a)=>({
42
- json: (0, _classtransformer.instanceToPlain)(a)
43
- }))
44
- ]);
45
- return resp;
24
+ class AbstractRunner {
25
+ constructData(sourceInputIndex, d, success = false) {
26
+ return d.map((a)=>({
27
+ json: a,
28
+ success,
29
+ sourceInputIndex
30
+ }));
46
31
  }
47
- constructor(name, priority = _priority.DEFAULT_PRIORITY, func, itemIndex){
48
- _define_property(this, "name", void 0);
49
- _define_property(this, "priority", void 0);
32
+ constructor(func, itemIndex){
50
33
  _define_property(this, "func", void 0);
51
34
  _define_property(this, "itemIndex", void 0);
52
- this.name = name;
53
- this.priority = priority;
54
35
  this.func = func;
55
36
  this.itemIndex = itemIndex;
56
37
  }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "IMAGE", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return IMAGE;
9
+ }
10
+ });
11
+ const IMAGE = "registry.yoshino-s.xyz/yoshino-s/soar-image:dev";