Skip to main content

Python launcher & profile manager for stealth Chromium fingerprint spoofing

Project description

alterbrowser

指纹浏览器 Python 启动 & profile 管理库。将 stealth Chromium 的几十个 --fingerprint-* 开关封装成 Profile dataclass 和一行启动 API。


特性

  • 一行启动AlterBrowser(seed=12345).launch("https://example.com")
  • Profile dataclass:40+ 字段覆盖 UA / GPU / 硬件 / 时区 / 地理 / WebRTC / 字体 / 代理
  • Device Archetype:按真实设备原型(Dell / ThinkPad / MacBook …)派生一致性指纹
  • IP 自适应:自动查询出口 IP,对齐 timezone / geolocation / language / 区域字体
  • 多模式引擎REALISTIC / UNIQUE / CUSTOM 三种指纹策略
  • 字体生成器default / custom / mix / system 四种字体模式
  • CLIpython -m alterbrowser launch --seed 12345 https://example.com
  • 零运行时依赖(仅标准库;socks 代理可选装 PySocks

致谢 (Credits)

本项目借鉴了以下开源项目的代码:

alterbrowser 本身只做 Python 侧的 Profile 管理和 Chrome 命令行组装,底层 Chromium 二进制请自行基于上述项目构建;本仓库不提供 Chromium 源码或二进制。

各项目均有自己的 License,请分别遵守。


安装

暂不发 PyPI。两种用法:

# 方式一:加入 PYTHONPATH
git clone <this-repo> alterbrowser
python -c "import alterbrowser; print(alterbrowser.__version__)"

# 方式二:editable install(需要 Python ≥ 3.9)
pip install -e ./alterbrowser

配置 chrome 路径(可选,否则用打包默认值):

export ALTERBROWSER_CHROME_BINARY="/path/to/your/patched-chrome"
export ALTERBROWSER_PROFILES_DIR="/path/to/profiles"

5 分钟上手

from alterbrowser import AlterBrowser

# 1) 最简:只给一个 seed
AlterBrowser(seed=12345).launch("https://example.com")

# 2) 🔥 shorthand:一行指定 GPU / CPU / OS / 分辨率 / 城市(v0.3+)
AlterBrowser(
    seed=12345,
    gpu="RTX 5090",        # 自动展开成 gpu_vendor/gpu_renderer
    cpu="i9-14900K",       # 自动展开成 hardware_concurrency / device_memory
    os="win11",            # 自动展开成 platform / platform_version
    resolution="4K",       # 自动展开成 screen_width/height(也支持 "1920x1080")
    city="Shanghai",       # 自动展开成 timezone / geolocation / language
).launch("https://example.com")

# 3) 从 Device Archetype 派生(市场权重随机挑一个真实机型)
sb = AlterBrowser.from_archetype("dell_latitude_e6430_2012", seed=12345)
sb.adapt_to_ip()           # 按出口 IP 自动对齐时区/地理/语言/字体
sb.launch("https://example.com")

# 4) 持久化
sb.save("profile_001.json")
AlterBrowser.load("profile_001.json").launch()

Shorthand 支持的写法(大小写和空白不敏感):

字段 示例
gpu "RTX 5090" / "RX 7900 XTX" / "Arc A770" / "UHD 630" / "M2 Pro" / 任意自由字符串
cpu "i9-14900K" / "Ryzen 9 7950X" / "M3 Max"
os "win11" / "Windows 10" / "macos 14" / "Sonoma" / "Ubuntu"
resolution "1920x1080" / "4K" / "qhd" / "1440p"
city "Shanghai" / "NYC" / "Tokyo" / "Hong Kong" / "London" / 30+ 大城市

不在预设表的显卡名会按品牌关键词识别(nvidia/radeon/intel/apple),其他字段 fallback 为 no-op。用户显式设置的底层字段始终优先于 shorthand。

更多场景示例见 docs/USAGE.md,所有 API 细节见 docs/API.md


字体模式速查

模式 含义 使用场景
default 不传 --fingerprint-fonts,由上游 seed-hiding 控制 多 profile,追求自动化差异
custom fonts_custom 作为严格白名单 高级用户精确控制
mix 混合风格(Windows + macOS + Linux + Google 混合 70–120 字体) 标准多账号场景
system 读系统实际安装字体作为白名单 最像真实浏览器

项目结构

alter_browser/                 ← repo 根
├── alterbrowser/              ← Python 包
│   ├── __init__.py            公开 API 导出
│   ├── __main__.py            CLI 入口
│   ├── browser.py             AlterBrowser 顶层类
│   ├── profile.py             Profile / ProfileBatch dataclass
│   ├── modes.py               FingerprintMode / SourceMode / WebRTCMode / TriState 枚举
│   ├── fonts.py               FontMode / FontGenerator
│   ├── archetype.py           Device Archetype 桥接
│   ├── ip_adapt.py            IP 自适应
│   ├── switches.py            命令行开关构建器
│   ├── launcher.py            subprocess 启动器
│   ├── errors.py              异常类型
│   └── utils.py               seed 派生 / 随机工具
├── tests/                     单元测试 (44 cases)
├── docs/
│   ├── USAGE.md               基础操作指南
│   └── API.md                 完整 API 参考
├── pyproject.toml
├── LICENSE
├── .gitignore
└── README.md

运行测试

pytest tests/ -v

版本

  • v0.3.0 — Shorthand 简写字段(GPU / CPU / OS / Resolution / City 一行搞定)
  • v0.2.1 — Archetype_library 内嵌打包(from_archetype 可直接用)
  • v0.2.0 — Archetype + IP 自适应 + 多模式引擎(首个 PyPI 发布)
  • v0.1.0 — MVP(Profile + SwitchBuilder + Launcher + CLI + 测试)

License

MIT — 见 LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

alterbrowser-0.3.0.tar.gz (51.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

alterbrowser-0.3.0-py3-none-any.whl (49.8 kB view details)

Uploaded Python 3

File details

Details for the file alterbrowser-0.3.0.tar.gz.

File metadata

  • Download URL: alterbrowser-0.3.0.tar.gz
  • Upload date:
  • Size: 51.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for alterbrowser-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1912124eb8f6086bc4c73a548e1dfe4d7e7bda6b9ca01116527769d10bd07eda
MD5 4ad626c23e486f20c292fcf43b6aed1f
BLAKE2b-256 adfd1792bb92b75098ddfb84e90750754508fab05a6aa30e578e1a6b903bcc36

See more details on using hashes here.

File details

Details for the file alterbrowser-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: alterbrowser-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 49.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for alterbrowser-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 083bbb40089910d28173032b034422c54a4132e0ff8255f0de5ed1c9f7a9afd0
MD5 4fe84ae1689400fee9caa39b19dfe5e6
BLAKE2b-256 f15961dfa62b112f69114e3bfa2d0253a778b16a48dae1199f3afed9d34cfa37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page