fix: 发布 1.1.45,稳住默认注入并修正清洗进度显示。

点应用即写入默认提示词,不必先保存。剥掉外层 project_instructions 壳并钉死会话系统提示,避免第二轮注入失效。未定位宿主不再显示 0/63,本机不需要的项计入已就绪。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-10-02 02:09:44 +08:00
1 parent 21dfd934a4
commit f2c244c78f
36 files changed
+2309 -738

No files matched your search

+116 -36
View File
@@ -30,9 +30,12 @@ window.__ModuleLoader__.load({
:root{--rt-dock-w:620px}
/* 右侧栏收起时给 frame 加内边距,中栏主动收窄。属性名跨 DSH 版本兼容:\n 旧版 details 栏 data-details-collapsed,新版 rightbar 栏 data-rightbar-collapsed。 */\ndiv:has(> [data-shell-overlay] .rt-dock[data-open="1"])[data-details-collapsed],\ndiv:has(> [data-shell-overlay] .rt-dock[data-open="1"])[data-rightbar-collapsed]{padding-right:var(--rt-dock-w)}
.rt-dock{position:absolute;top:0;right:0;bottom:0;z-index:20;display:flex;flex-direction:column;
background:var(--dsw-alias-bg-layer-1);border-left:1px solid var(--dsw-alias-border-l1);
box-shadow:-12px 0 32px rgba(0,0,0,.14);pointer-events:auto;color:var(--dsw-alias-label-primary);
background:color-mix(in srgb,var(--dsw-alias-bg-layer-1,#1c1c1c) 52%,transparent);
backdrop-filter:blur(20px) saturate(1.3);-webkit-backdrop-filter:blur(20px) saturate(1.3);
border-left:1px solid color-mix(in srgb,var(--dsw-alias-border-l1,#444) 70%,transparent);
box-shadow:-12px 0 32px color-mix(in srgb,#000 22%,transparent);pointer-events:auto;color:var(--dsw-alias-label-primary);
font-size:13px;line-height:1.5;transition:transform .18s ease,opacity .18s ease}
.rt-dock.rt-embedded{position:relative;background:transparent!important;border:0;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none}
/* 右侧栏打开(或新版全屏)时让位:滑出隐藏。必须同时否定两个属性名——\n 旧写法只用 :not([data-details-collapsed]),在新 shell 里该属性不存在会导致条件恒真、面板永远打不开。 */\ndiv:has(> [data-shell-overlay] .rt-dock[data-open="1"]):not([data-details-collapsed]):not([data-rightbar-collapsed]) .rt-dock,\ndiv:has(> [data-shell-overlay] .rt-dock[data-open="1"])[data-rightbar-fullscreen] .rt-dock{
transform:translateX(100%);opacity:0;pointer-events:none}
.rt-grip{position:absolute;left:-3px;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:2}
@@ -93,7 +96,8 @@ window.__ModuleLoader__.load({
.rt-kv b{color:var(--dsw-alias-label-primary);font-weight:600;min-width:64px;flex:none}
/* 图谱视图已移除(见 AssetsTab:资产关系由「域名维度」与 redteam_attack_path 工具承担) */
.rt-pane{flex:1;min-height:0;overflow:auto;padding:12px}
.rt-card{border:1px solid var(--dsw-alias-border-l1);border-radius:8px;padding:10px;margin-bottom:10px;background:var(--dsw-alias-bg-layer-2)}
.rt-card{border:1px solid color-mix(in srgb,var(--dsw-alias-border-l1,#444) 75%,transparent);border-radius:8px;padding:10px;margin-bottom:10px;
background:color-mix(in srgb,var(--dsw-alias-bg-layer-2,#2a2a2a) 48%,transparent);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
.rt-card h4{margin:0 0 6px;font-size:13px}
.rt-textarea{width:100%;min-height:260px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l1);
color:inherit;border-radius:6px;padding:8px;font-size:12.5px;font-family:ui-monospace,Menlo,monospace;
@@ -125,6 +129,7 @@ window.__ModuleLoader__.load({
.rt-test-blocked{color:#fff;background:#ef4444;border-color:#ef4444}
.rt-test-abandoned{color:#94a3b8;border-color:#94a3b855;background:#94a3b81a}
.rt-test-no_surface{color:#6366f1;border-color:#6366f155;background:#6366f11a}
.rt-scope-testing{color:#5b21b6;background:#ddd6fe}
.rt-pri{display:inline-block;padding:0 6px;border-radius:4px;font-size:11px;font-weight:600;white-space:nowrap}
.rt-pri-high{color:#fff;background:#ef4444}
.rt-pri-medium{color:#fff;background:#f59e0b}
@@ -780,10 +785,18 @@ window.__ModuleLoader__.load({
const sideChildren = []
sideChildren.push(h('div', Object.assign({
key: 'all', className: 'rt-seg' + (cidr ? '' : ' on'),
}, clickable(() => setCidr(null), { label: '全部 C 段' })),
key: 'all', className: 'rt-seg' + (cidr === null && view !== 'testing' ? ' on' : ''),
}, clickable(() => { setView('list'); setCidr(null) }, { label: '全部 C 段', expanded: cidr === null && view !== 'testing' })),
h('div', { className: 'rt-seg-cidr' }, '全部 C 段'),
h('div', { className: 'rt-seg-meta' }, segs.length + ' 个网段')))
sideChildren.push(h('div', Object.assign({
key: 'testing', className: 'rt-seg' + (view === 'testing' ? ' on' : ''),
title: '正在跑的扫描 / 探测与进度(5 秒自动刷新)',
}, clickable(() => { setView('testing'); setCidr(null) }, { label: '当前测试', expanded: view === 'testing' })),
h('div', { className: 'rt-seg-cidr', style: { display: 'flex', alignItems: 'baseline', gap: 5 } },
h('span', { className: 'rt-scope rt-scope-testing', title: '当前测试(既非内网也非外网)' }, '测'),
h('span', { style: { flex: 1 } }, '当前测试')),
h('div', { className: 'rt-seg-meta' }, '正在跑的扫描与探测')))
/* C 段按内外网分组:先外网(互联网可达,通常是入口)再内网(打进去之后才看得到) */
const segBlock = (title, list, kind) => {
/* 外网 / 内网两组各自可折叠(状态按靶标记住),默认展开 */
@@ -792,9 +805,9 @@ window.__ModuleLoader__.load({
const out = [h('div', {
key: 'h' + kind, className: 'rt-sidehead rt-sidehead-btn',
role: 'button', tabIndex: 0, 'aria-expanded': open ? 'true' : 'false',
title: open ? '收起本组' : '展开本组',
onClick: toggle,
onKeyDown: (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); toggle(e) } },
title: (open ? '收起本组' : '展开本组') + '(并切回资产列表)',
onClick: () => { setView('list'); toggle() },
onKeyDown: (e) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); setView('list'); toggle(e) } },
},
h('span', { className: 'rt-sec-caret' }, open ? '▾' : '▸'),
h('span', { className: 'rt-scope rt-scope-' + kind }, kind === 'internal' ? '内网' : '外网'),
@@ -807,7 +820,8 @@ window.__ModuleLoader__.load({
out.push(h('div', Object.assign({
key: s.cidr, className: 'rt-seg' + (cidr === s.cidr ? ' on' : ''),
title: (s.org || '未知归属') + ' · 存活 ' + (s.live || 0) + '/' + (s.assets || 0) + ' 台',
}, clickable(() => setCidr(s.cidr), { label: '筛选 C 段 ' + s.cidr, expanded: cidr === s.cidr })),
}, clickable(() => { setView('list'); setCidr(s.cidr) },
{ label: '筛选 C 段 ' + s.cidr, expanded: cidr === s.cidr && view !== 'testing' })),
h('div', { className: 'rt-seg-cidr', style: { display: 'flex', alignItems: 'baseline', gap: 5 } },
h('span', { className: 'rt-scope rt-scope-' + kind }, kind === 'internal' ? '内' : '外'),
h('span', { style: { flex: 1 } }, s.cidr),
@@ -1054,13 +1068,14 @@ window.__ModuleLoader__.load({
let pane = listPane
if (view === 'domain') pane = domainPane
if (view === 'testing') pane = h(TestingTab, { engagement: eng, refreshKey: refreshKey })
else if (view === 'domain') pane = domainPane
else if (view === 'web') pane = webPane
/* 发现时间视图自带滚动容器,直接放进 rt-main 的 flex 里 */
else if (view === 'timeline') pane = h(DiscoveryView, { engagement: eng, refreshKey: refreshKey })
return h('div', { className: 'rt-split' }, side,
h('div', { className: 'rt-main' }, toolbar,
h('div', { className: 'rt-main' }, view === 'testing' ? null : toolbar,
conclusion,
state.error ? h('div', { className: 'rt-err' }, state.error) : null,
pane))
@@ -1136,7 +1151,7 @@ window.__ModuleLoader__.load({
const [busy, setBusy] = React.useState(false)
React.useEffect(() => {
/* 无靶标时读内置默认提示词(与 store prompts 无 engagement 分支一致) */
/* 无靶标也允许:服务端回内置默认,不再报 engagement required */
api(eng ? { op: 'prompts', engagement: eng } : { op: 'prompts' }).then((r) => {
if (!r || r.ok === false) { setMsg({ err: (r && r.error) || '读取失败' }); return }
setRoles(r.roles || [])
@@ -1470,6 +1485,7 @@ window.__ModuleLoader__.load({
const [state, setState] = React.useState({ loading: false, error: null, total: 0, items: [], stats: null })
const [creds, setCreds] = React.useState([])
const [accesses, setAccesses] = React.useState([])
const [files, setFiles] = React.useState([])
const [openId, setOpenId] = React.useState(null)
const [msg, setMsg] = React.useState(null)
/* 子页签:漏洞 / 凭据 / 访问会话(凭据不再铺在漏洞页底部) */
@@ -1492,6 +1508,7 @@ window.__ModuleLoader__.load({
}, (e) => setState({ loading: false, error: String((e && e.message) || e), total: 0, items: [], stats: null }))
api({ op: 'credentials', engagement: eng }).then((r) => setCreds((r && r.items) || []), () => {})
api({ op: 'access', engagement: eng }).then((r) => setAccesses((r && r.items) || []), () => {})
api({ op: 'attackFiles', engagement: eng }).then((r) => setFiles((r && r.items) || []), () => {})
}
React.useEffect(load, [eng, sev, status, qApplied, refreshKey])
@@ -1507,6 +1524,16 @@ window.__ModuleLoader__.load({
const stats = (state.stats && state.stats.bySeverity) ? state.stats : { bySeverity: {}, byStatus: {} }
const needRestart = state.error !== null && String(state.error).indexOf('unknown op') >= 0
const allFiles = (files || []).flatMap((g) => (g.files || []).map((f) => Object.assign({ target: g.target }, f)))
const filesByVuln = new Map()
const orphanFiles = []
for (const f of allFiles) {
const vid = f.vuln_id === null || f.vuln_id === undefined ? null : Number(f.vuln_id)
if (vid === null) { orphanFiles.push(f); continue }
if (!filesByVuln.has(vid)) filesByVuln.set(vid, [])
filesByVuln.get(vid).push(f)
}
/* ── 结论行:只给结论,数字点一下就是筛选 ─────────────────────── */
const concl = (key, label, value, active, onClick) => h('span', Object.assign({
key: key, className: 'rt-concl-i' + (active ? ' on' : ''), title: '点击筛选 / 再点取消',
@@ -1561,6 +1588,17 @@ window.__ModuleLoader__.load({
h('div', { className: 'rt-kv' }, h('b', null, '资产'), h('span', null, (v.asset_ip || '—') + ' · ' + (v.segment_cidr || ''))),
h('div', { className: 'rt-kv' }, h('b', null, '来源'), h('span', null, (v.source || '—') + ' · ' + (v.found_by_agent || '—') + ' · ' + fmt(v.found_at))),
detailEvidence(v),
(() => {
const mine = filesByVuln.get(Number(v.id)) || []
return h('div', { className: 'rt-kv' }, h('b', null, '攻击文件'),
mine.length
? h('span', null, mine.map((f, fi) => h('div', { key: 'af' + fi, style: { marginBottom: 3 } },
'· ' + (f.kind ? '[' + f.kind + '] ' : '') + (f.name || '(未命名)')
+ (f.description ? ' — ' + f.description : ''),
h('div', { className: 'rt-mono', style: { fontSize: 11, marginLeft: 12, color: 'var(--dsw-alias-label-secondary)', overflowWrap: 'anywhere' } }, f.path || ''))))
: h('span', { style: { color: 'var(--dsw-alias-label-secondary)' } },
'(无)用 redteam_attack_file_add 把这条漏洞打通的脚本/马/EXP 归档,并带上 vuln_id'))
})(),
h('div', { className: 'rt-actions' },
h('button', { className: 'rt-btn', onClick: (e) => { e.stopPropagation(); setVulnStatus(v.id, 'confirmed') } }, '确认'),
h('button', { className: 'rt-btn', onClick: (e) => { e.stopPropagation(); setVulnStatus(v.id, 'exploited') } }, '已利用'),
@@ -1679,6 +1717,7 @@ window.__ModuleLoader__.load({
return h('div', { className: 'rt-main' }, toolbar, conclusion,
h('div', { className: 'rt-subtabs' },
subTabBtn('vulns', '漏洞', state.total || 0),
subTabBtn('files', '攻击文件', allFiles.length),
subTabBtn('creds', '凭据', creds.length),
subTabBtn('access', '访问会话', accesses.length),
h('div', { className: 'rt-spacer' }),
@@ -1698,7 +1737,13 @@ window.__ModuleLoader__.load({
msg ? h('div', { className: msg.err ? 'rt-err' : 'rt-foot' }, msg.err || msg.ok) : null,
needRestart ? h('div', { className: 'rt-empty' }, '该模块的宿主代码已更新,需重启一次当前宿主(官方 exe / 社区版 / dsh web)后生效') : null,
state.error && !needRestart ? h('div', { className: 'rt-err' }, state.error) : null,
subTab === 'creds'
subTab === 'files'
? h('div', { className: 'rt-body', style: { overflow: 'auto' } },
h('div', { className: 'rt-hint', style: { marginBottom: 8 } },
'攻击文件按靶标目录组织(原「攻击文件」页签);每条漏洞的关联文件也能在该漏洞详情里直接看到。'
+ (orphanFiles.length ? ' 目前有 ' + orphanFiles.length + ' 个文件没挂 vuln_id,建议补上以便与漏洞对应。' : '')),
h(AttackFilesTab, { engagement: eng, refreshKey: refreshKey }))
: subTab === 'creds'
? h('div', { className: 'rt-body', style: { overflow: 'auto' } }, credSection)
: subTab === 'access'
? h('div', { className: 'rt-body', style: { overflow: 'auto' } }, accessSection)
@@ -3431,13 +3476,12 @@ window.__ModuleLoader__.load({
const refreshKey = props.refreshKey || 0
const [roles, setRoles] = React.useState(null)
const [err, setErr] = React.useState(null)
const [openRole, setOpenRole] = React.useState('plan')
const [concurrency, setConcurrency] = React.useState(null)
const [busy, setBusy] = React.useState(false)
const load = () => {
setBusy(true)
api(eng ? { op: 'prompts', engagement: eng } : { op: 'prompts' }).then((r) => {
api({ op: eng ? 'prompts' : 'bootstrap', engagement: eng || undefined }).then((r) => {
setBusy(false)
if (!r || r.ok === false) { setErr((r && r.error) || '读取失败'); return }
setErr(null)
@@ -3450,8 +3494,6 @@ window.__ModuleLoader__.load({
}
React.useEffect(load, [eng, refreshKey])
const list = roles || []
const current = list.find((x) => x.role === openRole) || list[0]
const used = concurrency ? concurrency.used : null
const max = concurrency ? concurrency.max : 3
return h('div', { className: 'rt-main' },
@@ -3482,18 +3524,57 @@ window.__ModuleLoader__.load({
'④ 漏洞利用 `exploit` —— 先拿服务器权限(冰蝎/哥斯拉马)+ 建 suo5 隧道,再打其它得分项', h('br'),
'⑤ 内网渗透 `internal` —— 走隧道,依次拉起 ①②③④ 做内网', h('br'),
'⑥ 主会话 `plan` —— 只做计划、派活、汇总、汇报,不动手')),
h(ConcurrencyCard, { concurrency, onSaved: load }),
h('div', { className: 'rt-card' },
h('h4', null, '角色提示词(按靶标存,可在这里查看)'),
h('h4', null, '角色提示词(按靶标存,可在这里编辑)'),
h('div', { style: { fontSize: 11.5, color: 'var(--dsw-alias-label-secondary)', marginBottom: 6 } },
'完整编辑在「智能体提示词」页签;这里是速览。'),
h('div', { style: { display: 'flex', gap: 5, flexWrap: 'wrap', marginBottom: 8 } },
list.map((x) => h('button', {
key: x.role, className: 'rt-btn' + (current && current.role === x.role ? ' rt-btn-primary' : ''),
onClick: () => setOpenRole(x.role),
}, (ROLE_LABEL[x.role] || x.role) + (x.planner ? '(不派活)' : '')))),
current
? h('pre', { className: 'rt-rep-http', style: { maxHeight: 340 } }, current.content || '(还没有正文)')
: h('div', { className: 'rt-empty' }, eng ? '加载中…' : '先选一个靶标'))))
'「智能体提示词」已并入本页;下面是完整编辑器(改完点保存,只影响当前靶标)。'),
h(PromptsTab, { engagement: eng, refreshKey: refreshKey }))))
}
function ConcurrencyCard(props) {
const info = props.concurrency || {}
const [draft, setDraft] = React.useState('')
const [busy, setBusy] = React.useState(false)
const [msg, setMsg] = React.useState(null)
React.useEffect(() => { if (info.max) setDraft(String(info.max)) }, [info.max])
const limit = info.limit || 10
const used = typeof info.used === 'number' ? info.used : null
const source = info.source === 'settings' ? '面板中设置'
: info.source === 'env' ? '环境变量 REDTEAM_MAX_AGENTS' : '默认值'
const n = Number(draft)
const invalid = !Number.isFinite(n) || Math.floor(n) !== n || n < 1 || n > limit
const save = () => {
if (invalid) return
setBusy(true); setMsg(null)
api({ op: 'setAgentsMax', max: n }).then((r) => {
setBusy(false)
if (!r || r.ok === false) { setMsg({ err: (r && r.error) || '保存失败' }); return }
setMsg({ ok: '已保存:并发上限 ' + r.max + '(立即生效,不用重启)' })
if (props.onSaved) props.onSaved()
}, (e) => { setBusy(false); setMsg({ err: String((e && e.message) || e) }) })
}
return h('div', { className: 'rt-card' },
h('h4', null, '并发数量'),
h('div', { style: { fontSize: 12, lineHeight: 1.8, marginBottom: 8 } },
'同一靶标**同时最多几个执行智能体**。当前生效:**' + (info.max || '?') + '**'
+ (used === null ? '' : '(在跑 ' + used + ',剩余 ' + Math.max((info.max || 0) - used, 0) + ')')
+ ',来源:' + source + '。改完**立即生效**,不用重启。'),
h('div', { style: { display: 'flex', gap: 8, alignItems: 'center', flexWrap: 'wrap' } },
h('input', {
className: 'rt-input', style: { width: 90 }, type: 'number', min: 1, max: limit,
value: draft, onChange: (e) => setDraft(e.target.value),
}),
h('span', { style: { fontSize: 11.5, color: 'var(--dsw-alias-label-secondary)' } }, '范围 1 – ' + limit),
h('button', { className: 'rt-btn rt-btn-primary', disabled: busy || invalid, onClick: save },
busy ? '保存中…' : '保存'),
msg && msg.err ? h('span', { style: { fontSize: 12, color: 'var(--rt-danger, #d33)' } }, msg.err) : null,
msg && msg.ok ? h('span', { style: { fontSize: 12, color: 'var(--dsw-alias-label-secondary)' } }, msg.ok) : null),
h('div', { className: 'rt-note', style: { marginTop: 8 } },
'⚠️ 调大不等于更快:**同一个模型 API Key 的并发/速率上限是共享的**,同时派太多会互相挤占,'
+ '表现为排队等待、超时、返回被截断甚至限流报错 —— 反而让测试结果不稳定(漏测、半途而废)。'
+ '建议从 2–3 开始,只有在确认 Key 的额度足够、任务之间确实互不依赖时才调大。'))
}
/**
@@ -3775,11 +3856,11 @@ window.__ModuleLoader__.load({
const stats = (snapshot && snapshot.stats) || {}
const tabs = [
['assets', '资产测绘'], ['env', '环境适配'], ['testing', '当前测试'], ['agents', '智能体'], ['sessions', '会话隧道'],
['assets', '资产测绘'], ['env', '环境适配'], ['agents', '智能体'], ['sessions', '会话隧道'],
['findings', '漏洞战果'],
['chain', '攻击链'], ['scores', '得分目标'], ['report', '报告'],
['attackfiles', '攻击文件'], ['knowledge', '知识库'],
['prompts', '智能体提示词'], ['skills', '技能库'],
['knowledge', '知识库'],
['skills', '技能库'],
]
const full = isFullWindow()
const openFull = () => {
@@ -3804,12 +3885,11 @@ window.__ModuleLoader__.load({
let body
if (err) body = h('div', { className: 'rt-err' }, err)
/* 全局页:没有靶标也能看(知识库 / 环境适配 / 技能库 / 提示词 / 智能体概览) */
/* 全局页:没有靶标也能看(知识库 / 环境适配 / 技能库 / 智能体概览) */
else if (st.tab === 'knowledge') body = h(KnowledgeTab, { refreshKey: refreshKey })
else if (st.tab === 'env') body = h(EnvTab, { refreshKey: refreshKey })
else if (st.tab === 'skills') body = h(SkillsTab, { refreshKey: refreshKey })
else if (st.tab === 'prompts') body = h(PromptsTab, { engagement: eng, refreshKey: refreshKey })
else if (st.tab === 'agents') body = h(AgentsTab, { engagement: eng, refreshKey: refreshKey })
else if (st.tab === 'agents' || st.tab === 'prompts') body = h(AgentsTab, { engagement: eng, refreshKey: refreshKey })
else if (!eng) {
body = h('div', { className: 'rt-pane' },
h('div', { className: 'rt-card' },
@@ -3824,13 +3904,13 @@ window.__ModuleLoader__.load({
}),
h('button', { className: 'rt-btn rt-btn-primary', disabled: creating, onClick: () => openEngagement() },
creating ? '创建中…' : '创建靶标'))))
} else if (st.tab === 'assets') body = h(AssetsTab, { engagement: eng, snapshot: snapshot, refreshKey: refreshKey, onRefresh: refreshAll, onData: () => loadSnapshot(eng) })
else if (st.tab === 'testing') body = h(TestingTab, { engagement: eng, refreshKey: refreshKey })
} else if (st.tab === 'assets') body = h(AssetsTab, { engagement: eng, snapshot: snapshot, refreshKey: refreshKey, onRefresh: refreshAll, onData: () => loadSnapshot(eng) })
else if (st.tab === 'testing') body = h(AssetsTab, { engagement: eng, snapshot: snapshot, refreshKey: refreshKey, onRefresh: refreshAll, onData: () => loadSnapshot(eng) })
else if (st.tab === 'sessions') body = h(SessionTab, { engagement: eng, refreshKey: refreshKey })
else if (st.tab === 'findings') body = h(FindingsTab, { engagement: eng, refreshKey: refreshKey })
else if (st.tab === 'chain') body = h(ChainTab, { engagement: eng, refreshKey: refreshKey })
else if (st.tab === 'report') body = h(ReportTab, { engagement: eng, refreshKey: refreshKey })
else if (st.tab === 'attackfiles') body = h(AttackFilesTab, { engagement: eng, refreshKey: refreshKey })
else if (st.tab === 'attackfiles') body = h(FindingsTab, { engagement: eng, refreshKey: refreshKey })
else if (st.tab === 'scores') body = h(ScoreTab, { engagement: eng, refreshKey: refreshKey })
else body = h('div', { className: 'rt-empty' }, '未知页签')