hyper-sdk 0.2.0__tar.gz → 0.3.1__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.2.0 → hyper_sdk-0.3.1}/PKG-INFO +1 -1
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/akamai/sec_cpt.py +6 -4
- hyper_sdk-0.3.1/hyper_sdk/akamai_input.py +33 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/datadome_input.py +23 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/kasada/parse.py +2 -2
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/session.py +55 -4
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk.egg-info/PKG-INFO +1 -1
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/pyproject.toml +1 -1
- hyper_sdk-0.2.0/hyper_sdk/akamai_input.py +0 -15
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/LICENSE +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/README.md +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/__init__.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/akamai/__init__.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/akamai/pixel.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/akamai/script_path.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/akamai/stop_signal.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/datadome/__init__.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/datadome/parse.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/incapsula/__init__.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/incapsula/utmvc.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/incapsula_input.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/kasada/__init__.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk/kasada_input.py +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk.egg-info/SOURCES.txt +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk.egg-info/dependency_links.txt +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk.egg-info/requires.txt +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/hyper_sdk.egg-info/top_level.txt +0 -0
- {hyper_sdk-0.2.0 → hyper_sdk-0.3.1}/setup.cfg +0 -0
|
@@ -9,15 +9,16 @@ from typing import List
|
|
|
9
9
|
|
|
10
10
|
sec_duration_expr = re.compile(r'data-duration=(\d+)')
|
|
11
11
|
sec_challenge_expr = re.compile(r'challenge="(.*?)"')
|
|
12
|
-
sec_page_expr = re.compile(r'src="(
|
|
12
|
+
sec_page_expr = re.compile(r'data-duration=\d+\s+src="([^"]+)"')
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class SecCptChallengeData:
|
|
16
|
-
def __init__(self, token: str, timestamp: int, nonce: str, difficulty: int):
|
|
16
|
+
def __init__(self, token: str, timestamp: int, nonce: str, difficulty: int, count: int):
|
|
17
17
|
self.token = token
|
|
18
18
|
self.timestamp = timestamp
|
|
19
19
|
self.nonce = nonce
|
|
20
20
|
self.difficulty = difficulty
|
|
21
|
+
self.count = count
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
class SecCptChallenge:
|
|
@@ -63,7 +64,8 @@ class SecCptChallenge:
|
|
|
63
64
|
challenge_data.get('token', ''),
|
|
64
65
|
challenge_data.get('timestamp', 0),
|
|
65
66
|
challenge_data.get('nonce', ''),
|
|
66
|
-
challenge_data.get('difficulty', 0)
|
|
67
|
+
challenge_data.get('difficulty', 0),
|
|
68
|
+
challenge_data.get('count', 0)
|
|
67
69
|
)
|
|
68
70
|
|
|
69
71
|
@staticmethod
|
|
@@ -121,7 +123,7 @@ class SecCptChallenge:
|
|
|
121
123
|
difficulty += 1
|
|
122
124
|
answers.append(answer)
|
|
123
125
|
|
|
124
|
-
if len(answers) ==
|
|
126
|
+
if len(answers) == self.challenge_data.count:
|
|
125
127
|
break
|
|
126
128
|
continue
|
|
127
129
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class SensorInput:
|
|
2
|
+
def __init__(self, abck: str, bmsz: str, version: str, page_url: str, user_agent: str, ip = "", language = "", script_hash="", dynamic_values=""):
|
|
3
|
+
self.abck = abck
|
|
4
|
+
self.bmsz = bmsz
|
|
5
|
+
self.version = version
|
|
6
|
+
self.page_url = page_url
|
|
7
|
+
self.user_agent = user_agent
|
|
8
|
+
self.script_hash = script_hash
|
|
9
|
+
self.dynamic_values = dynamic_values
|
|
10
|
+
self.ip = ip
|
|
11
|
+
self.language = language
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class PixelInput:
|
|
15
|
+
def __init__(self, user_agent: str, html_var: str, script_var: str):
|
|
16
|
+
self.user_agent = user_agent
|
|
17
|
+
self.html_var = html_var
|
|
18
|
+
self.script_var = script_var
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class DynamicInput:
|
|
22
|
+
def __init__(self, script: str):
|
|
23
|
+
self.script = script
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class SbsdInput:
|
|
27
|
+
def __init__(self, user_agent: str, uuid: str, page_url: str, o_cookie: str, language = "", ip = ""):
|
|
28
|
+
self.user_agent = user_agent
|
|
29
|
+
self.uuid = uuid
|
|
30
|
+
self.page_url = page_url
|
|
31
|
+
self.o_cookie = o_cookie
|
|
32
|
+
self.language = language
|
|
33
|
+
self.ip = ip
|
|
@@ -47,4 +47,27 @@ class DataDomeInterstitialInput:
|
|
|
47
47
|
"userAgent": self.user_agent,
|
|
48
48
|
"deviceLink": self.device_link,
|
|
49
49
|
"html": self.html
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class DataDomeTagsInput:
|
|
54
|
+
def __init__(self, user_agent: str, cid: str, ddk: str, referer: str, tags_type: str, language = "", ip = ""):
|
|
55
|
+
# UserAgent must be a Chrome Windows User-Agent.
|
|
56
|
+
self.user_agent = user_agent
|
|
57
|
+
self.cid = cid
|
|
58
|
+
self.ddk = ddk
|
|
59
|
+
self.referer = referer
|
|
60
|
+
self.tags_type = tags_type
|
|
61
|
+
self.language = language
|
|
62
|
+
self.ip = ip
|
|
63
|
+
|
|
64
|
+
def to_dict(self):
|
|
65
|
+
return {
|
|
66
|
+
"userAgent": self.user_agent,
|
|
67
|
+
"cid": self.cid,
|
|
68
|
+
"ddk": self.ddk,
|
|
69
|
+
"referer": self.referer,
|
|
70
|
+
"type": self.tags_type,
|
|
71
|
+
"language": self.language,
|
|
72
|
+
"ip": self.ip,
|
|
50
73
|
}
|
|
@@ -22,6 +22,6 @@ def parse_script_path(src: str) -> str:
|
|
|
22
22
|
"""
|
|
23
23
|
match = script_path_expr.search(src)
|
|
24
24
|
if match:
|
|
25
|
-
return match.group(1)
|
|
25
|
+
return re.sub(r'&', '&', match.group(1))
|
|
26
26
|
else:
|
|
27
|
-
raise "hyper-sdk: script path not found"
|
|
27
|
+
raise Exception("hyper-sdk: script path not found")
|
|
@@ -5,9 +5,9 @@ import requests
|
|
|
5
5
|
import jwt
|
|
6
6
|
from datetime import datetime, timedelta, timezone
|
|
7
7
|
|
|
8
|
-
from .akamai_input import SensorInput, PixelInput
|
|
8
|
+
from .akamai_input import SensorInput, PixelInput, DynamicInput, SbsdInput
|
|
9
9
|
from .kasada_input import KasadaPowInput, KasadaPayloadInput
|
|
10
|
-
from .datadome_input import DataDomeSliderInput, DataDomeInterstitialInput
|
|
10
|
+
from .datadome_input import DataDomeSliderInput, DataDomeInterstitialInput, DataDomeTagsInput
|
|
11
11
|
from .incapsula_input import UtmvcInput
|
|
12
12
|
|
|
13
13
|
|
|
@@ -35,6 +35,44 @@ class Session:
|
|
|
35
35
|
'version': input_data.version,
|
|
36
36
|
'pageUrl': input_data.page_url,
|
|
37
37
|
'scriptHash': input_data.script_hash,
|
|
38
|
+
'dynamicValues': input_data.dynamic_values,
|
|
39
|
+
'ip': input_data.ip,
|
|
40
|
+
'language': input_data.language,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
def generate_sbsd_data(self, input_data: SbsdInput) -> str:
|
|
44
|
+
"""
|
|
45
|
+
Returns the sbsd data required to solve SBSD using the Hyper Solutions API.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
input_data (SbsdInput): An instance of SbsdInput containing the necessary data for generating the sbsd data.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
str: Sensor data as a string.
|
|
52
|
+
"""
|
|
53
|
+
sensor_endpoint = "https://akm.justhyped.dev/sbsd"
|
|
54
|
+
return self._send_request(sensor_endpoint, {
|
|
55
|
+
'userAgent': input_data.user_agent,
|
|
56
|
+
'uuid': input_data.uuid,
|
|
57
|
+
'pageUrl': input_data.page_url,
|
|
58
|
+
'o': input_data.o_cookie,
|
|
59
|
+
'language': input_data.language,
|
|
60
|
+
'ip': input_data.ip,
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
def parse_v3_dynamic(self, input_data: DynamicInput) -> str:
|
|
64
|
+
"""
|
|
65
|
+
Returns the dynamic values required to generate sensor data for V3 dynamic with Hyper Solutions API.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
input_data (DynamicInput): An instance of DynamicInput containing the necessary data for parsing the script.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
str: Dynamic values as a string.
|
|
72
|
+
"""
|
|
73
|
+
sensor_endpoint = "https://akm.justhyped.dev/v3dynamic"
|
|
74
|
+
return self._send_request(sensor_endpoint, {
|
|
75
|
+
'script': input_data.script,
|
|
38
76
|
})
|
|
39
77
|
|
|
40
78
|
def generate_pixel_data(self, input_data: PixelInput) -> str:
|
|
@@ -159,7 +197,7 @@ class Session:
|
|
|
159
197
|
|
|
160
198
|
Args:
|
|
161
199
|
session (Session): An instance of Session to handle the network request.
|
|
162
|
-
input_data (
|
|
200
|
+
input_data (DataDomeInterstitialInput): An instance of DataDomeInterstitialInput.
|
|
163
201
|
|
|
164
202
|
Returns:
|
|
165
203
|
str: The payload to post to /interstitial/
|
|
@@ -172,13 +210,26 @@ class Session:
|
|
|
172
210
|
|
|
173
211
|
Args:
|
|
174
212
|
session (Session): An instance of Session to handle the network request.
|
|
175
|
-
input_data (
|
|
213
|
+
input_data (DataDomeSliderInput): An instance of DataDomeSliderInput.
|
|
176
214
|
|
|
177
215
|
Returns:
|
|
178
216
|
str: The URL to make a GET request to and returns a solved datadome cookie.
|
|
179
217
|
"""
|
|
180
218
|
return self._send_request("https://datadome.justhyped.dev/slider", input_data.to_dict())
|
|
181
219
|
|
|
220
|
+
def generate_tags_payload(self, input_data: DataDomeTagsInput) -> str:
|
|
221
|
+
"""
|
|
222
|
+
Returns the DataDome Tags payload using the Hyper Solutions API.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
session (Session): An instance of Session to handle the network request.
|
|
226
|
+
input_data (DataDomeTagsInput): An instance of DataDomeTagsInput.
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
str: The tags payload.
|
|
230
|
+
"""
|
|
231
|
+
return self._send_request("https://datadome.justhyped.dev/tags", input_data.to_dict())
|
|
232
|
+
|
|
182
233
|
def generate_signature(self) -> str:
|
|
183
234
|
claims = {
|
|
184
235
|
"key": self.api_key,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
class SensorInput:
|
|
2
|
-
def __init__(self, abck: str, bmsz: str, version: str, page_url: str, user_agent: str, script_hash=""):
|
|
3
|
-
self.abck = abck
|
|
4
|
-
self.bmsz = bmsz
|
|
5
|
-
self.version = version
|
|
6
|
-
self.page_url = page_url
|
|
7
|
-
self.user_agent = user_agent
|
|
8
|
-
self.script_hash = script_hash
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class PixelInput:
|
|
12
|
-
def __init__(self, user_agent: str, html_var: str, script_var: str):
|
|
13
|
-
self.user_agent = user_agent
|
|
14
|
-
self.html_var = html_var
|
|
15
|
-
self.script_var = script_var
|
|
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
|