@@ -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 $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED) $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED_BASE)
|
||||
mkdir -p $(DESTDIR)$(includedir)
|
||||
cp ../include/*.h $(DESTDIR)$(includedir)
|
||||
@@ -43,9 +43,7 @@
|
||||
|
||||
#include "ndpi_content_match.c.inc"
|
||||
#include "third_party/include/ndpi_patricia.h"
|
||||
#include "third_party/src/ndpi_patricia.c"
|
||||
#include "third_party/include/hash.h"
|
||||
#include "third_party/src/hash.c"
|
||||
|
||||
#ifdef HAVE_HYPERSCAN
|
||||
#include <hs/hs.h>
|
||||
|
||||
+26
-10
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
/* #define CERTIFICATE_DEBUG 1 */
|
||||
// #define CERTIFICATE_DEBUG 1
|
||||
#define NDPI_MAX_SSL_REQUEST_SIZE 10000
|
||||
|
||||
/* Skype.c */
|
||||
@@ -246,28 +246,43 @@ int getSSLcertificate(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int16_t compression_len;
|
||||
u_int16_t extensions_len;
|
||||
|
||||
compression_len = packet->payload[offset+1];
|
||||
offset += compression_len + 3;
|
||||
offset++;
|
||||
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) {
|
||||
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
|
||||
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) {
|
||||
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;
|
||||
|
||||
memcpy(&extension_len, &packet->payload[offset+extension_offset], 2);
|
||||
extension_len = ntohs(*((u_int16_t*)&packet->payload[offset+extension_offset]));
|
||||
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) {
|
||||
u_int begin = 0,len;
|
||||
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)) {
|
||||
char certificate[64];
|
||||
int rc;
|
||||
|
||||
certificate[0] = '\0';
|
||||
rc = getSSLcertificate(ndpi_struct, flow, certificate, sizeof(certificate));
|
||||
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 void ht_set( hashtable_t *hashtable, char *key, u_int16_t value );
|
||||
extern u_int16_t ht_get( hashtable_t *hashtable, char *key );
|
||||
extern void ht_free( hashtable_t *hashtable );
|
||||
|
||||
#endif /* _HASH_H_ */
|
||||
|
||||
Reference in New Issue
Block a user