waa

package
v0.3.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterpreterHash

func InterpreterHash(source []byte) string

InterpreterHash 返回解释器源码的 SHA-256 base64url 摘要

Types

type BotGuardMetric added in v0.3.8

type BotGuardMetric struct {
	Metric string
	Label  string
	Value  float64
}

BotGuardMetric 是官网 BotGuard 包装层记录的一条 client streamz 指标,Metric 为 ec 或 cec 时 Value 是计数增量,其余为分布取值

type Challenge

type Challenge struct {
	MessageID                  string
	InterpreterJavaScript      string
	InterpreterURL             string
	InterpreterHash            string
	Program                    string
	GlobalName                 string
	ClientExperimentsStateBlob string
	// Packed 表示 challenge 来自响应第 2 字段的混淆字节,官网包装层为它记录解码耗时
	Packed bool
}

Challenge 保存 Waa/Create 返回的客户端解释器输入

func ParseChallenge

func ParseChallenge(raw []byte) (Challenge, error)

ParseChallenge 解析 Waa/Create 响应,第 2 字段的混淆 challenge 为空时读取第 1 字段的明文 challenge

type Options

type Options struct {
	Challenge   Challenge
	Interpreter string
	Profile     Profile
	LoadImage   func(string) bool
	// LoadFrame 以浏览器 iframe 导航形状载入地址,返回是否收到文档响应
	LoadFrame func(string) bool
	// Pointer 是页面上可信指针与焦点所在的位置,同一页面先后新建的 VM 共用;为 nil 时按刚载入的页面
	Pointer *Pointer
	// Rhythm 是账户点击与粘贴的事件节奏
	Rhythm rhythm.Rhythm
	// Start 是页面 load 事件结束的时刻,晚于现在时真实等到这一时刻再新建 VM
	Start time.Time
}

Options 定义一份 BotGuard VM 的解释器、宿主现场与网络依赖

type Pointer added in v0.3.8

type Pointer struct {
	// contains filtered or unexported fields
}

Pointer 是页面上可信指针与焦点所在的位置

func NewPointer added in v0.3.8

func NewPointer() *Pointer

NewPointer 返回刚载入的页面上的位置:指针还没进入页面,焦点在提示词输入框

func (*Pointer) Clicked added in v0.3.8

func (pointer *Pointer) Clicked() time.Time

Clicked 返回最近一次点击 Run 或 Rerun 时派发可信 click 的时刻

type Profile

type Profile struct {
	PageURL      string
	Locale       string
	TimeZone     string
	Window       map[string]any
	Navigator    map[string]any
	Screen       map[string]any
	Document     map[string]any
	Globals      map[string]any
	LocalStorage map[string]string
	HasFocus     bool
	// TrustedTypes 表示页面 CSP 要求脚本注入点使用 Trusted Types
	TrustedTypes bool
	// NavigationStart 是页面导航开始的时间,为零时页面时间起点取宿主安装时刻
	NavigationStart time.Time
	// Navigation 是顶层页面 PerformanceNavigationTiming 的取值,以导航开始为零点的毫秒数
	Navigation map[string]any
	// DOMLoading 是顶层页面旧版 performance.timing.domLoading 相对导航开始的毫秒数
	DOMLoading int
	// MediaInputs 是页面未授权时 enumerateDevices 列出的输入设备种类,按 audioinput、videoinput 顺序
	MediaInputs []string
}

Profile 保存账户指纹与页面状态决定的宿主现场值

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime 在嵌入的 SpiderMonkey 中持有一份与官网页面同形态的 BotGuard 生命周期

func NewRuntime

func NewRuntime(ctx context.Context, options Options) (*Runtime, error)

NewRuntime 在 Firefox 宿主中加载解释器并初始化 challenge program

func (*Runtime) Activate added in v0.3.8

func (runtime *Runtime) Activate(ctx context.Context) error

Activate 记录一次用户点击或按键:此后 navigator.userActivation 的 hasBeenActive 为 true,5 秒内 isActive 为 true

func (*Runtime) Close

func (runtime *Runtime) Close()

Close 结束 VM 生命周期并停止事件循环,关闭超时时中断仍在执行的脚本

func (*Runtime) Proof

func (runtime *Runtime) Proof(ctx context.Context, digest string, prompt string) (string, error)

Proof 同步页面提示词后为 SHA-256 digest 生成 snapshot proof,结束后清空输入框

func (*Runtime) RefreshSnapshot

func (runtime *Runtime) RefreshSnapshot(ctx context.Context) (string, error)

RefreshSnapshot 生成官网刷新 Waa/Create 时携带的无绑定 snapshot,与取 proof 一样从官网取 proof 耗时中抽值并排进此前的空闲区间

func (*Runtime) Replaced added in v0.3.8

func (runtime *Runtime) Replaced(ctx context.Context) error

Replaced 在页面替换指针下的元素时派发 Firefox 的 pointerover 与 mouseover:点击 Run 后按钮切换为 Stop 与切换回 Run,点击 Rerun 后最后一轮被移除,提交函数结果后函数调用块被替换;指针不在这三处时不派发

func (*Runtime) RerunProof added in v0.3.8

func (runtime *Runtime) RerunProof(ctx context.Context, digest string, rounds int) (string, error)

RerunProof 在 rounds 轮的对话上点击最后一轮的 Rerun 后为 SHA-256 digest 生成 fresh proof,与官网 Rerun 一样不写入提示词

func (*Runtime) RunProof added in v0.3.0

func (runtime *Runtime) RunProof(ctx context.Context, digest string, prompt string) (string, error)

RunProof 以可信键盘把文本粘贴进页面提示词输入框(输入框没有焦点时先以可信指针点击它)并点击 Run 后为 SHA-256 digest 生成 fresh proof,与官网用户粘贴提示词、点击 Run 后页面为 GenerateContent 取 proof 的顺序相同,返回前清空输入框

func (*Runtime) RunProofAfter added in v0.3.10

func (runtime *Runtime) RunProofAfter(ctx context.Context, digest string, prompt string, newChat func(at time.Time), groups [][]SettingStep, back time.Duration) (string, error)

RunProofAfter 做完运行设置操作后粘贴文本并点击 Run,为 SHA-256 digest 生成 fresh proof groups 按顺序做,放不下的一组与其后各组这次不做,步数计入 prooftime 的跳过步数 newChat 不为 nil 且连同运行设置与粘贴都放得下时先点顶栏 New chat 并在确认框点 Discard and continue 放不下时这次不点 New chat,两次点击计入跳过步数;点击确认后以 click 事件发生时的 VM 墙上时刻调用 newChat 做过运行设置时隔 back 以可信指针点击提示词输入框 各步按 VM 时钟排进此前的空闲区间,空闲不够时只真实等待差额

func (*Runtime) Settle

func (runtime *Runtime) Settle(ctx context.Context) error

Settle 等待 VM 发出的页面资源请求完成,请求完成回调中发出的新请求一并等待

func (*Runtime) Streamed added in v0.3.11

func (runtime *Runtime) Streamed()

Streamed 在回答正文流式渲染、对话区内容在静止的指针下移动时排入一组 Firefox 的 pointerout、pointerover、mouseout 与 mouseover:指针在对话区(Rerun 或提交函数结果之后)时指针下的元素在对话区与回答段落之间交替,同一帧内只派发一组,指针不在对话区时不派发;不等待派发

func (*Runtime) SubmitProof added in v0.3.9

func (runtime *Runtime) SubmitProof(ctx context.Context, digest string, result string, rounds int) (string, error)

SubmitProof 在 rounds 轮的对话上以可信指针点击最后一轮函数调用块中的函数响应输入框、以可信键盘粘贴 result,再点击提交后为 SHA-256 digest 生成 fresh proof,与官网用户提交函数结果后页面为 GenerateContent 取 proof 的顺序相同

func (*Runtime) TakeMetrics added in v0.3.8

func (runtime *Runtime) TakeMetrics(ctx context.Context) ([]BotGuardMetric, error)

TakeMetrics 在事件循环中取出上次以来记录的 BotGuard 指标,排在已排队的任务之后执行,与官网包装层以 setTimeout(0) 上报的时机相同

type SettingStep added in v0.3.10

type SettingStep struct {
	Wait    time.Duration
	To      string
	Text    string
	Clicked func(at time.Time)
}

SettingStep 是点击 Run 之前在运行设置中的一次可信指针点击 Wait 为与上一步的间隔,Text 非空时点击后以可信键盘粘贴 Text To 为点击的位置:selector、all、row、level、option、system、instructions、close、grounding、functions、edit、declarations、save Clicked 在抬起后以 click 事件发生时的 VM 墙上时刻调用

Directories

Path Synopsis
Package mozjs 经 cgo 嵌入 SpiderMonkey,提供线程绑定的上下文、根表句柄、求值、Go 原生函数、微任务与中断
Package mozjs 经 cgo 嵌入 SpiderMonkey,提供线程绑定的上下文、根表句柄、求值、Go 原生函数、微任务与中断
Package prooftime 累计一次请求取 WAA proof 的分项耗时
Package prooftime 累计一次请求取 WAA proof 的分项耗时
Package rhythm 生成并描述一个账户在官网页面上点击与粘贴时各组可信事件之间的间隔
Package rhythm 生成并描述一个账户在官网页面上点击与粘贴时各组可信事件之间的间隔

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL