mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Added the --disable-dot11 configure switch.
This commit is contained in:
15
configure
vendored
15
configure
vendored
@@ -775,6 +775,7 @@ enable_maintainer_mode
|
||||
with_pcap_include_path
|
||||
with_pcap_lib_path
|
||||
enable_c__11
|
||||
enable_dot11
|
||||
enable_wpa2
|
||||
'
|
||||
ac_precious_vars='build_alias
|
||||
@@ -1419,6 +1420,7 @@ Optional Features:
|
||||
--disable-maintainer-mode disable make rules and dependencies not useful
|
||||
(and sometimes confusing) to the casual installer
|
||||
--enable-c++11 enable C++11 features
|
||||
--disable-dot11 disable IEEE 802.11 support
|
||||
--disable-wpa2 disable WPA2 decryption features
|
||||
|
||||
Optional Packages:
|
||||
@@ -15328,6 +15330,19 @@ $as_echo "#define HAVE_CXX11 1" >>confdefs.h
|
||||
fi
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-dot11 was given.
|
||||
if test "${enable_dot11+set}" = set; then :
|
||||
enableval=$enable_dot11;
|
||||
else
|
||||
|
||||
|
||||
$as_echo "#define HAVE_DOT11 1" >>confdefs.h
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,15 @@ AC_ARG_ENABLE(
|
||||
[AX_CXX_COMPILE_STDCXX_11(noext)]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
dot11,
|
||||
[ --disable-dot11 disable IEEE 802.11 support],
|
||||
[],
|
||||
[
|
||||
AC_DEFINE([HAVE_DOT11], 1, Have IEEE 802.11 support)
|
||||
]
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
wpa2,
|
||||
[ --disable-wpa2 disable WPA2 decryption features],
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Have IEEE 802.11 support */
|
||||
#undef HAVE_DOT11
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_CRYPTO_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_CRYPTO_H) && defined(HAVE_DOT11)
|
||||
#define TINS_CRYPTO_H
|
||||
|
||||
#include <map>
|
||||
@@ -38,7 +40,6 @@
|
||||
#include "snap.h"
|
||||
#include "rawpdu.h"
|
||||
#include "handshake_capturer.h"
|
||||
#include "config.h"
|
||||
|
||||
namespace Tins {
|
||||
class PDU;
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT_11
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT_11) && defined(HAVE_DOT11)
|
||||
#define TINS_DOT_11
|
||||
|
||||
#include "dot11/dot11_base.h"
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT11_DOT11_ASSOC_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_ASSOC_H) && defined(HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_ASSOC_H
|
||||
|
||||
#include "../dot11/dot11_mgmt.h"
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT11_DOT11_AUTH_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_AUTH_H) && defined(HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_AUTH_H
|
||||
|
||||
#include "../dot11/dot11_mgmt.h"
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT11_DOT11_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_H) && defined(HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_H
|
||||
|
||||
#include <list>
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT11_DOT11_BEACON_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_BEACON_H) && defined(HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_BEACON_H
|
||||
|
||||
#include "../dot11/dot11_mgmt.h"
|
||||
|
||||
@@ -27,7 +27,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT11_DOT11_CONTROL_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_CONTROL_H) && defined(HAVE_DOT11)
|
||||
|
||||
#define TINS_DOT11_DOT11_CONTROL_H
|
||||
|
||||
#include "../dot11/dot11_base.h"
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT11_DOT11_DATA_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_DATA_H) && defined(HAVE_DOT11)
|
||||
#define TINS_DOT11_DOT11_DATA_H
|
||||
|
||||
#include "../dot11/dot11_base.h"
|
||||
|
||||
@@ -27,7 +27,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT11_DOT11_MGMT_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_MGMT_H) && defined(HAVE_DOT11)
|
||||
|
||||
#define TINS_DOT11_DOT11_MGMT_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -27,7 +27,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_DOT11_DOT11_PROBE_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_DOT11_DOT11_PROBE_H) && defined(HAVE_DOT11)
|
||||
|
||||
#define TINS_DOT11_DOT11_PROBE_H
|
||||
|
||||
#include "../dot11/dot11_mgmt.h"
|
||||
|
||||
@@ -155,6 +155,18 @@ public:
|
||||
return "Bad Tins cast";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Exception thrown when sniffing a protocol that
|
||||
* has been disabled at compile time.
|
||||
*/
|
||||
class protocol_disabled : public std::exception {
|
||||
public:
|
||||
const char *what() const throw() {
|
||||
return "Protocol disabled";
|
||||
}
|
||||
};
|
||||
|
||||
} // Tins
|
||||
|
||||
#endif // TINS_EXCEPTIONS_H
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_HANDSHAKE_CAPTURER_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_HANDSHAKE_CAPTURER_H) && defined(HAVE_DOT11)
|
||||
#define TINS_HANDSHAKE_CAPTURER_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TINS_RADIOTAP_H
|
||||
#include "config.h"
|
||||
|
||||
#if !defined(TINS_RADIOTAP_H) && defined(HAVE_DOT11)
|
||||
#define TINS_RADIOTAP_H
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
@@ -38,17 +38,10 @@
|
||||
#include <stdexcept>
|
||||
#include <iterator>
|
||||
#include "pdu.h"
|
||||
#include "ethernetII.h"
|
||||
#include "radiotap.h"
|
||||
#include "packet.h"
|
||||
#include "loopback.h"
|
||||
#include "dot11/dot11_base.h"
|
||||
#include "dot3.h"
|
||||
#include "sll.h"
|
||||
#include "cxxstd.h"
|
||||
#include "exceptions.h"
|
||||
#include "internals.h"
|
||||
#include "ppi.h"
|
||||
|
||||
namespace Tins {
|
||||
class SnifferIterator;
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
*/
|
||||
|
||||
#include "crypto.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#ifdef HAVE_WPA2_DECRYPTION
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
@@ -542,3 +545,5 @@ bool WPA2Decrypter::decrypt(PDU &pdu) {
|
||||
#endif // HAVE_WPA2_DECRYPTION
|
||||
} // namespace Crypto
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -27,9 +27,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_assoc.h"
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
namespace Tins {
|
||||
/* Diassoc */
|
||||
@@ -246,4 +248,6 @@ uint32_t Dot11ReAssocResponse::write_fixed_parameters(uint8_t *buffer, uint32_t
|
||||
memcpy(buffer, &this->_body, sz);
|
||||
return sz;
|
||||
}
|
||||
} // namespace Tins
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -27,9 +27,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_auth.h"
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include "dot11/dot11_auth.h"
|
||||
|
||||
namespace Tins {
|
||||
/* Auth */
|
||||
@@ -120,4 +122,6 @@ uint32_t Dot11Deauthentication::write_fixed_parameters(uint8_t *buffer, uint32_t
|
||||
memcpy(buffer, &this->_body, sz);
|
||||
return sz;
|
||||
}
|
||||
} // namespace Tins
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -27,6 +27,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_base.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
@@ -35,7 +38,6 @@
|
||||
#include <utility>
|
||||
#include "macros.h"
|
||||
#include "exceptions.h"
|
||||
#include "dot11/dot11_base.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#if defined(__FreeBSD_kernel__) || defined(BSD) || defined(__APPLE__)
|
||||
@@ -272,4 +274,6 @@ Dot11 *Dot11::from_bytes(const uint8_t *buffer, uint32_t total_sz) {
|
||||
ret = new Dot11(buffer, total_sz);
|
||||
return ret;
|
||||
}
|
||||
} // namespace Tins
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -27,9 +27,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_beacon.h"
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include "dot11/dot11_beacon.h"
|
||||
|
||||
namespace Tins {
|
||||
/* Dot11Beacon */
|
||||
@@ -76,4 +78,6 @@ uint32_t Dot11Beacon::write_fixed_parameters(uint8_t *buffer, uint32_t total_sz)
|
||||
std::memcpy(buffer, &this->_body, sz);
|
||||
return sz;
|
||||
}
|
||||
} // namespace Tins
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -27,9 +27,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_control.h"
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include "dot11/dot11_control.h"
|
||||
|
||||
namespace Tins {
|
||||
/* Dot11Control */
|
||||
@@ -280,4 +282,6 @@ uint32_t Dot11BlockAck::write_ext_header(uint8_t *buffer, uint32_t total_sz) {
|
||||
uint32_t Dot11BlockAck::header_size() const {
|
||||
return Dot11ControlTA::header_size() + sizeof(_start_sequence) + sizeof(_start_sequence) + sizeof(_bitmap);
|
||||
}
|
||||
} // namespace Tins
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -27,9 +27,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_data.h"
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include "dot11/dot11_data.h"
|
||||
#include "rawpdu.h"
|
||||
#include "snap.h"
|
||||
|
||||
@@ -180,3 +182,5 @@ uint32_t Dot11QoSData::write_fixed_parameters(uint8_t *buffer, uint32_t total_sz
|
||||
return sz;
|
||||
}
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -27,8 +27,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include "dot11/dot11_mgmt.h"
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include "rsn_information.h"
|
||||
|
||||
namespace Tins {
|
||||
@@ -638,4 +640,6 @@ Dot11ManagementFrame::vendor_specific_type
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace Tins
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -27,9 +27,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dot11/dot11_probe.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include "dot11/dot11_probe.h"
|
||||
|
||||
namespace Tins {
|
||||
/* Probe Request */
|
||||
@@ -94,4 +97,6 @@ uint32_t Dot11ProbeResponse::write_fixed_parameters(uint8_t *buffer, uint32_t to
|
||||
memcpy(buffer, &this->_body, sz);
|
||||
return sz;
|
||||
}
|
||||
} // namespace Tins
|
||||
} // namespace Tins
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -28,6 +28,9 @@
|
||||
*/
|
||||
|
||||
#include "handshake_capturer.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include "dot11/dot11_data.h"
|
||||
|
||||
namespace Tins {
|
||||
@@ -93,3 +96,5 @@ namespace Tins {
|
||||
return false;
|
||||
}
|
||||
} // namespace Tins;
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -146,33 +146,35 @@ Tins::PDU *pdu_from_flag(PDU::PDUType type, const uint8_t *buffer, uint32_t size
|
||||
return new Tins::ARP(buffer, size);
|
||||
case Tins::PDU::IEEE802_3:
|
||||
return new Tins::IEEE802_3(buffer, size);
|
||||
case Tins::PDU::RADIOTAP:
|
||||
return new Tins::RadioTap(buffer, size);
|
||||
case Tins::PDU::PPPOE:
|
||||
return new Tins::PPPoE(buffer, size);
|
||||
case Tins::PDU::DOT11:
|
||||
case Tins::PDU::DOT11_ACK:
|
||||
case Tins::PDU::DOT11_ASSOC_REQ:
|
||||
case Tins::PDU::DOT11_ASSOC_RESP:
|
||||
case Tins::PDU::DOT11_AUTH:
|
||||
case Tins::PDU::DOT11_BEACON:
|
||||
case Tins::PDU::DOT11_BLOCK_ACK:
|
||||
case Tins::PDU::DOT11_BLOCK_ACK_REQ:
|
||||
case Tins::PDU::DOT11_CF_END:
|
||||
case Tins::PDU::DOT11_DATA:
|
||||
case Tins::PDU::DOT11_CONTROL:
|
||||
case Tins::PDU::DOT11_DEAUTH:
|
||||
case Tins::PDU::DOT11_DIASSOC:
|
||||
case Tins::PDU::DOT11_END_CF_ACK:
|
||||
case Tins::PDU::DOT11_MANAGEMENT:
|
||||
case Tins::PDU::DOT11_PROBE_REQ:
|
||||
case Tins::PDU::DOT11_PROBE_RESP:
|
||||
case Tins::PDU::DOT11_PS_POLL:
|
||||
case Tins::PDU::DOT11_REASSOC_REQ:
|
||||
case Tins::PDU::DOT11_REASSOC_RESP:
|
||||
case Tins::PDU::DOT11_RTS:
|
||||
case Tins::PDU::DOT11_QOS_DATA:
|
||||
return Tins::Dot11::from_bytes(buffer, size);
|
||||
#ifdef HAVE_DOT11
|
||||
case Tins::PDU::RADIOTAP:
|
||||
return new Tins::RadioTap(buffer, size);
|
||||
case Tins::PDU::DOT11:
|
||||
case Tins::PDU::DOT11_ACK:
|
||||
case Tins::PDU::DOT11_ASSOC_REQ:
|
||||
case Tins::PDU::DOT11_ASSOC_RESP:
|
||||
case Tins::PDU::DOT11_AUTH:
|
||||
case Tins::PDU::DOT11_BEACON:
|
||||
case Tins::PDU::DOT11_BLOCK_ACK:
|
||||
case Tins::PDU::DOT11_BLOCK_ACK_REQ:
|
||||
case Tins::PDU::DOT11_CF_END:
|
||||
case Tins::PDU::DOT11_DATA:
|
||||
case Tins::PDU::DOT11_CONTROL:
|
||||
case Tins::PDU::DOT11_DEAUTH:
|
||||
case Tins::PDU::DOT11_DIASSOC:
|
||||
case Tins::PDU::DOT11_END_CF_ACK:
|
||||
case Tins::PDU::DOT11_MANAGEMENT:
|
||||
case Tins::PDU::DOT11_PROBE_REQ:
|
||||
case Tins::PDU::DOT11_PROBE_RESP:
|
||||
case Tins::PDU::DOT11_PS_POLL:
|
||||
case Tins::PDU::DOT11_REASSOC_REQ:
|
||||
case Tins::PDU::DOT11_REASSOC_RESP:
|
||||
case Tins::PDU::DOT11_RTS:
|
||||
case Tins::PDU::DOT11_QOS_DATA:
|
||||
return Tins::Dot11::from_bytes(buffer, size);
|
||||
#endif // HAVE_DOT11
|
||||
default:
|
||||
return 0;
|
||||
};
|
||||
|
||||
@@ -235,12 +235,14 @@ void PacketSender::send(PDU &pdu, const NetworkInterface &iface) {
|
||||
case PDU::ETHERNET_II:
|
||||
send<Tins::EthernetII>(pdu, iface);
|
||||
break;
|
||||
case PDU::DOT11:
|
||||
send<Tins::Dot11>(pdu, iface);
|
||||
break;
|
||||
case PDU::RADIOTAP:
|
||||
send<Tins::RadioTap>(pdu, iface);
|
||||
break;
|
||||
#ifdef HAVE_DOT11
|
||||
case PDU::DOT11:
|
||||
send<Tins::Dot11>(pdu, iface);
|
||||
break;
|
||||
case PDU::RADIOTAP:
|
||||
send<Tins::RadioTap>(pdu, iface);
|
||||
break;
|
||||
#endif // HAVE_DOT11
|
||||
case PDU::IEEE802_3:
|
||||
send<Tins::IEEE802_3>(pdu, iface);
|
||||
break;
|
||||
|
||||
13
src/ppi.cpp
13
src/ppi.cpp
@@ -41,6 +41,7 @@
|
||||
#include "sll.h"
|
||||
#include "ppi.h"
|
||||
#include "internals.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
namespace Tins {
|
||||
PPI::PPI(const uint8_t *buffer, uint32_t total_sz) {
|
||||
@@ -61,7 +62,11 @@ PPI::PPI(const uint8_t *buffer, uint32_t total_sz) {
|
||||
if(total_sz > 0) {
|
||||
switch(dlt()) {
|
||||
case DLT_IEEE802_11:
|
||||
inner_pdu(Dot11::from_bytes(buffer, total_sz));
|
||||
#ifdef HAVE_DOT11
|
||||
inner_pdu(Dot11::from_bytes(buffer, total_sz));
|
||||
#else
|
||||
throw protocol_disabled();
|
||||
#endif
|
||||
break;
|
||||
case DLT_EN10MB:
|
||||
if(Internals::is_dot3(buffer, total_sz))
|
||||
@@ -70,7 +75,11 @@ PPI::PPI(const uint8_t *buffer, uint32_t total_sz) {
|
||||
inner_pdu(new EthernetII(buffer, total_sz));
|
||||
break;
|
||||
case DLT_IEEE802_11_RADIO:
|
||||
inner_pdu(new RadioTap(buffer, total_sz));
|
||||
#ifdef HAVE_DOT11
|
||||
inner_pdu(new RadioTap(buffer, total_sz));
|
||||
#else
|
||||
throw protocol_disabled();
|
||||
#endif
|
||||
break;
|
||||
case DLT_NULL:
|
||||
inner_pdu(new Loopback(buffer, total_sz));
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "radiotap.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <cstring>
|
||||
#ifdef TINS_DEBUG
|
||||
#include <cassert>
|
||||
@@ -41,7 +45,6 @@
|
||||
#endif
|
||||
#include <net/ethernet.h>
|
||||
#endif
|
||||
#include "radiotap.h"
|
||||
#include "dot11/dot11_base.h"
|
||||
#include "utils.h"
|
||||
#include "packet_sender.h"
|
||||
@@ -385,3 +388,5 @@ void RadioTap::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
@@ -29,7 +29,13 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include "sniffer.h"
|
||||
|
||||
#include "dot11/dot11_base.h"
|
||||
#include "ethernetII.h"
|
||||
#include "radiotap.h"
|
||||
#include "loopback.h"
|
||||
#include "dot3.h"
|
||||
#include "sll.h"
|
||||
#include "ppi.h"
|
||||
|
||||
using std::string;
|
||||
using std::runtime_error;
|
||||
@@ -92,6 +98,7 @@ void sniff_loop_eth_handler(u_char *user, const struct pcap_pkthdr *h, const u_c
|
||||
data->pdu = safe_alloc<EthernetII>((const uint8_t*)bytes, h->caplen);
|
||||
}
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
void sniff_loop_dot11_handler(u_char *user, const struct pcap_pkthdr *h, const u_char *bytes) {
|
||||
sniff_data *data = (sniff_data*)user;
|
||||
data->packet_processed = true;
|
||||
@@ -103,6 +110,7 @@ void sniff_loop_dot11_handler(u_char *user, const struct pcap_pkthdr *h, const u
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
PtrPacket BaseSniffer::next_packet() {
|
||||
sniff_data data;
|
||||
@@ -110,10 +118,20 @@ PtrPacket BaseSniffer::next_packet() {
|
||||
pcap_handler handler = 0;
|
||||
if(iface_type == DLT_EN10MB)
|
||||
handler = sniff_loop_eth_handler;
|
||||
else if(iface_type == DLT_IEEE802_11_RADIO)
|
||||
handler = &sniff_loop_handler<RadioTap>;
|
||||
else if(iface_type == DLT_IEEE802_11)
|
||||
handler = sniff_loop_dot11_handler;
|
||||
else if(iface_type == DLT_IEEE802_11_RADIO) {
|
||||
#ifdef HAVE_DOT11
|
||||
handler = &sniff_loop_handler<RadioTap>;
|
||||
#else
|
||||
throw protocol_disabled();
|
||||
#endif
|
||||
}
|
||||
else if(iface_type == DLT_IEEE802_11) {
|
||||
#ifdef HAVE_DOT11
|
||||
handler = sniff_loop_dot11_handler;
|
||||
#else
|
||||
throw protocol_disabled();
|
||||
#endif
|
||||
}
|
||||
else if(iface_type == DLT_LOOP)
|
||||
handler = &sniff_loop_handler<Tins::Loopback>;
|
||||
else if(iface_type == DLT_LINUX_SLL)
|
||||
|
||||
1846
tests/depends.d
1846
tests/depends.d
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,7 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_control.h"
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11.h"
|
||||
|
||||
|
||||
@@ -98,3 +100,5 @@ TEST_F(Dot11AckTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -87,3 +90,4 @@ TEST_F(Dot11AssocRequestTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -95,3 +98,4 @@ TEST_F(Dot11AssocResponseTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_auth.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -103,3 +106,4 @@ TEST_F(Dot11AuthenticationTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_beacon.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "rsn_information.h"
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
@@ -456,3 +459,5 @@ TEST_F(Dot11BeaconTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_control.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11.h"
|
||||
|
||||
|
||||
@@ -90,3 +93,5 @@ TEST_F(Dot11BlockAckRequestTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_control.h"
|
||||
|
||||
@@ -73,3 +77,5 @@ TEST_F(Dot11CFEndTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_control.h"
|
||||
|
||||
@@ -74,3 +78,4 @@ TEST_F(Dot11EndCFAckTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_data.h"
|
||||
|
||||
@@ -163,3 +167,5 @@ TEST_F(Dot11DataTest, Source_Dest_BSSID_Address3) {
|
||||
EXPECT_EQ(data.dst_addr(), "00:18:f8:f5:c2:c6");
|
||||
EXPECT_EQ(data.bssid_addr(), "00:18:f8:f5:c2:c6");
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_auth.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -85,3 +88,4 @@ TEST_F(Dot11DeauthenticationTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -85,3 +88,5 @@ TEST_F(Dot11DisassocTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11.h"
|
||||
#include "utils.h"
|
||||
@@ -161,4 +165,4 @@ TEST_F(Dot11Test, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_probe.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -69,3 +72,4 @@ TEST_F(Dot11ProbeRequestTest, FromBytes) {
|
||||
test_equals_expected(*inner);
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_probe.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -93,3 +96,5 @@ TEST_F(Dot11ProbeResponseTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_control.h"
|
||||
|
||||
@@ -73,3 +77,5 @@ TEST_F(Dot11PSPollTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -93,3 +96,5 @@ TEST_F(Dot11ReAssocRequestTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "dot11/dot11_assoc.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_mgmt.h"
|
||||
|
||||
|
||||
@@ -83,3 +86,4 @@ TEST_F(Dot11ReAssocResponseTest, Serialize) {
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "tests/dot11_control.h"
|
||||
|
||||
@@ -73,3 +77,5 @@ TEST_F(Dot11RTSTest, Serialize) {
|
||||
ASSERT_EQ(sizeof(expected_packet), buffer.size());
|
||||
EXPECT_TRUE(std::equal(buffer.begin(), buffer.end(), expected_packet));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include "dot11/dot11_data.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <stdint.h>
|
||||
#include "ppi.h"
|
||||
#include "dot11/dot11_data.h"
|
||||
#include "udp.h"
|
||||
|
||||
using namespace Tins;
|
||||
@@ -36,3 +39,5 @@ TEST_F(PPITest, ConstructorFromBuffer) {
|
||||
EXPECT_TRUE(pdu.find_pdu<Dot11Data>());
|
||||
EXPECT_TRUE(pdu.find_pdu<UDP>());
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
#include "radiotap.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <stdint.h>
|
||||
#include "radiotap.h"
|
||||
#include "dot11/dot11_data.h"
|
||||
#include "dot11/dot11_beacon.h"
|
||||
#include "utils.h"
|
||||
@@ -195,3 +198,5 @@ TEST_F(RadioTapTest, TSFT) {
|
||||
radio.tsft(0x7afb9a8d);
|
||||
EXPECT_EQ(radio.tsft(), 0x7afb9a8dU);
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <string>
|
||||
#include "tcp_stream.h"
|
||||
#include "tcp.h"
|
||||
#include "ethernetII.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace Tins;
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
@@ -41,3 +45,5 @@ TEST_F(WEPDecryptTest, Decrypt1) {
|
||||
decrypter.add_password("00:12:bf:12:32:29", "\x1f\x1f\x1f\x1f\x1e");
|
||||
EXPECT_FALSE(decrypter.decrypt(dot11));
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_DOT11
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
@@ -216,3 +220,5 @@ TEST_F(WPA2DecryptTest, DecryptCCMPAndTKIPWithoutUsingBeacon) {
|
||||
ASSERT_FALSE(decrypter.decrypt(radio));
|
||||
}
|
||||
}
|
||||
|
||||
#endif // HAVE_DOT11
|
||||
|
||||
Reference in New Issue
Block a user