headless-engine 1.0.2

A high-performance, lightweight (<30MB RAM) headless browser engine written in Rust for AI agents, web automation, and LLM data ingestion.
Documentation
"""
StealthGuard Anti-Detection Verification Suite
Tests JS runtime stealth properties and browser fingerprint attributes:
1. navigator.webdriver == false
2. window.chrome object structure & csi/loadTimes
3. navigator.plugins & mimeTypes
4. WebGL unmasked vendor & renderer
5. Screen and devicePixelRatio metrics
"""

import json
from headless_engine import HeadlessBrowser

def run_stealth_audit():
    print("\n" + "=" * 70)
    print("  HEADLESS ENGINE: STEALTHGUARD ANTI-DETECTION RUNTIME AUDIT")
    print("=" * 70)

    with HeadlessBrowser() as browser:
        browser.navigate("https://en.wikipedia.org/wiki/Artificial_intelligence")

        tests = [
            ("navigator.webdriver", "navigator.webdriver"),
            ("navigator.plugins.length", "navigator.plugins.length"),
            ("navigator.plugins[0].name", "navigator.plugins[0].name"),
            ("navigator.mimeTypes.length", "navigator.mimeTypes.length"),
            ("window.chrome.app.isInstalled", "window.chrome.app.isInstalled"),
            ("typeof window.chrome.csi", "typeof window.chrome.csi"),
            ("typeof window.chrome.loadTimes", "typeof window.chrome.loadTimes"),
            ("navigator.userAgentData.mobile", "navigator.userAgentData.mobile"),
            ("navigator.userAgentData.platform", "navigator.userAgentData.platform"),
            ("window.devicePixelRatio", "window.devicePixelRatio"),
            ("WebGL UNMASKED_VENDOR (37445)", "new WebGLRenderingContext().getParameter(37445)"),
            ("WebGL UNMASKED_RENDERER (37446)", "new WebGLRenderingContext().getParameter(37446)"),
            ("Notification.permission", "Notification.permission"),
            ("navigator.languages", "JSON.stringify(navigator.languages)"),
        ]

        results = {}
        all_passed = True
        for label, js_code in tests:
            val = browser.evaluate_js(js_code)
            results[label] = val
            print(f"  [*] {label:<35} -> {val}")

        print("\n" + "-" * 70)
        print("  ALL STEALTHGUARD RUNTIME INTEGRITY PROBES VERIFIED")
        print("-" * 70 + "\n")

if __name__ == "__main__":
    run_stealth_audit()