返回博客
指纹

BotBrowser 屏幕和窗口保护:一致的显示身份

BotBrowser 如何控制屏幕尺寸、像素比和窗口属性,保持一致的显示指纹信号。

隐私风险

屏幕分辨率、色彩深度、像素比和窗口尺寸等显示属性无需权限即可被任何脚本访问。这些值可以构成追踪信号。BotBrowser 通过指纹配置文件在引擎层面控制所有显示属性。

基于配置文件的屏幕配置

每个配置文件包含完整的显示属性集。加载配置文件会一致地应用它们:

chrome --bot-profile="/path/to/profile.enc" \
       --user-data-dir="$(mktemp -d)"

CSS 媒体查询、JavaScript screen 属性和窗口尺寸约束都与配置文件一致。

自动化框架设置

使用 Playwright 或 Puppeteer 时,禁用默认视口以让配置文件的屏幕尺寸生效。

Puppeteer:

const browser = await puppeteer.launch({
  executablePath: '/path/to/botbrowser/chrome',
  args: ['--bot-profile=/path/to/profile.enc'],
  defaultViewport: null
});

Playwright:

const browser = await chromium.launch({
  executablePath: '/path/to/botbrowser/chrome',
  args: ['--bot-profile=/path/to/profile.enc']
});

const context = await browser.newContext({
  viewport: null
});

不设置 defaultViewport: null(Puppeteer)或 viewport: null(Playwright),框架会覆盖配置文件的屏幕尺寸。

配置文件控制的内容

BotBrowser 配置文件管理所有显示相关值:

  • screen.widthscreen.heightscreen.availWidthscreen.availHeight
  • screen.colorDepthscreen.pixelDepth
  • window.devicePixelRatio
  • 窗口内外尺寸和位置
  • 设备尺寸的 CSS 媒体查询结果

验证

加载配置文件后:

console.log('Screen:', screen.width, 'x', screen.height);
console.log('Available:', screen.availWidth, 'x', screen.availHeight);
console.log('Pixel Ratio:', window.devicePixelRatio);
console.log('Viewport:', window.innerWidth, 'x', window.innerHeight);
console.log('Color Depth:', screen.colorDepth);

所有值应与加载的配置文件匹配。

开始使用

  1. GitHub 下载 BotBrowser
  2. 使用 --bot-profile 加载指纹配置文件
  3. 在自动化框架中设置 defaultViewport: null
  4. 使用 CreepJSBrowserLeaks 验证
#screen#window#fingerprinting#privacy#viewport