From 95b2ec53a9d66720ae79d241be15810388d6f6d3 Mon Sep 17 00:00:00 2001 From: WildSoft Date: Tue, 13 Oct 2026 10:37:49 +0300 Subject: [PATCH] Update public source --- cracklab/server/repositories/handshakes.py | 19 ++--- cracklab/server/services/job_issuance.py | 15 +--- cracklab/server/web/routes.py | 34 ++++++++ cracklab/server/web/static/cracklab.css | 10 +++ cracklab/server/web/templates/jobs.html | 99 ++++++++++++++++++++++ 5 files changed, 153 insertions(+), 24 deletions(-) diff --git a/cracklab/server/repositories/handshakes.py b/cracklab/server/repositories/handshakes.py index b2d6d0e..fd16487 100644 --- a/cracklab/server/repositories/handshakes.py +++ b/cracklab/server/repositories/handshakes.py @@ -211,17 +211,12 @@ class HandshakesRepository: def get_search_context_statistics( self, - handshake_ids: list[int] | tuple[int, ...], + token_hash: str, method_id: str, method_version: int, - ) -> sqlite3.Row | None: - if not handshake_ids: - return None - - placeholders = ", ".join("?" for _ in handshake_ids) - + ) -> sqlite3.Row: return self._conn.execute( - f""" + """ SELECT COUNT(*) AS matched_count, SUM( @@ -295,8 +290,10 @@ class HandshakesRepository: ELSE 0 END ) AS reserved_count - FROM handshakes AS h - WHERE h.id IN ({placeholders}) + FROM crack_search_context_handshakes AS sch + INNER JOIN handshakes AS h + ON h.id = sch.handshake_id + WHERE sch.token_hash = ? """, ( method_id, @@ -305,6 +302,6 @@ class HandshakesRepository: method_version, method_id, method_version, - *handshake_ids, + token_hash, ), ).fetchone() diff --git a/cracklab/server/services/job_issuance.py b/cracklab/server/services/job_issuance.py index 258e901..4b4aaa9 100644 --- a/cracklab/server/services/job_issuance.py +++ b/cracklab/server/services/job_issuance.py @@ -78,27 +78,16 @@ class JobIssuanceService: def get_search_context_statistics( self, - handshake_ids: list[int] | tuple[int, ...], + token_hash: str, method_id: str, method_version: int, ) -> dict[str, int]: row = self._handshakes.get_search_context_statistics( - handshake_ids, + token_hash, method_id, method_version, ) - if row is None: - return { - "matched_count": 0, - "valid_hash_count": 0, - "found_count": 0, - "covered_count": 0, - "reserved_count": 0, - "available_count": 0, - "unsupported_count": 0, - } - matched_count = int(row["matched_count"] or 0) valid_hash_count = int(row["valid_hash_count"] or 0) found_count = int(row["found_count"] or 0) diff --git a/cracklab/server/web/routes.py b/cracklab/server/web/routes.py index db0360a..898d4ae 100644 --- a/cracklab/server/web/routes.py +++ b/cracklab/server/web/routes.py @@ -21,6 +21,7 @@ from cracklab.server.services.job_issuance import ( JobIssuanceError, JobIssuanceService, ) +from cracklab.server.services.search_context import SearchContextService from cracklab.server.services.job_result import ( JobResultError, JobResultService, @@ -88,6 +89,13 @@ def dashboard(): def jobs_page(): error = request.args.get("error") created_job_id = request.args.get("created") + search_context_token = request.values.get( + "search_context_token", + "", + ).strip() + + search_context = None + search_statistics = None conn = connect_database() @@ -138,6 +146,25 @@ def jobs_page(): except ValueError: selected_version = None + if search_context_token: + search_context = SearchContextService(conn).get_context( + search_context_token, + ) + + if ( + search_context is not None + and not search_context["expired"] + and selected_method_id + and selected_version is not None + ): + search_statistics = ( + issuance_service.get_search_context_statistics( + search_context["token_hash"], + selected_method_id, + selected_version, + ) + ) + if request.method == "POST": if not selected_method_id: raise JobIssuanceError( @@ -186,6 +213,7 @@ def jobs_page(): method_id=selected_method_id, method_version=selected_version, created=issued_job.job_id, + search_context_token=search_context_token or None, ) ) @@ -231,6 +259,9 @@ def jobs_page(): method_names=method_names, created_job_id=created_job_id, error=error, + search_context_token=search_context_token, + search_context=search_context, + search_statistics=search_statistics, ) except (JobIssuanceError, ValueError) as exc: @@ -278,6 +309,9 @@ def jobs_page(): method_names=method_names, created_job_id=created_job_id, error=error, + search_context_token=search_context_token, + search_context=search_context, + search_statistics=search_statistics, ) finally: diff --git a/cracklab/server/web/static/cracklab.css b/cracklab/server/web/static/cracklab.css index 36624b3..4b785a4 100644 --- a/cracklab/server/web/static/cracklab.css +++ b/cracklab/server/web/static/cracklab.css @@ -1299,3 +1299,13 @@ tbody tr:hover { gap: 24px; } } + +.jobs-search-stats-grid { + grid-template-columns: repeat(6, minmax(0, 1fr)); +} + +@media (max-width: 1100px) { + .jobs-search-stats-grid { + grid-template-columns: repeat(3, minmax(0, 1fr)); + } +} diff --git a/cracklab/server/web/templates/jobs.html b/cracklab/server/web/templates/jobs.html index 91afd4b..7926d15 100644 --- a/cracklab/server/web/templates/jobs.html +++ b/cracklab/server/web/templates/jobs.html @@ -94,6 +94,13 @@ id="method_version" value="{{ selected_version or '' }}" > + {% if search_context_token %} + + {% endif %} @@ -110,6 +117,13 @@ name="method_version" value="{{ selected_version or '' }}" > + {% if search_context_token %} + + {% endif %}
@@ -144,6 +158,91 @@
+ {% if search_context_token %} +
+

Search Results

+ + {% if search_context is none %} +
+ Поисковый контекст не найден или недействителен. + Вернитесь в Search и выполните экспорт заново. +
+ + {% elif search_context["expired"] %} +
+ Поисковый контекст истёк. + Вернитесь в Search, повторите поиск и экспортируйте + результаты заново. +
+ + {% else %} +

+ Источник: результаты поиска WiFi GPS Mapper. + Контекст действителен до + {{ search_context["expires_at"] }} UTC. +

+ + {% if search_statistics %} +
+
+
+ {{ search_statistics["matched_count"] }} +
+
+ Found by Search +
+
+ +
+
+ {{ search_statistics["available_count"] }} +
+
+ Available +
+
+ +
+
+ {{ search_statistics["found_count"] }} +
+
+ Password Found +
+
+ +
+
+ {{ search_statistics["covered_count"] }} +
+
+ Already Completed +
+
+ +
+
+ {{ search_statistics["reserved_count"] }} +
+
+ Reserved +
+
+ +
+
+ {{ search_statistics["unsupported_count"] }} +
+
+ Unsupported Hash +
+
+
+ {% endif %} + {% endif %} +
+ {% endif %} +