Skip to content

Commit de322b6

Browse files
committed
refactor: improve handshake validation logic to prioritize strict validators
1 parent afd321e commit de322b6

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

wifite/model/handshake.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,18 @@ def has_handshake(self):
6666
self.divine_bssid_and_essid()
6767

6868
#return len(self.tshark_handshakes()) > 0
69-
# Check if ANY validator detects a handshake
70-
# Tshark is strict (requires all 4 messages), but cowpatty/aircrack
71-
# can work with just messages 2&3, which is sufficient for cracking
72-
# hcxpcapngtool is best for hcxdumptool captures (pcapng format)
73-
return (len(self.tshark_handshakes()) > 0 or
74-
len(self.cowpatty_handshakes()) > 0 or
75-
len(self.aircrack_handshakes()) > 0 or
76-
len(self.hcxpcapngtool_handshakes()) > 0)
69+
# Prefer strict validators. Do NOT accept aircrack alone as proof.
70+
# Tshark requires the full 4-way (strict) — keep it.
71+
if len(self.tshark_handshakes()) > 0:
72+
return True
73+
74+
# cowpatty can be reliable for 2&3 captures
75+
if len(self.cowpatty_handshakes()) > 0:
76+
return True
77+
78+
# Do NOT treat aircrack-only as valid (aircrack is informative but not definitive)
79+
return False
80+
7781

7882
def tshark_handshakes(self):
7983
"""Returns list[tuple] of BSSID & ESSID pairs (ESSIDs are always `None`)."""

0 commit comments

Comments
 (0)