Fixed msys2 build warnings and re-activated CI Mingw64 build.
* Removed Visual Studio leftovers. Maintaining an autotools project with VS integration requires some additional overhead. Signed-off-by: Toni Uhlig <matzeton@googlemail.com> Signed-off-by: lns <matzeton@googlemail.com>
This commit is contained in:
@@ -142,7 +142,7 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
u_int idx, offset = 0;
|
||||
|
||||
for(idx = 0; idx < len && offset < sizeof(flow->protos.dhcp.fingerprint) - 2; idx++) {
|
||||
int rc = snprintf((char*)&flow->protos.dhcp.fingerprint[offset],
|
||||
int rc = ndpi_snprintf((char*)&flow->protos.dhcp.fingerprint[offset],
|
||||
sizeof(flow->protos.dhcp.fingerprint) - offset,
|
||||
"%s%u", (idx > 0) ? "," : "",
|
||||
(unsigned int)dhcp->options[i+2+idx] & 0xFF);
|
||||
|
||||
@@ -200,17 +200,21 @@ static int krb_decode_asn1_blocks_skip(struct ndpi_detection_module_struct *ndpi
|
||||
return length;
|
||||
}
|
||||
|
||||
static void strncpy_lower(char * const dst, size_t dst_siz,
|
||||
char const * const src, size_t src_siz)
|
||||
static void krb_strncpy_lower(char * const dst, size_t dst_siz,
|
||||
char const * const src, size_t src_siz)
|
||||
{
|
||||
int dst_len = ndpi_min(src_siz, dst_siz - 1);
|
||||
|
||||
strncpy(dst, src, dst_len);
|
||||
dst[dst_len] = '\0';
|
||||
|
||||
for(int i = 0; i < dst_len; ++i)
|
||||
{
|
||||
dst[i] = tolower(dst[i]);
|
||||
if (ndpi_isprint(src[i]) == 0)
|
||||
{
|
||||
dst[i] = '?';
|
||||
} else {
|
||||
dst[i] = tolower(src[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,8 +276,8 @@ static int krb_parse(struct ndpi_detection_module_struct * const ndpi_struct,
|
||||
length -= 2;
|
||||
if (flow->protos.kerberos.domain[0] == '\0')
|
||||
{
|
||||
strncpy_lower(flow->protos.kerberos.domain, sizeof(flow->protos.kerberos.domain),
|
||||
text, length);
|
||||
krb_strncpy_lower(flow->protos.kerberos.domain, sizeof(flow->protos.kerberos.domain),
|
||||
text, length);
|
||||
}
|
||||
|
||||
length = krb_decode_asn1_string_type(ndpi_struct, &kasn1_offset, NULL);
|
||||
@@ -312,11 +316,11 @@ static int krb_parse(struct ndpi_detection_module_struct * const ndpi_struct,
|
||||
length -= 2;
|
||||
if (flow->protos.kerberos.hostname[0] == '\0' && text[length - 1] != '$')
|
||||
{
|
||||
strncpy_lower(flow->protos.kerberos.hostname, sizeof(flow->protos.kerberos.hostname),
|
||||
text, length);
|
||||
krb_strncpy_lower(flow->protos.kerberos.hostname, sizeof(flow->protos.kerberos.hostname),
|
||||
text, length);
|
||||
} else if (flow->protos.kerberos.username[0] == '\0') {
|
||||
strncpy_lower(flow->protos.kerberos.username, sizeof(flow->protos.kerberos.username),
|
||||
text, length - 1);
|
||||
krb_strncpy_lower(flow->protos.kerberos.username, sizeof(flow->protos.kerberos.username),
|
||||
text, length - 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -532,15 +536,9 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
cname_str[0] = '\0'; // required, because cname_len
|
||||
|
||||
while(++num_cname <= 2) {
|
||||
if(cname_len > sizeof(cname_str)-1)
|
||||
cname_len = sizeof(cname_str)-1;
|
||||
|
||||
if (name_offset + cname_len + 1 >= packet->payload_packet_len)
|
||||
cname_len = 0;
|
||||
else
|
||||
strncpy(cname_str, (char*)&packet->payload[name_offset+1], cname_len);
|
||||
cname_str[cname_len] = '\0';
|
||||
for(i=0; i<cname_len; i++) cname_str[i] = tolower(cname_str[i]);
|
||||
krb_strncpy_lower(cname_str, sizeof(cname_str), (char*)&packet->payload[name_offset+1], cname_len);
|
||||
|
||||
#ifdef KERBEROS_DEBUG
|
||||
printf("[AS-REQ][s/dport: %u/%u][Kerberos Cname][len: %u][%s]\n", sport, dport, cname_len, cname_str);
|
||||
@@ -562,9 +560,9 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
&& (cname_len < sizeof(cname_str))
|
||||
&& (cname_str[cname_len-1] == '$')) {
|
||||
cname_str[cname_len-1] = '\0';
|
||||
snprintf(flow->protos.kerberos.hostname, sizeof(flow->protos.kerberos.hostname), "%s", cname_str);
|
||||
ndpi_snprintf(flow->protos.kerberos.hostname, sizeof(flow->protos.kerberos.hostname), "%s", cname_str);
|
||||
} else
|
||||
snprintf(flow->protos.kerberos.username, sizeof(flow->protos.kerberos.username), "%s", cname_str);
|
||||
ndpi_snprintf(flow->protos.kerberos.username, sizeof(flow->protos.kerberos.username), "%s", cname_str);
|
||||
|
||||
for(i=0; (i < 14) && (realm_offset < packet->payload_packet_len); i++) {
|
||||
if(packet->payload[realm_offset] != 0x1b)
|
||||
@@ -584,19 +582,13 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if((realm_offset+realm_len) < packet->payload_packet_len) {
|
||||
char realm_str[48];
|
||||
|
||||
if(realm_len > sizeof(realm_str)-1)
|
||||
realm_len = sizeof(realm_str)-1;
|
||||
|
||||
realm_offset += 1;
|
||||
|
||||
strncpy(realm_str, (char*)&packet->payload[realm_offset], realm_len);
|
||||
realm_str[realm_len] = '\0';
|
||||
for(i=0; i<realm_len; i++) realm_str[i] = tolower(realm_str[i]);
|
||||
krb_strncpy_lower(realm_str, sizeof(realm_str), (char*)&packet->payload[realm_offset], realm_len);
|
||||
|
||||
#ifdef KERBEROS_DEBUG
|
||||
printf("[AS-REQ][Kerberos Realm][len: %u][%s]\n", realm_len, realm_str);
|
||||
#endif
|
||||
snprintf(flow->protos.kerberos.domain, sizeof(flow->protos.kerberos.domain), "%s", realm_str);
|
||||
ndpi_snprintf(flow->protos.kerberos.domain, sizeof(flow->protos.kerberos.domain), "%s", realm_str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -639,19 +631,13 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if((realm_len+name_offset) < packet->payload_packet_len) {
|
||||
char realm_str[48];
|
||||
|
||||
if(realm_len > sizeof(realm_str)-1)
|
||||
realm_len = sizeof(realm_str)-1;
|
||||
|
||||
name_offset += 1;
|
||||
|
||||
strncpy(realm_str, (char*)&packet->payload[name_offset], realm_len);
|
||||
realm_str[realm_len] = '\0';
|
||||
for(i=0; i<realm_len; i++) realm_str[i] = tolower(realm_str[i]);
|
||||
krb_strncpy_lower(realm_str, sizeof(realm_str), (char*)&packet->payload[name_offset], realm_len);
|
||||
|
||||
#ifdef KERBEROS_DEBUG
|
||||
printf("[TGS-REQ][s/dport: %u/%u][Kerberos Realm][len: %u][%s]\n", sport, dport, realm_len, realm_str);
|
||||
#endif
|
||||
snprintf(flow->protos.kerberos.domain, sizeof(flow->protos.kerberos.domain), "%s", realm_str);
|
||||
ndpi_snprintf(flow->protos.kerberos.domain, sizeof(flow->protos.kerberos.domain), "%s", realm_str);
|
||||
|
||||
/* If necessary we can decode sname */
|
||||
if(flow->kerberos_buf.pktbuf) {
|
||||
|
||||
@@ -178,7 +178,7 @@ void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if(user) {
|
||||
char *pwd;
|
||||
|
||||
snprintf(flow->l4.tcp.ftp_imap_pop_smtp.username,
|
||||
ndpi_snprintf(flow->l4.tcp.ftp_imap_pop_smtp.username,
|
||||
sizeof(flow->l4.tcp.ftp_imap_pop_smtp.username),
|
||||
"%s", user);
|
||||
|
||||
@@ -186,7 +186,7 @@ void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
|
||||
pwd = strtok_r(NULL, " \"\r\n", &saveptr);
|
||||
if(pwd) {
|
||||
snprintf(flow->l4.tcp.ftp_imap_pop_smtp.password,
|
||||
ndpi_snprintf(flow->l4.tcp.ftp_imap_pop_smtp.password,
|
||||
sizeof(flow->l4.tcp.ftp_imap_pop_smtp.password),
|
||||
"%s", pwd);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ static void ndpi_search_mining_udp(struct ndpi_detection_module_struct *ndpi_str
|
||||
else if(packet->iphv6 && ntohl(packet->iphv6->ip6_dst.u6_addr.u6_addr32[0]) == 0xFF020000)
|
||||
;
|
||||
else {
|
||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||
ndpi_snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
|
||||
if(packet->iph) /* TODO: ipv6 */
|
||||
cacheMiningHostTwins(ndpi_struct, packet->iph->saddr + packet->iph->daddr);
|
||||
@@ -96,7 +96,7 @@ static void ndpi_search_mining_tcp(struct ndpi_detection_module_struct *ndpi_str
|
||||
u_int32_t magic = htonl(0xf9beb4d9), magic1 = htonl(0xfabfb5da), *to_match = (u_int32_t*)packet->payload;
|
||||
|
||||
if((*to_match == magic) || (*to_match == magic1)) {
|
||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||
ndpi_snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
|
||||
if(packet->iph) /* TODO: ipv6 */
|
||||
cacheMiningHostTwins(ndpi_struct, packet->iph->saddr + packet->iph->daddr);
|
||||
@@ -108,7 +108,7 @@ static void ndpi_search_mining_tcp(struct ndpi_detection_module_struct *ndpi_str
|
||||
&& (packet->payload_packet_len < 600)
|
||||
&& (packet->payload[2] == 0x04)) {
|
||||
if(isEthPort(ntohs(packet->tcp->dest)) /* Ethereum port */) {
|
||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||
ndpi_snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
|
||||
if(packet->iph) /* TODO: ipv6 */
|
||||
cacheMiningHostTwins(ndpi_struct, packet->iph->saddr + packet->iph->daddr);
|
||||
@@ -127,7 +127,7 @@ static void ndpi_search_mining_tcp(struct ndpi_detection_module_struct *ndpi_str
|
||||
{ "id": 2, "jsonrpc":"2.0","result":true}
|
||||
{"worker": "", "jsonrpc": "2.0", "params": [], "id": 3, "method": "eth_getWork"}
|
||||
*/
|
||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||
ndpi_snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ETH");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
|
||||
if(packet->iph) /* TODO: ipv6 */
|
||||
cacheMiningHostTwins(ndpi_struct, packet->iph->saddr + packet->iph->daddr);
|
||||
@@ -151,7 +151,7 @@ static void ndpi_search_mining_tcp(struct ndpi_detection_module_struct *ndpi_str
|
||||
{"id":1,"jsonrpc":"2.0","error":null,"result":{"id":"479059546883218","job":{"blob":"0606e89883d205a65d8ee78991838a1cf3ec2ebbc5fb1fa43dec5fa1cd2bee4069212a549cd731000000005a88235653097aa3e97ef2ceef4aee610751a828f9be1a0758a78365fb0a4c8c05","job_id":"722134174127131","target":"dc460300"},"status":"OK"}}
|
||||
{"method":"submit","params":{"id":"479059546883218","job_id":"722134174127131","nonce":"98024001","result":"c9be9381a68d533c059d614d961e0534d7d8785dd5c339c2f9596eb95f320100"},"id":1}
|
||||
*/
|
||||
snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ZCash/Monero");
|
||||
ndpi_snprintf(flow->flow_extra_info, sizeof(flow->flow_extra_info), "%s", "ZCash/Monero");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MINING, NDPI_PROTOCOL_UNKNOWN, NDPI_CONFIDENCE_DPI);
|
||||
if(packet->iph) /* TODO: ipv6 */
|
||||
cacheMiningHostTwins(ndpi_struct, packet->iph->saddr + packet->iph->daddr);
|
||||
|
||||
@@ -99,7 +99,19 @@ static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
for(i=0; i<packet->payload_packet_len; i++) {
|
||||
if(packet->packet_direction == 0) /* client -> server */ {
|
||||
if(flow->protos.telnet.character_id < (sizeof(flow->protos.telnet.username)-1))
|
||||
flow->protos.telnet.username[flow->protos.telnet.character_id++] = packet->payload[i];
|
||||
{
|
||||
if (i>=packet->payload_packet_len-2 &&
|
||||
(packet->payload[i] == '\r' || packet->payload[i] == '\n'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (ndpi_isprint(packet->payload[i]) == 0)
|
||||
{
|
||||
flow->protos.telnet.username[flow->protos.telnet.character_id++] = '?';
|
||||
} else {
|
||||
flow->protos.telnet.username[flow->protos.telnet.character_id++] = packet->payload[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-26
@@ -268,7 +268,7 @@ static int extractRDNSequence(struct ndpi_packet_struct *packet,
|
||||
}
|
||||
|
||||
if(is_printable) {
|
||||
int rc = snprintf(&rdnSeqBuf[*rdnSeqBuf_offset],
|
||||
int rc = ndpi_snprintf(&rdnSeqBuf[*rdnSeqBuf_offset],
|
||||
rdnSeqBuf_len-(*rdnSeqBuf_offset),
|
||||
"%s%s=%s", (*rdnSeqBuf_offset > 0) ? ", " : "",
|
||||
label, buffer);
|
||||
@@ -530,13 +530,14 @@ static void processCertificateElements(struct ndpi_detection_module_struct *ndpi
|
||||
|
||||
if(general_name_type == 0x87) {
|
||||
if(len == 4 /* IPv4 */) {
|
||||
snprintf(dNSName, sizeof(dNSName), "%u.%u.%u.%u",
|
||||
ndpi_snprintf(dNSName, sizeof(dNSName), "%u.%u.%u.%u",
|
||||
packet->payload[i] & 0xFF,
|
||||
packet->payload[i+1] & 0xFF,
|
||||
packet->payload[i+2] & 0xFF,
|
||||
packet->payload[i+3] & 0xFF);
|
||||
} else if(len == 16 /* IPv6 */){
|
||||
inet_ntop(AF_INET6, &packet->payload[i], dNSName, sizeof(dNSName));
|
||||
} else if(len == 16 /* IPv6 */) {
|
||||
struct in6_addr addr = *(struct in6_addr *)&packet->payload[i];
|
||||
inet_ntop(AF_INET6, &addr, dNSName, sizeof(dNSName));
|
||||
} else {
|
||||
/* Is that possibile? Better safe than sorry */
|
||||
dNSName[0] = '\0';
|
||||
@@ -1461,7 +1462,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if(flow->protos.tls_quic.alpn != NULL)
|
||||
tlsCheckUncommonALPN(ndpi_struct, flow);
|
||||
|
||||
snprintf(ja3.server.alpn, sizeof(ja3.server.alpn), "%s", alpn_str);
|
||||
ndpi_snprintf(ja3.server.alpn, sizeof(ja3.server.alpn), "%s", alpn_str);
|
||||
|
||||
/* Replace , with - as in JA3 */
|
||||
for(i=0; ja3.server.alpn[i] != '\0'; i++)
|
||||
@@ -1500,36 +1501,36 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
i += 4 + extension_len, offset += 4 + extension_len;
|
||||
} /* for */
|
||||
|
||||
ja3_str_len = snprintf(ja3_str, JA3_STR_LEN, "%u,", ja3.server.tls_handshake_version);
|
||||
ja3_str_len = ndpi_snprintf(ja3_str, JA3_STR_LEN, "%u,", ja3.server.tls_handshake_version);
|
||||
|
||||
for(i=0; (i<ja3.server.num_cipher) && (JA3_STR_LEN > ja3_str_len); i++) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u", (i > 0) ? "-" : "", ja3.server.cipher[i]);
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u", (i > 0) ? "-" : "", ja3.server.cipher[i]);
|
||||
|
||||
if(rc <= 0) break; else ja3_str_len += rc;
|
||||
}
|
||||
|
||||
if(JA3_STR_LEN > ja3_str_len) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",");
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",");
|
||||
if(rc > 0 && ja3_str_len + rc < JA3_STR_LEN) ja3_str_len += rc;
|
||||
}
|
||||
|
||||
/* ********** */
|
||||
|
||||
for(i=0; (i<ja3.server.num_tls_extension) && (JA3_STR_LEN > ja3_str_len); i++) {
|
||||
int rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u", (i > 0) ? "-" : "", ja3.server.tls_extension[i]);
|
||||
int rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u", (i > 0) ? "-" : "", ja3.server.tls_extension[i]);
|
||||
|
||||
if(rc <= 0) break; else ja3_str_len += rc;
|
||||
}
|
||||
|
||||
if(ndpi_struct->enable_ja3_plus) {
|
||||
for(i=0; (i<ja3.server.num_elliptic_curve_point_format) && (JA3_STR_LEN > ja3_str_len); i++) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
(i > 0) ? "-" : "", ja3.server.elliptic_curve_point_format[i]);
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc; else break;
|
||||
}
|
||||
|
||||
if((ja3.server.alpn[0] != '\0') && (JA3_STR_LEN > ja3_str_len)) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",%s", ja3.server.alpn);
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",%s", ja3.server.alpn);
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc;
|
||||
}
|
||||
|
||||
@@ -1547,7 +1548,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
ndpi_MD5Final(md5_hash, &ctx);
|
||||
|
||||
for(i=0, j=0; i<16; i++) {
|
||||
int rc = snprintf(&flow->protos.tls_quic.ja3_server[j],
|
||||
int rc = ndpi_snprintf(&flow->protos.tls_quic.ja3_server[j],
|
||||
sizeof(flow->protos.tls_quic.ja3_server)-j, "%02x", md5_hash[i]);
|
||||
if(rc <= 0) break; else j += rc;
|
||||
}
|
||||
@@ -1898,7 +1899,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
#endif
|
||||
|
||||
for(i=0; i<tot_signature_algorithms_len && s_offset+i<total_len; i++) {
|
||||
int rc = snprintf(&ja3.client.signature_algorithms[i*2], sizeof(ja3.client.signature_algorithms)-i*2, "%02X", packet->payload[s_offset+i]);
|
||||
int rc = ndpi_snprintf(&ja3.client.signature_algorithms[i*2], sizeof(ja3.client.signature_algorithms)-i*2, "%02X", packet->payload[s_offset+i]);
|
||||
|
||||
if(rc < 0) break;
|
||||
}
|
||||
@@ -2048,7 +2049,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if(flow->protos.tls_quic.alpn == NULL)
|
||||
flow->protos.tls_quic.alpn = ndpi_strdup(alpn_str);
|
||||
|
||||
snprintf(ja3.client.alpn, sizeof(ja3.client.alpn), "%s", alpn_str);
|
||||
ndpi_snprintf(ja3.client.alpn, sizeof(ja3.client.alpn), "%s", alpn_str);
|
||||
|
||||
/* Replace , with - as in JA3 */
|
||||
for(i=0; ja3.client.alpn[i] != '\0'; i++)
|
||||
@@ -2083,7 +2084,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
#endif
|
||||
|
||||
if((version_str_len+8) < sizeof(version_str)) {
|
||||
int rc = snprintf(&version_str[version_str_len],
|
||||
int rc = ndpi_snprintf(&version_str[version_str_len],
|
||||
sizeof(version_str) - version_str_len, "%s%s",
|
||||
(version_str_len > 0) ? "," : "",
|
||||
ndpi_ssl_version2str(buf_ver_tmp, sizeof(buf_ver_tmp), tls_version, &unknown_tls_version));
|
||||
@@ -2092,7 +2093,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
else
|
||||
version_str_len += rc;
|
||||
|
||||
rc = snprintf(&ja3.client.supported_versions[supported_versions_offset],
|
||||
rc = ndpi_snprintf(&ja3.client.supported_versions[supported_versions_offset],
|
||||
sizeof(ja3.client.supported_versions)-supported_versions_offset,
|
||||
"%s%04X", (j > 0) ? "-" : "", tls_version);
|
||||
|
||||
@@ -2232,47 +2233,47 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
int rc;
|
||||
|
||||
compute_ja3c:
|
||||
ja3_str_len = snprintf(ja3_str, JA3_STR_LEN, "%u,", ja3.client.tls_handshake_version);
|
||||
ja3_str_len = ndpi_snprintf(ja3_str, JA3_STR_LEN, "%u,", ja3.client.tls_handshake_version);
|
||||
|
||||
for(i=0; i<ja3.client.num_cipher; i++) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
(i > 0) ? "-" : "", ja3.client.cipher[i]);
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc; else break;
|
||||
}
|
||||
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",");
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",");
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc;
|
||||
|
||||
/* ********** */
|
||||
|
||||
for(i=0; i<ja3.client.num_tls_extension; i++) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
(i > 0) ? "-" : "", ja3.client.tls_extension[i]);
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc; else break;
|
||||
}
|
||||
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",");
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",");
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc;
|
||||
|
||||
/* ********** */
|
||||
|
||||
for(i=0; i<ja3.client.num_elliptic_curve; i++) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
(i > 0) ? "-" : "", ja3.client.elliptic_curve[i]);
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc; else break;
|
||||
}
|
||||
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",");
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, ",");
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc;
|
||||
|
||||
for(i=0; i<ja3.client.num_elliptic_curve_point_format; i++) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len, "%s%u",
|
||||
(i > 0) ? "-" : "", ja3.client.elliptic_curve_point_format[i]);
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc; else break;
|
||||
}
|
||||
|
||||
if(ndpi_struct->enable_ja3_plus) {
|
||||
rc = snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len,
|
||||
rc = ndpi_snprintf(&ja3_str[ja3_str_len], JA3_STR_LEN-ja3_str_len,
|
||||
",%s,%s,%s", ja3.client.signature_algorithms, ja3.client.supported_versions, ja3.client.alpn);
|
||||
if((rc > 0) && (ja3_str_len + rc < JA3_STR_LEN)) ja3_str_len += rc;
|
||||
}
|
||||
@@ -2286,7 +2287,7 @@ int processClientServerHello(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
ndpi_MD5Final(md5_hash, &ctx);
|
||||
|
||||
for(i=0, j=0; i<16; i++) {
|
||||
rc = snprintf(&flow->protos.tls_quic.ja3_client[j],
|
||||
rc = ndpi_snprintf(&flow->protos.tls_quic.ja3_client[j],
|
||||
sizeof(flow->protos.tls_quic.ja3_client)-j, "%02x",
|
||||
md5_hash[i]);
|
||||
if(rc > 0) j += rc; else break;
|
||||
|
||||
Reference in New Issue
Block a user