Skip to main content

launch/
launch.rs

1//! Launches a Chromium session with a built-in preset identity applied, then
2//! holds the browser open so you can manually visit fingerprint-detection sites
3//! to eyeball the stealth:
4//!   - https://abrahamjuliot.github.io/creepjs/         (canvas/audio/webgl/fonts)
5//!   - https://bot.sannysoft.com/                       (webdriver/automation tells)
6//!   - https://browserleaks.com/canvas                  (canvas hash stability)
7//!   - https://fingerprintjs.github.io/fingerprintjs/   (visitor id stability)
8//!
9//! Pick a preset by ID (1-10) on the command line, or omit for a random one:
10//!   cargo run --example launch          # random preset
11//!   cargo run --example launch -- 6     # preset 6 (Android / Pixel 7)
12//!
13//! Stop with Ctrl-C.
14
15use rustenium_identity::{preset, IdentitySession};
16
17#[tokio::main]
18async fn main() -> Result<(), Box<dyn std::error::Error>> {
19    let identity = match std::env::args().nth(1) {
20        Some(arg) => {
21            let id: u64 = arg.parse()?;
22            preset::get_by_id(id)?
23        }
24        None => preset::random(),
25    };
26
27    println!(
28        "Launching preset #{:?}: {:?} {} / {:?} / {}",
29        identity.id, identity.os, identity.os_version, identity.browser, identity.gpu.webgl_renderer
30    );
31
32    let _session = IdentitySession::launch(identity).await?;
33
34    println!("Browser is up with the identity applied.");
35    println!("Visit a detection site in the opened window (e.g. creepjs / bot.sannysoft.com).");
36    println!("Press Ctrl-C to quit.");
37
38    // Hold the process (and therefore the browser) open until interrupted.
39    tokio::signal::ctrl_c().await?;
40    println!("\nShutting down.");
41    Ok(())
42}