forked from derv82/wifite2
-
Notifications
You must be signed in to change notification settings - Fork 220
Fix: stricter handshake validation to avoid aircrack-only false positives (fixes #419) #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRefine handshake validation by enforcing stricter checks: only accept captures validated by tshark or cowpatty and reject aircrack-only/hcxpcapngtool results to eliminate false positives. Class diagram for updated handshake validation logicclassDiagram
class Handshake {
+has_handshake()
+tshark_handshakes()
+cowpatty_handshakes()
+aircrack_handshakes()
+hcxpcapngtool_handshakes()
}
Handshake : has_handshake() updated
Handshake : Only returns True if tshark or cowpatty detects handshake
Handshake : aircrack-only and hcxpcapngtool-only results are ignored
Flow diagram for new handshake validation decision processflowchart TD
A["Start handshake validation"] --> B["Check tshark_handshakes"]
B -- "Found" --> E["Return True (valid handshake)"]
B -- "Not found" --> C["Check cowpatty_handshakes"]
C -- "Found" --> E
C -- "Not found" --> D["Reject (Return False)"]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `wifite/model/handshake.py:75-79` </location>
<code_context>
def has_handshake(self):
if not self.bssid or not self.essid:
self.divine_bssid_and_essid()
#return len(self.tshark_handshakes()) > 0
# Prefer strict validators. Do NOT accept aircrack alone as proof.
# Tshark requires the full 4-way (strict) — keep it.
if len(self.tshark_handshakes()) > 0:
return True
# cowpatty can be reliable for 2&3 captures
if len(self.cowpatty_handshakes()) > 0:
return True
# Do NOT treat aircrack-only as valid (aircrack is informative but not definitive)
return False
</code_context>
<issue_to_address>
**suggestion (code-quality):** We've found these issues:
- Lift code into else after jump in control flow ([`reintroduce-else`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/reintroduce-else/))
- Replace if statement with if expression ([`assign-if-exp`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/assign-if-exp/))
- Simplify boolean if expression ([`boolean-if-exp-identity`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/boolean-if-exp-identity/))
- Remove unnecessary casts to int, str, float or bool ([`remove-unnecessary-cast`](https://docs.sourcery.ai/Reference/Default-Rules/refactorings/remove-unnecessary-cast/))
```suggestion
return len(self.cowpatty_handshakes()) > 0
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This modification is a fix for #419 . That behavior happened because Wifite considers a handshake “captured” if any validator (tshark, cowpatty, or aircrack-ng) returns a positive result but I've noticed aircrack-ng every time reports a handshake as valid even when no real EAPOL exchange is present in the capture file. The fix introduces stricter validation, requiring at least one between tshark or cowpatty to confirm the handshake before it’s accepted.
Summary by Sourcery
Bug Fixes: