hyper-sdk 0.9.1__tar.gz → 0.10.0__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.
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/PKG-INFO +1 -1
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/__init__.py +1 -0
- hyper_sdk-0.10.0/hyper_sdk/incapsula/__init__.py +2 -0
- hyper_sdk-0.10.0/hyper_sdk/incapsula/dynamic.py +48 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk.egg-info/PKG-INFO +1 -1
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk.egg-info/SOURCES.txt +1 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/pyproject.toml +1 -1
- hyper_sdk-0.9.1/hyper_sdk/incapsula/__init__.py +0 -1
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/LICENSE +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/README.md +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/akamai/__init__.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/akamai/pixel.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/akamai/script_path.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/akamai/sec_cpt.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/akamai/stop_signal.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/akamai_input.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/datadome/__init__.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/datadome/parse.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/datadome_input.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/incapsula/utmvc.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/incapsula_input.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/kasada/__init__.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/kasada/parse.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/kasada_input.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk/session.py +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk.egg-info/dependency_links.txt +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk.egg-info/requires.txt +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/hyper_sdk.egg-info/top_level.txt +0 -0
- {hyper_sdk-0.9.1 → hyper_sdk-0.10.0}/setup.cfg +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from urllib.parse import urlparse
|
|
3
|
+
|
|
4
|
+
# Precompiled regular expressions
|
|
5
|
+
reese_script_regex = re.compile(r'src\s*=\s*"((/[^/]+/\d+)(?:\?.*)?)"')
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def parse_dynamic_reese_script(html_content: str, url_str: str) -> tuple[str, str]:
|
|
9
|
+
"""
|
|
10
|
+
Parses the sensor path and script path from the given HTML content.
|
|
11
|
+
|
|
12
|
+
This function searches the provided HTML for a script element containing a specific pattern
|
|
13
|
+
and extracts both the sensor path (shortened path) and script path (the full path).
|
|
14
|
+
It requires that the HTML contains "Pardon Our Interruption" to confirm it's the correct page type.
|
|
15
|
+
It also takes a URL string, extracts the hostname, and appends it to the sensor path.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
html_content (str): The HTML content to parse.
|
|
19
|
+
url_str (str): The URL string to extract the hostname from.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
tuple[str, str]: A tuple containing the sensor path (with hostname) and script path.
|
|
23
|
+
|
|
24
|
+
Raises:
|
|
25
|
+
ValueError: If the URL is invalid.
|
|
26
|
+
Exception: If the page is not an interruption page or if the Reese script is not found.
|
|
27
|
+
"""
|
|
28
|
+
# Parse the URL to extract hostname
|
|
29
|
+
try:
|
|
30
|
+
parsed_url = urlparse(url_str)
|
|
31
|
+
hostname = parsed_url.netloc
|
|
32
|
+
except Exception:
|
|
33
|
+
raise ValueError("hyper-sdk: invalid URL")
|
|
34
|
+
|
|
35
|
+
# Verify this is an interruption page
|
|
36
|
+
if "Pardon Our Interruption" not in html_content:
|
|
37
|
+
raise Exception("hyper-sdk: not an interruption page")
|
|
38
|
+
|
|
39
|
+
# Find the Reese script
|
|
40
|
+
match = reese_script_regex.search(html_content)
|
|
41
|
+
if not match or len(match.groups()) < 2:
|
|
42
|
+
raise Exception("hyper-sdk: reese script not found")
|
|
43
|
+
|
|
44
|
+
script_path = match.group(1)
|
|
45
|
+
sensor_path = match.group(2)
|
|
46
|
+
|
|
47
|
+
# Append the hostname to the sensor path
|
|
48
|
+
return f"{sensor_path}?d={hostname}", script_path
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .utmvc import *
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|