dsh-blue-team-mode 1.3.0 → 1.3.1

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/README.md CHANGED
@@ -52,13 +52,13 @@ dsh plugin --profile desktop add dsh-blue-team-mode
52
52
  plugin_manager action=install_bundle target="dsh-blue-team-mode"
53
53
  ```
54
54
 
55
- 包名 `dsh-blue-team-mode`,当前版本 `1.3.0`;`dsh.bundle` 指向包内的 `cordis.patch.yml`。npm 安装不需要 `allowBuilds`,也不依赖本机源码目录。
55
+ 包名 `dsh-blue-team-mode`,当前版本 `1.3.1`;`dsh.bundle` 指向包内的 `cordis.patch.yml`。npm 安装不需要 `allowBuilds`,也不依赖本机源码目录。
56
56
 
57
57
  ### 从本地 tarball 安装
58
58
 
59
59
  ```sh
60
60
  npm pack --pack-destination dist
61
- dsh plugin --profile desktop add .\dist\dsh-blue-team-mode-1.3.0.tgz
61
+ dsh plugin --profile desktop add .\dist\dsh-blue-team-mode-1.3.1.tgz
62
62
  ```
63
63
 
64
64
  ### 从本地目录安装
@@ -198,7 +198,7 @@ node scripts/decoy-server.mjs --host 127.0.0.1 --port 8080
198
198
  npm 安装后:
199
199
 
200
200
  ```powershell
201
- npx dsh-blue-decoy --host 127.0.0.1 --port 8080
201
+ npx --yes --package dsh-blue-team-mode dsh-blue-decoy --host 127.0.0.1 --port 8080
202
202
  ```
203
203
 
204
204
  默认只监听本机;公开/内网监听必须显式:
@@ -207,7 +207,7 @@ npx dsh-blue-decoy --host 127.0.0.1 --port 8080
207
207
  node scripts/decoy-server.mjs --host 0.0.0.0 --port 8080 --allow-public
208
208
  ```
209
209
 
210
- 提供 `/admin`、`/.git/config`、`/phpmyadmin`、`/backup.sql`、`/shell.php` 等静态假路径;`/shell.php` 只返回文本,不执行。事件写 `$DSH_HOME/blue/decoy-events.jsonl`,不主动外传。不会自动启动,是否部署由用户决定。
210
+ 提供 `/admin`、`/.git/config`、`/phpmyadmin`、`/backup.sql`、`/shell.php` 等静态假路径;`/shell.php` 只返回文本,不执行。事件写 `$DSH_HOME/blue/decoy-events.jsonl`,不主动外传;body 中的 password/token/secret/cookie 会脱敏。不会自动启动,是否部署由用户决定。
211
211
 
212
212
  详见 `skills/decoy-server.md`。
213
213
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-blue-team-mode",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "CTF 网络攻防蓝队防御模式:资产盘点、告警研判、威胁狩猎、应急响应、取证分析与加固修复,内置 SQLite 事实库、独立右侧栏控制台与自主任务派发队列。",
5
5
  "license": "MIT",
6
6
  "author": "FGCGDroid",
@@ -91,6 +91,12 @@ function notFound() {
91
91
  return '<html><head><title>404 Not Found</title></head><body><h1>404 Not Found</h1><hr>nginx</body></html>'
92
92
  }
93
93
 
94
+ /** 诱饵日志只保留攻击载荷;不把口令、token、Cookie 等凭据原样写盘。 */
95
+ function redactBody(value) {
96
+ return String(value || '').slice(0, 2000)
97
+ .replace(/((?:password|passwd|pwd|token|secret|authorization|cookie|session)[^=:&\s]*\s*[=:]\s*)([^&\s"']+)/gi, '$1[REDACTED]')
98
+ }
99
+
94
100
  const server = createServer((req, res) => {
95
101
  const started = Date.now()
96
102
  const remote = req.socket.remoteAddress || ''
@@ -157,7 +163,7 @@ function record(req, remote, status, body, started, url = new URL(req.url || '/'
157
163
  query: url.search,
158
164
  user_agent: String(req.headers['user-agent'] || '').slice(0, 300),
159
165
  referer: String(req.headers.referer || '').slice(0, 300),
160
- body: String(body || '').slice(0, 2000),
166
+ body: redactBody(body),
161
167
  status,
162
168
  elapsed_ms: Date.now() - started,
163
169
  }
@@ -55,11 +55,20 @@ try {
55
55
  const shellText = await shell.text()
56
56
  if (shell.status !== 200 || !shellText.includes('synthetic decoy') || shellText.includes('exec')) throw new Error('假 shell 不应执行')
57
57
 
58
+ await fetch(base + '/admin', {
59
+ method: 'POST',
60
+ headers: { 'content-type': 'application/x-www-form-urlencoded' },
61
+ body: 'username=admin&password=SuperSecret123&token=abc123',
62
+ })
63
+
58
64
  const missing = await fetch(base + '/random-path')
59
65
  if (missing.status !== 404) throw new Error('未知路径应 404')
60
66
 
61
67
  await sleep(100)
62
- const lines = readFileSync(log, 'utf8').trim().split(/\r?\n/).filter(Boolean)
68
+ const logText = readFileSync(log, 'utf8')
69
+ if (logText.includes('SuperSecret123') || logText.includes('abc123')) throw new Error('日志泄露口令/token')
70
+ if (!logText.includes('[REDACTED]')) throw new Error('日志未标记脱敏')
71
+ const lines = logText.trim().split(/\r?\n/).filter(Boolean)
63
72
  if (lines.length < 4) throw new Error('事件日志不足:' + lines.length)
64
73
  const event = JSON.parse(lines[0])
65
74
  if (event.decoy !== 'test-decoy' || !event.remote || !event.path) throw new Error('事件字段不完整')
@@ -16,7 +16,7 @@ node scripts/decoy-server.mjs --host 127.0.0.1 --port 8080
16
16
  安装为 npm 包后:
17
17
 
18
18
  ```bash
19
- npx dsh-blue-decoy --host 127.0.0.1 --port 8080
19
+ npx --yes --package dsh-blue-team-mode dsh-blue-decoy --host 127.0.0.1 --port 8080
20
20
  ```
21
21
 
22
22
  默认只监听 `127.0.0.1`。对公网/内网资产监听必须显式:
@@ -50,7 +50,7 @@ node scripts/decoy-server.mjs --host 0.0.0.0 --port 8080 --allow-public
50
50
  $DSH_HOME/blue/decoy-events.jsonl
51
51
  ```
52
52
 
53
- 每条 JSON 包含时间、来源、方法、路径、UA、截断 body、状态码、耗时。不会记录 Cookie/Authorization,不抓 WebRTC/Canvas/硬件指纹。
53
+ 每条 JSON 包含时间、来源、方法、路径、UA、脱敏 body、状态码、耗时。不会记录 Cookie/Authorization;body 中的 password/token/secret/cookie 等字段会替换为 `[REDACTED]`,不抓 WebRTC/Canvas/硬件指纹。
54
54
 
55
55
  把事件交给 Agent:
56
56