hyper-sdk 3.0.0__tar.gz → 3.1.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.
Files changed (34) hide show
  1. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/PKG-INFO +16 -1
  2. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/README.md +15 -0
  3. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/__init__.py +1 -0
  4. hyper_sdk-3.1.0/hyper_sdk/kasada/__init__.py +2 -0
  5. hyper_sdk-3.1.0/hyper_sdk/kasada/user_agent.py +24 -0
  6. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/kasada_input.py +66 -66
  7. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk.egg-info/PKG-INFO +16 -1
  8. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk.egg-info/SOURCES.txt +3 -1
  9. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/pyproject.toml +1 -1
  10. hyper_sdk-3.1.0/tests/test_user_agent.py +13 -0
  11. hyper_sdk-3.0.0/hyper_sdk/kasada/__init__.py +0 -1
  12. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/LICENSE +0 -0
  13. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/akamai/__init__.py +0 -0
  14. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/akamai/pixel.py +0 -0
  15. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/akamai/script_path.py +0 -0
  16. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/akamai/sec_cpt.py +0 -0
  17. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/akamai/stop_signal.py +0 -0
  18. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/akamai_input.py +0 -0
  19. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/datadome/__init__.py +0 -0
  20. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/datadome/parse.py +0 -0
  21. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/datadome_input.py +0 -0
  22. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/incapsula/__init__.py +0 -0
  23. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/incapsula/dynamic.py +0 -0
  24. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/incapsula/utmvc.py +0 -0
  25. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/incapsula_input.py +0 -0
  26. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/kasada/parse.py +0 -0
  27. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/session.py +0 -0
  28. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/session_async.py +0 -0
  29. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/shared.py +0 -0
  30. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk/trustdecision_input.py +0 -0
  31. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk.egg-info/dependency_links.txt +0 -0
  32. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk.egg-info/requires.txt +0 -0
  33. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/hyper_sdk.egg-info/top_level.txt +0 -0
  34. {hyper_sdk-3.0.0 → hyper_sdk-3.1.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyper_sdk
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: Hyper Solutions Python SDK
5
5
  License: MIT License
6
6
 
@@ -316,6 +316,21 @@ script_path = parse_kasada_script_path(blocked_page_html)
316
316
  # Returns: /ips.js?timestamp=...
317
317
  ```
318
318
 
319
+ ### Mobile User-Agent Generation
320
+
321
+ Generate the **Kasada mobile `user-agent`** value sent on the native app flow. The mobile SDK derives it as the lowercase hex MD5 of `"<os_version> / <bundle_id> <app_version>"`:
322
+
323
+ ```python
324
+ from hyper_sdk import generate_kasada_user_agent
325
+
326
+ user_agent = generate_kasada_user_agent("18.0.1", "com.example.app", "9.15.0")
327
+ # iOS: os_version = UIDevice.systemVersion, bundle_id = CFBundleIdentifier
328
+ # Android: os_version = Build.VERSION.SDK_INT, bundle_id = package name
329
+ # Returns: 7016adc4ba8d433533954ebad33be424
330
+ ```
331
+
332
+ Available in `hyper_sdk` 3.1.0 and later.
333
+
319
334
  ## 🎯 DataDome Solutions
320
335
 
321
336
  Solve **DataDome captchas** including slider challenges and interstitial pages.
@@ -273,6 +273,21 @@ script_path = parse_kasada_script_path(blocked_page_html)
273
273
  # Returns: /ips.js?timestamp=...
274
274
  ```
275
275
 
276
+ ### Mobile User-Agent Generation
277
+
278
+ Generate the **Kasada mobile `user-agent`** value sent on the native app flow. The mobile SDK derives it as the lowercase hex MD5 of `"<os_version> / <bundle_id> <app_version>"`:
279
+
280
+ ```python
281
+ from hyper_sdk import generate_kasada_user_agent
282
+
283
+ user_agent = generate_kasada_user_agent("18.0.1", "com.example.app", "9.15.0")
284
+ # iOS: os_version = UIDevice.systemVersion, bundle_id = CFBundleIdentifier
285
+ # Android: os_version = Build.VERSION.SDK_INT, bundle_id = package name
286
+ # Returns: 7016adc4ba8d433533954ebad33be424
287
+ ```
288
+
289
+ Available in `hyper_sdk` 3.1.0 and later.
290
+
276
291
  ## 🎯 DataDome Solutions
277
292
 
278
293
  Solve **DataDome captchas** including slider challenges and interstitial pages.
@@ -7,4 +7,5 @@ from .incapsula.dynamic import *
7
7
  from .session import *
8
8
  from .session_async import *
9
9
  from .kasada.parse import *
10
+ from .kasada.user_agent import *
10
11
  from .datadome.parse import *
@@ -0,0 +1,2 @@
1
+ from .parse import *
2
+ from .user_agent import *
@@ -0,0 +1,24 @@
1
+ import hashlib
2
+
3
+ __all__ = ["generate_kasada_user_agent"]
4
+
5
+
6
+ def generate_kasada_user_agent(os_version: str, bundle_id: str, app_version: str) -> str:
7
+ """
8
+ Generates the Kasada mobile user-agent value.
9
+
10
+ The Kasada 2.x mobile SDK derives the user-agent header as the lowercase hex MD5 of
11
+ "<os_version> / <bundle_id> <app_version>". On iOS os_version is UIDevice.systemVersion
12
+ (e.g. "18.0.1") and bundle_id is the app bundle id (e.g. "com.example.app"); on
13
+ Android os_version is Build.VERSION.SDK_INT (e.g. "34") and bundle_id is the package name.
14
+
15
+ Args:
16
+ os_version (str): The device OS version string.
17
+ bundle_id (str): The app bundle id (iOS) or package name (Android).
18
+ app_version (str): The app version (e.g. "9.15.0").
19
+
20
+ Returns:
21
+ str: The lowercase hex MD5 user-agent value.
22
+ """
23
+ raw = f"{os_version} / {bundle_id} {app_version}"
24
+ return hashlib.md5(raw.encode("utf-8")).hexdigest()
@@ -1,67 +1,67 @@
1
- class KasadaPowInput:
2
- def __init__(self, st: int, ct: str, domain: str, fc: str = "", work_time: int = None):
3
- # St is the x-kpsdk-st value returned by the /tl POST request
4
- self.st = st
5
- # Ct is the x-kpsdk-ct value returned by the /tl POST request
6
- self.ct = ct
7
- # fc is the x-kpsdk-fc value returned by the /mfc GET request, if used by the site
8
- self.fc = fc
9
- # WorkTime can be used to pre-generate POW strings
10
- self.work_time = work_time
11
- self.domain = domain
12
-
13
- def to_dict(self):
14
- result = {"st": self.st, "ct": self.ct, "domain": self.domain}
15
- if self.fc: # Only include fc if it's not empty
16
- result["fc"] = self.fc
17
- if self.work_time is not None:
18
- result["workTime"] = self.work_time
19
- return result
20
-
21
-
22
- class KasadaPayloadInput:
23
- def __init__(self, user_agent: str, ips_link: str, script: str, accept_language: str, ip: str):
24
- # UserAgent must be a Chrome Windows User-Agent.
25
- self.user_agent = user_agent
26
-
27
- # IpsLink is the ips.js script link, parsed from the block page (429 status code)
28
- self.ips_link = ips_link
29
-
30
- # Script is the ips.js script retrieved using the IpsLink url
31
- self.script = script
32
-
33
- # Your accept-language header
34
- self.accept_language = accept_language
35
- self.ip = ip
36
-
37
- def to_dict(self):
38
- result = {
39
- "userAgent": self.user_agent,
40
- "ipsLink": self.ips_link,
41
- "script": self.script,
42
- "acceptLanguage": self.accept_language,
43
- "ip": self.ip,
44
- }
45
- return result
46
-
47
- class BotIDHeaderInput:
48
- def __init__(self, script: str, user_agent: str, ip: str, accept_language: str):
49
- # Script is the c.js script retrieved from the BotID script endpoint
50
- self.script = script
51
-
52
- # UserAgent must be a Chrome Windows User-Agent.
53
- self.user_agent = user_agent
54
-
55
- # IP is the IPV4 address of your network or proxy
56
- self.ip = ip
57
-
58
- # Your accept-language header
59
- self.accept_language = accept_language
60
-
61
- def to_dict(self):
62
- return {
63
- "script": self.script,
64
- "userAgent": self.user_agent,
65
- "ip": self.ip,
66
- "acceptLanguage": self.accept_language,
1
+ class KasadaPowInput:
2
+ def __init__(self, st: int, ct: str, domain: str, fc: str = "", work_time: int = None):
3
+ # St is the x-kpsdk-st value returned by the /tl POST request
4
+ self.st = st
5
+ # Ct is the x-kpsdk-ct value returned by the /tl POST request
6
+ self.ct = ct
7
+ # fc is the x-kpsdk-fc value returned by the /mfc GET request, if used by the site
8
+ self.fc = fc
9
+ # WorkTime can be used to pre-generate POW strings
10
+ self.work_time = work_time
11
+ self.domain = domain
12
+
13
+ def to_dict(self):
14
+ result = {"st": self.st, "ct": self.ct, "domain": self.domain}
15
+ if self.fc: # Only include fc if it's not empty
16
+ result["fc"] = self.fc
17
+ if self.work_time is not None:
18
+ result["workTime"] = self.work_time
19
+ return result
20
+
21
+
22
+ class KasadaPayloadInput:
23
+ def __init__(self, user_agent: str, ips_link: str, script: str, accept_language: str, ip: str):
24
+ # UserAgent must be a Chrome Windows User-Agent.
25
+ self.user_agent = user_agent
26
+
27
+ # IpsLink is the ips.js script link, parsed from the block page (429 status code)
28
+ self.ips_link = ips_link
29
+
30
+ # Script is the ips.js script retrieved using the IpsLink url
31
+ self.script = script
32
+
33
+ # Your accept-language header
34
+ self.accept_language = accept_language
35
+ self.ip = ip
36
+
37
+ def to_dict(self):
38
+ result = {
39
+ "userAgent": self.user_agent,
40
+ "ipsLink": self.ips_link,
41
+ "script": self.script,
42
+ "acceptLanguage": self.accept_language,
43
+ "ip": self.ip,
44
+ }
45
+ return result
46
+
47
+ class BotIDHeaderInput:
48
+ def __init__(self, script: str, user_agent: str, ip: str, accept_language: str):
49
+ # Script is the c.js script retrieved from the BotID script endpoint
50
+ self.script = script
51
+
52
+ # UserAgent must be a Chrome Windows User-Agent.
53
+ self.user_agent = user_agent
54
+
55
+ # IP is the IPV4 address of your network or proxy
56
+ self.ip = ip
57
+
58
+ # Your accept-language header
59
+ self.accept_language = accept_language
60
+
61
+ def to_dict(self):
62
+ return {
63
+ "script": self.script,
64
+ "userAgent": self.user_agent,
65
+ "ip": self.ip,
66
+ "acceptLanguage": self.accept_language,
67
67
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hyper_sdk
3
- Version: 3.0.0
3
+ Version: 3.1.0
4
4
  Summary: Hyper Solutions Python SDK
5
5
  License: MIT License
6
6
 
@@ -316,6 +316,21 @@ script_path = parse_kasada_script_path(blocked_page_html)
316
316
  # Returns: /ips.js?timestamp=...
317
317
  ```
318
318
 
319
+ ### Mobile User-Agent Generation
320
+
321
+ Generate the **Kasada mobile `user-agent`** value sent on the native app flow. The mobile SDK derives it as the lowercase hex MD5 of `"<os_version> / <bundle_id> <app_version>"`:
322
+
323
+ ```python
324
+ from hyper_sdk import generate_kasada_user_agent
325
+
326
+ user_agent = generate_kasada_user_agent("18.0.1", "com.example.app", "9.15.0")
327
+ # iOS: os_version = UIDevice.systemVersion, bundle_id = CFBundleIdentifier
328
+ # Android: os_version = Build.VERSION.SDK_INT, bundle_id = package name
329
+ # Returns: 7016adc4ba8d433533954ebad33be424
330
+ ```
331
+
332
+ Available in `hyper_sdk` 3.1.0 and later.
333
+
319
334
  ## 🎯 DataDome Solutions
320
335
 
321
336
  Solve **DataDome captchas** including slider challenges and interstitial pages.
@@ -26,4 +26,6 @@ hyper_sdk/incapsula/__init__.py
26
26
  hyper_sdk/incapsula/dynamic.py
27
27
  hyper_sdk/incapsula/utmvc.py
28
28
  hyper_sdk/kasada/__init__.py
29
- hyper_sdk/kasada/parse.py
29
+ hyper_sdk/kasada/parse.py
30
+ hyper_sdk/kasada/user_agent.py
31
+ tests/test_user_agent.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hyper_sdk"
7
- version = "3.0.0"
7
+ version = "3.1.0"
8
8
  description = "Hyper Solutions Python SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -0,0 +1,13 @@
1
+ import unittest
2
+
3
+ from hyper_sdk import generate_kasada_user_agent
4
+
5
+
6
+ class KasadaUserAgent(unittest.TestCase):
7
+ def test_matches_documented_vector(self):
8
+ ua = generate_kasada_user_agent("18.0.1", "com.example.app", "9.15.0")
9
+ self.assertEqual(ua, "7016adc4ba8d433533954ebad33be424")
10
+
11
+
12
+ if __name__ == "__main__":
13
+ unittest.main()
@@ -1 +0,0 @@
1
- from .parse import *
File without changes
File without changes
File without changes