From c2353314faff9d8830d71bbac90352d84b0fbe9c Mon Sep 17 00:00:00 2001 From: Matias Fontanini Date: Tue, 4 Jun 2013 15:49:33 -0300 Subject: [PATCH] WEPDecrypter now returns true iff the packet was decrypted successfully. --- src/crypto.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/crypto.cpp b/src/crypto.cpp index 5745b61..bca6b36 100644 --- a/src/crypto.cpp +++ b/src/crypto.cpp @@ -27,7 +27,6 @@ * */ -#include // borrame #include #include #include @@ -69,14 +68,16 @@ bool WEPDecrypter::decrypt(PDU &pdu) { passwords_type::iterator it = passwords.find(addr); if(it != passwords.end()) { dot11->inner_pdu(decrypt(*raw, it->second)); - dot11->wep(0); - // Invalid WEP packet(CRC check failed). Skip it. - if(!dot11->inner_pdu()) - return false; + // If its valid, then return true + if(dot11->inner_pdu()) { + // it's no longer encrypted. + dot11->wep(0); + return true; + } } } } - return true; + return false; } PDU *WEPDecrypter::decrypt(RawPDU &raw, const std::string &password) {