Update SSL server ciphers
This commit is contained in:
@@ -1099,6 +1099,7 @@ struct ndpi_flow_struct {
|
|||||||
struct {
|
struct {
|
||||||
char client_certificate[64], server_certificate[64], server_organization[64];
|
char client_certificate[64], server_certificate[64], server_organization[64];
|
||||||
char ja3_client[33], ja3_server[33];
|
char ja3_client[33], ja3_server[33];
|
||||||
|
u_int16_t server_cipher;
|
||||||
ndpi_cipher_weakness client_unsafe_cipher, server_unsafe_cipher;
|
ndpi_cipher_weakness client_unsafe_cipher, server_unsafe_cipher;
|
||||||
} ssl;
|
} ssl;
|
||||||
|
|
||||||
|
|||||||
+19
-18
@@ -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
|
||||||
|
|
||||||
@@ -458,13 +458,14 @@ int getSSLcertificate(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
ja3.ssl_version = ssl_version;
|
ja3.ssl_version = ssl_version;
|
||||||
|
|
||||||
if(handshake_protocol == 0x02) {
|
if(handshake_protocol == 0x02) {
|
||||||
u_int16_t offset = 43, extension_len;
|
u_int16_t offset = 43, extension_len, j;
|
||||||
u_int8_t session_id_len = packet->payload[43];
|
u_int8_t session_id_len = packet->payload[43];
|
||||||
|
|
||||||
offset += session_id_len+1;
|
offset += session_id_len+1;
|
||||||
|
|
||||||
ja3.num_cipher = 1, ja3.cipher[0] = ntohs(*((u_int16_t*)&packet->payload[offset]));
|
ja3.num_cipher = 1, ja3.cipher[0] = ntohs(*((u_int16_t*)&packet->payload[offset]));
|
||||||
flow->protos.stun_ssl.ssl.server_unsafe_cipher = is_safe_ssl_cipher(ja3.cipher[0]);
|
flow->protos.stun_ssl.ssl.server_unsafe_cipher = is_safe_ssl_cipher(ja3.cipher[0]);
|
||||||
|
flow->protos.stun_ssl.ssl.server_cipher = ja3.cipher[0];
|
||||||
|
|
||||||
#ifdef CERTIFICATE_DEBUG
|
#ifdef CERTIFICATE_DEBUG
|
||||||
printf("SSL [server][session_id_len: %u][cipher: %04X]\n", session_id_len, ja3.cipher[0]);
|
printf("SSL [server][session_id_len: %u][cipher: %04X]\n", session_id_len, ja3.cipher[0]);
|
||||||
@@ -512,6 +513,22 @@ int getSSLcertificate(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
printf("SSL [server] %s\n", ja3_str);
|
printf("SSL [server] %s\n", ja3_str);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CERTIFICATE_DEBUG
|
||||||
|
printf("[JA3] Server: %s \n", ja3_str);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MD5Init(&ctx);
|
||||||
|
MD5Update(&ctx, (const unsigned char *)ja3_str, strlen(ja3_str));
|
||||||
|
MD5Final(md5_hash, &ctx);
|
||||||
|
|
||||||
|
for(i=0, j=0; i<16; i++)
|
||||||
|
j += snprintf(&flow->protos.stun_ssl.ssl.ja3_server[j],
|
||||||
|
sizeof(flow->protos.stun_ssl.ssl.ja3_server)-j, "%02x", md5_hash[i]);
|
||||||
|
|
||||||
|
#ifdef CERTIFICATE_DEBUG
|
||||||
|
printf("[JA3] Server: %s \n", flow->protos.stun_ssl.ssl.ja3_server);
|
||||||
|
#endif
|
||||||
|
|
||||||
flow->l4.tcp.ssl_seen_server_cert = 1;
|
flow->l4.tcp.ssl_seen_server_cert = 1;
|
||||||
} else
|
} else
|
||||||
flow->l4.tcp.ssl_seen_certificate = 1;
|
flow->l4.tcp.ssl_seen_certificate = 1;
|
||||||
@@ -563,22 +580,6 @@ int getSSLcertificate(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
sizeof(flow->protos.stun_ssl.ssl.server_certificate), "%s", buffer);
|
sizeof(flow->protos.stun_ssl.ssl.server_certificate), "%s", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CERTIFICATE_DEBUG
|
|
||||||
printf("[JA3] Server: %s \n", ja3_str);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
MD5Init(&ctx);
|
|
||||||
MD5Update(&ctx, (const unsigned char *)ja3_str, strlen(ja3_str));
|
|
||||||
MD5Final(md5_hash, &ctx);
|
|
||||||
|
|
||||||
for(i=0, j=0; i<16; i++)
|
|
||||||
j += snprintf(&flow->protos.stun_ssl.ssl.ja3_server[j],
|
|
||||||
sizeof(flow->protos.stun_ssl.ssl.ja3_server)-j, "%02x", md5_hash[i]);
|
|
||||||
|
|
||||||
#ifdef CERTIFICATE_DEBUG
|
|
||||||
printf("[JA3] Server: %s \n", flow->protos.stun_ssl.ssl.ja3_server);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return(1 /* Server Certificate */);
|
return(1 /* Server Certificate */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user