mirror of
https://github.com/CloakHQ/CloakBrowser.git
synced 2026-06-23 11:41:46 +02:00
feat: add page.stealth_evaluate() for undetectable JS execution (#108)
Extract CDP isolated world classes from humanize layer into standalone stealth_eval module. Attach page.stealth_evaluate(expression) to every page automatically — runs JS in a CDP isolated world with clean Error.stack traces and full variable isolation from main world JS.
This commit is contained in:
@@ -138,6 +138,10 @@ def launch(
|
||||
cfg = resolve_config(human_preset, human_config)
|
||||
patch_browser(browser, cfg)
|
||||
|
||||
# Stealth evaluate — always attached
|
||||
from .stealth_eval import patch_browser_stealth_eval
|
||||
patch_browser_stealth_eval(browser, is_async=False)
|
||||
|
||||
return browser
|
||||
|
||||
|
||||
@@ -227,6 +231,10 @@ async def launch_async( # noqa: C901
|
||||
cfg = resolve_config(human_preset, human_config)
|
||||
patch_browser_async(browser, cfg)
|
||||
|
||||
# Stealth evaluate — always attached
|
||||
from .stealth_eval import patch_browser_stealth_eval
|
||||
patch_browser_stealth_eval(browser, is_async=True)
|
||||
|
||||
return browser
|
||||
|
||||
|
||||
@@ -344,6 +352,10 @@ def launch_persistent_context(
|
||||
cfg = resolve_config(human_preset, human_config)
|
||||
patch_context(context, cfg)
|
||||
|
||||
# Stealth evaluate — always attached
|
||||
from .stealth_eval import patch_context_stealth_eval
|
||||
patch_context_stealth_eval(context, is_async=False)
|
||||
|
||||
return context
|
||||
|
||||
|
||||
@@ -463,6 +475,10 @@ async def launch_persistent_context_async(
|
||||
cfg = resolve_config(human_preset, human_config)
|
||||
patch_context_async(context, cfg)
|
||||
|
||||
# Stealth evaluate — always attached
|
||||
from .stealth_eval import patch_context_stealth_eval
|
||||
patch_context_stealth_eval(context, is_async=True)
|
||||
|
||||
return context
|
||||
|
||||
|
||||
@@ -556,6 +572,10 @@ def launch_context(
|
||||
cfg = resolve_config(human_preset, human_config)
|
||||
patch_context(context, cfg)
|
||||
|
||||
# Stealth evaluate — always attached
|
||||
from .stealth_eval import patch_context_stealth_eval
|
||||
patch_context_stealth_eval(context, is_async=False)
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user