Compare commits
15
Commits
2.4
...
2.4-stable
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
906a63aa09 | ||
|
|
736978637c | ||
|
|
1569744f67 | ||
|
|
3a9c52ff85 | ||
|
|
b4b7a81069 | ||
|
|
cfd97bbbca | ||
|
|
a1f6cbb6c9 | ||
|
|
6dcf1f3fba | ||
|
|
54fd7face8 | ||
|
|
ba72865f23 | ||
|
|
d1ca778f60 | ||
|
|
efd8348c3a | ||
|
|
6be5188ff9 | ||
|
|
33c35f5376 | ||
|
|
91ac4e4bee |
+1
-2
@@ -1,8 +1,7 @@
|
|||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
SUBDIRS = src/lib example tests
|
SUBDIRS = src/lib example tests
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libndpi.pc
|
pkgconfig_DATA = libndpi.pc
|
||||||
|
|
||||||
EXTRA_DIST = libndpi.sym autogen.sh
|
EXTRA_DIST = autogen.sh
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ NDPI_MINOR="4"
|
|||||||
NDPI_PATCH="0"
|
NDPI_PATCH="0"
|
||||||
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
|
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
|
||||||
|
|
||||||
rm -f configure config.h config.h.in src/lib/Makefile.in
|
rm -f configure config.h config.h.in
|
||||||
|
|
||||||
AUTOCONF=$(command -v autoconf)
|
AUTOCONF=$(command -v autoconf)
|
||||||
AUTOMAKE=$(command -v automake)
|
AUTOMAKE=$(command -v automake)
|
||||||
|
|||||||
+5
-4
@@ -10,6 +10,7 @@ AC_PROG_CC
|
|||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
AX_PTHREAD
|
AX_PTHREAD
|
||||||
|
|
||||||
|
NDPI_VERSION_SHORT="@NDPI_VERSION_SHORT@"
|
||||||
NDPI_MAJOR="@NDPI_MAJOR@"
|
NDPI_MAJOR="@NDPI_MAJOR@"
|
||||||
NDPI_MINOR="@NDPI_MINOR@"
|
NDPI_MINOR="@NDPI_MINOR@"
|
||||||
NDPI_PATCH="@NDPI_PATCH@"
|
NDPI_PATCH="@NDPI_PATCH@"
|
||||||
@@ -50,12 +51,11 @@ if test $SHORT_MACHINE = "arm"; then
|
|||||||
else
|
else
|
||||||
AC_CHECK_LIB([numa], [numa_available], [LIBNUMA="-lnuma"])
|
AC_CHECK_LIB([numa], [numa_available], [LIBNUMA="-lnuma"])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
HS_LIB=
|
HS_LIB=
|
||||||
HS_INC=
|
HS_INC=
|
||||||
|
|
||||||
AC_ARG_WITH(hyperscan, [ --with-hyperscan Enable nDPI build with Intel Hyperscan])
|
AC_ARG_WITH(hyperscan, [ --with-hyperscan Enable nDPI build with Intel Hyperscan])
|
||||||
|
|
||||||
if test "${with_hyperscan+set}" = set; then
|
if test "${with_hyperscan+set}" = set; then
|
||||||
BKP=$LIBS
|
BKP=$LIBS
|
||||||
@@ -127,12 +127,13 @@ AC_ARG_ENABLE([debug-messages],
|
|||||||
|
|
||||||
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))
|
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile example/Makefile tests/Makefile libndpi.pc src/include/ndpi_define.h])
|
AC_CONFIG_FILES([Makefile example/Makefile tests/Makefile libndpi.pc src/include/ndpi_define.h src/lib/Makefile])
|
||||||
AC_CONFIG_HEADERS(src/include/ndpi_config.h)
|
AC_CONFIG_HEADERS(src/include/ndpi_config.h)
|
||||||
AC_SUBST(GIT_RELEASE)
|
AC_SUBST(GIT_RELEASE)
|
||||||
AC_SUBST(NDPI_MAJOR)
|
AC_SUBST(NDPI_MAJOR)
|
||||||
AC_SUBST(NDPI_MINOR)
|
AC_SUBST(NDPI_MINOR)
|
||||||
AC_SUBST(NDPI_PATCH)
|
AC_SUBST(NDPI_PATCH)
|
||||||
|
AC_SUBST(NDPI_VERSION_SHORT)
|
||||||
AC_SUBST(SVN_DATE)
|
AC_SUBST(SVN_DATE)
|
||||||
AC_SUBST(JSON_C_LIB)
|
AC_SUBST(JSON_C_LIB)
|
||||||
AC_SUBST(PCAP_INC)
|
AC_SUBST(PCAP_INC)
|
||||||
|
|||||||
+1
-1
@@ -7,4 +7,4 @@ Name: libndpi
|
|||||||
Description: deep packet inspection library
|
Description: deep packet inspection library
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: -L${libdir} -lndpi
|
Libs: -L${libdir} -lndpi
|
||||||
Cflags: -I${includedir}/libndpi-@VERSION@
|
Cflags: -I${includedir}/ndpi
|
||||||
|
|||||||
+29
-3
@@ -274,7 +274,7 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||||
struct ndpi_flow_struct *flow);
|
struct ndpi_flow_struct *flow);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API call that is called internally by ndpi_detection_process_packet or by apps
|
* API call that is called internally by ndpi_detection_process_packet or by apps
|
||||||
* that want to avoid calling ndpi_detection_process_packet as they have already
|
* that want to avoid calling ndpi_detection_process_packet as they have already
|
||||||
@@ -420,7 +420,7 @@ extern "C" {
|
|||||||
char *bigram_to_match);
|
char *bigram_to_match);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the protocol name in the buffer -buf- as master_protocol.protocol
|
* Write the protocol name in the buffer -buf- as master_protocol.protocol (string)
|
||||||
*
|
*
|
||||||
* @par ndpi_mod = the detection module
|
* @par ndpi_mod = the detection module
|
||||||
* @par proto = the struct ndpi_protocol contain the protocols name
|
* @par proto = the struct ndpi_protocol contain the protocols name
|
||||||
@@ -432,6 +432,32 @@ extern "C" {
|
|||||||
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod,
|
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
ndpi_protocol proto, char *buf, u_int buf_len);
|
ndpi_protocol proto, char *buf, u_int buf_len);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Same as ndpi_protocol2name() with the difference that the numeric protocol
|
||||||
|
* name is returned
|
||||||
|
*
|
||||||
|
* @par ndpi_mod = the detection module
|
||||||
|
* @par proto = the struct ndpi_protocol contain the protocols name
|
||||||
|
* @par buf = the buffer to write the name of the protocols
|
||||||
|
* @par buf_len = the length of the buffer
|
||||||
|
* @return the buffer contains the master_protocol and protocol name
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
char* ndpi_protocol2id(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
|
ndpi_protocol proto, char *buf, u_int buf_len);
|
||||||
|
/**
|
||||||
|
* Write the protocol name in the buffer -buf- as master_protocol.protocol (number)
|
||||||
|
*
|
||||||
|
* @par ndpi_mod = the detection module
|
||||||
|
* @par proto = the struct ndpi_protocol contain the protocols name
|
||||||
|
* @par buf = the buffer to write the name of the protocols
|
||||||
|
* @par buf_len = the length of the buffer
|
||||||
|
* @return the buffer contains the master_protocol and protocol name
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
char* ndpi_protocol2id(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
|
ndpi_protocol proto, char *buf, u_int buf_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find out if a given category is custom/user-defined
|
* Find out if a given category is custom/user-defined
|
||||||
*
|
*
|
||||||
@@ -733,7 +759,7 @@ extern "C" {
|
|||||||
u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod);
|
u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod);
|
||||||
u_int ndpi_get_ndpi_detection_module_size();
|
u_int ndpi_get_ndpi_detection_module_size();
|
||||||
void ndpi_set_log_level(struct ndpi_detection_module_struct *ndpi_mod, u_int l);
|
void ndpi_set_log_level(struct ndpi_detection_module_struct *ndpi_mod, u_int l);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a string to match to an automata
|
* Add a string to match to an automata
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,9 +26,6 @@
|
|||||||
|
|
||||||
#include "ndpi_define.h"
|
#include "ndpi_define.h"
|
||||||
|
|
||||||
/* Needed to have access to HAVE_* defines */
|
|
||||||
#include "ndpi_config.h"
|
|
||||||
|
|
||||||
/* NDPI_LOG_LEVEL */
|
/* NDPI_LOG_LEVEL */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
NDPI_LOG_ERROR,
|
NDPI_LOG_ERROR,
|
||||||
@@ -854,7 +851,17 @@ typedef struct ndpi_proto {
|
|||||||
#define NUM_CUSTOM_CATEGORIES 5
|
#define NUM_CUSTOM_CATEGORIES 5
|
||||||
#define CUSTOM_CATEGORY_LABEL_LEN 32
|
#define CUSTOM_CATEGORY_LABEL_LEN 32
|
||||||
|
|
||||||
|
#ifdef NDPI_LIB_COMPILATION
|
||||||
|
|
||||||
|
/* Needed to have access to HAVE_* defines */
|
||||||
|
#include "ndpi_define.h"
|
||||||
|
|
||||||
#ifdef HAVE_HYPERSCAN
|
#ifdef HAVE_HYPERSCAN
|
||||||
|
struct hs {
|
||||||
|
hs_database_t *database;
|
||||||
|
hs_scratch_t *scratch;
|
||||||
|
};
|
||||||
|
|
||||||
struct hs_list {
|
struct hs_list {
|
||||||
char *expression;
|
char *expression;
|
||||||
unsigned int id;
|
unsigned int id;
|
||||||
@@ -862,8 +869,6 @@ struct hs_list {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NDPI_LIB_COMPILATION
|
|
||||||
|
|
||||||
struct ndpi_detection_module_struct {
|
struct ndpi_detection_module_struct {
|
||||||
NDPI_PROTOCOL_BITMASK detection_bitmask;
|
NDPI_PROTOCOL_BITMASK detection_bitmask;
|
||||||
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
|
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
#
|
|
||||||
# Simple non-autotools dependent makefile
|
|
||||||
#
|
|
||||||
# ./autogen.sh
|
|
||||||
# cd src/lib
|
|
||||||
# make -f Makefile.simple
|
|
||||||
#
|
|
||||||
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -g
|
|
||||||
RANLIB = ranlib
|
|
||||||
|
|
||||||
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) ndpi_main.o
|
|
||||||
HEADERS = $(wildcard ../include/*.h)
|
|
||||||
|
|
||||||
all: libndpi.a
|
|
||||||
|
|
||||||
ndpi_main.c: ndpi_content_match.c.inc
|
|
||||||
|
|
||||||
libndpi.a: $(OBJECTS)
|
|
||||||
ar rc $@ $(OBJECTS)
|
|
||||||
$(RANLIB) $@
|
|
||||||
|
|
||||||
%.o: %.c $(HEADERS) Makefile
|
|
||||||
$(CC) $(CFLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
clean:
|
|
||||||
/bin/rm -f libndpi.a $(OBJECTS)
|
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
#
|
||||||
|
# Simple non-autotools dependent makefile
|
||||||
|
#
|
||||||
|
# ./autogen.sh
|
||||||
|
# cd src/lib
|
||||||
|
# make Makefile
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Installation directories
|
||||||
|
#
|
||||||
|
prefix = /usr/local
|
||||||
|
libdir = ${prefix}/lib
|
||||||
|
includedir = ${prefix}/include/ndpi
|
||||||
|
CC = @CC@
|
||||||
|
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -O2 # -g
|
||||||
|
RANLIB = ranlib
|
||||||
|
|
||||||
|
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) ndpi_main.o
|
||||||
|
HEADERS = $(wildcard ../include/*.h)
|
||||||
|
NDPI_LIB_STATIC = libndpi.a
|
||||||
|
NDPI_LIB_SHARED_BASE = libndpi.so
|
||||||
|
NDPI_LIB_SHARED = $(NDPI_LIB_SHARED_BASE).@NDPI_VERSION_SHORT@
|
||||||
|
NDPI_LIBS = $(NDPI_LIB_STATIC) $(NDPI_LIB_SHARED)
|
||||||
|
|
||||||
|
ifeq ($(OS),Darwin)
|
||||||
|
CC=clang
|
||||||
|
endif
|
||||||
|
|
||||||
|
all: $(NDPI_LIBS)
|
||||||
|
|
||||||
|
ndpi_main.c: ndpi_content_match.c.inc
|
||||||
|
|
||||||
|
$(NDPI_LIB_STATIC): $(OBJECTS)
|
||||||
|
ar rc $@ $(OBJECTS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
$(NDPI_LIB_SHARED): $(OBJECTS)
|
||||||
|
$(CC) -shared -fPIC -o $@ $(OBJECTS)
|
||||||
|
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE)
|
||||||
|
|
||||||
|
%.o: %.c $(HEADERS) Makefile
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
/bin/rm -f $(NDPI_LIB_STATIC) $(OBJECTS) *.o *.so *.lo
|
||||||
|
|
||||||
|
install: $(NDPI_LIBS)
|
||||||
|
mkdir -p $(DESTDIR)$(libdir)
|
||||||
|
cp $(NDPI_LIBS) $(DESTDIR)$(libdir)/
|
||||||
|
ln -Fs $(NDPI_LIB_SHARED) $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED_BASE)
|
||||||
|
mkdir -p $(DESTDIR)$(includedir)
|
||||||
|
cp ../include/*.h $(DESTDIR)$(includedir)
|
||||||
+18
-10
@@ -43,21 +43,12 @@
|
|||||||
|
|
||||||
#include "ndpi_content_match.c.inc"
|
#include "ndpi_content_match.c.inc"
|
||||||
#include "third_party/include/ndpi_patricia.h"
|
#include "third_party/include/ndpi_patricia.h"
|
||||||
#include "third_party/src/ndpi_patricia.c"
|
|
||||||
#include "third_party/include/hash.h"
|
#include "third_party/include/hash.h"
|
||||||
#include "third_party/src/hash.c"
|
|
||||||
|
|
||||||
#ifdef HAVE_HYPERSCAN
|
#ifdef HAVE_HYPERSCAN
|
||||||
#include <hs/hs.h>
|
#include <hs/hs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_HYPERSCAN
|
|
||||||
struct hs {
|
|
||||||
hs_database_t *database;
|
|
||||||
hs_scratch_t *scratch;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NDPI_CONST_GENERIC_PROTOCOL_NAME "GenericProtocol"
|
#define NDPI_CONST_GENERIC_PROTOCOL_NAME "GenericProtocol"
|
||||||
|
|
||||||
static int _ndpi_debug_callbacks = 0;
|
static int _ndpi_debug_callbacks = 0;
|
||||||
@@ -1234,7 +1225,7 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp
|
|||||||
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
||||||
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_VIDTO,
|
ndpi_set_proto_defaults(ndpi_mod, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_VIDTO,
|
||||||
no_master,
|
no_master,
|
||||||
no_master, "PPStream", NDPI_PROTOCOL_CATEGORY_MEDIA,
|
no_master, "Vidto", NDPI_PROTOCOL_CATEGORY_MEDIA,
|
||||||
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
ndpi_build_default_ports(ports_a, 0, 0, 0, 0, 0) /* TCP */,
|
||||||
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
ndpi_build_default_ports(ports_b, 0, 0, 0, 0, 0) /* UDP */);
|
||||||
|
|
||||||
@@ -5328,6 +5319,23 @@ ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct
|
|||||||
|
|
||||||
/* ****************************************************** */
|
/* ****************************************************** */
|
||||||
|
|
||||||
|
char* ndpi_protocol2id(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
|
ndpi_protocol proto, char *buf, u_int buf_len) {
|
||||||
|
if((proto.master_protocol != NDPI_PROTOCOL_UNKNOWN)
|
||||||
|
&& (proto.master_protocol != proto.app_protocol)) {
|
||||||
|
if(proto.app_protocol != NDPI_PROTOCOL_UNKNOWN)
|
||||||
|
snprintf(buf, buf_len, "%u.%u",
|
||||||
|
proto.master_protocol, proto.app_protocol);
|
||||||
|
else
|
||||||
|
snprintf(buf, buf_len, "%u", proto.master_protocol);
|
||||||
|
} else
|
||||||
|
snprintf(buf, buf_len, "%u", proto.app_protocol);
|
||||||
|
|
||||||
|
return(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ****************************************************** */
|
||||||
|
|
||||||
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod,
|
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod,
|
||||||
ndpi_protocol proto, char *buf, u_int buf_len) {
|
ndpi_protocol proto, char *buf, u_int buf_len) {
|
||||||
if((proto.master_protocol != NDPI_PROTOCOL_UNKNOWN)
|
if((proto.master_protocol != NDPI_PROTOCOL_UNKNOWN)
|
||||||
|
|||||||
+26
-10
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include "ndpi_api.h"
|
#include "ndpi_api.h"
|
||||||
|
|
||||||
/* #define CERTIFICATE_DEBUG 1 */
|
// #define CERTIFICATE_DEBUG 1
|
||||||
#define NDPI_MAX_SSL_REQUEST_SIZE 10000
|
#define NDPI_MAX_SSL_REQUEST_SIZE 10000
|
||||||
|
|
||||||
/* Skype.c */
|
/* Skype.c */
|
||||||
@@ -246,28 +246,43 @@ int getSSLcertificate(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
u_int16_t compression_len;
|
u_int16_t compression_len;
|
||||||
u_int16_t extensions_len;
|
u_int16_t extensions_len;
|
||||||
|
|
||||||
compression_len = packet->payload[offset+1];
|
offset++;
|
||||||
offset += compression_len + 3;
|
compression_len = packet->payload[offset];
|
||||||
|
offset++;
|
||||||
|
|
||||||
|
#ifdef CERTIFICATE_DEBUG
|
||||||
|
printf("SSL [compression_len: %u]\n", compression_len);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// offset += compression_len + 3;
|
||||||
|
offset += compression_len;
|
||||||
|
|
||||||
if(offset < total_len) {
|
if(offset < total_len) {
|
||||||
extensions_len = packet->payload[offset];
|
extensions_len = ntohs(*((u_int16_t*)&packet->payload[offset]));
|
||||||
|
offset += 2;
|
||||||
|
|
||||||
|
#ifdef CERTIFICATE_DEBUG
|
||||||
|
printf("SSL [extensions_len: %u]\n", extensions_len);
|
||||||
|
#endif
|
||||||
|
|
||||||
if((extensions_len+offset) < total_len) {
|
if((extensions_len+offset) <= total_len) {
|
||||||
/* Move to the first extension
|
/* Move to the first extension
|
||||||
Type is u_int to avoid possible overflow on extension_len addition */
|
Type is u_int to avoid possible overflow on extension_len addition */
|
||||||
u_int extension_offset = 1;
|
u_int extension_offset = 0;
|
||||||
|
|
||||||
while(extension_offset < extensions_len) {
|
while(extension_offset < extensions_len) {
|
||||||
u_int16_t extension_id, extension_len;
|
u_int16_t extension_id, extension_len;
|
||||||
|
|
||||||
memcpy(&extension_id, &packet->payload[offset+extension_offset], 2);
|
extension_id = ntohs(*((u_int16_t*)&packet->payload[offset+extension_offset]));
|
||||||
extension_offset += 2;
|
extension_offset += 2;
|
||||||
|
|
||||||
memcpy(&extension_len, &packet->payload[offset+extension_offset], 2);
|
extension_len = ntohs(*((u_int16_t*)&packet->payload[offset+extension_offset]));
|
||||||
extension_offset += 2;
|
extension_offset += 2;
|
||||||
|
|
||||||
extension_id = ntohs(extension_id), extension_len = ntohs(extension_len);
|
#ifdef CERTIFICATE_DEBUG
|
||||||
|
printf("SSL [extension_id: %u][extension_len: %u]\n", extension_id, extension_len);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(extension_id == 0) {
|
if(extension_id == 0) {
|
||||||
u_int begin = 0,len;
|
u_int begin = 0,len;
|
||||||
char *server_name = (char*)&packet->payload[offset+extension_offset];
|
char *server_name = (char*)&packet->payload[offset+extension_offset];
|
||||||
@@ -316,6 +331,7 @@ int sslTryAndRetrieveServerCertificate(struct ndpi_detection_module_struct *ndpi
|
|||||||
if((packet->payload_packet_len > 9) && (packet->payload[0] == 0x16)) {
|
if((packet->payload_packet_len > 9) && (packet->payload[0] == 0x16)) {
|
||||||
char certificate[64];
|
char certificate[64];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
certificate[0] = '\0';
|
certificate[0] = '\0';
|
||||||
rc = getSSLcertificate(ndpi_struct, flow, certificate, sizeof(certificate));
|
rc = getSSLcertificate(ndpi_struct, flow, certificate, sizeof(certificate));
|
||||||
packet->ssl_certificate_num_checks++;
|
packet->ssl_certificate_num_checks++;
|
||||||
|
|||||||
Vendored
+1
@@ -25,5 +25,6 @@ extern int ht_hash( hashtable_t *hashtable, char *key );
|
|||||||
extern entry_t *ht_newpair( char *key, u_int16_t value );
|
extern entry_t *ht_newpair( char *key, u_int16_t value );
|
||||||
extern void ht_set( hashtable_t *hashtable, char *key, u_int16_t value );
|
extern void ht_set( hashtable_t *hashtable, char *key, u_int16_t value );
|
||||||
extern u_int16_t ht_get( hashtable_t *hashtable, char *key );
|
extern u_int16_t ht_get( hashtable_t *hashtable, char *key );
|
||||||
|
extern void ht_free( hashtable_t *hashtable );
|
||||||
|
|
||||||
#endif /* _HASH_H_ */
|
#endif /* _HASH_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user