Risk check improvement
This commit is contained in:
+3
-3
@@ -49,8 +49,8 @@ ip:54.80.47.130@AmazonPrime
|
|||||||
#
|
#
|
||||||
# For IPs, the flow risk is put in AND (source IP mask OR destination IP mask)
|
# For IPs, the flow risk is put in AND (source IP mask OR destination IP mask)
|
||||||
# For Flows with a hostname (e.g. TLS) the risk is also put in AND with the host_risk_mask
|
# For Flows with a hostname (e.g. TLS) the risk is also put in AND with the host_risk_mask
|
||||||
ip_risk_mask:192.168.1.6=0
|
#ip_risk_mask:192.168.1.0/24=0
|
||||||
ip_risk_mask:10.196.157.228=0
|
#ip_risk_mask:10.196.157.228=0
|
||||||
host_risk_mask:"api-global.netflix.com"=0
|
#host_risk_mask:".local"=0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1301,7 +1301,7 @@ struct ndpi_flow_struct {
|
|||||||
/* HTTP host or DNS query */
|
/* HTTP host or DNS query */
|
||||||
u_char host_server_name[240];
|
u_char host_server_name[240];
|
||||||
u_int8_t initial_binary_bytes[8], initial_binary_bytes_len;
|
u_int8_t initial_binary_bytes[8], initial_binary_bytes_len;
|
||||||
u_int8_t risk_checked:1, ip_risk_mask_evaluated:1, _notused:6;
|
u_int8_t risk_checked:1, ip_risk_mask_evaluated:1, host_risk_mask_evaluated:1, _notused:7;
|
||||||
ndpi_risk host_risk_mask; /* Stores the flow risk mask for flow peers */
|
ndpi_risk host_risk_mask; /* Stores the flow risk mask for flow peers */
|
||||||
ndpi_risk risk; /* Issues found with this flow [bitmask of ndpi_risk] */
|
ndpi_risk risk; /* Issues found with this flow [bitmask of ndpi_risk] */
|
||||||
|
|
||||||
|
|||||||
+15
-10
@@ -2057,19 +2057,24 @@ static void ndpi_handle_risk_exceptions(struct ndpi_detection_module_struct *ndp
|
|||||||
|
|
||||||
host = ndpi_get_flow_name(flow);
|
host = ndpi_get_flow_name(flow);
|
||||||
|
|
||||||
if(host && (host[0] != '\0')) {
|
if(!flow->host_risk_mask_evaluated) {
|
||||||
/* Check host exception */
|
if(host && (host[0] != '\0')) {
|
||||||
ndpi_automa *automa = &ndpi_str->host_risk_mask_automa;
|
/* Check host exception */
|
||||||
|
ndpi_automa *automa = &ndpi_str->host_risk_mask_automa;
|
||||||
|
|
||||||
if(automa->ac_automa) {
|
if(automa->ac_automa) {
|
||||||
AC_TEXT_t ac_input_text;
|
AC_TEXT_t ac_input_text;
|
||||||
AC_REP_t match;
|
AC_REP_t match;
|
||||||
|
|
||||||
ac_input_text.astring = host, ac_input_text.length = strlen(host);
|
ac_input_text.astring = host, ac_input_text.length = strlen(host);
|
||||||
ac_input_text.option = 0;
|
ac_input_text.option = 0;
|
||||||
|
|
||||||
if(ac_automata_search(automa->ac_automa, &ac_input_text, &match) > 0)
|
if(ac_automata_search(automa->ac_automa, &ac_input_text, &match) > 0)
|
||||||
flow->risk &= match.number64;
|
flow->risk &= match.number64;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Used to avoid double checks (e.g. in DNS req/rsp) */
|
||||||
|
flow->host_risk_mask_evaluated = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user