1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-26 03:51:35 +01:00

WEPDecrypter now returns true iff the packet was decrypted successfully.

This commit is contained in:
Matias Fontanini
2013-06-04 15:49:33 -03:00
parent 5d315c5b6d
commit c2353314fa

View File

@@ -27,7 +27,6 @@
*
*/
#include <iostream> // borrame
#include <openssl/evp.h>
#include <openssl/hmac.h>
#include <openssl/aes.h>
@@ -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) {