n8n-nodes-soar 0.1.10 → 0.1.11

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.
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "Uncover", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return Uncover;
9
+ }
10
+ });
11
+ const _executor = require("../../utils/executor");
12
+ function _define_property(obj, key, value) {
13
+ if (key in obj) {
14
+ Object.defineProperty(obj, key, {
15
+ value: value,
16
+ enumerable: true,
17
+ configurable: true,
18
+ writable: true
19
+ });
20
+ } else {
21
+ obj[key] = value;
22
+ }
23
+ return obj;
24
+ }
25
+ class Uncover {
26
+ async execute() {
27
+ const result = [];
28
+ const executor = new _executor.SoarExecutor(this);
29
+ for(let idx = 0; idx < this.getInputData().length; idx++){
30
+ const response = await executor.run(idx, "uncover", "-query", {
31
+ extraArgs: [
32
+ "-disable-update-check",
33
+ "-json",
34
+ "-silent"
35
+ ],
36
+ extraArgParameters: [
37
+ "options.input",
38
+ "options.searchEngine",
39
+ "options.config",
40
+ "options.output"
41
+ ]
42
+ });
43
+ result.push(...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(((d)=>d.split("\n").map((n)=>n.trim()).filter(Boolean).map((d)=>JSON.parse(d)))(response.stdout)), {
44
+ itemData: {
45
+ item: idx
46
+ }
47
+ }));
48
+ }
49
+ return [
50
+ result
51
+ ];
52
+ }
53
+ constructor(){
54
+ _define_property(this, "description", {
55
+ displayName: "Soar: Uncover",
56
+ name: "uncover",
57
+ group: [
58
+ "output"
59
+ ],
60
+ version: 1,
61
+ subtitle: "={{ 'uncover' + ($parameter['batch'] ? ' (Batch)' : ' on ' + $parameter['target']) }}",
62
+ description: "Interact with Uncover",
63
+ defaults: {
64
+ name: "Uncover"
65
+ },
66
+ inputs: [
67
+ "main"
68
+ ],
69
+ outputs: [
70
+ "main"
71
+ ],
72
+ credentials: [
73
+ {
74
+ name: "dockerCredentialsApi"
75
+ },
76
+ {
77
+ name: "kubernetesCredentialsApi"
78
+ }
79
+ ],
80
+ properties: (0, _executor.injectCommonProperties)([
81
+ {
82
+ displayName: "Options",
83
+ name: "options",
84
+ type: "fixedCollection",
85
+ default: {},
86
+ typeOptions: {
87
+ multipleValues: true
88
+ },
89
+ options: [
90
+ {
91
+ displayName: "Input",
92
+ name: "input",
93
+ values: [
94
+ {
95
+ displayName: "Options",
96
+ name: "key",
97
+ type: "options",
98
+ default: "-engine",
99
+ options: [
100
+ {
101
+ name: "Engine",
102
+ value: "-engine",
103
+ description: "Search engine to query (shodan,shodan-idb,fofa,censys,quake,hunter,zoomeye,netlas,publicwww,criminalip,hunterhow) (default shodan) (string[])"
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ displayName: "Value",
109
+ name: "value",
110
+ type: "string",
111
+ default: ""
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ displayName: "Search Engine",
117
+ name: "searchEngine",
118
+ values: [
119
+ {
120
+ displayName: "Options",
121
+ name: "key",
122
+ type: "options",
123
+ default: "-censys",
124
+ options: [
125
+ {
126
+ name: "Censys",
127
+ value: "-censys",
128
+ description: "Search query for censys (example: -censys 'query.txt') (string[])"
129
+ },
130
+ {
131
+ name: "CriminalIP",
132
+ value: "-criminalip",
133
+ description: "Search query for criminalip (example: -criminalip 'query.txt') (string[])"
134
+ },
135
+ {
136
+ name: "Fofa",
137
+ value: "-fofa",
138
+ description: "Search query for fofa (example: -fofa 'query.txt') (string[])"
139
+ },
140
+ {
141
+ name: "Hunter",
142
+ value: "-hunter",
143
+ description: "Search query for hunter (example: -hunter 'query.txt') (string[])"
144
+ },
145
+ {
146
+ name: "Hunterhow",
147
+ value: "-hunterhow",
148
+ description: "Search query for hunterhow (example: -hunterhow 'query.txt') (string[])"
149
+ },
150
+ {
151
+ name: "Netlas",
152
+ value: "-netlas",
153
+ description: "Search query for netlas (example: -netlas 'query.txt') (string[])"
154
+ },
155
+ {
156
+ name: "Publicwww",
157
+ value: "-publicwww",
158
+ description: "Search query for publicwww (example: -publicwww 'query.txt') (string[])"
159
+ },
160
+ {
161
+ name: "Quake",
162
+ value: "-quake",
163
+ description: "Search query for quake (example: -quake 'query.txt') (string[])"
164
+ },
165
+ {
166
+ name: "Shodan",
167
+ value: "-shodan",
168
+ description: "Search query for shodan (example: -shodan 'query.txt') (string[])"
169
+ },
170
+ {
171
+ name: "Shodan IDb",
172
+ value: "-shodan-idb",
173
+ description: "Search query for shodan-idb (example: -shodan-idb 'query.txt') (string[])"
174
+ },
175
+ {
176
+ name: "Zoomeye",
177
+ value: "-zoomeye",
178
+ description: "Search query for zoomeye (example: -zoomeye 'query.txt') (string[])"
179
+ }
180
+ ]
181
+ },
182
+ {
183
+ displayName: "Value",
184
+ name: "value",
185
+ type: "string",
186
+ default: ""
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ displayName: "Config",
192
+ name: "config",
193
+ values: [
194
+ {
195
+ displayName: "Options",
196
+ name: "key",
197
+ type: "options",
198
+ default: "-config",
199
+ options: [
200
+ {
201
+ name: "Config",
202
+ value: "-config",
203
+ description: 'Flag configuration file (default "/root/.config/uncover/config.yaml") (string)'
204
+ },
205
+ {
206
+ name: "ProvIDer",
207
+ value: "-provider",
208
+ description: 'Provider configuration file (default "/root/.config/uncover/provider-config.yaml") (string)'
209
+ },
210
+ {
211
+ name: "Rate Limit",
212
+ value: "-rate-limit",
213
+ description: "Maximum number of http requests to send per second (int)"
214
+ },
215
+ {
216
+ name: "Rate Limit Minute",
217
+ value: "-rate-limit-minute",
218
+ description: "Maximum number of requests to send per minute (int)"
219
+ },
220
+ {
221
+ name: "Retry",
222
+ value: "-retry",
223
+ description: "Number of times to retry a failed request (default 2) (int)"
224
+ },
225
+ {
226
+ name: "Timeout",
227
+ value: "-timeout",
228
+ description: "Timeout in seconds (default 30) (int)"
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ displayName: "Value",
234
+ name: "value",
235
+ type: "string",
236
+ default: ""
237
+ }
238
+ ]
239
+ },
240
+ {
241
+ displayName: "Output",
242
+ name: "output",
243
+ values: [
244
+ {
245
+ displayName: "Options",
246
+ name: "key",
247
+ type: "options",
248
+ default: "-field",
249
+ options: [
250
+ {
251
+ name: "Field",
252
+ value: "-field",
253
+ description: 'Field to display in output (ip,port,host) (default "ip:port") (string)'
254
+ },
255
+ {
256
+ name: "Raw",
257
+ value: "-raw",
258
+ description: "Write raw output as received by the remote api"
259
+ },
260
+ {
261
+ name: "Limit",
262
+ value: "-limit",
263
+ description: "Limit the number of results to return (default 100) (int)"
264
+ }
265
+ ]
266
+ },
267
+ {
268
+ displayName: "Value",
269
+ name: "value",
270
+ type: "string",
271
+ default: ""
272
+ }
273
+ ]
274
+ }
275
+ ]
276
+ }
277
+ ])
278
+ });
279
+ }
280
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "node": "n8n-nodes-soar.uncover",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": [
6
+ "Development",
7
+ "Container"
8
+ ]
9
+ }
@@ -2,9 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "SoarExecutor", {
6
- enumerable: true,
7
- get: function() {
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
+ injectCommonProperties: function() {
13
+ return injectCommonProperties;
14
+ },
15
+ SoarExecutor: function() {
8
16
  return SoarExecutor;
9
17
  }
10
18
  });
@@ -24,6 +32,102 @@ function _define_property(obj, key, value) {
24
32
  }
25
33
  return obj;
26
34
  }
35
+ const injectCommonProperties = (p, target = true)=>{
36
+ const properties = [];
37
+ if (target) {
38
+ properties.push({
39
+ displayName: "Batch",
40
+ name: "batch",
41
+ type: "boolean",
42
+ default: false
43
+ }, {
44
+ displayName: "Target",
45
+ name: "target",
46
+ type: "string",
47
+ default: "",
48
+ displayOptions: {
49
+ show: {
50
+ batch: [
51
+ false
52
+ ]
53
+ }
54
+ }
55
+ }, {
56
+ displayName: "Targets",
57
+ name: "targets",
58
+ type: "json",
59
+ default: "[]",
60
+ displayOptions: {
61
+ show: {
62
+ batch: [
63
+ true
64
+ ]
65
+ }
66
+ }
67
+ });
68
+ }
69
+ properties.push(...p);
70
+ properties.push({
71
+ displayName: "Advanced Config",
72
+ name: "advanced",
73
+ type: "fixedCollection",
74
+ default: {},
75
+ typeOptions: {
76
+ multipleValues: true
77
+ },
78
+ options: [
79
+ {
80
+ name: "envs",
81
+ displayName: "Envs",
82
+ values: [
83
+ {
84
+ displayName: "Key",
85
+ name: "key",
86
+ type: "string",
87
+ default: ""
88
+ },
89
+ {
90
+ displayName: "Value",
91
+ name: "value",
92
+ type: "string",
93
+ default: ""
94
+ }
95
+ ]
96
+ },
97
+ {
98
+ name: "Files",
99
+ displayName: "Files",
100
+ values: [
101
+ {
102
+ displayName: "Name",
103
+ name: "name",
104
+ type: "string",
105
+ default: ""
106
+ },
107
+ {
108
+ displayName: "Content",
109
+ name: "content",
110
+ type: "string",
111
+ default: ""
112
+ }
113
+ ]
114
+ },
115
+ {
116
+ displayName: "Collect Files",
117
+ name: "colllectFiles",
118
+ values: [
119
+ {
120
+ displayName: "Name",
121
+ name: "name",
122
+ type: "string",
123
+ default: ""
124
+ }
125
+ ]
126
+ }
127
+ ]
128
+ });
129
+ return properties;
130
+ };
27
131
  class SoarExecutor {
28
132
  async getRunner(idx) {
29
133
  try {
@@ -40,11 +144,34 @@ class SoarExecutor {
40
144
  }
41
145
  throw new _n8nworkflow.NodeOperationError(this.func.getNode(), "No credentials got returned!");
42
146
  }
43
- async run(idx, cmdd, env, files, collectFiles = []) {
147
+ async run(idx, target, targetArg, { env = {}, files = {}, collectFiles = [], extraArgs = [], extraArgParameters = [] } = {}) {
44
148
  const runner = await this.getRunner(idx);
45
149
  const cmdline = [
46
150
  "/usr/local/bin/runner"
47
151
  ];
152
+ const _env = this.func.getNodeParameter("advanced.envs", idx, []);
153
+ env = Object.assign({}, env, Object.fromEntries(_env.map(({ key, value })=>[
154
+ key,
155
+ value
156
+ ])));
157
+ const _files = this.func.getNodeParameter("advanced.files", idx, []);
158
+ files = Object.assign({}, files, Object.fromEntries(_files.map(({ name, content })=>[
159
+ name,
160
+ content
161
+ ])));
162
+ const _collectFiles = this.func.getNodeParameter("advanced.collectFiles", idx, []);
163
+ collectFiles = collectFiles.concat(_collectFiles.map(({ name })=>name));
164
+ let targets = [];
165
+ if (this.func.getNodeParameter("batch", idx)) {
166
+ targets = this.func.getNodeParameter("targets", idx, []);
167
+ if (!Array.isArray(targets) || targets.every((t)=>typeof t !== "string")) {
168
+ throw new _n8nworkflow.NodeOperationError(this.func.getNode(), "Invalid targets");
169
+ }
170
+ } else {
171
+ targets = [
172
+ this.func.getNodeParameter("target", idx, "")
173
+ ];
174
+ }
48
175
  for (const [key, value] of Object.entries(files)){
49
176
  cmdline.push("--files", `${key}:${btoa(value)}`);
50
177
  }
@@ -52,9 +179,40 @@ class SoarExecutor {
52
179
  cmdline.push("--collect-files", key);
53
180
  }
54
181
  cmdline.push("--");
182
+ const cmdd = [
183
+ target,
184
+ ...extraArgs
185
+ ];
186
+ if (targetArg) {
187
+ cmdd.push(...targets.flatMap((target)=>[
188
+ targetArg,
189
+ target
190
+ ]));
191
+ }
192
+ for (const parameter of extraArgParameters){
193
+ const value = this.func.getNodeParameter(parameter, idx, null);
194
+ if (!value) continue;
195
+ if (typeof value === "string") {
196
+ cmdd.push(parameter, value);
197
+ } else if (Array.isArray(value)) {
198
+ value.forEach((v)=>{
199
+ if (typeof v === "string") {
200
+ cmdd.push(v);
201
+ } else {
202
+ const { key, value } = v;
203
+ if (value) {
204
+ cmdd.push(key, value);
205
+ } else {
206
+ cmdd.push(key);
207
+ }
208
+ }
209
+ });
210
+ }
211
+ }
55
212
  for (const cmd of cmdd){
56
213
  cmdline.push(cmd);
57
214
  }
215
+ this.func.logger.debug("Running " + cmdline.join(" "));
58
216
  const { stdout, stderr, err, files: resultFiles } = await runner.run(cmdline, env);
59
217
  if (err) {
60
218
  throw new _n8nworkflow.NodeOperationError(this.func.getNode(), stderr);
@@ -62,6 +220,7 @@ class SoarExecutor {
62
220
  if (stderr) {
63
221
  this.func.logger.warn(stderr);
64
222
  }
223
+ this.func.logger.debug("Stdout: " + stdout);
65
224
  return {
66
225
  stdout,
67
226
  files: resultFiles
@@ -91,7 +91,7 @@ class K8sRunner {
91
91
  ]
92
92
  }
93
93
  };
94
- this.func.logger.info("Creating pod " + JSON.stringify(podSpec));
94
+ this.func.logger.debug("Creating pod " + JSON.stringify(podSpec));
95
95
  const namespace = "default";
96
96
  await k8sCoreApi.createNamespacedPod(namespace, podSpec);
97
97
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-soar",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "n8n-community-node-package"
@@ -18,9 +18,10 @@
18
18
  "main": "index.js",
19
19
  "scripts": {
20
20
  "prepare": "husky install",
21
- "build": "swc src -d dist && ts-node ./scripts/copy.ts",
22
- "build:watch": "ts-node ./scripts/copy.ts && swc src -d dist --watch",
23
- "new": "ts-node ./scripts/new.ts",
21
+ "build": "swc src -d dist && tsx ./scripts/copy.ts",
22
+ "build:watch": "tsx ./scripts/copy.ts && swc src -d dist --watch",
23
+ "new": "tsx ./scripts/new.ts",
24
+ "parse": "tsx ./scripts/parse.ts",
24
25
  "lint": "eslint src --ext .ts",
25
26
  "lint:fix": "eslint src --ext .ts --fix",
26
27
  "prepublishOnly": "yarn build",
@@ -34,9 +35,13 @@
34
35
  "n8n": {
35
36
  "n8nNodesApiVersion": 1,
36
37
  "nodes": [
37
- "dist/nodes/Katana/Katana.node.js",
38
+ "dist/nodes/Uncover/Uncover.node.js",
39
+ "dist/nodes/Cdncheck/Cdncheck.node.js",
40
+ "dist/nodes/Naabu/Naabu.node.js",
41
+ "dist/nodes/Nuclei/Nuclei.node.js",
42
+ "dist/nodes/Httpx/Httpx.node.js",
38
43
  "dist/nodes/Subfinder/Subfinder.node.js",
39
- "dist/nodes/Httpx/Httpx.node.js"
44
+ "dist/nodes/Katana/Katana.node.js"
40
45
  ]
41
46
  },
42
47
  "devDependencies": {
@@ -47,6 +52,7 @@
47
52
  "@swc/jest": "^0.2.24",
48
53
  "@types/dockerode": "^3.3.19",
49
54
  "@types/glob": "^8.0.1",
55
+ "@types/inquirer": "^9.0.3",
50
56
  "@types/jest": "^29.2.6",
51
57
  "@types/request-promise-native": "^1.0.18",
52
58
  "@typescript-eslint/eslint-plugin": "^5.30.5",
@@ -69,7 +75,7 @@
69
75
  "n8n-workflow": "^1.0.1",
70
76
  "prettier": "^2.8.3",
71
77
  "standard-version": "^9.5.0",
72
- "ts-node": "^10.9.1",
78
+ "tsx": "^3.12.8",
73
79
  "typescript": "^4.9.4"
74
80
  },
75
81
  "config": {
@@ -90,6 +96,7 @@
90
96
  },
91
97
  "dependencies": {
92
98
  "dockerode": "^3.3.5",
99
+ "inquirer": "^9.2.11",
93
100
  "n8n-nodes-container": "^0.1.8"
94
101
  }
95
102
  }