Update public source
This commit is contained in:
@@ -56,3 +56,83 @@ class HandshakesRepository:
|
||||
limit,
|
||||
),
|
||||
).fetchall()
|
||||
|
||||
def get_method_statistics(
|
||||
self,
|
||||
method_id: str,
|
||||
method_version: int,
|
||||
) -> sqlite3.Row:
|
||||
return self._conn.execute(
|
||||
"""
|
||||
SELECT
|
||||
COUNT(*) AS total_count,
|
||||
SUM(
|
||||
CASE
|
||||
WHEN EXISTS (
|
||||
SELECT 1
|
||||
FROM credentials AS c
|
||||
WHERE c.handshake_id = h.id
|
||||
)
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS found_count,
|
||||
SUM(
|
||||
CASE
|
||||
WHEN NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM credentials AS c
|
||||
WHERE c.handshake_id = h.id
|
||||
)
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM crack_attempts AS a
|
||||
WHERE a.handshake_id = h.id
|
||||
AND a.method_id = ?
|
||||
AND a.method_version = ?
|
||||
AND a.status = 'COMPLETED'
|
||||
)
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS covered_count,
|
||||
SUM(
|
||||
CASE
|
||||
WHEN NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM credentials AS c
|
||||
WHERE c.handshake_id = h.id
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM crack_attempts AS a
|
||||
WHERE a.handshake_id = h.id
|
||||
AND a.method_id = ?
|
||||
AND a.method_version = ?
|
||||
AND a.status = 'COMPLETED'
|
||||
)
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM crack_reservations AS r
|
||||
WHERE r.handshake_id = h.id
|
||||
AND r.method_id = ?
|
||||
AND r.method_version = ?
|
||||
AND r.status = 'ACTIVE'
|
||||
)
|
||||
THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
) AS reserved_count
|
||||
FROM handshakes AS h
|
||||
WHERE h.hash22000 IS NOT NULL
|
||||
AND TRIM(h.hash22000) <> ''
|
||||
""",
|
||||
(
|
||||
method_id,
|
||||
method_version,
|
||||
method_id,
|
||||
method_version,
|
||||
method_id,
|
||||
method_version,
|
||||
),
|
||||
).fetchone()
|
||||
|
||||
Reference in New Issue
Block a user