Exemplo n.º 1
0
TEST_F(WPA2DecryptTest, DecryptTKIPUsingKey) {
    Crypto::WPA2Decrypter::addr_pair addresses;
    Crypto::WPA2::SessionKeys session_keys;

    {
        Crypto::WPA2Decrypter decrypter;
        decrypter.add_ap_data("libtinstest", "NODO", "00:1b:11:d2:1b:eb");
        for(size_t i = 1; i < 5; ++i) {
            RadioTap radio(tkip_packets[i], tkip_packets_size[i]);
            ASSERT_FALSE(decrypter.decrypt(radio));
        }
        const Crypto::WPA2Decrypter::keys_map& keys = decrypter.get_keys();
        ASSERT_EQ(1ULL, keys.size());
        addresses = keys.begin()->first;
        session_keys = keys.begin()->second;
    }

    Crypto::WPA2Decrypter decrypter;
    decrypter.add_decryption_keys(addresses, session_keys);
    for(size_t i = 5; i < 7; ++i) {
        RadioTap radio(tkip_packets[i], tkip_packets_size[i]);
        ASSERT_TRUE(decrypter.decrypt(radio));
        if(i == 5)
            check_tkip_packet5(radio);
        else
            check_tkip_packet6(radio);
    }

    EXPECT_FALSE(session_keys.uses_ccmp());
}
Exemplo n.º 2
0
TEST_F(WPA2DecryptTest, DecryptCCMPAndTKIPWithoutUsingBeacon) {
    Crypto::WPA2Decrypter decrypter;
    decrypter.add_ap_data("libtinstest", "NODO", "00:1b:11:d2:1b:eb");
    decrypter.add_ap_data("Induction", "Coherer", "00:0c:41:82:b2:55");
    for(size_t i = 1; i < 7; ++i) {
        RadioTap radio(ccmp_packets[i], ccmp_packets_size[i]);
        if(i > 4) {
            ASSERT_TRUE(decrypter.decrypt(radio));
            if(i == 5)
                check_ccmp_packet5(radio);
            else
                check_ccmp_packet6(radio);
        }
        else 
            ASSERT_FALSE(decrypter.decrypt(radio));
    }
    for(size_t i = 1; i < 7; ++i) {
        RadioTap radio(tkip_packets[i], tkip_packets_size[i]);
        if(i > 4) {
            ASSERT_TRUE(decrypter.decrypt(radio));
            if(i == 5)
                check_tkip_packet5(radio);
            else
                check_tkip_packet6(radio);
        }
        else 
            ASSERT_FALSE(decrypter.decrypt(radio));
    }
}
Exemplo n.º 3
0
TEST_F(WPA2DecryptTest, DecryptCCMPUsingKey) {
    Crypto::WPA2Decrypter::addr_pair addresses;
    Crypto::WPA2::SessionKeys session_keys;

    {
        Crypto::WPA2Decrypter decrypter;
        decrypter.add_ap_data("Induction", "Coherer", "00:0c:41:82:b2:55");
        for(size_t i = 1; i < 5; ++i) {
            RadioTap radio(ccmp_packets[i], ccmp_packets_size[i]);
            ASSERT_FALSE(decrypter.decrypt(radio));
        }
        const Crypto::WPA2Decrypter::keys_map& keys = decrypter.get_keys();
        ASSERT_EQ(1ULL, keys.size());
        addresses = keys.begin()->first;
        session_keys = keys.begin()->second;
    }

    Crypto::WPA2Decrypter decrypter;
    decrypter.add_decryption_keys(addresses, session_keys);
    for(size_t i = 5; i < 7; ++i) {
        RadioTap radio(ccmp_packets[i], ccmp_packets_size[i]);
        ASSERT_TRUE(decrypter.decrypt(radio));
        if(i == 5)
            check_ccmp_packet5(radio);
        else
            check_ccmp_packet6(radio);
    }

    EXPECT_TRUE(session_keys.uses_ccmp());
}
Exemplo n.º 4
0
TEST_F(WPA2DecryptTest, AccessPointFoundCallback) {
    using namespace std::placeholders;

    Crypto::WPA2Decrypter decrypter;
    decrypter.add_ap_data("libtinstest", "NODO");
    decrypter.add_ap_data("Induction", "Coherer");
    decrypter.ap_found_callback(std::bind(&WPA2DecryptTest::ap_found, this, _1, _2));
    for(size_t i = 0; i < 7; ++i) {
        RadioTap radio(ccmp_packets[i], ccmp_packets_size[i]);
        decrypter.decrypt(radio);
    }
    for(size_t i = 0; i < 7; ++i) {
        RadioTap radio(tkip_packets[i], tkip_packets_size[i]);
        decrypter.decrypt(radio);
    }

    ASSERT_EQ(2U, access_points_.size());
    ap_data data = access_points_[0];
    EXPECT_EQ("Coherer", data.ssid);
    EXPECT_EQ(address_type("00:0c:41:82:b2:55"), data.bssid);

    data = access_points_[1];
    EXPECT_EQ("NODO", data.ssid);
    EXPECT_EQ(address_type("00:1b:11:d2:1b:eb"), data.bssid);
}
Exemplo n.º 5
0
TEST_F(WPA2DecryptTest, HandshakeCapturedCallback) {
    using namespace std::placeholders;

    Crypto::WPA2Decrypter decrypter;
    decrypter.add_ap_data("libtinstest", "NODO", "00:1b:11:d2:1b:eb");
    decrypter.add_ap_data("Induction", "Coherer", "00:0c:41:82:b2:55");
    decrypter.handshake_captured_callback(std::bind(&WPA2DecryptTest::handshake_captured,
                                          this, _1, _2, _3));
    for(size_t i = 1; i < 7; ++i) {
        RadioTap radio(ccmp_packets[i], ccmp_packets_size[i]);
        decrypter.decrypt(radio);
    }
    for(size_t i = 1; i < 7; ++i) {
        RadioTap radio(tkip_packets[i], tkip_packets_size[i]);
        decrypter.decrypt(radio);
    }

    ASSERT_EQ(2U, handshakes_.size());
    handshake hs = handshakes_[0];
    EXPECT_EQ(hs.ssid, "Coherer");
    EXPECT_EQ(address_type("00:0d:93:82:36:3a"), hs.client_hw);
    EXPECT_EQ(address_type("00:0c:41:82:b2:55"), hs.bssid);

    hs = handshakes_[1];
    EXPECT_EQ(hs.ssid, "NODO");
    EXPECT_EQ(address_type("94:0c:6d:8f:93:88"), hs.client_hw);
    EXPECT_EQ(address_type("00:1b:11:d2:1b:eb"), hs.bssid);
}
Exemplo n.º 6
0
TEST_F(WPA2DecryptTest, DecryptCCMPQosUsingBeacon) {
    Crypto::WPA2Decrypter decrypter;
    decrypter.add_ap_data("password1", "Testing");
    for(size_t i = 0; i < 6; ++i) {
        RadioTap radio(ccmp_qos_packets[i], ccmp_qos_packets_size[i]);
        if (i > 4) {
            ASSERT_TRUE(decrypter.decrypt(radio));
            EXPECT_TRUE(radio.find_pdu<ARP>() != 0);
        }
        else { 
            ASSERT_FALSE(decrypter.decrypt(radio));
        }
    }
}
Exemplo n.º 7
0
TEST_F(WPA2DecryptTest, DecryptCCMPUsingBeacon) {
    Crypto::WPA2Decrypter decrypter;
    decrypter.add_ap_data("Induction", "Coherer");
    for(size_t i = 0; i < 7; ++i) {
        RadioTap radio(ccmp_packets[i], ccmp_packets_size[i]);
        if(i > 4) {
            ASSERT_TRUE(decrypter.decrypt(radio));
            if(i == 5)
                check_ccmp_packet5(radio);
            else
                check_ccmp_packet6(radio);
        }
        else 
            ASSERT_FALSE(decrypter.decrypt(radio));
    }
}
Exemplo n.º 8
0
TEST_F(WPA2DecryptTest, DecryptTKIPUsingBeacon) {
    Crypto::WPA2Decrypter decrypter;
    decrypter.add_ap_data("libtinstest", "NODO");
    for(size_t i = 0; i < 7; ++i) {
        RadioTap radio(tkip_packets[i], tkip_packets_size[i]);
        if(i > 4) {
            ASSERT_TRUE(decrypter.decrypt(radio));
            if(i == 5)
                check_tkip_packet5(radio);
            else
                check_tkip_packet6(radio);
        }
        else 
            ASSERT_FALSE(decrypter.decrypt(radio));
    }
}