Created
February 20, 2022 02:04
-
-
Save modderme123/005f1ffbd7fcdec6cf4f04b5389d14ed to your computer and use it in GitHub Desktop.
Decrypt WiFI DNS traffic
This file contains 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
#include <tins/tins.h> | |
#include <iostream> | |
using std::cout; | |
using std::endl; | |
using namespace Tins; | |
Crypto::WPA2Decrypter decrypter; | |
bool callback(PDU &pdu) { | |
auto decrypted = decrypter.decrypt(pdu); | |
auto dns = pdu.rfind_pdu<RawPDU>().to<DNS>(); | |
if (dns.type() == DNS::QUERY) { | |
for (const auto &query : dns.queries()) { | |
auto name = query.dname(); | |
cout << name << std::endl; | |
} | |
} | |
return true; | |
} | |
int main(int argc, char *argv[]) { | |
SnifferConfiguration config; | |
config.set_promisc_mode(true); | |
config.set_rfmon(true); | |
config.set_timeout(5000); | |
decrypter.add_ap_data("password", "wifissid", "00:00:00:00:00:00"); | |
Sniffer sniffer("en0", config); | |
sniffer.set_timeout(5000); | |
cout << "Sniffing en0" << endl; | |
sniffer.sniff_loop(callback); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment