1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-29 13:04:28 +01:00

Merge branch 'develop'

This commit is contained in:
Matias Fontanini
2017-03-23 19:31:10 -07:00
15 changed files with 128 additions and 27 deletions

View File

@@ -14,8 +14,7 @@ INCLUDE_DIRECTORIES(
${PCAP_INCLUDE_DIR}
)
ADD_LIBRARY(
tins ${LIBTINS_TYPE}
set(SOURCES
arp.cpp
bootp.cpp
handshake_capturer.cpp
@@ -43,19 +42,14 @@ ADD_LIBRARY(
loopback.cpp
mpls.cpp
network_interface.cpp
offline_packet_filter.cpp
packet_sender.cpp
packet_writer.cpp
ppi.cpp
pdu.cpp
pktap.cpp
radiotap.cpp
address_range.cpp
rawpdu.cpp
rsn_information.cpp
sll.cpp
snap.cpp
sniffer.cpp
tcp.cpp
tcp_ip/ack_tracker.cpp
tcp_ip/flow.cpp
@@ -63,7 +57,6 @@ ADD_LIBRARY(
tcp_ip/stream.cpp
tcp_ip/stream_follower.cpp
tcp_ip/stream_identifier.cpp
tcp_stream.cpp
timestamp.cpp
udp.cpp
utils.cpp
@@ -77,9 +70,28 @@ ADD_LIBRARY(
dot11/dot11_control.cpp
)
SET(PCAP_DEPENDENT_SOURCES
sniffer.cpp
packet_writer.cpp
pktap.cpp
tcp_stream.cpp
offline_packet_filter.cpp
ppi.cpp
)
IF(LIBTINS_ENABLE_PCAP)
message(STATUS "SETTING TO ${PCAP_DEPENDENT_SOURCES}")
SET(SOURCES ${SOURCES} ${PCAP_DEPENDENT_SOURCES})
ENDIF()
ADD_LIBRARY(
tins ${LIBTINS_TYPE}
${SOURCES}
)
TARGET_LINK_LIBRARIES(tins ${PCAP_LIBRARY} ${OPENSSL_LIBRARIES} ${LIBTINS_OS_LIBS})
SET_TARGET_PROPERTIES(tins PROPERTIES OUTPUT_NAME tins )
SET_TARGET_PROPERTIES(tins PROPERTIES OUTPUT_NAME tins)
SET_TARGET_PROPERTIES(tins PROPERTIES VERSION ${LIBTINS_VERSION} SOVERSION ${LIBTINS_VERSION} )
# Install instructions for this target

View File

@@ -355,6 +355,12 @@ SNAP* SessionKeys::ccmp_decrypt_unicast(const Dot11Data& dot11, RawPDU& raw) con
counter[14] = (total_sz >> 8) & 0xff;
counter[15] = total_sz & 0xff;
if (dot11.subtype() == Dot11::QOS_DATA_DATA) {
const uint32_t offset = (dot11.from_ds() && dot11.to_ds()) ? 30 : 24;
AAD[offset] = static_cast<const Dot11QoSData&>(dot11).qos_control() & 0x0f;
counter[1] = AAD[offset];
}
AES_encrypt(counter, MIC, &ctx);
xor_range(MIC, AAD, MIC, 16);
AES_encrypt(MIC, MIC, &ctx);

View File

@@ -28,7 +28,9 @@
*/
#include "internals.h"
#include <pcap.h>
#ifdef TINS_HAVE_PCAP
#include <pcap.h>
#endif // TINS_HAVE_PCAP
#include "ip.h"
#include "ethernetII.h"
#include "ieee802_3.h"
@@ -179,6 +181,7 @@ Tins::PDU* pdu_from_flag(Constants::IP::e flag,
return 0;
}
#ifdef TINS_HAVE_PCAP
PDU* pdu_from_dlt_flag(int flag,
const uint8_t* buffer,
uint32_t size,
@@ -208,6 +211,7 @@ PDU* pdu_from_dlt_flag(int flag,
return rawpdu_on_no_match ? new RawPDU(buffer, size) : 0;
};
}
#endif // TINS_HAVE_PCAP
Tins::PDU* pdu_from_flag(PDU::PDUType type, const uint8_t* buffer, uint32_t size) {
switch(type) {