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,211 @@
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
+ RESOURCES: function() {
13
+ return RESOURCES;
14
+ },
15
+ VulboxApi: function() {
16
+ return VulboxApi;
17
+ }
18
+ });
19
+ const _asynclock = /*#__PURE__*/ _interop_require_default(require("async-lock"));
20
+ const _n8nworkflow = require("n8n-workflow");
21
+ const _nodecache = /*#__PURE__*/ _interop_require_default(require("node-cache"));
22
+ function _define_property(obj, key, value) {
23
+ if (key in obj) {
24
+ Object.defineProperty(obj, key, {
25
+ value: value,
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true
29
+ });
30
+ } else {
31
+ obj[key] = value;
32
+ }
33
+ return obj;
34
+ }
35
+ function _interop_require_default(obj) {
36
+ return obj && obj.__esModule ? obj : {
37
+ default: obj
38
+ };
39
+ }
40
+ const cache = new _nodecache.default({
41
+ stdTTL: 60 * 24
42
+ });
43
+ const lock = new _asynclock.default();
44
+ let lastRequestTime = Date.now();
45
+ const REQUEST_INTERVAL = 2000;
46
+ var RESOURCES;
47
+ (function(RESOURCES) {
48
+ RESOURCES["TASK"] = "bugs/tasks";
49
+ RESOURCES["VULNERABILITY"] = "vulnerability";
50
+ RESOURCES["BUSINESS"] = "bugs/business";
51
+ RESOURCES["VPN"] = "project/vpn";
52
+ })(RESOURCES || (RESOURCES = {}));
53
+ const questionAnswer = {
54
+ 1: 1,
55
+ 2: 1,
56
+ 3: 1,
57
+ 4: [
58
+ 0,
59
+ 1
60
+ ],
61
+ 5: 1,
62
+ 6: 1,
63
+ 7: 3,
64
+ 8: 1,
65
+ 9: [
66
+ 0,
67
+ 1
68
+ ],
69
+ 10: 1,
70
+ 11: 4,
71
+ 12: 0,
72
+ 13: 1,
73
+ 14: 1,
74
+ 15: 1,
75
+ 16: 1,
76
+ 18: 1,
77
+ 19: 0,
78
+ 20: 4,
79
+ 21: [
80
+ 0,
81
+ 2
82
+ ],
83
+ 22: [
84
+ 0,
85
+ 1,
86
+ 2,
87
+ 3
88
+ ],
89
+ 23: 0
90
+ };
91
+ class NeedQuestionError extends Error {
92
+ }
93
+ class VulboxApiError extends _n8nworkflow.NodeApiError {
94
+ }
95
+ class VulboxApi {
96
+ async request(options) {
97
+ while(true){
98
+ const resp = await lock.acquire("vulboxApi", async ()=>{
99
+ if (options.cache) {
100
+ const cacheKey = JSON.stringify(options);
101
+ const cached = cache.get(cacheKey);
102
+ if (cached) {
103
+ return cached;
104
+ }
105
+ }
106
+ if (Date.now() - lastRequestTime < REQUEST_INTERVAL) {
107
+ await new Promise((resolve)=>setTimeout(resolve, REQUEST_INTERVAL));
108
+ }
109
+ this.func.logger.info(`Requesting ${options.url}`);
110
+ lastRequestTime = Date.now();
111
+ const resp = await this.func.helpers.httpRequestWithAuthentication.call(this.func, "vulboxApi", options);
112
+ this.func.logger.info(`Response ${JSON.stringify(resp)}`);
113
+ if (resp.code !== 200) {
114
+ if (resp.code === 429) {} else if (resp.code === 550) {
115
+ throw new NeedQuestionError();
116
+ } else {
117
+ throw new VulboxApiError(this.func.getNode(), resp, {
118
+ message: `Vulbox API error response: ${JSON.stringify(resp)}`
119
+ });
120
+ }
121
+ }
122
+ if (options.cache) {
123
+ const cacheKey = JSON.stringify(options);
124
+ cache.set(cacheKey, resp);
125
+ }
126
+ return resp;
127
+ });
128
+ if (resp.code === 429) {
129
+ continue;
130
+ }
131
+ return resp.data;
132
+ }
133
+ }
134
+ async listIndustries() {
135
+ return this.request({
136
+ method: "GET",
137
+ url: "https://user.vulbox.com/api/hacker/common/industry",
138
+ cache: true
139
+ });
140
+ }
141
+ async listAreas() {
142
+ return this.request({
143
+ method: "GET",
144
+ url: "https://user.vulbox.com/api/hacker/common/area",
145
+ cache: true
146
+ });
147
+ }
148
+ async listBugTypes() {
149
+ return this.request({
150
+ method: "GET",
151
+ url: "https://user.vulbox.com/api/hacker/bugs/bug_type/list",
152
+ cache: true
153
+ });
154
+ }
155
+ async list(resource, full, options) {
156
+ const resp = await this.request({
157
+ method: "GET",
158
+ url: `https://user.vulbox.com/api/hacker/${resource}${resource === "bugs/business" ? "" : "/list"}`,
159
+ qs: options
160
+ });
161
+ if (full) {
162
+ return resp;
163
+ } else {
164
+ return resp.data;
165
+ }
166
+ }
167
+ async submitBug(request) {
168
+ try {
169
+ const resp = await this.request({
170
+ method: "POST",
171
+ url: "https://user.vulbox.com/api/hacker/bugs/bugs",
172
+ body: request
173
+ });
174
+ return {
175
+ code: 200,
176
+ msg: "success",
177
+ data: resp
178
+ };
179
+ } catch (e) {
180
+ if (e instanceof NeedQuestionError) {
181
+ await this.solveQuestion();
182
+ return await this.submitBug(request);
183
+ } else if (e instanceof VulboxApiError) {
184
+ return e.cause;
185
+ } else {
186
+ throw e;
187
+ }
188
+ }
189
+ }
190
+ async solveQuestion() {
191
+ const questions = await this.request({
192
+ method: "GET",
193
+ url: "https://user.vulbox.com/api/hacker/question"
194
+ });
195
+ const answers = questions.reduce((acc, cur)=>{
196
+ acc[cur.id] = questionAnswer[cur.id];
197
+ return acc;
198
+ }, {});
199
+ await this.request({
200
+ method: "POST",
201
+ url: "https://user.vulbox.com/api/hacker/question",
202
+ body: {
203
+ question_ids: answers
204
+ }
205
+ });
206
+ }
207
+ constructor(func){
208
+ _define_property(this, "func", void 0);
209
+ this.func = func;
210
+ }
211
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "methods", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return methods;
9
+ }
10
+ });
11
+ const _api = require("./api");
12
+ const methods = {
13
+ listSearch: {
14
+ async listBusinesses (filter, paginationToken) {
15
+ const client = new _api.VulboxApi(this);
16
+ const page = paginationToken ? parseInt(paginationToken) : 1;
17
+ const resp = await client.list(_api.RESOURCES.BUSINESS, true, {
18
+ search_value: filter ?? "",
19
+ page: page
20
+ });
21
+ return {
22
+ results: resp.data.map((n)=>({
23
+ name: `${n.bus_name}|${n.bus_url}`,
24
+ url: n.bus_url,
25
+ value: JSON.stringify(n)
26
+ })),
27
+ paginationToken: page === resp.last_page ? undefined : page + 1
28
+ };
29
+ },
30
+ async listTasks (filter, paginationToken) {
31
+ const client = new _api.VulboxApi(this);
32
+ const page = paginationToken ? parseInt(paginationToken) : 1;
33
+ const resp = await client.list(_api.RESOURCES.TASK, true, {
34
+ search_value: filter ?? "",
35
+ page: page
36
+ });
37
+ return {
38
+ results: resp.data.map((n)=>({
39
+ name: n.task_title,
40
+ value: n.id
41
+ })),
42
+ paginationToken: page === resp.last_page ? undefined : page + 1
43
+ };
44
+ }
45
+ },
46
+ loadOptions: {
47
+ async listAreas () {
48
+ const client = new _api.VulboxApi(this);
49
+ const resp = await client.listAreas();
50
+ return resp.flatMap(({ name: parentName, children })=>children.map(({ name })=>[
51
+ parentName,
52
+ name
53
+ ])).map((v)=>({
54
+ name: v.join("/"),
55
+ value: v.join("/")
56
+ }));
57
+ },
58
+ async listIndustries () {
59
+ const client = new _api.VulboxApi(this);
60
+ const resp = await client.listIndustries();
61
+ return resp.map(({ title })=>title).map((v)=>({
62
+ name: v,
63
+ value: v
64
+ }));
65
+ },
66
+ async listIndustryCategories () {
67
+ const client = new _api.VulboxApi(this);
68
+ const resp = await client.listIndustries();
69
+ const industry = this.getNodeParameter("industry");
70
+ return resp.find(({ title })=>title === industry)?.children?.map(({ title })=>({
71
+ name: title,
72
+ value: title
73
+ })) ?? [];
74
+ },
75
+ async listTopLevelBugTypes () {
76
+ const client = new _api.VulboxApi(this);
77
+ const resp = await client.listBugTypes();
78
+ return resp.map((v)=>({
79
+ name: v.title,
80
+ value: v.title
81
+ }));
82
+ },
83
+ async listBugTypes () {
84
+ const client = new _api.VulboxApi(this);
85
+ const resp = await client.listBugTypes();
86
+ const flatBugTypes = [];
87
+ const topLevelBugType = this.getNodeParameter("bug_type_top");
88
+ const topLevelBugTypeObj = resp.find(({ title })=>title === topLevelBugType);
89
+ if (!topLevelBugTypeObj) {
90
+ return [];
91
+ }
92
+ function flatten(bugTypes = [], prefix = [], path = []) {
93
+ for (const { id, title, children } of bugTypes){
94
+ if (!children) {
95
+ flatBugTypes.push({
96
+ name: [
97
+ ...prefix,
98
+ title
99
+ ].join("/"),
100
+ value: JSON.stringify([
101
+ ...path,
102
+ id
103
+ ].map((v)=>v.toString()))
104
+ });
105
+ } else {
106
+ flatten(children, [
107
+ ...prefix,
108
+ title
109
+ ], [
110
+ ...path,
111
+ id
112
+ ]);
113
+ }
114
+ }
115
+ }
116
+ flatten(topLevelBugTypeObj.children ?? [], [
117
+ topLevelBugTypeObj.title
118
+ ], [
119
+ topLevelBugTypeObj.id
120
+ ]);
121
+ return flatBugTypes;
122
+ }
123
+ }
124
+ };