From 71eb550e9f893d995cff554087e7f9b732ac66f0 Mon Sep 17 00:00:00 2001 From: WildSoft Date: Thu, 15 Oct 2026 11:43:23 +0300 Subject: [PATCH] Update public source --- reports/wifitrip.py | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/reports/wifitrip.py b/reports/wifitrip.py index 24a6ecc..d31d9f4 100644 --- a/reports/wifitrip.py +++ b/reports/wifitrip.py @@ -1603,6 +1603,7 @@ def _session_id_by_hash( return row["id"] + def _map_existing_handshake_ids( conn, session_id, @@ -1636,8 +1637,6 @@ def _map_existing_handshake_ids( "match the .wifitrip package." ) - handshake_ids = {} - fields = ( "bssid", "type", @@ -1649,14 +1648,38 @@ def _map_existing_handshake_ids( "speed", ) - for row, handshake in zip( - rows, - session_handshakes, - ): - if any( - row[field] != handshake[field] + local_ids_by_signature = {} + + for row in rows: + signature = tuple( + row[field] for field in fields - ): + ) + + local_ids_by_signature.setdefault( + signature, + [], + ).append(row["id"]) + + signature_positions = {} + handshake_ids = {} + + for handshake in session_handshakes: + signature = tuple( + handshake[field] + for field in fields + ) + + local_ids = local_ids_by_signature.get( + signature, + ) + + position = signature_positions.get( + signature, + 0, + ) + + if local_ids is None or position >= len(local_ids): raise WifitripError( "Existing session handshake mapping " "does not match the .wifitrip package." @@ -1664,7 +1687,9 @@ def _map_existing_handshake_ids( handshake_ids[ handshake["handshake_key"] - ] = row["id"] + ] = local_ids[position] + + signature_positions[signature] = position + 1 return handshake_ids