Skip to content

fix(lanzou): handle acw_sc__v2 anti-crawler challenge on all requests#9548

Merged
skysliences merged 1 commit into
mainfrom
fix/lanzou-acw-sc-v2
Jun 1, 2026
Merged

fix(lanzou): handle acw_sc__v2 anti-crawler challenge on all requests#9548
skysliences merged 1 commit into
mainfrom
fix/lanzou-acw-sc-v2

Conversation

@okatu-loli

Copy link
Copy Markdown
Collaborator

问题

蓝奏云(账号密码登录)能列文件,但获取下载地址间歇性失败,报错形式不一:

  • failed get link: acw_sc__v2 validation error
  • failed get link: not find data
  • failed get link:(message 为空)
  • 初始化时 Failed init storage: uid variable not find

根因

蓝奏云的 acw_sc__v2 反爬挑战会出现在任意 pan.lanzoui.com 请求上(分享页、iframe 下载页、ajaxm.php),以及初始化时的 pc.woozooo.com/mydisk.php。但原代码只对第一个分享页做了挑战处理,导致:

  • mydisk.php 返回挑战页 → 找不到 uid=uid variable not find
  • iframe 下载页返回挑战页 → 解析不到 JSON → not find data
  • ajaxm.php 的 POST 返回挑战页 → 被当成 JSON 解析,zt=0 走 default 分支且 info 为空 → 空错误

此外 HexXor 自驱动引入起就是坏的,使得挑战根本无法被正确求解:

  1. bytes.NewBuffer(make([]byte, len(hex1))) 用的是长度而非容量,结果被 len(hex1)\x00 前缀污染;
  2. 缺少前导 0 补齐,异或结果 < 0x10 时只输出一个十六进制字符,导致整串错位/长度不足。

改动

  • 修复 HexXor:改用 strings.Builder + %02x 补零,并修正循环边界。
  • 将 acw_sc__v2 的「检测挑战 → 计算 cookie → 带 cookie 重试同一请求」逻辑下沉到最底层的 request(),所有 GET/POST 透明解挑战(最多 3 次)。
  • 相应简化 getHtmlgetVeiAndUid / getShareUrlHtml / iframe 页统一走该链路。

验证

用真实账号密码联调(账号密码登录):

  • 修复前:列根目录 5 个文件,逐个取下载地址 3 轮 → 全部失败ajaxm.php POST 被挑战,空错误)。
  • 修复后:相同文件 3 文件 × 3 轮 → 全部成功返回真实直链(webgetstore.com / lanosso.com);mydisk.php 的 uid/vei 正常获取。

仅改动 drivers/lanzou/help.godrivers/lanzou/util.gogo build ./drivers/lanzou/ 通过。

The acw_sc__v2 challenge can be served on any pan.lanzoui.com request
(share page, iframe page, ajaxm.php), but it was only handled for the
first share page. This caused intermittent failures:

- "uid variable not find" when mydisk.php returned the challenge on init
- "not find data" when the iframe download page returned the challenge
- empty "failed get link" when ajaxm.php POST returned the challenge
  (the challenge HTML was parsed as JSON, zt=0 -> empty info)

Also fix HexXor, which was broken since the driver was introduced and
made every challenge unsolvable:

- bytes.NewBuffer(make([]byte, len(hex1))) prefixed the result with
  len(hex1) null bytes
- missing zero-padding produced a single hex char when xor result < 0x10,
  misaligning the whole string

Move the challenge solve/retry loop down into request() so every GET/POST
transparently handles it, and simplify getHtml accordingly.
@skysliences skysliences merged commit d0cec67 into main Jun 1, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants