Removed some Tor false positives (more work necessary)
This commit is contained in:
+31
-27
@@ -19,7 +19,7 @@ static void ndpi_int_tor_add_connection(struct ndpi_detection_module_struct
|
|||||||
|
|
||||||
int ndpi_is_ssl_tor(struct ndpi_detection_module_struct *ndpi_struct,
|
int ndpi_is_ssl_tor(struct ndpi_detection_module_struct *ndpi_struct,
|
||||||
struct ndpi_flow_struct *flow, char *certificate) {
|
struct ndpi_flow_struct *flow, char *certificate) {
|
||||||
int prev_num = 0, numbers_found = 0, num_found = 0, i;
|
int prev_num = 0, numbers_found = 0, num_found = 0, i, len;
|
||||||
char dummy[48], *dot, *name;
|
char dummy[48], *dot, *name;
|
||||||
|
|
||||||
if((certificate == NULL)
|
if((certificate == NULL)
|
||||||
@@ -37,41 +37,45 @@ int ndpi_is_ssl_tor(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
if((dot = strrchr(dummy, '.')) == NULL) return(0);
|
if((dot = strrchr(dummy, '.')) == NULL) return(0);
|
||||||
name = &dot[1];
|
name = &dot[1];
|
||||||
|
|
||||||
for(i = 0; name[i+1] != '\0'; i++) {
|
len = strlen(name);
|
||||||
if((name[i] >= '0') && (name[i] <= '9')) {
|
|
||||||
|
|
||||||
if(prev_num != 1) {
|
if(len > 6) {
|
||||||
numbers_found++;
|
for(i = 0; name[i+1] != '\0'; i++) {
|
||||||
|
if((name[i] >= '0') && (name[i] <= '9')) {
|
||||||
|
|
||||||
if(numbers_found == 2) {
|
if(prev_num != 1) {
|
||||||
ndpi_int_tor_add_connection(ndpi_struct, flow);
|
numbers_found++;
|
||||||
return(1);
|
|
||||||
|
if(numbers_found == 2) {
|
||||||
|
ndpi_int_tor_add_connection(ndpi_struct, flow);
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
prev_num = 1;
|
||||||
}
|
}
|
||||||
prev_num = 1;
|
} else
|
||||||
|
prev_num = 0;
|
||||||
|
|
||||||
|
if(ndpi_match_bigram(ndpi_struct, &ndpi_struct->impossible_bigrams_automa, &name[i])) {
|
||||||
|
ndpi_int_tor_add_connection(ndpi_struct, flow);
|
||||||
|
return(1);
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
prev_num = 0;
|
|
||||||
|
|
||||||
if(ndpi_match_bigram(ndpi_struct, &ndpi_struct->impossible_bigrams_automa, &name[i])) {
|
if(ndpi_match_bigram(ndpi_struct, &ndpi_struct->bigrams_automa, &name[i])) {
|
||||||
|
num_found++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(num_found == 0) {
|
||||||
ndpi_int_tor_add_connection(ndpi_struct, flow);
|
ndpi_int_tor_add_connection(ndpi_struct, flow);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if(ndpi_match_bigram(ndpi_struct, &ndpi_struct->bigrams_automa, &name[i])) {
|
|
||||||
num_found++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(num_found == 0) {
|
|
||||||
ndpi_int_tor_add_connection(ndpi_struct, flow);
|
|
||||||
return(1);
|
|
||||||
} else {
|
|
||||||
#ifdef PENDANTIC_TOR_CHECK
|
#ifdef PENDANTIC_TOR_CHECK
|
||||||
if(gethostbyname(certificate) == NULL) {
|
if(gethostbyname(certificate) == NULL) {
|
||||||
ndpi_int_tor_add_connection(ndpi_struct, flow);
|
ndpi_int_tor_add_connection(ndpi_struct, flow);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user