From 3adf78e4ba5d110cd73572eab6601b1ae563f163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=85=8E=E9=A5=BC=E6=9E=9C=E5=AD=90=E5=8D=B7=E9=B2=A8?= =?UTF-8?q?=E9=B1=BC=E8=BE=A3=E6=A4=92?= Date: Thu, 15 Jan 2026 15:50:17 +0800 Subject: [PATCH] =?UTF-8?q?```=20fix(cursor-scripts):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=AD=A3=E5=88=99=E8=A1=A8=E8=BE=BE=E5=BC=8F=E8=BD=AC=E4=B9=89?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E6=8F=90=E5=8D=87b6=E7=89=B9=E5=BE=81?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=E5=87=86=E7=A1=AE=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🔧 修复:避免 raw string + 单引号 + ['"] 字符组导致的语法错误; 同时修正正则转义,提升 b6 特征匹配命中率 - 修正 createHash 正则表达式的转义方式,使用三重引号字符串 - 修正 digest 和 return 语句的正则匹配模式 - 移除多余的转义字符,提高正则匹配准确性 ``` --- scripts/run/cursor_linux_id_modifier.sh | 9 +++++---- scripts/run/cursor_mac_id_modifier.sh | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/run/cursor_linux_id_modifier.sh b/scripts/run/cursor_linux_id_modifier.sh index 5575e6d..8ea9dcc 100755 --- a/scripts/run/cursor_linux_id_modifier.sh +++ b/scripts/run/cursor_linux_id_modifier.sh @@ -1275,8 +1275,9 @@ if True: i += 1 return None - hash_re = re.compile(r'createHash\\([\"\\']sha256[\"\\']\\)') - sig_re = re.compile(r'^async function (\\w+)\\((\\w+)\\)') + # 🔧 修复:避免 raw string + 单引号 + ['"] 字符组导致的语法错误;同时修正正则转义,提升 b6 特征匹配命中率 + hash_re = re.compile(r"""createHash\(["']sha256["']\)""") + sig_re = re.compile(r'^async function (\w+)\((\w+)\)') hash_matches = list(hash_re.finditer(window)) diag(f"marker_index={marker_index} window_len={len(window)} sha256_createHash={len(hash_matches)}") @@ -1315,8 +1316,8 @@ if True: name, param = sm.group(1), sm.group(2) # 特征校验:sha256 + hex digest + return param ? raw : hash - has_digest = re.search(r'\\.digest\\([\"\\']hex[\"\\']\\)', func_text) is not None - has_return = re.search(r'return\\s+' + re.escape(param) + r'\\?\\w+:\\w+\\}', func_text) is not None + has_digest = re.search(r"""\.digest\(["']hex["']\)""", func_text) is not None + has_return = re.search(r'return\s+' + re.escape(param) + r'\?\w+:\w+\}', func_text) is not None if idx <= 3: diag(f"候选#{idx}: {name}({param}) len={len(func_text)} digest={has_digest} return={has_return}") if not has_digest: diff --git a/scripts/run/cursor_mac_id_modifier.sh b/scripts/run/cursor_mac_id_modifier.sh index 54d657a..923c8de 100644 --- a/scripts/run/cursor_mac_id_modifier.sh +++ b/scripts/run/cursor_mac_id_modifier.sh @@ -2002,8 +2002,9 @@ if True: i += 1 return None - hash_re = re.compile(r'createHash\\([\"\\']sha256[\"\\']\\)') - sig_re = re.compile(r'^async function (\\w+)\\((\\w+)\\)') + # 🔧 修复:避免 raw string + 单引号 + ['"] 字符组导致的语法错误;同时修正正则转义,提升 b6 特征匹配命中率 + hash_re = re.compile(r"""createHash\(["']sha256["']\)""") + sig_re = re.compile(r'^async function (\w+)\((\w+)\)') hash_matches = list(hash_re.finditer(window)) diag(f"marker_index={marker_index} window_len={len(window)} sha256_createHash={len(hash_matches)}") @@ -2042,8 +2043,8 @@ if True: name, param = sm.group(1), sm.group(2) # 特征校验:sha256 + hex digest + return param ? raw : hash - has_digest = re.search(r'\\.digest\\([\"\\']hex[\"\\']\\)', func_text) is not None - has_return = re.search(r'return\\s+' + re.escape(param) + r'\\?\\w+:\\w+\\}', func_text) is not None + has_digest = re.search(r"""\.digest\(["']hex["']\)""", func_text) is not None + has_return = re.search(r'return\s+' + re.escape(param) + r'\?\w+:\w+\}', func_text) is not None if idx <= 3: diag(f"候选#{idx}: {name}({param}) len={len(func_text)} digest={has_digest} return={has_return}") if not has_digest: