phantomwright 0.0.4__tar.gz → 0.0.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {phantomwright-0.0.4 → phantomwright-0.0.6}/PKG-INFO +1 -1
  2. phantomwright-0.0.6/phantomwright/__init__.py +8 -0
  3. phantomwright-0.0.6/phantomwright/_impl/_core_debug_patch.py +38 -0
  4. phantomwright-0.0.6/phantomwright/_impl/_evaluate_patch.py +54 -0
  5. phantomwright-0.0.6/phantomwright/_repo_version.py +1 -0
  6. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/async_api/__init__.py +0 -1
  7. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/sync_api/__init__.py +0 -1
  8. {phantomwright-0.0.4 → phantomwright-0.0.6}/pyproject.toml +1 -1
  9. phantomwright-0.0.4/phantomwright/__init__.py +0 -5
  10. phantomwright-0.0.4/phantomwright/async_api/_patch_evaluate.py +0 -26
  11. phantomwright-0.0.4/phantomwright/sync_api/_patch_evaluate.py +0 -26
  12. {phantomwright-0.0.4 → phantomwright-0.0.6}/.gitignore +0 -0
  13. {phantomwright-0.0.4 → phantomwright-0.0.6}/LICENSE +0 -0
  14. {phantomwright-0.0.4 → phantomwright-0.0.6}/README.md +0 -0
  15. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/_impl/__init__.py +0 -0
  16. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/_impl/_user_sim/_mouse_move_sim.py +0 -0
  17. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/_impl/_user_sim/_mouse_wheel_sim.py +0 -0
  18. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/async_api/_patch_goto.py +0 -0
  19. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/__init__.py +0 -0
  20. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/case_insensitive_dict.py +0 -0
  21. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/context_managers.py +0 -0
  22. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/chrome.app.js +0 -0
  23. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/chrome.csi.js +0 -0
  24. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/chrome.hairline.js +0 -0
  25. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/chrome.load.times.js +0 -0
  26. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/chrome.runtime.js +0 -0
  27. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/error.prototype.js +0 -0
  28. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/iframe.contentWindow.js +0 -0
  29. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/media.codecs.js +0 -0
  30. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/navigator.hardwareConcurrency.js +0 -0
  31. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/navigator.languages.js +0 -0
  32. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/navigator.permissions.js +0 -0
  33. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/navigator.platform.js +0 -0
  34. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/navigator.plugins.js +0 -0
  35. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/navigator.userAgent.js +0 -0
  36. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/navigator.vendor.js +0 -0
  37. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/evasions/webgl.vendor.js +0 -0
  38. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/generate.magic.arrays.js +0 -0
  39. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/js/utils.js +0 -0
  40. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/stealth/stealth.py +0 -0
  41. {phantomwright-0.0.4 → phantomwright-0.0.6}/phantomwright/sync_api/_patch_goto.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phantomwright
3
- Version: 0.0.4
3
+ Version: 0.0.6
4
4
  Summary: Bridging playwright-core patch + extending playwright API for stealth injection & user simulation
5
5
  Project-URL: homepage, https://github.com/ai-microsoft/phantom-wright
6
6
  Project-URL: changelog, https://github.com/ai-microsoft/phantom-wright/blob/main/CHANGELOG.md
@@ -0,0 +1,8 @@
1
+ """
2
+ Patchright + Stealth Plugin + User Behavior Simulation = PhantomWright
3
+ """
4
+
5
+ from ._impl import _core_debug_patch, _evaluate_patch
6
+
7
+ _evaluate_patch.do_patch()
8
+ _core_debug_patch.do_patch()
@@ -0,0 +1,38 @@
1
+ import os
2
+
3
+ import patchright._impl._transport as t
4
+
5
+ _patched = False
6
+
7
+
8
+ def do_patch() -> None:
9
+ """
10
+ Automatically enable Node.js debug mode if PHANTOMWRIGHT_DEBUG environment variable is set.
11
+
12
+ Environment variables:
13
+ PHANTOMWRIGHT_DEBUG: Set to "1" or "true" to enable debug mode
14
+ PHANTOMWRIGHT_DEBUG_PORT: Debug port (default: 9229)
15
+ PHANTOMWRIGHT_DEBUG_BREAK: Set to "0" or "false" to disable break on start
16
+ """
17
+ global _patched
18
+ if _patched:
19
+ return
20
+
21
+ debug_env = os.environ.get("PHANTOMWRIGHT_DEBUG", "").lower()
22
+ if debug_env not in ("1", "true"):
23
+ return
24
+
25
+ port = int(os.environ.get("PHANTOMWRIGHT_DEBUG_PORT", "9229"))
26
+ break_on_start = os.environ.get("PHANTOMWRIGHT_DEBUG_BREAK", "1").lower() not in ("0", "false")
27
+ inspect_flag = f"--inspect-brk={port}" if break_on_start else f"--inspect={port}"
28
+
29
+ orig_create = t.asyncio.create_subprocess_exec
30
+
31
+ async def patched_create(*args, **kwargs):
32
+ args = list(args)
33
+ args.insert(1, inspect_flag)
34
+ print(f"[PhantomWright Debug] Launching Node with: {args}")
35
+ return await orig_create(*args, **kwargs)
36
+
37
+ t.asyncio.create_subprocess_exec = patched_create
38
+ _patched = True
@@ -0,0 +1,54 @@
1
+ from functools import wraps
2
+
3
+ from patchright.async_api import Page as AsyncPage
4
+ from patchright.sync_api import Page as SyncPage
5
+
6
+ def do_patch() -> None:
7
+ """ Aysnc / Sync version of evaluate override"""
8
+ _original_sync_evaluate = SyncPage.evaluate
9
+
10
+
11
+ @wraps(_original_sync_evaluate)
12
+ def _hooked_sync_evaluate(self, *args, **kwargs):
13
+ # Ensure isolated_context defaults to False if not provided
14
+ kwargs.setdefault("isolated_context", False)
15
+ return _original_sync_evaluate(self, *args, **kwargs)
16
+
17
+
18
+ SyncPage.evaluate = _hooked_sync_evaluate
19
+
20
+ _original_sync_evaluate_handle = SyncPage.evaluate_handle
21
+
22
+
23
+ @wraps(_original_sync_evaluate_handle)
24
+ def _hooked_sync_evaluate_handle(self, *args, **kwargs):
25
+ # Ensure isolated_context defaults to False if not provided
26
+ kwargs.setdefault("isolated_context", False)
27
+ return _original_sync_evaluate_handle(self, *args, **kwargs)
28
+
29
+
30
+ SyncPage.evaluate_handle = _hooked_sync_evaluate_handle
31
+
32
+ _original_async_evaluate = AsyncPage.evaluate
33
+
34
+
35
+ @wraps(_original_async_evaluate)
36
+ async def _hooked_async_evaluate(self, *args, **kwargs):
37
+ # Ensure isolated_context defaults to False if not provided
38
+ kwargs.setdefault("isolated_context", False)
39
+ return await _original_async_evaluate(self, *args, **kwargs)
40
+
41
+
42
+ AsyncPage.evaluate = _hooked_async_evaluate
43
+
44
+ _original_async_evaluate_handle = AsyncPage.evaluate_handle
45
+
46
+
47
+ @wraps(_original_async_evaluate_handle)
48
+ async def _hooked_async_evaluate_handle(self, *args, **kwargs):
49
+ # Ensure isolated_context defaults to False if not provided
50
+ kwargs.setdefault("isolated_context", False)
51
+ return await _original_async_evaluate_handle(self, *args, **kwargs)
52
+
53
+
54
+ AsyncPage.evaluate_handle = _hooked_async_evaluate_handle
@@ -0,0 +1 @@
1
+ version = 'v0.0.6'
@@ -1,6 +1,5 @@
1
1
  from patchright.async_api import expect, async_playwright, Accessibility, APIRequest, APIRequestContext, APIResponse, Browser, BrowserContext, BrowserType, CDPSession, ChromiumBrowserContext, ConsoleMessage, Cookie, Dialog, Download, ElementHandle, Error, FileChooser, FilePayload, FloatRect, Frame, FrameLocator, Geolocation, HttpCredentials, JSHandle, Keyboard, Locator, Mouse, Page, PdfMargins, Position, Playwright, ProxySettings, Request, ResourceTiming, Response, Route, Selectors, SourceLocation, StorageState, StorageStateCookie, TimeoutError, Touchscreen, Video, ViewportSize, WebError, WebSocket, WebSocketRoute, Worker
2
2
  from ._patch_goto import *
3
- from ._patch_evaluate import *
4
3
 
5
4
  __all__ = [
6
5
  "expect",
@@ -1,6 +1,5 @@
1
1
  from patchright.sync_api import expect, Accessibility, APIRequest, APIRequestContext, APIResponse, Browser, BrowserContext, BrowserType, CDPSession, ChromiumBrowserContext, ConsoleMessage, Cookie, Dialog, Download, ElementHandle, Error, FileChooser, FilePayload, FloatRect, Frame, FrameLocator, Geolocation, HttpCredentials, JSHandle, Keyboard, Locator, Mouse, Page, PdfMargins, Position, Playwright, ProxySettings, Request, ResourceTiming, Response, Route, Selectors, SourceLocation, StorageState, StorageStateCookie, sync_playwright, TimeoutError, Touchscreen, Video, ViewportSize, WebError, WebSocket, WebSocketRoute, Worker
2
2
  from ._patch_goto import *
3
- from ._patch_evaluate import *
4
3
 
5
4
  __all__ = [
6
5
  "expect",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "phantomwright"
3
- version = "0.0.4"
3
+ version = "0.0.6"
4
4
  description = "Bridging playwright-core patch + extending playwright API for stealth injection & user simulation"
5
5
  authors = [
6
6
  {name="Hang Yin", email="hangyin@microsoft.com"},
@@ -1,5 +0,0 @@
1
- """
2
- Patchright + Stealth Plugin + User Behavior Simulation = PhantomWright
3
- """
4
-
5
- __version__ = "0.0.4"
@@ -1,26 +0,0 @@
1
- from functools import wraps
2
- from patchright.async_api import Page
3
-
4
- _original_evaluate = Page.evaluate
5
-
6
-
7
- @wraps(_original_evaluate)
8
- async def _hooked_evaluate(self, *args, **kwargs):
9
- # Ensure isolated_context defaults to False if not provided
10
- kwargs.setdefault("isolated_context", False)
11
- return await _original_evaluate(self, *args, **kwargs)
12
-
13
-
14
- Page.evaluate = _hooked_evaluate
15
-
16
- _original_evaluate_handle = Page.evaluate_handle
17
-
18
-
19
- @wraps(_original_evaluate_handle)
20
- async def _hooked_evaluate_handle(self, *args, **kwargs):
21
- # Ensure isolated_context defaults to False if not provided
22
- kwargs.setdefault("isolated_context", False)
23
- return await _original_evaluate_handle(self, *args, **kwargs)
24
-
25
-
26
- Page.evaluate_handle = _hooked_evaluate_handle
@@ -1,26 +0,0 @@
1
- from functools import wraps
2
- from patchright.sync_api import Page
3
-
4
- _original_evaluate = Page.evaluate
5
-
6
-
7
- @wraps(_original_evaluate)
8
- def _hooked_evaluate(self, *args, **kwargs):
9
- # Ensure isolated_context defaults to False if not provided
10
- kwargs.setdefault("isolated_context", False)
11
- return _original_evaluate(self, *args, **kwargs)
12
-
13
-
14
- Page.evaluate = _hooked_evaluate
15
-
16
- _original_evaluate_handle = Page.evaluate_handle
17
-
18
-
19
- @wraps(_original_evaluate_handle)
20
- def _hooked_evaluate_handle(self, *args, **kwargs):
21
- # Ensure isolated_context defaults to False if not provided
22
- kwargs.setdefault("isolated_context", False)
23
- return _original_evaluate_handle(self, *args, **kwargs)
24
-
25
-
26
- Page.evaluate_handle = _hooked_evaluate_handle
File without changes
File without changes
File without changes