scythe-ttp 0.17.3__tar.gz → 0.17.5__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.
Potentially problematic release.
This version of scythe-ttp might be problematic. Click here for more details.
- {scythe_ttp-0.17.3/scythe_ttp.egg-info → scythe_ttp-0.17.5}/PKG-INFO +1 -1
- scythe_ttp-0.17.5/VERSION +1 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/auth/cookie_jwt.py +43 -14
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5/scythe_ttp.egg-info}/PKG-INFO +1 -1
- scythe_ttp-0.17.3/VERSION +0 -1
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/LICENSE +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/MANIFEST.in +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/README.md +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/pyproject.toml +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/requirements.txt +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/auth/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/auth/base.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/auth/basic.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/auth/bearer.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/behaviors/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/behaviors/base.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/behaviors/default.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/behaviors/human.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/behaviors/machine.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/behaviors/stealth.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/cli/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/cli/main.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/core/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/core/executor.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/core/headers.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/core/ttp.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/journeys/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/journeys/actions.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/journeys/base.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/journeys/executor.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/orchestrators/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/orchestrators/base.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/orchestrators/batch.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/orchestrators/distributed.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/orchestrators/scale.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/payloads/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/payloads/generators.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/ttps/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/ttps/web/__init__.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/ttps/web/login_bruteforce.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/ttps/web/sql_injection.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe/ttps/web/uuid_guessing.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe_ttp.egg-info/SOURCES.txt +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe_ttp.egg-info/dependency_links.txt +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe_ttp.egg-info/entry_points.txt +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe_ttp.egg-info/requires.txt +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/scythe_ttp.egg-info/top_level.txt +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/setup.cfg +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_api_models.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_authentication.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_behaviors.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_cli.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_cookie_jwt_auth.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_executor_modes.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_expected_results.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_feature_completeness.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_header_extraction.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_journeys.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_orchestrators.py +0 -0
- {scythe_ttp-0.17.3 → scythe_ttp-0.17.5}/tests/test_ttp_api_mode.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.17.5
|
|
@@ -49,10 +49,17 @@ class CookieJWTAuth(Authentication):
|
|
|
49
49
|
|
|
50
50
|
Behavior:
|
|
51
51
|
- In API mode: JourneyExecutor will call get_auth_cookies(); this class will
|
|
52
|
-
perform a POST to login_url (if token not cached),
|
|
53
|
-
|
|
52
|
+
perform a POST to login_url (if token not cached), extract the token, and
|
|
53
|
+
return {cookie_name: token}.
|
|
54
54
|
- In UI mode: authenticate() will ensure the browser has the cookie set for
|
|
55
55
|
the target domain.
|
|
56
|
+
|
|
57
|
+
Parameters:
|
|
58
|
+
- content_type: Either "json" (default) to send payload as JSON, or "form"
|
|
59
|
+
to send as application/x-www-form-urlencoded form data.
|
|
60
|
+
- jwt_source: Either "json" (default) to extract JWT from the JSON response body
|
|
61
|
+
using jwt_json_path, or "cookie" to extract it from the Set-Cookie response header
|
|
62
|
+
using cookie_name.
|
|
56
63
|
"""
|
|
57
64
|
|
|
58
65
|
def __init__(self,
|
|
@@ -64,6 +71,8 @@ class CookieJWTAuth(Authentication):
|
|
|
64
71
|
extra_fields: Optional[Dict[str, Any]] = None,
|
|
65
72
|
jwt_json_path: str = "token",
|
|
66
73
|
cookie_name: str = "stellarbridge",
|
|
74
|
+
content_type: str = "json",
|
|
75
|
+
jwt_source: str = "json",
|
|
67
76
|
session: Optional[requests.Session] = None,
|
|
68
77
|
description: str = "Authenticate via API and set JWT cookie"):
|
|
69
78
|
super().__init__(
|
|
@@ -78,29 +87,49 @@ class CookieJWTAuth(Authentication):
|
|
|
78
87
|
self.extra_fields = extra_fields or {}
|
|
79
88
|
self.jwt_json_path = jwt_json_path
|
|
80
89
|
self.cookie_name = cookie_name
|
|
90
|
+
self.content_type = content_type
|
|
91
|
+
self.jwt_source = jwt_source
|
|
81
92
|
# Avoid importing requests in test environments; allow injected session
|
|
82
93
|
self._session = session or (requests.Session() if requests is not None else None)
|
|
83
94
|
self.token: Optional[str] = None
|
|
84
95
|
|
|
85
96
|
def _login_and_get_token(self) -> str:
|
|
86
97
|
payload: Dict[str, Any] = dict(self.extra_fields)
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if self.password is not None:
|
|
90
|
-
payload[self.password_field] = self.password
|
|
98
|
+
payload[self.username_field] = self.username
|
|
99
|
+
payload[self.password_field] = self.password
|
|
91
100
|
try:
|
|
92
|
-
|
|
101
|
+
if self.content_type == "form":
|
|
102
|
+
resp = self._session.post(self.login_url, data=payload, timeout=15)
|
|
103
|
+
else:
|
|
104
|
+
resp = self._session.post(self.login_url, json=payload, timeout=15)
|
|
93
105
|
# try json; raise on non-2xx to surface errors
|
|
94
106
|
resp.raise_for_status()
|
|
95
|
-
data = resp.json()
|
|
96
107
|
except Exception as e:
|
|
97
108
|
raise AuthenticationError(f"Login request failed: {e}", self.name)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
)
|
|
109
|
+
|
|
110
|
+
# Extract token from either response cookies or JSON body
|
|
111
|
+
token = None
|
|
112
|
+
if self.jwt_source == "cookie":
|
|
113
|
+
# Extract from response cookies
|
|
114
|
+
token = resp.cookies.get(self.cookie_name)
|
|
115
|
+
if not token or not isinstance(token, str):
|
|
116
|
+
raise AuthenticationError(
|
|
117
|
+
f"JWT cookie '{self.cookie_name}' not found in login response",
|
|
118
|
+
self.name,
|
|
119
|
+
)
|
|
120
|
+
else:
|
|
121
|
+
# Extract from JSON response body
|
|
122
|
+
try:
|
|
123
|
+
data = resp.json()
|
|
124
|
+
except Exception as e:
|
|
125
|
+
raise AuthenticationError(f"Failed to parse JSON response: {e}", self.name)
|
|
126
|
+
token = _extract_by_dot_path(data, self.jwt_json_path)
|
|
127
|
+
if not token or not isinstance(token, str):
|
|
128
|
+
raise AuthenticationError(
|
|
129
|
+
f"JWT not found at path '{self.jwt_json_path}' in login response",
|
|
130
|
+
self.name,
|
|
131
|
+
)
|
|
132
|
+
|
|
104
133
|
self.token = token
|
|
105
134
|
self.store_auth_data('jwt', token)
|
|
106
135
|
self.store_auth_data('login_time', time.time())
|
scythe_ttp-0.17.3/VERSION
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
0.17.3
|
|
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
|
|
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
|
|
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
|