From 776812569a18a2b075fa012797ecf1ead36e2770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=AB=E6=88=91=E5=B0=8F=E6=9D=A8=E5=90=8C=E5=AD=A6?= Date: Tue, 29 Sep 2026 00:13:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8F=91=E5=B8=83=201.1.36=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BA=A2=E9=98=9F=E6=A8=A1=E5=BC=8F=E6=8B=92?= =?UTF-8?q?=E7=BB=9D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- README.md | 2 +- README.zh-CN.md | 2 +- client.js | 16 ++++++++++++++++ lib/identity.js | 32 +++++++++++++++++++++++++++++++- package.json | 2 +- presets/redteam/agent.cordis.yml | 2 -- release-notes.md | 12 ++++++++++++ 7 files changed, 62 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fa76dea..592d29b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

⚔️ DeepSeek Harness cybersecurity red-team tool (dsh-purge)

-

Version 1.1.35

+

Version 1.1.36

Local official DeepSeek Harness cybersecurity red-team plugin. Clean host policy, and ship a built-in drill console. Swap prompts per model. Default prompt for Chinese models — 小码酱. Please star ⭐ diff --git a/README.zh-CN.md b/README.zh-CN.md index 80698c6..2865ff4 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -4,7 +4,7 @@

⚔️ DeepSeek Harness 网络安全红队工具(dsh-purge)

-

Version 1.1.35

+

Version 1.1.36

本机官方 DeepSeek Harness 网络安全红队评测插件。清洗宿主策略,并带内嵌演练台。不同模型可换不同提示词。默认提示词面向国模「小码酱」。求 Star 收藏 ⭐ diff --git a/client.js b/client.js index d42a3a3..372d740 100644 --- a/client.js +++ b/client.js @@ -161,6 +161,14 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => { "auth.ok.tab": "确认授权并进入演练台", "auth.ok.full": "确认授权并全面浏览", "auth.ok.env": "确认授权并打开环境适配", + "envGate.title": "环境还没配好", + "envGate.lead": "红队模式发送前需要本机工具。未检测到可用环境时,先去环境适配,或确认暂不配置。", + "envGate.kaliHint": "检测到 Kali 时会直接用本机工具,不必填路径。没有 Kali 时,在环境适配里填写各工具路径,或选一个整包文件夹自动分配。", + "envGate.skip": "暂不配置", + "envGate.skipConfirm": "确认后这次可以继续对话。扫描和利用类技能仍会因为缺少工具而不可用,之后可以在 dsh-purge → 环境适配里补路径。", + "envGate.skipNo": "返回", + "envGate.skipYes": "确认暂不配置", + "envGate.go": "去环境适配", "theme.aria": "外观", "theme.white": "白", "theme.ink": "墨", @@ -398,6 +406,14 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => { "auth.ok.tab": "Authorize and open Drill", "auth.ok.full": "Authorize and open Full view", "auth.ok.env": "Authorize and open Env adapt", + "envGate.title": "Environment is not ready", + "envGate.lead": "Red team mode needs local tools before you send. If none are available, open Env adapt or confirm you will continue without them.", + "envGate.kaliHint": "When Kali is detected, local tools are used directly and paths are optional. Otherwise set each tool path in Env adapt, or pick one toolkit folder to assign them.", + "envGate.skip": "Skip for now", + "envGate.skipConfirm": "You can keep chatting after this. Scan and exploit skills stay unavailable until the tools are installed. You can add paths later under dsh-purge → Env adapt.", + "envGate.skipNo": "Back", + "envGate.skipYes": "Continue without tools", + "envGate.go": "Open Env adapt", "theme.aria": "Appearance", "theme.white": "Light", "theme.ink": "Ink", diff --git a/lib/identity.js b/lib/identity.js index b663225..c8ddde5 100644 --- a/lib/identity.js +++ b/lib/identity.js @@ -106,6 +106,33 @@ function ensureFullInject(sections, inject) { return [{ name: "dsh-purge", text: inject, order: -10000 }, ...sections]; } +/** 红队预设里要留下来的操作说明起点。这句前面的「你是红队指挥」身份句丢掉。 */ +const REDTEAM_OPS_MARK = "## 运行环境前提"; + +function redteamOpsBody(text) { + const raw = String(text || ""); + const at = raw.indexOf(REDTEAM_OPS_MARK); + if (at < 0) return null; + return raw.slice(at).trim(); +} + +/** + * 主模式仍只有清洗提示词。 + * 红队模式把同一份清洗提示词放在最前,后面只接派活和操作说明,不保留红队身份句。 + */ +function attachInjectToRedteamPersona(sections, inject) { + let attached = false; + const next = sections.map((section) => { + const ops = redteamOpsBody(section?.text); + if (ops == null) return section; + attached = true; + const text = inject ? `${inject}\n\n${ops}` : ops; + return { ...section, text, order: -10000 }; + }); + if (!attached) return sections; + return next.filter((section) => section?.name !== "dsh-purge"); +} + function stripIdentityPrefix(text) { let rest = String(text || "").trim(); if (rest.startsWith(IDENTITY_CARD_PREFIX)) { @@ -274,6 +301,9 @@ export function rewritePromptAssembly(assembled, fallbackInject = "", options = const extras = opts.dropPurgeAfterFold ? purge.filter((section) => section.name !== "dsh-purge") : purge; - assembled.sections = ensureFullInject([...folded, ...extras], injectText); + assembled.sections = ensureFullInject( + attachInjectToRedteamPersona([...folded, ...extras], injectText), + injectText, + ); return assembled; } diff --git a/package.json b/package.json index d19eb8f..c36c634 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dsh-purge", - "version": "1.1.35", + "version": "1.1.36", "description": "DeepSeek Harness 网络安全红队工具:本机官方 Harness 受控评测与清洗,内嵌演练台;不同模型可换不同提示词;默认提示词面向国模「小码酱」。求 Star ⭐", "type": "module", "main": "lib/index.js", diff --git a/presets/redteam/agent.cordis.yml b/presets/redteam/agent.cordis.yml index 3dcfef2..00af576 100644 --- a/presets/redteam/agent.cordis.yml +++ b/presets/redteam/agent.cordis.yml @@ -31,8 +31,6 @@ config: # 新版 dsh-persona 用 prefix/suffix 取代了旧的 text 字段(text 会因缺 prefix 挂载失败) prefix: | - 你是红队(RedTeam)作战**指挥**智能体,运行在 {{model}} 上,工作目录 {{cwd}}。 - ## 运行环境前提(第一次开工前提醒用户一次) 红队模式会**真实发包、上传文件、建立隧道**,优先在**专供演练的 Kali 虚拟机**里跑, **尽量不要用日常办公电脑/宿主机当主战场**(私钥、冰蝎/哥斯拉马与扫描器落盘、EDR 误伤、出口 IP 信誉等风险仍在): diff --git a/release-notes.md b/release-notes.md index 59b42c1..c8c36f3 100644 --- a/release-notes.md +++ b/release-notes.md @@ -1,3 +1,15 @@ +# 1.1.36 + +## 中文 + +- 版本升级到 1.1.36。 +- 解决红队模式拒绝问题。 + +## English + +- Version 1.1.36. +- Fix red team mode refusing the cleaned prompt. + # 1.1.35 ## 中文