diff options
author | Luca Deri <deri@ntop.org> | 2020-08-30 20:48:58 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2020-08-30 20:48:58 +0200 |
commit | 638624869a343468c6b2cc6c09d5f50542fa87e1 (patch) | |
tree | a951cc04adfbeb9e204b6d6b7e1d0931236d53bc /src | |
parent | 647c7d59bbf98e0feff5253a9c8bb8b6d84d3758 (diff) |
Added new risk for NDPI_UNSAFE_PROTOCOL that identifies protocols that are not condidered safe/secure
Diffstat (limited to 'src')
-rw-r--r-- | src/include/ndpi_typedefs.h | 2 | ||||
-rw-r--r-- | src/lib/ndpi_main.c | 21 | ||||
-rw-r--r-- | src/lib/ndpi_utils.c | 4 |
3 files changed, 22 insertions, 5 deletions
diff --git a/src/include/ndpi_typedefs.h b/src/include/ndpi_typedefs.h index 153651cec..ab6f56d31 100644 --- a/src/include/ndpi_typedefs.h +++ b/src/include/ndpi_typedefs.h @@ -80,7 +80,7 @@ typedef enum { NDPI_SSH_OBSOLETE_SERVER_VERSION_OR_CIPHER, NDPI_SMB_INSECURE_VERSION, NDPI_TLS_SUSPICIOUS_ESNI_USAGE, - NDPI_BLACKLISTED_HOST, + NDPI_UNSAFE_PROTOCOL, /* Leave this as last member */ NDPI_MAX_RISK /* must be <= 31 due to (**) */ diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index de95726ef..a84d650bc 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -805,7 +805,7 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp no_master, no_master, "eDonkey", NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, 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_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_UNSAFE, NDPI_PROTOCOL_BITTORRENT, 0 /* can_have_a_subprotocol */, + ndpi_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_BITTORRENT, 0 /* can_have_a_subprotocol */, no_master, no_master, "BitTorrent", NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, ndpi_build_default_ports(ports_a, 51413, 53646, 0, 0, 0) /* TCP */, ndpi_build_default_ports(ports_b, 6771, 51413, 0, 0, 0) /* UDP */); @@ -1303,6 +1303,10 @@ static void ndpi_init_protocol_defaults(struct ndpi_detection_module_struct *ndp no_master, no_master, "TeamSpeak", NDPI_PROTOCOL_CATEGORY_VOIP, 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_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS, NDPI_PROTOCOL_TOR, 0 /* can_have_a_subprotocol */, + no_master, no_master, "Tor", NDPI_PROTOCOL_CATEGORY_VPN, + 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_set_proto_defaults(ndpi_str, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_SKINNY, 0 /* can_have_a_subprotocol */, no_master, no_master, "CiscoSkinny", NDPI_PROTOCOL_CATEGORY_VOIP, ndpi_build_default_ports(ports_a, 2000, 0, 0, 0, 0) /* TCP */, @@ -4464,7 +4468,6 @@ static void ndpi_reconcile_protocols(struct ndpi_detection_module_struct *ndpi_s Skype for a host doing MS Teams means MS Teams (MS Teams uses Skype as transport protocol for voice/video) */ - if(flow) { /* Do not go for DNS when there is an application protocol. Example DNS.Apple */ if((flow->detected_protocol_stack[1] != NDPI_PROTOCOL_UNKNOWN) @@ -4511,6 +4514,20 @@ static void ndpi_reconcile_protocols(struct ndpi_detection_module_struct *ndpi_s } break; } /* switch */ + + if(flow) { + switch(ndpi_get_proto_breed(ndpi_str, ret->app_protocol)) { + case NDPI_PROTOCOL_UNSAFE: + case NDPI_PROTOCOL_POTENTIALLY_DANGEROUS: + case NDPI_PROTOCOL_DANGEROUS: + NDPI_SET_BIT(flow->risk, NDPI_UNSAFE_PROTOCOL); + break; + default: + /* Nothign to do */ + break; + } + } + } /* ********************************************************************************* */ diff --git a/src/lib/ndpi_utils.c b/src/lib/ndpi_utils.c index e1258bfd2..5cd351ba9 100644 --- a/src/lib/ndpi_utils.c +++ b/src/lib/ndpi_utils.c @@ -1537,8 +1537,8 @@ const char* ndpi_risk2str(ndpi_risk_enum risk) { case NDPI_TLS_SUSPICIOUS_ESNI_USAGE: return("TLS Suspicious ESNI Usage"); - case NDPI_BLACKLISTED_HOST: - return("Blacklisted Host"); + case NDPI_UNSAFE_PROTOCOL: + return("Unsafe Protocol"); default: snprintf(buf, sizeof(buf), "%d", (int)risk); |