Skip to content

dashn9/rustenium-identity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rustenium-identity

A Rust crate that transforms a raw CDP browser session into a fully-personified browser instance. Built on top of rustenium, it consumes an identity record and applies fingerprint spoofing to make the session indistinguishable from a real user.

Features

  • Full UA construction for all OS/browser combinations (Windows, macOS, Linux, Android, iOS x Chrome, Safari, Edge)
  • iOS-aware: CriOS/EdgiOS user agents, no client hints, Safari stealth block for all iOS browsers
  • CDP emulation overrides: screen metrics, locale, timezone, touch, hardware concurrency
  • Client Hints (Sec-CH-UA) for Chrome/Edge with platform-specific grease brands
  • JS stealth injection via Page.addScriptToEvaluateOnNewDocument (runs before page JS):
    • Navigator properties (platform, hardwareConcurrency, deviceMemory, languages, maxTouchPoints, webdriver)
    • WebGL parameter spoofing (vendor/renderer)
    • Battery status with randomized percentage
    • History count manipulation
    • Browser-specific overrides (Chrome plugins, Safari vendor, Edge plugins)
  • Timezone resolution: explicit value or auto-fetch from ip-api.com via proxy
  • Runtime GPU update via Runtime.evaluate
  • Optional BSON deserialization behind bson feature flag

Quick Start

use rustenium_identity::{Identity, IdentitySession};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let raw = std::fs::read_to_string("identity.json")?;
    let identity = Identity::from_json(&raw)?;

    let mut session = IdentitySession::launch(identity).await?;
    session.navigate("https://example.com").await?;

    Ok(())
}

Identity JSON Example

{
  "id": 1,
  "device_model": "SM-S921B",
  "has_battery": true,
  "has_mouse": false,
  "has_touch": true,
  "os": "Android",
  "os_version": "14",
  "platform": {
    "bitness": null,
    "architecture": null,
    "navigator_platform": "Linux armv81",
    "version": "14.0.0"
  },
  "browser": "chrome",
  "browser_version": [124, 0, 6367, 78],
  "screen": {
    "logical_width": 412,
    "logical_height": 915,
    "original_width": 1080,
    "original_height": 2340,
    "density_pixel_ratio": 2.625
  },
  "hardware_concurrency": 8,
  "memory": 8,
  "gpu": {
    "vendor": "Qualcomm",
    "webgl_renderer": "ANGLE (Qualcomm, Adreno (TM) 750, OpenGL ES 3.2)",
    "webgl_vendor": "Google Inc. (Qualcomm)"
  },
  "language": ["en-US", "en"],
  "history_count": 4,
  "proxy": "socks5://user:pass@proxy.example.com:1080",
  "timezone": "America/New_York"
}

Custom ChromeConfig

use rustenium::browsers::chrome::browser::ChromeConfig;
use rustenium_identity::{Identity, IdentityConfig, IdentitySession};

let identity = Identity::from_json(&raw)?;
let config = IdentityConfig::new(identity, ChromeConfig {
    enable_cdp: true,
    enable_bidi: false,
    ..Default::default()
});
let mut session = IdentitySession::launch(config).await?;

Project Structure

src/
  lib.rs          - Public API (IdentityConfig, IdentitySession)
  identity.rs     - Data model (Identity, Gpu, Os, Browser, etc.)
  ua.rs           - User-agent string construction
  cdp.rs          - CDP emulation commands + client hints
  script/mod.rs   - Stealth JS builder (template substitution)
  tz.rs           - Timezone resolution
  error.rs        - Error types
js/
  property_modifier.js  - Stealthy property spoofing utility
  main_world.js         - Main stealth script (templated)
  browser_chrome.js     - Chrome-specific overrides
  browser_safari.js     - Safari-specific overrides
  browser_edge.js       - Edge-specific overrides
  update_gpu.js         - Runtime GPU update script

About

Stealth layer built over rustenium

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors