Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a4c8e2959 | ||
|
|
5352c34ba5 | ||
|
|
41fcb7b1c1 | ||
|
|
a0bef995b6 | ||
|
|
d6b5d8e2c2 | ||
|
|
449742e69d | ||
|
|
bc786b48fa | ||
|
|
506b4e5f81 | ||
|
|
8365b127f2 | ||
|
|
471ea81594 | ||
|
|
b0ac39fe28 | ||
|
|
aced1e9673 | ||
|
|
e37be3b43d | ||
|
|
6648d19239 | ||
|
|
8d8a204519 | ||
|
|
2ab10ec9b7 | ||
|
|
0ce34f341e | ||
|
|
0d68f8ab5d | ||
|
|
3ea5f2f0a6 | ||
|
|
912c160ad3 | ||
|
|
d9745a2e2c | ||
|
|
deb96d83d3 | ||
|
|
e5f3d21f81 | ||
|
|
eb49f15453 | ||
|
|
5165102f81 | ||
|
|
d215d6d861 | ||
|
|
0739b577d4 | ||
|
|
c62e8dadb6 | ||
|
|
e29bd2270f | ||
|
|
aa4bdebf40 | ||
|
|
5f460c95cc | ||
|
|
73358d5ec2 | ||
|
|
e98108a8be | ||
|
|
5af906ad83 | ||
|
|
1d711d849d | ||
|
|
0b7af2dbbc | ||
|
|
9d1e99ad0a | ||
|
|
f948e76c45 | ||
|
|
e3e8b5c6e4 | ||
|
|
e4f4cfb1de | ||
|
|
085d7f0ed4 | ||
|
|
f3105f6c81 | ||
|
|
5c55b970c6 | ||
|
|
cad7e541b6 | ||
|
|
312c7ce1af | ||
|
|
c354ff85a6 | ||
|
|
fc12541e8a | ||
|
|
e178653f48 | ||
|
|
05f2eb6270 | ||
|
|
0307c85bd3 | ||
|
|
71ed576e18 | ||
|
|
2f347a33d8 | ||
|
|
436af982fd | ||
|
|
1dd0c912c7 | ||
|
|
824c5f82d3 | ||
|
|
5266c726f2 | ||
|
|
a4b22a612e | ||
|
|
e222345c85 | ||
|
|
2b30cc8f2c | ||
|
|
dc1d7bf47f | ||
|
|
f5d6cd511e | ||
|
|
09c137b27a | ||
|
|
151f74d596 | ||
|
|
2ac44376cb | ||
|
|
7f807b81fe | ||
|
|
60884f9047 | ||
|
|
49ea23530f | ||
|
|
07ebed7fae | ||
|
|
857020c475 | ||
|
|
68af5c221d | ||
|
|
4089227863 | ||
|
|
a968718b52 | ||
|
|
83d46d02d4 | ||
|
|
32cdefb7d7 | ||
|
|
8da7af7b7b | ||
|
|
276a35d36d | ||
|
|
7e28cc0981 | ||
|
|
40292a737a | ||
|
|
8d5dda9d33 | ||
|
|
1d9d0b89ab | ||
|
|
dd834c0eeb | ||
|
|
1d698899f6 | ||
|
|
9bb99ed01d | ||
|
|
ce94b7e545 | ||
|
|
53c0b81dad | ||
|
|
2be84d4d64 | ||
|
|
806c1a48d5 | ||
|
|
4f691de0b5 | ||
|
|
37912b6045 | ||
|
|
d04979402c | ||
|
|
8a2493c26a | ||
|
|
b2816d72da | ||
|
|
9d361ec772 | ||
|
|
5b62fa3464 | ||
|
|
92e813cca4 | ||
|
|
a7b7254ac0 | ||
|
|
23048378d8 | ||
|
|
b16ff0a3dc | ||
|
|
f97fe9a7b5 | ||
|
|
85db524a35 | ||
|
|
031f1709f2 | ||
|
|
7391fe0c5e | ||
|
|
984eca8a27 | ||
|
|
8b321fda41 | ||
|
|
702a9d0867 | ||
|
|
20740e1b68 | ||
|
|
c4adefe75b | ||
|
|
11fb7e1796 | ||
|
|
12f89fff49 | ||
|
|
f3bb7fb9c2 | ||
|
|
72b205f5c1 | ||
|
|
4ce9dec54e |
@@ -1,6 +1,6 @@
|
||||
# What is nDPI ?
|
||||
|
||||
nDPI is an open source GPLv3 library for deep-packet inspection. Based on OpenDPI it includes ntop extensions. We have tried to push them into the OpenDPI source tree but nobody answered emails so we have decided to create mour own source tree
|
||||
nDPI is an open source LGPLv3 library for deep-packet inspection. Based on OpenDPI it includes ntop extensions. We have tried to push them into the OpenDPI source tree but nobody answered emails so we have decided to create our own source tree
|
||||
|
||||
# How To Compile nDPI
|
||||
|
||||
@@ -35,3 +35,8 @@ The entire procedure of adding new protocols in detail:
|
||||
If you want to distribute a source tar file of nDPI do:
|
||||
|
||||
- make dist
|
||||
|
||||
|
||||
# Acknowledgements
|
||||
|
||||
Many thanks to <A HREF=http://www.radcom.com>Radcom</A> Ltd for supporting the development of nDPI.
|
||||
+3
-2
@@ -6,6 +6,7 @@
|
||||
AUTOCONF=$(which autoconf)
|
||||
AUTOMAKE=$(which automake)
|
||||
LIBTOOL=$(which libtool)
|
||||
LIBTOOLIZE=$(which libtoolize)
|
||||
AUTORECONF=$(which autoreconf)
|
||||
|
||||
if test -z $AUTOCONF; then
|
||||
@@ -18,8 +19,8 @@ if test -z $AUTOMAKE; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if test -z $LIBTOOL; then
|
||||
echo "libtool is missing: please install it and try again"
|
||||
if test -z $LIBTOOL && test -z $LIBTOOLIZE ; then
|
||||
echo "libtool and libtoolize is missing: please install it and try again"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
AC_INIT([libndpi], [1.6.0])
|
||||
AC_INIT([libndpi], [1.7.1])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
@@ -16,7 +16,7 @@ if test -d ".git"; then :
|
||||
# On CentOS 6 `git rev-list HEAD --count` does not work
|
||||
#
|
||||
#
|
||||
GIT_NUM=`git log --pretty=oneline | wc -l`
|
||||
GIT_NUM=`git log --pretty=oneline | wc -l | tr -d '[[:space:]]'`
|
||||
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
GIT_RELEASE="${PACKAGE_VERSION}-${GIT_BRANCH}-${GIT_NUM}-${GIT_TAG}"
|
||||
else
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+170
-127
@@ -76,7 +76,7 @@ static char *_jsonFilePath = NULL; /**< JSON file path */
|
||||
#ifdef HAVE_JSON_C
|
||||
static json_object *jArray_known_flows, *jArray_unknown_flows;
|
||||
#endif
|
||||
static u_int8_t live_capture = 0, full_http_dissection = 0;
|
||||
static u_int8_t live_capture = 0;
|
||||
static u_int8_t undetected_flows_deleted = 0;
|
||||
/**
|
||||
* User preferences
|
||||
@@ -84,7 +84,7 @@ static u_int8_t undetected_flows_deleted = 0;
|
||||
static u_int8_t enable_protocol_guess = 1, verbose = 0, nDPI_traceLevel = 0, json_flag = 0;
|
||||
static u_int16_t decode_tunnels = 0;
|
||||
static u_int16_t num_loops = 1;
|
||||
static u_int8_t shutdown_app = 0, quiet_mode = 0;
|
||||
static u_int8_t shutdown_app = 0, quiet_mode = 0;
|
||||
static u_int8_t num_threads = 1;
|
||||
static u_int32_t current_ndpi_memory = 0, max_ndpi_memory = 0;
|
||||
#ifdef linux
|
||||
@@ -176,7 +176,7 @@ typedef struct ndpi_flow {
|
||||
u_int32_t packets;
|
||||
|
||||
// result only, not used for flow identification
|
||||
u_int32_t detected_protocol;
|
||||
ndpi_protocol detected_protocol;
|
||||
|
||||
char host_server_name[256];
|
||||
|
||||
@@ -307,14 +307,14 @@ static void parseOptions(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 'q':
|
||||
quiet_mode = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
help(0);
|
||||
quiet_mode = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
help(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// check parameters
|
||||
if(_pcap_file[0] == NULL || strcmp(_pcap_file[0], "") == 0) {
|
||||
@@ -418,6 +418,9 @@ static char* ipProto2Name(u_short proto_id) {
|
||||
case IPPROTO_ICMP:
|
||||
return("ICMP");
|
||||
break;
|
||||
case IPPROTO_ICMPV6:
|
||||
return("ICMPV6");
|
||||
break;
|
||||
case 112:
|
||||
return("VRRP");
|
||||
break;
|
||||
@@ -470,34 +473,45 @@ static void printFlow(u_int16_t thread_id, struct ndpi_flow *flow) {
|
||||
#ifdef HAVE_JSON_C
|
||||
json_object *jObj;
|
||||
#endif
|
||||
FILE *out = results_file ? results_file : stdout;
|
||||
|
||||
if(!json_flag) {
|
||||
#if 0
|
||||
printf("\t%s [VLAN: %u] %s:%u <-> %s:%u\n",
|
||||
fprintf(out, "\t%s [VLAN: %u] %s:%u <-> %s:%u\n",
|
||||
ipProto2Name(flow->protocol), flow->vlan_id,
|
||||
flow->lower_name, ntohs(flow->lower_port),
|
||||
flow->upper_name, ntohs(flow->upper_port));
|
||||
|
||||
#else
|
||||
printf("\t%u", ++num_flows);
|
||||
fprintf(out, "\t%u", ++num_flows);
|
||||
|
||||
printf("\t%s %s:%u <-> %s:%u ",
|
||||
fprintf(out, "\t%s %s:%u <-> %s:%u ",
|
||||
ipProto2Name(flow->protocol),
|
||||
flow->lower_name, ntohs(flow->lower_port),
|
||||
flow->upper_name, ntohs(flow->upper_port));
|
||||
|
||||
if(flow->vlan_id > 0) printf("[VLAN: %u]", flow->vlan_id);
|
||||
if(flow->vlan_id > 0) fprintf(out, "[VLAN: %u]", flow->vlan_id);
|
||||
|
||||
printf("[proto: %u/%s][%u pkts/%llu bytes]",
|
||||
flow->detected_protocol,
|
||||
ndpi_get_proto_name(ndpi_thread_info[thread_id].ndpi_struct, flow->detected_protocol),
|
||||
if(flow->detected_protocol.master_protocol) {
|
||||
char buf[64];
|
||||
|
||||
fprintf(out, "[proto: %u.%u/%s]",
|
||||
flow->detected_protocol.master_protocol, flow->detected_protocol.protocol,
|
||||
ndpi_protocol2name(ndpi_thread_info[thread_id].ndpi_struct,
|
||||
flow->detected_protocol, buf, sizeof(buf)));
|
||||
} else
|
||||
fprintf(out, "[proto: %u/%s]",
|
||||
flow->detected_protocol.protocol,
|
||||
ndpi_get_proto_name(ndpi_thread_info[thread_id].ndpi_struct, flow->detected_protocol.protocol));
|
||||
|
||||
fprintf(out, "[%u pkts/%llu bytes]",
|
||||
flow->packets, (long long unsigned int)flow->bytes);
|
||||
|
||||
if(flow->host_server_name[0] != '\0') printf("[Host: %s]", flow->host_server_name);
|
||||
if(flow->ssl.client_certificate[0] != '\0') printf("[SSL client: %s]", flow->ssl.client_certificate);
|
||||
if(flow->ssl.server_certificate[0] != '\0') printf("[SSL server: %s]", flow->ssl.server_certificate);
|
||||
if(flow->host_server_name[0] != '\0') fprintf(out, "[Host: %s]", flow->host_server_name);
|
||||
if(flow->ssl.client_certificate[0] != '\0') fprintf(out, "[SSL client: %s]", flow->ssl.client_certificate);
|
||||
if(flow->ssl.server_certificate[0] != '\0') fprintf(out, "[SSL server: %s]", flow->ssl.server_certificate);
|
||||
|
||||
printf("\n");
|
||||
fprintf(out, "\n");
|
||||
#endif
|
||||
} else {
|
||||
#ifdef HAVE_JSON_C
|
||||
@@ -508,8 +522,26 @@ static void printFlow(u_int16_t thread_id, struct ndpi_flow *flow) {
|
||||
json_object_object_add(jObj,"host_a.port",json_object_new_int(ntohs(flow->lower_port)));
|
||||
json_object_object_add(jObj,"host_b.name",json_object_new_string(flow->upper_name));
|
||||
json_object_object_add(jObj,"host_n.port",json_object_new_int(ntohs(flow->upper_port)));
|
||||
json_object_object_add(jObj,"detected.protocol",json_object_new_int(flow->detected_protocol));
|
||||
json_object_object_add(jObj,"detected.protocol.name",json_object_new_string(ndpi_get_proto_name(ndpi_thread_info[thread_id].ndpi_struct, flow->detected_protocol)));
|
||||
|
||||
if(flow->detected_protocol.master_protocol)
|
||||
json_object_object_add(jObj,"detected.masterprotocol",json_object_new_int(flow->detected_protocol.master_protocol));
|
||||
|
||||
json_object_object_add(jObj,"detected.protocol",json_object_new_int(flow->detected_protocol.protocol));
|
||||
|
||||
if(flow->detected_protocol.master_protocol) {
|
||||
char tmp[256];
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%s.%s",
|
||||
ndpi_get_proto_name(ndpi_thread_info[thread_id].ndpi_struct, flow->detected_protocol.master_protocol),
|
||||
ndpi_get_proto_name(ndpi_thread_info[thread_id].ndpi_struct, flow->detected_protocol.protocol));
|
||||
|
||||
json_object_object_add(jObj,"detected.protocol.name",
|
||||
json_object_new_string(tmp));
|
||||
} else
|
||||
json_object_object_add(jObj,"detected.protocol.name",
|
||||
json_object_new_string(ndpi_get_proto_name(ndpi_thread_info[thread_id].ndpi_struct,
|
||||
flow->detected_protocol.protocol)));
|
||||
|
||||
json_object_object_add(jObj,"packets",json_object_new_int(flow->packets));
|
||||
json_object_object_add(jObj,"bytes",json_object_new_int(flow->bytes));
|
||||
|
||||
@@ -543,6 +575,7 @@ static void free_ndpi_flow(struct ndpi_flow *flow) {
|
||||
if(flow->ndpi_flow) { ndpi_free_flow(flow->ndpi_flow); flow->ndpi_flow = NULL; }
|
||||
if(flow->src_id) { ndpi_free(flow->src_id); flow->src_id = NULL; }
|
||||
if(flow->dst_id) { ndpi_free(flow->dst_id); flow->dst_id = NULL; }
|
||||
|
||||
}
|
||||
|
||||
/* ***************************************************** */
|
||||
@@ -560,7 +593,7 @@ static void node_print_unknown_proto_walker(const void *node, ndpi_VISIT which,
|
||||
struct ndpi_flow *flow = *(struct ndpi_flow**)node;
|
||||
u_int16_t thread_id = *((u_int16_t*)user_data);
|
||||
|
||||
if(flow->detected_protocol != 0 /* UNKNOWN */) return;
|
||||
if(flow->detected_protocol.protocol != NDPI_PROTOCOL_UNKNOWN) return;
|
||||
|
||||
if((which == ndpi_preorder) || (which == ndpi_leaf)) /* Avoid walking the same node multiple times */
|
||||
printFlow(thread_id, flow);
|
||||
@@ -572,7 +605,7 @@ static void node_print_known_proto_walker(const void *node, ndpi_VISIT which, in
|
||||
struct ndpi_flow *flow = *(struct ndpi_flow**)node;
|
||||
u_int16_t thread_id = *((u_int16_t*)user_data);
|
||||
|
||||
if(flow->detected_protocol == 0 /* UNKNOWN */) return;
|
||||
if(flow->detected_protocol.protocol == NDPI_PROTOCOL_UNKNOWN) return;
|
||||
|
||||
if((which == ndpi_preorder) || (which == ndpi_leaf)) /* Avoid walking the same node multiple times */
|
||||
printFlow(thread_id, flow);
|
||||
@@ -580,8 +613,7 @@ static void node_print_known_proto_walker(const void *node, ndpi_VISIT which, in
|
||||
|
||||
/* ***************************************************** */
|
||||
|
||||
static unsigned int node_guess_undetected_protocol(u_int16_t thread_id,
|
||||
struct ndpi_flow *flow) {
|
||||
static u_int16_t node_guess_undetected_protocol(u_int16_t thread_id, struct ndpi_flow *flow) {
|
||||
flow->detected_protocol = ndpi_guess_undetected_protocol(ndpi_thread_info[thread_id].ndpi_struct,
|
||||
flow->protocol,
|
||||
ntohl(flow->lower_ip),
|
||||
@@ -589,10 +621,10 @@ static unsigned int node_guess_undetected_protocol(u_int16_t thread_id,
|
||||
ntohl(flow->upper_ip),
|
||||
ntohs(flow->upper_port));
|
||||
// printf("Guess state: %u\n", flow->detected_protocol);
|
||||
if(flow->detected_protocol != 0)
|
||||
if(flow->detected_protocol.protocol != NDPI_PROTOCOL_UNKNOWN)
|
||||
ndpi_thread_info[thread_id].stats.guessed_flow_protocols++;
|
||||
|
||||
return flow->detected_protocol;
|
||||
return(flow->detected_protocol.protocol);
|
||||
}
|
||||
|
||||
/* ***************************************************** */
|
||||
@@ -613,15 +645,15 @@ static void node_proto_guess_walker(const void *node, ndpi_VISIT which, int dept
|
||||
|
||||
if((which == ndpi_preorder) || (which == ndpi_leaf)) { /* Avoid walking the same node multiple times */
|
||||
if(enable_protocol_guess) {
|
||||
if(flow->detected_protocol == 0 /* UNKNOWN */) {
|
||||
if(flow->detected_protocol.protocol == NDPI_PROTOCOL_UNKNOWN) {
|
||||
node_guess_undetected_protocol(thread_id, flow);
|
||||
// printFlow(thread_id, flow);
|
||||
}
|
||||
}
|
||||
|
||||
ndpi_thread_info[thread_id].stats.protocol_counter[flow->detected_protocol] += flow->packets;
|
||||
ndpi_thread_info[thread_id].stats.protocol_counter_bytes[flow->detected_protocol] += flow->bytes;
|
||||
ndpi_thread_info[thread_id].stats.protocol_flows[flow->detected_protocol]++;
|
||||
ndpi_thread_info[thread_id].stats.protocol_counter[flow->detected_protocol.protocol] += flow->packets;
|
||||
ndpi_thread_info[thread_id].stats.protocol_counter_bytes[flow->detected_protocol.protocol] += flow->bytes;
|
||||
ndpi_thread_info[thread_id].stats.protocol_flows[flow->detected_protocol.protocol]++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,7 +672,7 @@ static void node_idle_scan_walker(const void *node, ndpi_VISIT which, int depth,
|
||||
/* update stats */
|
||||
node_proto_guess_walker(node, which, depth, user_data);
|
||||
|
||||
if (flow->detected_protocol == 0 /* UNKNOWN */ && !undetected_flows_deleted)
|
||||
if((flow->detected_protocol.protocol == NDPI_PROTOCOL_UNKNOWN) && !undetected_flows_deleted)
|
||||
undetected_flows_deleted = 1;
|
||||
|
||||
free_ndpi_flow(flow);
|
||||
@@ -814,18 +846,21 @@ static struct ndpi_flow *get_ndpi_flow(u_int16_t thread_id,
|
||||
|
||||
if((newflow->ndpi_flow = malloc_wrapper(size_flow_struct)) == NULL) {
|
||||
printf("[NDPI] %s(2): not enough memory\n", __FUNCTION__);
|
||||
free(newflow);
|
||||
return(NULL);
|
||||
} else
|
||||
memset(newflow->ndpi_flow, 0, size_flow_struct);
|
||||
|
||||
if((newflow->src_id = malloc_wrapper(size_id_struct)) == NULL) {
|
||||
printf("[NDPI] %s(3): not enough memory\n", __FUNCTION__);
|
||||
free(newflow);
|
||||
return(NULL);
|
||||
} else
|
||||
memset(newflow->src_id, 0, size_id_struct);
|
||||
|
||||
if((newflow->dst_id = malloc_wrapper(size_id_struct)) == NULL) {
|
||||
printf("[NDPI] %s(4): not enough memory\n", __FUNCTION__);
|
||||
free(newflow);
|
||||
return(NULL);
|
||||
} else
|
||||
memset(newflow->dst_id, 0, size_id_struct);
|
||||
@@ -837,7 +872,7 @@ static struct ndpi_flow *get_ndpi_flow(u_int16_t thread_id,
|
||||
|
||||
// printFlow(thread_id, newflow);
|
||||
|
||||
return(newflow);
|
||||
return newflow ;
|
||||
}
|
||||
} else {
|
||||
struct ndpi_flow *flow = *(struct ndpi_flow**)ret;
|
||||
@@ -896,8 +931,7 @@ static void setupDetection(u_int16_t thread_id) {
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if(full_http_dissection)
|
||||
ndpi_thread_info[thread_id].ndpi_struct->http_dissect_response = 1;
|
||||
/* ndpi_thread_info[thread_id].ndpi_struct->http_dont_dissect_response = 1; */
|
||||
|
||||
// enable all protocols
|
||||
NDPI_BITMASK_SET_ALL(all);
|
||||
@@ -942,7 +976,6 @@ static unsigned int packet_processing(u_int16_t thread_id,
|
||||
struct ndpi_id_struct *src, *dst;
|
||||
struct ndpi_flow *flow;
|
||||
struct ndpi_flow_struct *ndpi_flow = NULL;
|
||||
u_int32_t protocol = 0;
|
||||
u_int8_t proto;
|
||||
|
||||
if(iph)
|
||||
@@ -964,55 +997,57 @@ static unsigned int packet_processing(u_int16_t thread_id,
|
||||
|
||||
if(flow->detection_completed) return(0);
|
||||
|
||||
protocol = (const u_int32_t)ndpi_detection_process_packet(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow,
|
||||
iph ? (uint8_t *)iph : (uint8_t *)iph6,
|
||||
ipsize, time, src, dst);
|
||||
flow->detected_protocol = ndpi_detection_process_packet(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow,
|
||||
iph ? (uint8_t *)iph : (uint8_t *)iph6,
|
||||
ipsize, time, src, dst);
|
||||
|
||||
flow->detected_protocol = protocol;
|
||||
|
||||
if((flow->detected_protocol != NDPI_PROTOCOL_UNKNOWN)
|
||||
if((flow->detected_protocol.protocol != NDPI_PROTOCOL_UNKNOWN)
|
||||
|| ((proto == IPPROTO_UDP) && (flow->packets > 8))
|
||||
|| ((proto == IPPROTO_TCP) && (flow->packets > 10))) {
|
||||
flow->detection_completed = 1;
|
||||
|
||||
if((flow->detected_protocol.protocol == NDPI_PROTOCOL_UNKNOWN) && (ndpi_flow->num_stun_udp_pkts > 0))
|
||||
ndpi_set_detected_protocol(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow, NDPI_PROTOCOL_STUN, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
snprintf(flow->host_server_name, sizeof(flow->host_server_name), "%s", flow->ndpi_flow->host_server_name);
|
||||
|
||||
if((proto == IPPROTO_TCP) && (flow->detected_protocol != NDPI_PROTOCOL_DNS)) {
|
||||
if((proto == IPPROTO_TCP) && (flow->detected_protocol.protocol != NDPI_PROTOCOL_DNS)) {
|
||||
snprintf(flow->ssl.client_certificate, sizeof(flow->ssl.client_certificate), "%s", flow->ndpi_flow->protos.ssl.client_certificate);
|
||||
snprintf(flow->ssl.server_certificate, sizeof(flow->ssl.server_certificate), "%s", flow->ndpi_flow->protos.ssl.server_certificate);
|
||||
}
|
||||
|
||||
if((
|
||||
(flow->detected_protocol == NDPI_PROTOCOL_HTTP)
|
||||
|| (flow->detected_protocol == NDPI_SERVICE_FACEBOOK)
|
||||
)
|
||||
&& full_http_dissection) {
|
||||
char *method;
|
||||
#if 0
|
||||
if(verbose > 1) {
|
||||
if(ndpi_is_proto(flow->detected_protocol, NDPI_PROTOCOL_HTTP)) {
|
||||
char *method;
|
||||
|
||||
printf("[URL] %s\n", ndpi_get_http_url(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow));
|
||||
printf("[Content-Type] %s\n", ndpi_get_http_content_type(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow));
|
||||
printf("[URL] %s\n", ndpi_get_http_url(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow));
|
||||
printf("[Content-Type] %s\n", ndpi_get_http_content_type(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow));
|
||||
|
||||
switch(ndpi_get_http_method(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow)) {
|
||||
case HTTP_METHOD_OPTIONS: method = "HTTP_METHOD_OPTIONS"; break;
|
||||
case HTTP_METHOD_GET: method = "HTTP_METHOD_GET"; break;
|
||||
case HTTP_METHOD_HEAD: method = "HTTP_METHOD_HEAD"; break;
|
||||
case HTTP_METHOD_POST: method = "HTTP_METHOD_POST"; break;
|
||||
case HTTP_METHOD_PUT: method = "HTTP_METHOD_PUT"; break;
|
||||
case HTTP_METHOD_DELETE: method = "HTTP_METHOD_DELETE"; break;
|
||||
case HTTP_METHOD_TRACE: method = "HTTP_METHOD_TRACE"; break;
|
||||
case HTTP_METHOD_CONNECT: method = "HTTP_METHOD_CONNECT"; break;
|
||||
default: method = "HTTP_METHOD_UNKNOWN"; break;
|
||||
switch(ndpi_get_http_method(ndpi_thread_info[thread_id].ndpi_struct, ndpi_flow)) {
|
||||
case HTTP_METHOD_OPTIONS: method = "HTTP_METHOD_OPTIONS"; break;
|
||||
case HTTP_METHOD_GET: method = "HTTP_METHOD_GET"; break;
|
||||
case HTTP_METHOD_HEAD: method = "HTTP_METHOD_HEAD"; break;
|
||||
case HTTP_METHOD_POST: method = "HTTP_METHOD_POST"; break;
|
||||
case HTTP_METHOD_PUT: method = "HTTP_METHOD_PUT"; break;
|
||||
case HTTP_METHOD_DELETE: method = "HTTP_METHOD_DELETE"; break;
|
||||
case HTTP_METHOD_TRACE: method = "HTTP_METHOD_TRACE"; break;
|
||||
case HTTP_METHOD_CONNECT: method = "HTTP_METHOD_CONNECT"; break;
|
||||
default: method = "HTTP_METHOD_UNKNOWN"; break;
|
||||
}
|
||||
|
||||
printf("[Method] %s\n", method);
|
||||
}
|
||||
|
||||
printf("[Method] %s\n", method);
|
||||
}
|
||||
#endif
|
||||
|
||||
free_ndpi_flow(flow);
|
||||
|
||||
if(verbose > 1) {
|
||||
if(enable_protocol_guess) {
|
||||
if(flow->detected_protocol == 0 /* UNKNOWN */) {
|
||||
protocol = node_guess_undetected_protocol(thread_id, flow);
|
||||
if(flow->detected_protocol.protocol == NDPI_PROTOCOL_UNKNOWN) {
|
||||
flow->detected_protocol.protocol = node_guess_undetected_protocol(thread_id, flow),
|
||||
flow->detected_protocol.master_protocol = NDPI_PROTOCOL_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1134,7 +1169,7 @@ static void printResults(u_int64_t tot_usec) {
|
||||
int thread_id;
|
||||
char buf[32];
|
||||
#ifdef HAVE_JSON_C
|
||||
FILE *json_fp;
|
||||
FILE *json_fp = NULL;
|
||||
json_object *jObj_main, *jObj_trafficStats, *jArray_detProto, *jObj;
|
||||
#endif
|
||||
long long unsigned int breed_stats[NUM_BREEDS] = { 0 };
|
||||
@@ -1174,63 +1209,65 @@ static void printResults(u_int64_t tot_usec) {
|
||||
}
|
||||
|
||||
if(!quiet_mode) {
|
||||
printf("\nnDPI Memory statistics:\n");
|
||||
printf("\tnDPI Memory (once): %-13s\n", formatBytes(sizeof(struct ndpi_detection_module_struct), buf, sizeof(buf)));
|
||||
printf("\tFlow Memory (per flow): %-13s\n", formatBytes(size_flow_struct, buf, sizeof(buf)));
|
||||
printf("\tActual Memory: %-13s\n", formatBytes(current_ndpi_memory, buf, sizeof(buf)));
|
||||
printf("\tPeak Memory: %-13s\n", formatBytes(max_ndpi_memory, buf, sizeof(buf)));
|
||||
printf("\nnDPI Memory statistics:\n");
|
||||
printf("\tnDPI Memory (once): %-13s\n", formatBytes(sizeof(struct ndpi_detection_module_struct), buf, sizeof(buf)));
|
||||
printf("\tFlow Memory (per flow): %-13s\n", formatBytes(size_flow_struct, buf, sizeof(buf)));
|
||||
printf("\tActual Memory: %-13s\n", formatBytes(current_ndpi_memory, buf, sizeof(buf)));
|
||||
printf("\tPeak Memory: %-13s\n", formatBytes(max_ndpi_memory, buf, sizeof(buf)));
|
||||
|
||||
if(!json_flag) {
|
||||
printf("\nTraffic statistics:\n");
|
||||
printf("\tEthernet bytes: %-13llu (includes ethernet CRC/IFC/trailer)\n",
|
||||
(long long unsigned int)cumulative_stats.total_wire_bytes);
|
||||
printf("\tDiscarded bytes: %-13llu\n",
|
||||
(long long unsigned int)cumulative_stats.total_discarded_bytes);
|
||||
printf("\tIP packets: %-13llu of %llu packets total\n",
|
||||
(long long unsigned int)cumulative_stats.ip_packet_count,
|
||||
(long long unsigned int)cumulative_stats.raw_packet_count);
|
||||
/* In order to prevent Floating point exception in case of no traffic*/
|
||||
if(cumulative_stats.total_ip_bytes && cumulative_stats.raw_packet_count)
|
||||
avg_pkt_size = (unsigned int)(cumulative_stats.total_ip_bytes/cumulative_stats.raw_packet_count);
|
||||
printf("\tIP bytes: %-13llu (avg pkt size %u bytes)\n",
|
||||
(long long unsigned int)cumulative_stats.total_ip_bytes,avg_pkt_size);
|
||||
printf("\tUnique flows: %-13u\n", cumulative_stats.ndpi_flow_count);
|
||||
if(!json_flag) {
|
||||
printf("\nTraffic statistics:\n");
|
||||
printf("\tEthernet bytes: %-13llu (includes ethernet CRC/IFC/trailer)\n",
|
||||
(long long unsigned int)cumulative_stats.total_wire_bytes);
|
||||
printf("\tDiscarded bytes: %-13llu\n",
|
||||
(long long unsigned int)cumulative_stats.total_discarded_bytes);
|
||||
printf("\tIP packets: %-13llu of %llu packets total\n",
|
||||
(long long unsigned int)cumulative_stats.ip_packet_count,
|
||||
(long long unsigned int)cumulative_stats.raw_packet_count);
|
||||
/* In order to prevent Floating point exception in case of no traffic*/
|
||||
if(cumulative_stats.total_ip_bytes && cumulative_stats.raw_packet_count)
|
||||
avg_pkt_size = (unsigned int)(cumulative_stats.total_ip_bytes/cumulative_stats.raw_packet_count);
|
||||
printf("\tIP bytes: %-13llu (avg pkt size %u bytes)\n",
|
||||
(long long unsigned int)cumulative_stats.total_ip_bytes,avg_pkt_size);
|
||||
printf("\tUnique flows: %-13u\n", cumulative_stats.ndpi_flow_count);
|
||||
|
||||
printf("\tTCP Packets: %-13lu\n", (unsigned long)cumulative_stats.tcp_count);
|
||||
printf("\tUDP Packets: %-13lu\n", (unsigned long)cumulative_stats.udp_count);
|
||||
printf("\tVLAN Packets: %-13lu\n", (unsigned long)cumulative_stats.vlan_count);
|
||||
printf("\tMPLS Packets: %-13lu\n", (unsigned long)cumulative_stats.mpls_count);
|
||||
printf("\tPPPoE Packets: %-13lu\n", (unsigned long)cumulative_stats.pppoe_count);
|
||||
printf("\tFragmented Packets: %-13lu\n", (unsigned long)cumulative_stats.fragmented_count);
|
||||
printf("\tMax Packet size: %-13u\n", cumulative_stats.max_packet_len);
|
||||
printf("\tPacket Len < 64: %-13lu\n", (unsigned long)cumulative_stats.packet_len[0]);
|
||||
printf("\tPacket Len 64-128: %-13lu\n", (unsigned long)cumulative_stats.packet_len[1]);
|
||||
printf("\tPacket Len 128-256: %-13lu\n", (unsigned long)cumulative_stats.packet_len[2]);
|
||||
printf("\tPacket Len 256-1024: %-13lu\n", (unsigned long)cumulative_stats.packet_len[3]);
|
||||
printf("\tPacket Len 1024-1500: %-13lu\n", (unsigned long)cumulative_stats.packet_len[4]);
|
||||
printf("\tPacket Len > 1500: %-13lu\n", (unsigned long)cumulative_stats.packet_len[5]);
|
||||
printf("\tTCP Packets: %-13lu\n", (unsigned long)cumulative_stats.tcp_count);
|
||||
printf("\tUDP Packets: %-13lu\n", (unsigned long)cumulative_stats.udp_count);
|
||||
printf("\tVLAN Packets: %-13lu\n", (unsigned long)cumulative_stats.vlan_count);
|
||||
printf("\tMPLS Packets: %-13lu\n", (unsigned long)cumulative_stats.mpls_count);
|
||||
printf("\tPPPoE Packets: %-13lu\n", (unsigned long)cumulative_stats.pppoe_count);
|
||||
printf("\tFragmented Packets: %-13lu\n", (unsigned long)cumulative_stats.fragmented_count);
|
||||
printf("\tMax Packet size: %-13u\n", cumulative_stats.max_packet_len);
|
||||
printf("\tPacket Len < 64: %-13lu\n", (unsigned long)cumulative_stats.packet_len[0]);
|
||||
printf("\tPacket Len 64-128: %-13lu\n", (unsigned long)cumulative_stats.packet_len[1]);
|
||||
printf("\tPacket Len 128-256: %-13lu\n", (unsigned long)cumulative_stats.packet_len[2]);
|
||||
printf("\tPacket Len 256-1024: %-13lu\n", (unsigned long)cumulative_stats.packet_len[3]);
|
||||
printf("\tPacket Len 1024-1500: %-13lu\n", (unsigned long)cumulative_stats.packet_len[4]);
|
||||
printf("\tPacket Len > 1500: %-13lu\n", (unsigned long)cumulative_stats.packet_len[5]);
|
||||
|
||||
if(tot_usec > 0) {
|
||||
char buf[32], buf1[32];
|
||||
float t = (float)(cumulative_stats.ip_packet_count*1000000)/(float)tot_usec;
|
||||
float b = (float)(cumulative_stats.total_wire_bytes * 8 *1000000)/(float)tot_usec;
|
||||
float traffic_duration;
|
||||
if (live_capture) traffic_duration = tot_usec;
|
||||
else traffic_duration = (pcap_end.tv_sec*1000000 + pcap_end.tv_usec) - (pcap_start.tv_sec*1000000 + pcap_start.tv_usec);
|
||||
printf("\tnDPI throughput: %s pps / %s/sec\n", formatPackets(t, buf), formatTraffic(b, 1, buf1));
|
||||
t = (float)(cumulative_stats.ip_packet_count*1000000)/(float)traffic_duration;
|
||||
b = (float)(cumulative_stats.total_wire_bytes * 8 *1000000)/(float)traffic_duration;
|
||||
printf("\tTraffic throughput: %s pps / %s/sec\n", formatPackets(t, buf), formatTraffic(b, 1, buf1));
|
||||
printf("\tTraffic duration: %.3f sec\n", traffic_duration/1000000);
|
||||
if(tot_usec > 0) {
|
||||
char buf[32], buf1[32];
|
||||
float t = (float)(cumulative_stats.ip_packet_count*1000000)/(float)tot_usec;
|
||||
float b = (float)(cumulative_stats.total_wire_bytes * 8 *1000000)/(float)tot_usec;
|
||||
float traffic_duration;
|
||||
if (live_capture) traffic_duration = tot_usec;
|
||||
else traffic_duration = (pcap_end.tv_sec*1000000 + pcap_end.tv_usec) - (pcap_start.tv_sec*1000000 + pcap_start.tv_usec);
|
||||
printf("\tnDPI throughput: %s pps / %s/sec\n", formatPackets(t, buf), formatTraffic(b, 1, buf1));
|
||||
t = (float)(cumulative_stats.ip_packet_count*1000000)/(float)traffic_duration;
|
||||
b = (float)(cumulative_stats.total_wire_bytes * 8 *1000000)/(float)traffic_duration;
|
||||
printf("\tTraffic throughput: %s pps / %s/sec\n", formatPackets(t, buf), formatTraffic(b, 1, buf1));
|
||||
printf("\tTraffic duration: %.3f sec\n", traffic_duration/1000000);
|
||||
}
|
||||
|
||||
if(enable_protocol_guess)
|
||||
printf("\tGuessed flow protos: %-13u\n", cumulative_stats.guessed_flow_protocols);
|
||||
}
|
||||
|
||||
if(enable_protocol_guess)
|
||||
printf("\tGuessed flow protos: %-13u\n", cumulative_stats.guessed_flow_protocols);
|
||||
}
|
||||
} else {
|
||||
|
||||
if(json_flag) {
|
||||
#ifdef HAVE_JSON_C
|
||||
if((json_fp = fopen(_jsonFilePath,"w")) == NULL) {
|
||||
printf("Error create .json file\n");
|
||||
printf("Error createing .json file %s\n", _jsonFilePath);
|
||||
json_flag = 0;
|
||||
} else {
|
||||
jObj_main = json_object_new_object();
|
||||
@@ -1287,15 +1324,17 @@ static void printResults(u_int64_t tot_usec) {
|
||||
cumulative_stats.protocol_flows[i]);
|
||||
} else {
|
||||
#ifdef HAVE_JSON_C
|
||||
jObj = json_object_new_object();
|
||||
if(json_fp) {
|
||||
jObj = json_object_new_object();
|
||||
|
||||
json_object_object_add(jObj,"name",json_object_new_string(ndpi_get_proto_name(ndpi_thread_info[0].ndpi_struct, i)));
|
||||
json_object_object_add(jObj,"breed",json_object_new_string(ndpi_get_proto_breed_name(ndpi_thread_info[0].ndpi_struct, breed)));
|
||||
json_object_object_add(jObj,"packets",json_object_new_int64(cumulative_stats.protocol_counter[i]));
|
||||
json_object_object_add(jObj,"bytes",json_object_new_int64(cumulative_stats.protocol_counter_bytes[i]));
|
||||
json_object_object_add(jObj,"flows",json_object_new_int(cumulative_stats.protocol_flows[i]));
|
||||
json_object_object_add(jObj,"name",json_object_new_string(ndpi_get_proto_name(ndpi_thread_info[0].ndpi_struct, i)));
|
||||
json_object_object_add(jObj,"breed",json_object_new_string(ndpi_get_proto_breed_name(ndpi_thread_info[0].ndpi_struct, breed)));
|
||||
json_object_object_add(jObj,"packets",json_object_new_int64(cumulative_stats.protocol_counter[i]));
|
||||
json_object_object_add(jObj,"bytes",json_object_new_int64(cumulative_stats.protocol_counter_bytes[i]));
|
||||
json_object_object_add(jObj,"flows",json_object_new_int(cumulative_stats.protocol_flows[i]));
|
||||
|
||||
json_object_array_add(jArray_detProto,jObj);
|
||||
json_object_array_add(jArray_detProto,jObj);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1318,7 +1357,9 @@ static void printResults(u_int64_t tot_usec) {
|
||||
// printf("\n\nTotal Flow Traffic: %llu (diff: %llu)\n", total_flow_bytes, cumulative_stats.total_ip_bytes-total_flow_bytes);
|
||||
|
||||
if(verbose) {
|
||||
if(!json_flag) printf("\n");
|
||||
FILE *out = results_file ? results_file : stdout;
|
||||
|
||||
if(!json_flag) fprintf(out, "\n");
|
||||
|
||||
num_flows = 0;
|
||||
for(thread_id = 0; thread_id < num_threads; thread_id++) {
|
||||
@@ -1329,7 +1370,9 @@ static void printResults(u_int64_t tot_usec) {
|
||||
for(thread_id = 0; thread_id < num_threads; thread_id++) {
|
||||
if(ndpi_thread_info[thread_id].stats.protocol_counter[0 /* 0 = Unknown */] > 0) {
|
||||
if(!json_flag) {
|
||||
printf("\n\nUndetected flows:%s\n", undetected_flows_deleted ? " (expired flows are not listed below)" : "");
|
||||
FILE *out = results_file ? results_file : stdout;
|
||||
|
||||
fprintf(out, "\n\nUndetected flows:%s\n", undetected_flows_deleted ? " (expired flows are not listed below)" : "");
|
||||
}
|
||||
|
||||
if(json_flag)
|
||||
|
||||
@@ -13,6 +13,12 @@ tcp:3000@ntop
|
||||
host:"googlesyndacation.com"@Google
|
||||
host:"venere.com"@Venere
|
||||
host:"kataweb.it",host:"repubblica.it"@Repubblica
|
||||
host:"ntop"@ntop
|
||||
# IP based Subprotocols
|
||||
# Format:
|
||||
# ip:<value>,ip:<value>,.....@<subproto>
|
||||
|
||||
ip:213.75.170.11@CustomProtocol
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -25,3 +25,6 @@ ndpi_get_http_content_type
|
||||
ndpi_free_flow
|
||||
ndpi_get_proto_breed
|
||||
ndpi_get_proto_breed_name
|
||||
ndpi_get_proto_by_id
|
||||
ndpi_get_protocol_id_master_proto
|
||||
ndpi_guess_protocol_id
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
require "formula"
|
||||
|
||||
class Ndpi < Formula
|
||||
desc "Deep Packet Inspection (DPI) library"
|
||||
homepage "http://www.ntop.org/products/ndpi/"
|
||||
url "https://downloads.sourceforge.net/project/ntop/nDPI/libndpi-1.5.1.tar.gz"
|
||||
sha1 "0a6ed585545ab6611f3f0ac9efd9eb36bb5481dd"
|
||||
url "https://downloads.sourceforge.net/project/ntop/nDPI/nDPI-1.7.tar.gz"
|
||||
sha256 "714b745103a072462130b0e14cf31b2eb5270f580b7c839da5cf5ea75150262d"
|
||||
|
||||
bottle do
|
||||
cellar :any
|
||||
sha256 "e9464d314479ba3e7a91422e0bc606cfd5f6e72e94d6441cc4fa30e9c925da5c" => :yosemite
|
||||
sha256 "1d6b1d860669b42766baa276ed948c342e2fa4fd28663ba64a90fd0e200ba9c4" => :mavericks
|
||||
sha256 "b814918b4fb9588de7126061ce4ac3eb41a5c3eee27c7432b669f6dc6921bfde" => :mountain_lion
|
||||
end
|
||||
|
||||
depends_on "autoconf" => :build
|
||||
depends_on "automake" => :build
|
||||
@@ -12,12 +18,13 @@ class Ndpi < Formula
|
||||
depends_on "json-c"
|
||||
|
||||
def install
|
||||
system "./configure","--prefix=#{prefix}"
|
||||
system "./autogen.sh"
|
||||
system "./configure", "--prefix=#{prefix}"
|
||||
system "make"
|
||||
system "make", "install"
|
||||
end
|
||||
|
||||
test do
|
||||
system "#{bin}/ndpiReader","-h"
|
||||
system "#{bin}/ndpiReader", "-i", test_fixtures("test.pcap")
|
||||
end
|
||||
end
|
||||
|
||||
+20
-15
@@ -123,14 +123,16 @@ extern "C" {
|
||||
* @param dst void pointer to the destination subscriber state machine
|
||||
* @return returns the detected ID of the protocol
|
||||
*/
|
||||
unsigned int
|
||||
ndpi_detection_process_packet(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
const unsigned char *packet,
|
||||
const unsigned short packetlen,
|
||||
const u_int64_t current_tick,
|
||||
struct ndpi_id_struct *src,
|
||||
struct ndpi_id_struct *dst);
|
||||
ndpi_protocol ndpi_detection_process_packet(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
const unsigned char *packet,
|
||||
const unsigned short packetlen,
|
||||
const u_int64_t current_tick,
|
||||
struct ndpi_id_struct *src,
|
||||
struct ndpi_id_struct *dst);
|
||||
|
||||
u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow);
|
||||
|
||||
#define NDPI_DETECTION_ONLY_IPV4 ( 1 << 0 )
|
||||
#define NDPI_DETECTION_ONLY_IPV6 ( 1 << 1 )
|
||||
@@ -155,7 +157,7 @@ extern "C" {
|
||||
* @param ndpi_struct the detection module
|
||||
* @return the protocol id of the last real protocol found in the protocol history of the flow
|
||||
*/
|
||||
u_int16_t ndpi_detection_get_real_protocol_of_flow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
/* u_int16_t ndpi_detection_get_real_protocol_of_flow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); */
|
||||
|
||||
/**
|
||||
* returns true if the protocol history of the flow of the last packet given to the detection
|
||||
@@ -167,17 +169,20 @@ extern "C" {
|
||||
u_int8_t ndpi_detection_flow_protocol_history_contains_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t protocol_id);
|
||||
unsigned int ndpi_find_port_based_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t proto, u_int32_t shost, u_int16_t sport, u_int32_t dhost, u_int16_t dport);
|
||||
unsigned int ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
ndpi_protocol ndpi_find_port_based_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t proto, u_int32_t shost, u_int16_t sport, u_int32_t dhost, u_int16_t dport);
|
||||
int ndpi_match_string_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, char *string_to_match, u_int string_to_match_len);
|
||||
ndpi_protocol ndpi_guess_undetected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t proto, u_int32_t shost, u_int16_t sport, u_int32_t dhost, u_int16_t dport);
|
||||
int ndpi_match_host_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, char *string_to_match, u_int string_to_match_len,
|
||||
u_int16_t master_protocol_id);
|
||||
int ndpi_match_content_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
char *string_to_match, u_int string_to_match_len);
|
||||
char *string_to_match, u_int string_to_match_len,
|
||||
u_int16_t master_protocol_id);
|
||||
int ndpi_match_bigram(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
ndpi_automa *automa, char *bigram_to_match);
|
||||
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol proto, char *buf, u_int buf_len);
|
||||
char* ndpi_get_proto_name(struct ndpi_detection_module_struct *mod, u_int16_t proto_id);
|
||||
ndpi_protocol_breed_t ndpi_get_proto_breed(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t proto);
|
||||
char* ndpi_get_proto_breed_name(struct ndpi_detection_module_struct *ndpi_struct, ndpi_protocol_breed_t breed_id);
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
/**********************
|
||||
* detection features *
|
||||
**********************/
|
||||
#define NDPI_SELECT_DETECTION_WITH_REAL_PROTOCOL ( 1 << 0 )
|
||||
/* #define NDPI_SELECT_DETECTION_WITH_REAL_PROTOCOL ( 1 << 0 ) */
|
||||
|
||||
#define NDPI_DIRECTCONNECT_CONNECTION_IP_TICK_TIMEOUT 600
|
||||
#define NDPI_IRC_CONNECTION_TIMEOUT 120
|
||||
|
||||
+12
-8
@@ -98,9 +98,10 @@ u_int64_t ndpi_bytestream_dec_or_hex_to_number64(const u_int8_t * str, u_int16_t
|
||||
u_int32_t ndpi_bytestream_to_ipv4(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
|
||||
|
||||
|
||||
void ndpi_int_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t detected_protocol, ndpi_protocol_type_t protocol_type);
|
||||
void ndpi_set_detected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
|
||||
|
||||
/* function to parse a packet which has line based information into a line based structure
|
||||
@@ -112,11 +113,12 @@ extern void ndpi_parse_packet_line_info_any(struct ndpi_detection_module_struct
|
||||
extern u_int16_t ndpi_check_for_email_address(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int16_t counter);
|
||||
extern void ndpi_int_change_packet_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t detected_protocol, ndpi_protocol_type_t protocol_type);
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
extern void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int16_t detected_protocol,
|
||||
ndpi_protocol_type_t protocol_type);
|
||||
u_int16_t upper_detected_protocol,
|
||||
u_int16_t lower_detected_protocol);
|
||||
extern void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
ndpi_protocol_breed_t protoBreed, u_int16_t protoId,
|
||||
u_int16_t tcp_alias_protoId[2], u_int16_t udp_alias_protoId[2],
|
||||
@@ -134,6 +136,8 @@ extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *
|
||||
extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id);
|
||||
extern u_int16_t ndpi_guess_protocol_id(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t proto, u_int16_t sport, u_int16_t dport);
|
||||
extern u_int8_t ndpi_is_proto(ndpi_protocol p, u_int16_t proto);
|
||||
extern u_int16_t ndpi_get_lower_proto(ndpi_protocol p);
|
||||
extern int ndpi_get_protocol_id_master_proto(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int16_t protocol_id,
|
||||
u_int16_t** tcp_master_proto,
|
||||
@@ -147,8 +151,8 @@ extern u_int8_t ndpi_ips_match(u_int32_t src, u_int32_t dst,
|
||||
u_int32_t net, u_int32_t num_bits);
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const char **file, const char **func, u_int32_t * line);
|
||||
void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const char **file, const char **func, u_int32_t * line);
|
||||
#endif
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define __NDPI_PROTOCOLS_DEFAULT_H__
|
||||
|
||||
#define NDPI_DETECTION_SUPPORT_IPV6
|
||||
#define NDPI_PROTOCOL_HISTORY_SIZE 3
|
||||
#define NDPI_PROTOCOL_HISTORY_SIZE 2
|
||||
|
||||
#define NDPI_PROTOCOL_UNKNOWN 0
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
#define NDPI_PROTOCOL_WEBEX 141
|
||||
#define NDPI_PROTOCOL_VIBER 144
|
||||
#define NDPI_PROTOCOL_RADIUS 146
|
||||
#define NDPI_PROTOCOL_WINDOWS_UPDATE 147 /* Thierry Laurion */
|
||||
#define NDPI_SERVICE_WINDOWS_UPDATE 147
|
||||
#define NDPI_PROTOCOL_TEAMVIEWER 148 /* xplico.org */
|
||||
#define NDPI_PROTOCOL_LOTUS_NOTES 150
|
||||
#define NDPI_PROTOCOL_SAP 151
|
||||
@@ -198,7 +198,9 @@
|
||||
#define NDPI_PROTOCOL_VHUA 184
|
||||
#define NDPI_PROTOCOL_TELEGRAM 185 /* Gianluca Costa <g.costa@xplico.org> */
|
||||
#define NDPI_PROTOCOL_QUIC 188 /* Andrea Buscarinu <andrea.buscarinu@gmail.com> - Michele Campus <michelecampus5@gmail.com> */
|
||||
|
||||
#define NDPI_PROTOCOL_WHATSAPP_VOICE 189
|
||||
#define NDPI_PROTOCOL_STARCRAFT 213 /* Matteo Bracci <matteobracci1@gmail.com> */
|
||||
#define NDPI_PROTOCOL_TEREDO 214
|
||||
|
||||
#define NDPI_CONTENT_AVI 39
|
||||
#define NDPI_CONTENT_FLASH 40
|
||||
@@ -219,7 +221,7 @@
|
||||
#define NDPI_SERVICE_GOOGLE 126
|
||||
#define NDPI_SERVICE_NETFLIX 133
|
||||
#define NDPI_SERVICE_LASTFM 134
|
||||
#define NDPI_SERVICE_GROOVESHARK 135
|
||||
#define NDPI_SERVICE_WAZE 135
|
||||
#define NDPI_SERVICE_APPLE 140
|
||||
#define NDPI_SERVICE_WHATSAPP 142
|
||||
#define NDPI_SERVICE_APPLE_ICLOUD 143
|
||||
@@ -235,10 +237,34 @@
|
||||
#define NDPI_SERVICE_VIBER NDPI_PROTOCOL_VIBER /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_YAHOO NDPI_PROTOCOL_YAHOO /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
#define NDPI_SERVICE_PANDORA 187
|
||||
#define NDPI_PROTOCOL_EAQ 190
|
||||
#define NDPI_SERVICE_TIMMEU 191
|
||||
#define NDPI_SERVICE_TORCEDOR 192
|
||||
#define NDPI_SERVICE_KAKAOTALK 193 /* KakaoTalk Chat (no voice call) */
|
||||
#define NDPI_SERVICE_KAKAOTALK_VOICE 194 /* KakaoTalk Voice */
|
||||
#define NDPI_SERVICE_TWITCH 195 /* Edoardo Dominici <edoaramis@gmail.com> */
|
||||
#define NDPI_SERVICE_QUICKPLAY 196 /* Streaming service used by various services such as hooq.tv */
|
||||
#define NDPI_SERVICE_TIM 197 /* Traffic for tim.com.br and tim.it */
|
||||
#define NDPI_PROTOCOL_MPEGTS 198
|
||||
#define NDPI_SERVICE_SNAPCHAT 199
|
||||
#define NDPI_SERVICE_SIMET 200
|
||||
#define NDPI_SERVICE_OPENSIGNAL 201
|
||||
#define NDPI_SERVICE_99TAXI 202
|
||||
#define NDPI_SERVICE_EASYTAXI 203
|
||||
#define NDPI_SERVICE_GLOBOTV 204
|
||||
#define NDPI_SERVICE_TIMSOMDECHAMADA 205
|
||||
#define NDPI_SERVICE_TIMMENU 206
|
||||
#define NDPI_SERVICE_TIMPORTASABERTAS 207
|
||||
#define NDPI_SERVICE_TIMRECARGA 208
|
||||
#define NDPI_SERVICE_TIMBETA 209
|
||||
#define NDPI_SERVICE_DEEZER 210
|
||||
#define NDPI_SERVICE_INSTAGRAM 211 /* Andrea Buscarinu <andrea.buscarinu@gmail.com> */
|
||||
#define NDPI_SERVICE_MICROSOFT 212
|
||||
#define NDPI_SERVICE_HOTSPOT_SHIELD 215
|
||||
|
||||
/* UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE (NDPI_PROTOCOL_QUIC) */
|
||||
#define NDPI_LAST_IMPLEMENTED_PROTOCOL 188
|
||||
/* UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE */
|
||||
#define NDPI_LAST_IMPLEMENTED_PROTOCOL NDPI_SERVICE_HOTSPOT_SHIELD
|
||||
|
||||
#define NDPI_MAX_SUPPORTED_PROTOCOLS (NDPI_LAST_IMPLEMENTED_PROTOCOL + 1)
|
||||
#define NDPI_MAX_SUPPORTED_PROTOCOLS (NDPI_LAST_IMPLEMENTED_PROTOCOL + 1)
|
||||
#define NDPI_MAX_NUM_CUSTOM_PROTOCOLS (NDPI_NUM_BITS-NDPI_LAST_IMPLEMENTED_PROTOCOL)
|
||||
#endif
|
||||
|
||||
@@ -29,6 +29,20 @@
|
||||
#include "ndpi_main.h"
|
||||
|
||||
|
||||
ndpi_port_range* ndpi_build_default_ports_range(ndpi_port_range *ports,
|
||||
u_int16_t portA_low, u_int16_t portA_high,
|
||||
u_int16_t portB_low, u_int16_t portB_high,
|
||||
u_int16_t portC_low, u_int16_t portC_high,
|
||||
u_int16_t portD_low, u_int16_t portD_high,
|
||||
u_int16_t portE_low, u_int16_t portE_high);
|
||||
|
||||
ndpi_port_range* ndpi_build_default_ports(ndpi_port_range *ports,
|
||||
u_int16_t portA,
|
||||
u_int16_t portB,
|
||||
u_int16_t portC,
|
||||
u_int16_t portD,
|
||||
u_int16_t portE);
|
||||
|
||||
/* TCP/UDP protocols */
|
||||
u_int ndpi_search_tcp_or_udp_raw(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int8_t protocol,
|
||||
@@ -142,7 +156,6 @@ void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_str
|
||||
void ndpi_search_guildwars_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_skype(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
@@ -178,5 +191,146 @@ void ndpi_search_twitter(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
void ndpi_search_vhua(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_telegram(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_eaq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
void ndpi_search_starcraft(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
|
||||
|
||||
|
||||
/* --- INIT FUNCTIONS --- */
|
||||
void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_aimini_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_applejuice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_armagetron_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ayiya_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_battlefield_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_bgp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_bittorrent_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_teredo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ciscovpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_citrix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_corba_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_crossfire_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dcerpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dhcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dhcpv6_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_directconnect_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dofus_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_directdownloadlink_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dropbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_eaq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_edonkey_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_fasttrack_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_fiesta_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_filetopia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_florensia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ftp_control_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ftp_data_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_gnutella_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_gtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_guildwars_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_h323_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_halflife2_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_http_activesync_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_iax_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_icecast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_imesh_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ipp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_irc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_jabber_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_kakaotalk_voice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_kerberos_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_kontiki_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ldap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_lotus_notes_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mail_imap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mail_pop_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mail_smtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_maplestory_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mdns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_meebo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_megaco_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mgpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mms_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_msn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mpegts_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mssql_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mysql_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_netbios_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_netflow_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_nfs_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_noe_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_non_tcp_udp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ntp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_openft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_openvpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_oracle_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_oscar_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pando_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pcanywhere_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_postgres_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pplive_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ppstream_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pptp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_qq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_quake_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_quic_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_radius_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rdp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_redis_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rsync_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rtcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rtmp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_rtsp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_sflow_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_shoutcast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_sip_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_skinny_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_skype_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_smb_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_snmp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_socrates_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_sopcast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_soulseek_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_spotify_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ssh_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ssl_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_starcraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stealthnet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_steam_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stun_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_syslog_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ssdp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tds_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_teamspeak_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_teamviewer_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_telegram_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_telnet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tftp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_thunder_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tor_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tvants_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tvuplayer_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_twitter_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_usenet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_veohtv_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_vhua_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_viber_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_vmware_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_vnc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_warcraft3_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_whois_das_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_winmx_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_world_of_warcraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_world_of_kung_fu_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_xbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_xdmcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_yahoo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_zattoo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_zmq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stracraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
|
||||
#endif /* __NDPI_PROTOCOLS_INCLUDE_FILE__ */
|
||||
|
||||
+56
-85
@@ -44,7 +44,7 @@ typedef enum {
|
||||
} ndpi_VISIT;
|
||||
|
||||
typedef struct node_t {
|
||||
char *key;
|
||||
char *key;
|
||||
struct node_t *left, *right;
|
||||
} ndpi_node;
|
||||
|
||||
@@ -88,7 +88,7 @@ struct ndpi_ipv6hdr {
|
||||
struct ndpi_ip6_addr saddr;
|
||||
struct ndpi_ip6_addr daddr;
|
||||
};
|
||||
#endif /* NDPI_DETECTION_SUPPORT_IPV6 */
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
u_int32_t ipv4;
|
||||
@@ -126,19 +126,19 @@ struct hash_ip4p {
|
||||
|
||||
struct hash_ip4p_table {
|
||||
size_t size;
|
||||
int ipv6;
|
||||
int ipv6;
|
||||
spinlock_t lock;
|
||||
atomic_t count;
|
||||
struct hash_ip4p tbl;
|
||||
};
|
||||
|
||||
struct bt_announce { // 192 bytes
|
||||
struct bt_announce { // 192 bytes
|
||||
u_int32_t hash[5];
|
||||
u_int32_t ip[4];
|
||||
u_int32_t time;
|
||||
u_int16_t port;
|
||||
u_int8_t name_len,
|
||||
name[192 - 4*10 - 2 - 1]; // 149 bytes
|
||||
name[192 - 4*10 - 2 - 1]; // 149 bytes
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -288,7 +288,7 @@ struct ndpi_flow_tcp_struct {
|
||||
u_int32_t irc_0x1000_full:1;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_WINMX
|
||||
u_int32_t winmx_stage:1; // 0-1
|
||||
u_int32_t winmx_stage:1; // 0 - 1
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_SOULSEEK
|
||||
u_int32_t soulseek_stage:2;
|
||||
@@ -310,9 +310,9 @@ struct ndpi_flow_tcp_struct {
|
||||
u_int32_t http_stage:2;
|
||||
u_int32_t http_empty_line_seen:1;
|
||||
u_int32_t http_wait_for_retransmission:1;
|
||||
#endif // NDPI_PROTOCOL_HTTP
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_GNUTELLA
|
||||
u_int32_t gnutella_stage:2; //0-2
|
||||
u_int32_t gnutella_stage:2; // 0 - 2
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_MMS
|
||||
u_int32_t mms_stage:2;
|
||||
@@ -373,23 +373,18 @@ struct ndpi_flow_tcp_struct {
|
||||
#ifdef NDPI_PROTOCOL_MAIL_IMAP
|
||||
u_int32_t mail_imap_stage:3;
|
||||
#endif
|
||||
|
||||
#ifdef NDPI_PROTOCOL_SKYPE
|
||||
u_int8_t skype_packet_id;
|
||||
#endif
|
||||
|
||||
#ifdef NDPI_PROTOCOL_CITRIX
|
||||
u_int8_t citrix_packet_id;
|
||||
#endif
|
||||
|
||||
#ifdef NDPI_PROTOCOL_LOTUS_NOTES
|
||||
u_int8_t lotus_notes_packet_id;
|
||||
#endif
|
||||
|
||||
#ifdef NDPI_PROTOCOL_TEAMVIEWER
|
||||
u_int8_t teamviewer_stage;
|
||||
#endif
|
||||
|
||||
#ifdef NDPI_PROTOCOL_ZMQ
|
||||
u_int8_t prev_zmq_pkt_len;
|
||||
u_char prev_zmq_pkt[10];
|
||||
@@ -416,10 +411,10 @@ struct ndpi_flow_udp_struct {
|
||||
u_int32_t snmp_stage:2;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_PPSTREAM
|
||||
u_int32_t ppstream_stage:3; // 0-7
|
||||
u_int32_t ppstream_stage:3; // 0 - 7
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_HALFLIFE2
|
||||
u_int32_t halflife2_stage:2; // 0 - 2
|
||||
u_int32_t halflife2_stage:2; // 0 - 2
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_TFTP
|
||||
u_int32_t tftp_stage:1;
|
||||
@@ -439,6 +434,10 @@ struct ndpi_flow_udp_struct {
|
||||
#ifdef NDPI_PROTOCOL_TEAMVIEWER
|
||||
u_int8_t teamviewer_stage;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_EAQ
|
||||
u_int8_t eaq_pkt_id;
|
||||
u_int32_t eaq_sequence;
|
||||
#endif
|
||||
}
|
||||
#if !defined(WIN32)
|
||||
__attribute__ ((__packed__))
|
||||
@@ -468,24 +467,11 @@ typedef struct ndpi_packet_struct {
|
||||
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||
u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||
|
||||
/* this is for simple read-only access to the real protocol
|
||||
* used for the main loop */
|
||||
u_int16_t real_protocol_read_only;
|
||||
|
||||
#if NDPI_PROTOCOL_HISTORY_SIZE > 1
|
||||
# if NDPI_PROTOCOL_HISTORY_SIZE > 5
|
||||
# error protocol stack size not supported
|
||||
# endif
|
||||
|
||||
struct {
|
||||
u_int8_t entry_is_real_protocol:5;
|
||||
u_int8_t current_stack_size_minus_one:3;
|
||||
}
|
||||
#if !defined(WIN32)
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
protocol_stack_info;
|
||||
#endif
|
||||
u_int16_t protocol_stack_info;
|
||||
|
||||
struct ndpi_int_one_line_struct line[NDPI_MAX_PARSE_LINES_PER_PACKET];
|
||||
struct ndpi_int_one_line_struct host_line;
|
||||
@@ -543,12 +529,12 @@ typedef struct {
|
||||
} ndpi_port_range;
|
||||
|
||||
typedef enum {
|
||||
NDPI_PROTOCOL_SAFE = 0, /* Safe protocol with encryption */
|
||||
NDPI_PROTOCOL_ACCEPTABLE, /* Ok but not encrypted */
|
||||
NDPI_PROTOCOL_FUN, /* Pure fun protocol */
|
||||
NDPI_PROTOCOL_UNSAFE, /* Protocol with a safe version existing what should be used instead */
|
||||
NDPI_PROTOCOL_SAFE = 0, /* Safe protocol with encryption */
|
||||
NDPI_PROTOCOL_ACCEPTABLE, /* Ok but not encrypted */
|
||||
NDPI_PROTOCOL_FUN, /* Pure fun protocol */
|
||||
NDPI_PROTOCOL_UNSAFE, /* Protocol with a safe version existing what should be used instead */
|
||||
NDPI_PROTOCOL_POTENTIALLY_DANGEROUS, /* Be prepared to troubles */
|
||||
NDPI_PROTOCOL_UNRATED /* No idea */
|
||||
NDPI_PROTOCOL_UNRATED /* No idea */
|
||||
} ndpi_protocol_breed_t;
|
||||
|
||||
#define NUM_BREEDS (NDPI_PROTOCOL_UNRATED+1)
|
||||
@@ -572,6 +558,12 @@ typedef struct _ndpi_automa {
|
||||
u_int8_t ac_automa_finalized;
|
||||
} ndpi_automa;
|
||||
|
||||
typedef struct ndpi_proto {
|
||||
u_int16_t master_protocol /* e.g. HTTP */, protocol /* e.g. FaceBook */;
|
||||
} ndpi_protocol;
|
||||
|
||||
#define NDPI_PROTOCOL_NULL { NDPI_PROTOCOL_UNKNOWN , NDPI_PROTOCOL_UNKNOWN }
|
||||
|
||||
typedef struct ndpi_detection_module_struct {
|
||||
NDPI_PROTOCOL_BITMASK detection_bitmask;
|
||||
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
|
||||
@@ -582,6 +574,7 @@ typedef struct ndpi_detection_module_struct {
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
void *user_data;
|
||||
#endif
|
||||
|
||||
/* callback function buffer */
|
||||
struct ndpi_call_function_struct callback_buffer[NDPI_MAX_SUPPORTED_PROTOCOLS + 1];
|
||||
u_int32_t callback_buffer_size;
|
||||
@@ -607,6 +600,7 @@ typedef struct ndpi_detection_module_struct {
|
||||
const char *ndpi_debug_print_function;
|
||||
u_int32_t ndpi_debug_print_line;
|
||||
#endif
|
||||
|
||||
/* misc parameters */
|
||||
u_int32_t tcp_max_retransmission_window_size;
|
||||
|
||||
@@ -619,8 +613,10 @@ typedef struct ndpi_detection_module_struct {
|
||||
u_int ndpi_num_custom_protocols;
|
||||
|
||||
/* HTTP/DNS/HTTPS host matching */
|
||||
ndpi_automa host_automa, content_automa, bigrams_automa, impossible_bigrams_automa;
|
||||
|
||||
ndpi_automa host_automa, /* Used for DNS/HTTPS */
|
||||
content_automa, /* Used for HTTP subprotocol_detection */
|
||||
subprotocol_automa, /* Used for HTTP subprotocol_detection */
|
||||
bigrams_automa, impossible_bigrams_automa; /* TOR */
|
||||
/* IP-based protocol detection */
|
||||
void *protocols_ptree;
|
||||
|
||||
@@ -638,9 +634,9 @@ typedef struct ndpi_detection_module_struct {
|
||||
u_int32_t rtsp_connection_timeout;
|
||||
/* tvants parameters */
|
||||
u_int32_t tvants_connection_timeout;
|
||||
/* rstp */
|
||||
u_int32_t orb_rstp_ts_timeout;
|
||||
/* yahoo */
|
||||
// u_int32_t yahoo_http_filetransfer_timeout;
|
||||
u_int8_t yahoo_detect_http_connections;
|
||||
u_int32_t yahoo_lan_video_timeout;
|
||||
u_int32_t zattoo_connection_timeout;
|
||||
@@ -651,7 +647,6 @@ typedef struct ndpi_detection_module_struct {
|
||||
char ip_string[NDPI_IP_STRING_SIZE];
|
||||
#endif
|
||||
u_int8_t ip_version_limit;
|
||||
/* ********************* */
|
||||
#ifdef NDPI_PROTOCOL_BITTORRENT
|
||||
struct hash_ip4p_table *bt_ht;
|
||||
#ifdef NDPI_DETECTION_SUPPORT_IPV6
|
||||
@@ -665,33 +660,21 @@ typedef struct ndpi_detection_module_struct {
|
||||
|
||||
ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS];
|
||||
|
||||
u_int8_t match_dns_host_names:1, http_dissect_response:1;
|
||||
u_int8_t match_dns_host_names:1, http_dont_dissect_response:1;
|
||||
u_int8_t direction_detect_disable:1; /* disable internal detection of packet direction */
|
||||
} ndpi_detection_module_struct_t;
|
||||
|
||||
typedef struct ndpi_flow_struct {
|
||||
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_HISTORY_SIZE];
|
||||
#if NDPI_PROTOCOL_HISTORY_SIZE > 1
|
||||
# if NDPI_PROTOCOL_HISTORY_SIZE > 5
|
||||
# error protocol stack size not supported
|
||||
# endif
|
||||
|
||||
struct {
|
||||
u_int8_t entry_is_real_protocol:5;
|
||||
u_int8_t current_stack_size_minus_one:3;
|
||||
}
|
||||
|
||||
#if !defined(WIN32)
|
||||
__attribute__ ((__packed__))
|
||||
#endif
|
||||
protocol_stack_info;
|
||||
#endif
|
||||
u_int16_t protocol_stack_info;
|
||||
|
||||
/* init parameter, internal used to set up timestamp,... */
|
||||
u_int16_t guessed_protocol_id;
|
||||
|
||||
u_int8_t protocol_id_already_guessed:1;
|
||||
u_int8_t no_cache_protocol:1;
|
||||
u_int8_t init_finished:1;
|
||||
u_int8_t setup_packet_direction:1;
|
||||
u_int8_t packet_direction:1; /* if ndpi_struct->direction_detect_disable == 1 */
|
||||
@@ -737,7 +720,12 @@ typedef struct ndpi_flow_struct {
|
||||
u_int8_t bad_packet /* the received packet looks bad */;
|
||||
u_int16_t query_type, query_class, rsp_type;
|
||||
} dns;
|
||||
|
||||
|
||||
struct {
|
||||
u_int8_t request_code;
|
||||
u_int8_t version;
|
||||
} ntp;
|
||||
|
||||
struct {
|
||||
char client_certificate[48], server_certificate[48];
|
||||
} ssl;
|
||||
@@ -747,30 +735,19 @@ typedef struct ndpi_flow_struct {
|
||||
/* protocols which have marked a connection as this connection cannot be protocol XXX, multiple u_int64_t */
|
||||
NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask;
|
||||
|
||||
#if 0
|
||||
#ifdef NDPI_PROTOCOL_RTP
|
||||
u_int32_t rtp_ssid[2];
|
||||
u_int16_t rtp_seqnum[2]; /* current highest sequence number (only goes forwards, is not decreased by retransmissions) */
|
||||
/* tcp and udp */
|
||||
u_int8_t rtp_payload_type[2];
|
||||
u_int32_t rtp_stage1:2; //0-3
|
||||
u_int32_t rtp_stage2:2;
|
||||
#endif
|
||||
#endif
|
||||
u_int8_t num_stun_udp_pkts;
|
||||
|
||||
#ifdef NDPI_PROTOCOL_REDIS
|
||||
u_int8_t redis_s2d_first_char, redis_d2s_first_char;
|
||||
#endif
|
||||
|
||||
u_int16_t packet_counter; // can be 0-65000
|
||||
u_int16_t packet_counter; // can be 0 - 65000
|
||||
u_int16_t packet_direction_counter[2];
|
||||
u_int16_t byte_counter[2];
|
||||
|
||||
#ifdef NDPI_PROTOCOL_BITTORRENT
|
||||
u_int8_t bittorrent_stage; // can be 0-255
|
||||
u_int8_t bittorrent_stage; // can be 0 - 255
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_DIRECTCONNECT
|
||||
u_int32_t directconnect_stage:2; // 0-1
|
||||
u_int32_t directconnect_stage:2; // 0 - 1
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_SIP
|
||||
#ifdef NDPI_PROTOCOL_YAHOO
|
||||
@@ -779,12 +756,11 @@ typedef struct ndpi_flow_struct {
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_HTTP
|
||||
u_int32_t http_detected:1;
|
||||
#endif // NDPI_PROTOCOL_HTTP
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_RTSP
|
||||
u_int32_t rtsprdt_stage:2;
|
||||
u_int32_t rtsp_control_flow:1;
|
||||
#endif
|
||||
|
||||
#ifdef NDPI_PROTOCOL_YAHOO
|
||||
u_int32_t yahoo_detection_finished:2;
|
||||
#endif
|
||||
@@ -795,7 +771,7 @@ typedef struct ndpi_flow_struct {
|
||||
u_int32_t qq_stage:3;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_THUNDER
|
||||
u_int32_t thunder_stage:2; // 0-3
|
||||
u_int32_t thunder_stage:2; // 0 - 3
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_OSCAR
|
||||
u_int32_t oscar_ssl_voice_stage:3;
|
||||
@@ -805,20 +781,17 @@ typedef struct ndpi_flow_struct {
|
||||
u_int32_t florensia_stage:1;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_SOCKS5
|
||||
u_int32_t socks5_stage:2; // 0-3
|
||||
u_int32_t socks5_stage:2; // 0 - 3
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_SOCKS4
|
||||
u_int32_t socks4_stage:2; // 0-3
|
||||
u_int32_t socks4_stage:2; // 0 - 3
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_EDONKEY
|
||||
u_int32_t edonkey_stage:2; // 0-3
|
||||
u_int32_t edonkey_stage:2; // 0 - 3
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_FTP_CONTROL
|
||||
u_int32_t ftp_control_stage:2;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_FTP_DATA
|
||||
u_int32_t ftp_data_stage:2;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_RTMP
|
||||
u_int32_t rtmp_stage:2;
|
||||
#endif
|
||||
@@ -832,9 +805,12 @@ typedef struct ndpi_flow_struct {
|
||||
u_int32_t steam_stage3:2; // 0 - 2
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_PPLIVE
|
||||
u_int32_t pplive_stage1:3; // 0-6
|
||||
u_int32_t pplive_stage2:2; // 0-2
|
||||
u_int32_t pplive_stage3:2; // 0-2
|
||||
u_int32_t pplive_stage1:3; // 0 - 6
|
||||
u_int32_t pplive_stage2:2; // 0 - 2
|
||||
u_int32_t pplive_stage3:2; // 0 - 2
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_STARCRAFT
|
||||
u_int32_t starcraft_udp_stage : 3; // 0-7
|
||||
#endif
|
||||
|
||||
/* internal structures to save functions calls */
|
||||
@@ -844,9 +820,4 @@ typedef struct ndpi_flow_struct {
|
||||
struct ndpi_id_struct *dst;
|
||||
} ndpi_flow_struct_t;
|
||||
|
||||
typedef enum {
|
||||
NDPI_REAL_PROTOCOL = 0,
|
||||
NDPI_CORRELATED_PROTOCOL = 1
|
||||
} ndpi_protocol_type_t;
|
||||
|
||||
#endif/* __NDPI_TYPEDEFS_FILE__ */
|
||||
|
||||
@@ -39,6 +39,7 @@ libndpi_la_SOURCES = ndpi_content_match.c.inc \
|
||||
protocols/dns.c \
|
||||
protocols/dofus.c \
|
||||
protocols/dropbox.c \
|
||||
protocols/eaq.c \
|
||||
protocols/edonkey.c \
|
||||
protocols/fasttrack.c \
|
||||
protocols/fiesta.c \
|
||||
@@ -59,6 +60,7 @@ libndpi_la_SOURCES = ndpi_content_match.c.inc \
|
||||
protocols/ipp.c \
|
||||
protocols/irc.c \
|
||||
protocols/jabber.c \
|
||||
protocols/kakaotalk_voice.c \
|
||||
protocols/kerberos.c \
|
||||
protocols/kontiki.c \
|
||||
protocols/ldap.c \
|
||||
@@ -72,6 +74,7 @@ libndpi_la_SOURCES = ndpi_content_match.c.inc \
|
||||
protocols/megaco.c \
|
||||
protocols/mgcp.c \
|
||||
protocols/mms.c \
|
||||
protocols/mpegts.c \
|
||||
protocols/msn.c \
|
||||
protocols/mssql.c \
|
||||
protocols/mysql.c \
|
||||
@@ -118,6 +121,7 @@ libndpi_la_SOURCES = ndpi_content_match.c.inc \
|
||||
protocols/ssdp.c \
|
||||
protocols/ssh.c \
|
||||
protocols/ssl.c \
|
||||
protocols/starcraft.c \
|
||||
protocols/stealthnet.c \
|
||||
protocols/steam.c \
|
||||
protocols/stun.c \
|
||||
@@ -131,6 +135,7 @@ libndpi_la_SOURCES = ndpi_content_match.c.inc \
|
||||
protocols/tftp.c \
|
||||
protocols/thunder.c \
|
||||
protocols/tor.c \
|
||||
protocols/teredo.c \
|
||||
protocols/tvants.c \
|
||||
protocols/tvuplayer.c \
|
||||
protocols/twitter.c \
|
||||
|
||||
+767
-644
File diff suppressed because it is too large
Load Diff
+864
-1983
File diff suppressed because it is too large
Load Diff
+40
-28
@@ -29,7 +29,7 @@
|
||||
|
||||
static void ndpi_int_afp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_AFP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AFP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,39 +37,51 @@ void ndpi_search_afp(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// struct ndpi_id_struct *src = flow->src;
|
||||
// struct ndpi_id_struct *dst = flow->dst;
|
||||
// struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
/*
|
||||
* this will detect the OpenSession command of the Data Stream Interface (DSI) protocol
|
||||
* which is exclusively used by the Apple Filing Protocol (AFP) on TCP/IP networks
|
||||
*/
|
||||
if (packet->payload_packet_len >= 22 && get_u_int16_t(packet->payload, 0) == htons(0x0004) &&
|
||||
get_u_int16_t(packet->payload, 2) == htons(0x0001) && get_u_int32_t(packet->payload, 4) == 0 &&
|
||||
get_u_int32_t(packet->payload, 8) == htonl(packet->payload_packet_len - 16) &&
|
||||
get_u_int32_t(packet->payload, 12) == 0 && get_u_int16_t(packet->payload, 16) == htons(0x0104)) {
|
||||
|
||||
/*
|
||||
* this will detect the OpenSession command of the Data Stream Interface (DSI) protocol
|
||||
* which is exclusively used by the Apple Filing Protocol (AFP) on TCP/IP networks
|
||||
*/
|
||||
if (packet->payload_packet_len >= 22 && get_u_int16_t(packet->payload, 0) == htons(0x0004) &&
|
||||
get_u_int16_t(packet->payload, 2) == htons(0x0001) && get_u_int32_t(packet->payload, 4) == 0 &&
|
||||
get_u_int32_t(packet->payload, 8) == htonl(packet->payload_packet_len - 16) &&
|
||||
get_u_int32_t(packet->payload, 12) == 0 && get_u_int16_t(packet->payload, 16) == htons(0x0104)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP: DSI OpenSession detected.\n");
|
||||
ndpi_int_afp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP: DSI OpenSession detected.\n");
|
||||
ndpi_int_afp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* detection of GetStatus command of DSI protocl
|
||||
*/
|
||||
if (packet->payload_packet_len >= 18 && get_u_int16_t(packet->payload, 0) == htons(0x0003) &&
|
||||
get_u_int16_t(packet->payload, 2) == htons(0x0001) && get_u_int32_t(packet->payload, 4) == 0 &&
|
||||
get_u_int32_t(packet->payload, 8) == htonl(packet->payload_packet_len - 16) &&
|
||||
get_u_int32_t(packet->payload, 12) == 0 && get_u_int16_t(packet->payload, 16) == htons(0x0f00)) {
|
||||
|
||||
/*
|
||||
* detection of GetStatus command of DSI protocl
|
||||
*/
|
||||
if (packet->payload_packet_len >= 18 && get_u_int16_t(packet->payload, 0) == htons(0x0003) &&
|
||||
get_u_int16_t(packet->payload, 2) == htons(0x0001) && get_u_int32_t(packet->payload, 4) == 0 &&
|
||||
get_u_int32_t(packet->payload, 8) == htonl(packet->payload_packet_len - 16) &&
|
||||
get_u_int32_t(packet->payload, 12) == 0 && get_u_int16_t(packet->payload, 16) == htons(0x0f00)) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP: DSI GetStatus detected.\n");
|
||||
ndpi_int_afp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP: DSI GetStatus detected.\n");
|
||||
ndpi_int_afp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP excluded.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AFP);
|
||||
NDPI_LOG(NDPI_PROTOCOL_AFP, ndpi_struct, NDPI_LOG_DEBUG, "AFP excluded.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AFP);
|
||||
}
|
||||
|
||||
|
||||
void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("AFP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AFP,
|
||||
ndpi_search_afp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+26
-12
@@ -28,10 +28,10 @@
|
||||
#ifdef NDPI_PROTOCOL_AIMINI
|
||||
|
||||
|
||||
static void ndpi_int_aimini_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
ndpi_protocol_type_t protocol_type)
|
||||
static void ndpi_int_aimini_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_AIMINI, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AIMINI, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
|| (packet->payload_packet_len > 100 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0115))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "found aimini (64, 0x010b), (>300, 0x0115), "
|
||||
"(16, 0x010c || 64, 0x010b), (16, 0x010c || 64, 0x010b || >100, 0x0115).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
&& ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (136, 0x01c9), (136, 0x01c9)," "(136, 0x01c9),(136, 0x01c9 || 32, 0x01ca).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
&& (packet->payload_packet_len == 88 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x0101)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (88, 0x0101), (88, 0x0101)," "(88, 0x0101),(88, 0x0101).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
|| (packet->payload_packet_len == 32 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (104, 0x0102), (104, 0x0102), " "(104, 0x0102), (104, 0x0102).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
|| (packet->payload_packet_len == 32 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x01ca))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (32,0x01ca), (32,0x01ca), (32,0x01ca), ((136, 0x0166)||(32,0x01ca)).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
&& (packet->payload_packet_len == 16 && ntohs(get_u_int16_t(packet->payload, 0)) == 0x010c)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found aimini (16, 0x010c), (16, 0x010c), (16, 0x010c), (16, 0x010c).\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
} else if (packet->tcp != NULL) {
|
||||
@@ -243,7 +243,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
if (packet->host_line.ptr != NULL && packet->host_line.len > 11
|
||||
&& (memcmp(&packet->host_line.ptr[packet->host_line.len - 11], ".aimini.net", 11) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG, "AIMINI HTTP traffic detected.\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
if (is_special_aimini_host(packet->host_line) == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"AIMINI HTTP traffic detected.\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
if (is_special_aimini_host(packet->host_line) == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_AIMINI, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"AIMINI HTTP traffic detected.\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -280,4 +280,18 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AIMINI);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_aimini_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Aimini", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AIMINI,
|
||||
ndpi_search_aimini,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
static void ndpi_int_applejuice_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_APPLEJUICE, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_APPLEJUICE, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_applejuice_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
@@ -54,4 +54,17 @@ void ndpi_search_applejuice_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_APPLEJUICE);
|
||||
}
|
||||
|
||||
|
||||
void init_applejuice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("AppleJuice", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_APPLEJUICE,
|
||||
ndpi_search_applejuice_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* include files */
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_ARMAGETRON
|
||||
@@ -33,7 +31,7 @@ static void ndpi_int_armagetron_add_connection(struct ndpi_detection_module_stru
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_ARMAGETRON, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ARMAGETRON, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -99,4 +97,19 @@ void ndpi_search_armagetron_udp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_ARMAGETRON);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void init_armagetron_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Armagetron", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_ARMAGETRON,
|
||||
ndpi_search_armagetron_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
static void ndpi_int_flash_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_FLASH, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FLASH);
|
||||
}
|
||||
|
||||
void ndpi_search_flash(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
static void ndpi_int_ftp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_FTP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FTP);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@ static void ndpi_int_manolito_add_connection(struct
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MANOLITO, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MANOLITO);
|
||||
|
||||
|
||||
if (src != NULL) {
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
static void ndpi_int_popo_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_POPO, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_POPO);
|
||||
}
|
||||
|
||||
void ndpi_search_popo_tcp_udp(struct ndpi_detection_module_struct
|
||||
|
||||
@@ -27,10 +27,10 @@
|
||||
#ifdef NDPI_PROTOCOL_SECONDLIFE
|
||||
|
||||
static void ndpi_int_secondlife_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
ndpi_protocol_type_t protocol_type)
|
||||
struct ndpi_flow_struct *flow/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_SECONDLIFE, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_SECONDLIFE, protocol_type);
|
||||
}
|
||||
|
||||
void ndpi_search_secondlife(struct ndpi_detection_module_struct
|
||||
@@ -92,25 +92,25 @@ void ndpi_search_secondlife(struct ndpi_detection_module_struct
|
||||
if (packet->payload_packet_len == 46
|
||||
&& memcmp(packet->payload, "\x40\x00\x00\x00\x01\x00\xff\xff\x00\x03", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life 0xffff0003 detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 54
|
||||
&& memcmp(packet->payload, "\x40\x00\x00\x00\x01\x00\xff\xff\x00\x52", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life 0xffff0052 detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 58
|
||||
&& memcmp(packet->payload, "\x40\x00\x00\x00\x01\x00\xff\xff\x00\xa9", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life 0xffff00a9 detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len > 54 && memcmp(packet->payload, "\x40\x00\x00\x00\x01\x00\x08", 7) == 0 &&
|
||||
get_u_int32_t(packet->payload, packet->payload_packet_len - 4) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_SECONDLIFE, ndpi_struct, NDPI_LOG_DEBUG, "Second Life 0x08 detected.\n");
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_secondlife_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ void ndpi_search_ayiya(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
now = flow->packet.tick_timestamp;
|
||||
|
||||
if((epoch >= (now - fireyears)) && (epoch <= (now+86400 /* 1 day */)))
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_AYIYA, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AYIYA, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -64,4 +64,18 @@ void ndpi_search_ayiya(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_AYIYA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_ayiya_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Ayiya", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AYIYA,
|
||||
ndpi_search_ayiya,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@ static void ndpi_int_battlefield_add_connection(struct ndpi_detection_module_str
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_BATTLEFIELD, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BATTLEFIELD, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
if (src != NULL) {
|
||||
src->battlefield_ts = packet->tick_timestamp;
|
||||
@@ -115,4 +115,16 @@ void ndpi_search_battlefield(struct ndpi_detection_module_struct *ndpi_struct, s
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void init_battlefield_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("BattleField", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_BATTLEFIELD,
|
||||
ndpi_search_battlefield,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+14
-1
@@ -29,7 +29,7 @@
|
||||
|
||||
static void ndpi_int_bgp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_BGP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BGP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
/* this detection also works asymmetrically */
|
||||
@@ -54,4 +54,17 @@ void ndpi_search_bgp(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_BGP);
|
||||
}
|
||||
|
||||
|
||||
void init_bgp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("BGP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_BGP,
|
||||
ndpi_search_bgp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,20 +31,16 @@
|
||||
#define NDPI_PROTOCOL_PLAIN_DETECTION 0
|
||||
#define NDPI_PROTOCOL_WEBSEED_DETECTION 2
|
||||
static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
const u_int8_t save_detection, const u_int8_t encrypted_connection,
|
||||
ndpi_protocol_type_t protocol_type)
|
||||
const u_int8_t save_detection, const u_int8_t encrypted_connection/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, protocol_type);
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src = flow->src;
|
||||
// struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
u_int16_t a = 0;
|
||||
|
||||
if (packet->payload_packet_len == 1 && packet->payload[0] == 0x13) {
|
||||
@@ -58,8 +54,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_REAL_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -72,8 +68,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_REAL_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -83,8 +79,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "BT: plain webseed BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
/* seen Azureus as server for webseed, possibly other servers existing, to implement */
|
||||
@@ -95,8 +91,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "BT: plain Bitcomet persistent seed protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -118,8 +114,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "Azureus /Bittorrent user agent line detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -130,8 +126,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "Bittorrent Shareaza detected.\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -165,8 +161,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "Bitcomet LTS detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
|
||||
}
|
||||
@@ -192,8 +188,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "FlashGet detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
|
||||
}
|
||||
@@ -214,8 +210,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "FlashGet detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
|
||||
}
|
||||
@@ -285,8 +281,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, " BT stat: tracker info hash parsed\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -315,8 +311,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "BT: Warez - Plain BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_REAL_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -332,8 +328,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
||||
ndpi_struct, NDPI_LOG_TRACE,
|
||||
"BT: Warez - Plain BitTorrent protocol detected due to Host: ip2p.com: pattern\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION,
|
||||
NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||
/* NDPI_CORRELATED_PROTOCOL */);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -370,12 +366,18 @@ static void ndpi_int_search_bittorrent_tcp(struct ndpi_detection_module_struct *
|
||||
void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
int no_bittorrent = 0;
|
||||
|
||||
/* This is broadcast */
|
||||
if(packet->iph
|
||||
&& ((packet->iph->saddr == 0xFFFFFFFF) || (packet->iph->daddr == 0xFFFFFFFF)))
|
||||
if(packet->iph
|
||||
&& (((packet->iph->saddr == 0xFFFFFFFF) || (packet->iph->daddr == 0xFFFFFFFF))
|
||||
|| (packet->udp
|
||||
&& ((ntohs(packet->udp->source) == 3544) /* teredo.c */
|
||||
|| (ntohs(packet->udp->dest) == 3544))))) {
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_BITTORRENT);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (packet->detected_protocol_stack[0] != NDPI_PROTOCOL_BITTORRENT) {
|
||||
/* check for tcp retransmission here */
|
||||
|
||||
@@ -399,8 +401,8 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
if(packet->payload_packet_len >= 23 /* min header size */) {
|
||||
if(strncmp((const char*)packet->payload, bt_search, strlen(bt_search)) == 0) {
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_REAL_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return;
|
||||
} else {
|
||||
/* Check if this is protocol v0 */
|
||||
@@ -462,8 +464,8 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION,
|
||||
NDPI_REAL_PROTOCOL);
|
||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||
/* NDPI_REAL_PROTOCOL */);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -475,4 +477,17 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_bittorrent_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("BitTorrent", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_BITTORRENT,
|
||||
ndpi_search_bittorrent,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
static void ndpi_int_ciscovpn_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_CISCOVPN, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CISCOVPN, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -67,4 +67,17 @@ void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_ciscovpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("CiscoVPN", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CISCOVPN,
|
||||
ndpi_search_ciscovpn,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -54,7 +54,7 @@ static void ndpi_check_citrix(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
|
||||
if(memcmp(packet->payload, citrix_header, sizeof(citrix_header)) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CITRIX, ndpi_struct, NDPI_LOG_DEBUG, "Found citrix.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_CITRIX, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CITRIX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -64,7 +64,7 @@ static void ndpi_check_citrix(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if((memcmp(packet->payload, citrix_header, sizeof(citrix_header)) == 0)
|
||||
|| (ndpi_strnstr((const char *)packet->payload, "Citrix.TcpProxyService", payload_len) != NULL)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CITRIX, ndpi_struct, NDPI_LOG_DEBUG, "Found citrix.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_CITRIX, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CITRIX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -90,4 +90,16 @@ void ndpi_search_citrix(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
ndpi_check_citrix(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_citrix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Citrix", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CITRIX,
|
||||
ndpi_search_citrix,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -44,10 +44,11 @@ void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
if(len == packet->payload_packet_len) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_COLLECTD, ndpi_struct, NDPI_LOG_DEBUG, "found COLLECTD.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_COLLECTD, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_COLLECTD, NDPI_PROTOCOL_UNKNOWN);
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_COLLECTD, ndpi_struct, NDPI_LOG_DEBUG, "exclude COLLECTD.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_COLLECTD);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
static void ndpi_int_corba_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_CORBA, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CORBA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
void ndpi_search_corba(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
@@ -45,4 +45,16 @@ void ndpi_search_corba(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_CORBA);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_corba_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Corba", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CORBA,
|
||||
ndpi_search_corba,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -22,17 +22,16 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* include files */
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_CROSSFIRE
|
||||
|
||||
|
||||
static void ndpi_int_crossfire_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, ndpi_protocol_type_t protocol_type)
|
||||
struct ndpi_flow_struct *flow/* , ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_CROSSFIRE, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CROSSFIRE, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -51,7 +50,7 @@ void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_str
|
||||
&& get_u_int16_t(packet->payload, 22) == ntohs(0x7d00)
|
||||
) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CROSSFIRE, ndpi_struct, NDPI_LOG_DEBUG, "Crossfire: found udp packet.\n");
|
||||
ndpi_int_crossfire_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_crossfire_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +68,7 @@ void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_str
|
||||
|| memcmp(packet->host_line.ptr, "www.crossfire", 13) == 0))
|
||||
) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_CROSSFIRE, ndpi_struct, NDPI_LOG_DEBUG, "Crossfire: found HTTP request.\n");
|
||||
ndpi_int_crossfire_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_crossfire_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -81,5 +80,15 @@ void ndpi_search_crossfire_tcp_udp(struct ndpi_detection_module_struct *ndpi_str
|
||||
}
|
||||
|
||||
|
||||
void init_crossfire_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Crossfire", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CROSSFIRE,
|
||||
ndpi_search_crossfire_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
static void ndpi_int_dcerpc_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DCERPC, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DCERPC, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -51,4 +51,16 @@ void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DCERPC);
|
||||
}
|
||||
|
||||
|
||||
void init_dcerpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DCE_RPC", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DCERPC,
|
||||
ndpi_search_dcerpc,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
static void ndpi_int_dhcp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DHCP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DHCP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,4 +57,17 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DHCP);
|
||||
}
|
||||
|
||||
|
||||
void init_dhcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DHCP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DHCP,
|
||||
ndpi_search_dhcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,7 +33,7 @@ static void ndpi_int_dhcpv6_add_connection(struct ndpi_detection_module_struct *
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DHCPV6, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DHCPV6, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_dhcpv6_udp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -57,4 +57,16 @@ void ndpi_search_dhcpv6_udp(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DHCPV6);
|
||||
}
|
||||
|
||||
|
||||
void init_dhcpv6_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DHCPV6", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DHCPV6,
|
||||
ndpi_search_dhcpv6_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -81,7 +81,7 @@ static void ndpi_int_directconnect_add_connection(struct ndpi_detection_module_s
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
if (src != NULL) {
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
@@ -168,7 +168,7 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
src->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc port\n %d", ntohs(src->detected_directconnect_port));
|
||||
@@ -184,7 +184,7 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
src->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
src->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc port\n %d", ntohs(src->detected_directconnect_ssl_port));
|
||||
@@ -204,7 +204,7 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc port\n %d", ntohs(dst->detected_directconnect_port));
|
||||
@@ -220,7 +220,7 @@ static void ndpi_search_directconnect_tcp(struct ndpi_detection_module_struct *n
|
||||
if ((u_int32_t)
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc port\n %d", ntohs(dst->detected_directconnect_ssl_port));
|
||||
@@ -352,7 +352,7 @@ static void ndpi_search_directconnect_udp(struct ndpi_detection_module_struct
|
||||
(packet->tick_timestamp -
|
||||
dst->directconnect_last_safe_access_time) < ndpi_struct->directconnect_connection_ip_tick_timeout) {
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECTCONNECT, NDPI_PROTOCOL_UNKNOWN);
|
||||
dst->directconnect_last_safe_access_time = packet->tick_timestamp;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DIRECTCONNECT, ndpi_struct,
|
||||
NDPI_LOG_DEBUG, "marking using dc udp port\n %d", ntohs(dst->detected_directconnect_udp_port));
|
||||
@@ -471,4 +471,17 @@ void ndpi_search_directconnect(struct ndpi_detection_module_struct
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_directconnect_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DirectConnect", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DIRECTCONNECT,
|
||||
ndpi_search_directconnect,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@ static void ndpi_int_direct_download_link_add_connection(struct ndpi_detection_m
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
flow->l4.tcp.ddlink_server_direction = packet->packet_direction;
|
||||
}
|
||||
@@ -734,4 +734,16 @@ void ndpi_search_direct_download_link_tcp(struct ndpi_detection_module_struct *n
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void init_directdownloadlink_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Direct_Download_Link", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK,
|
||||
ndpi_search_direct_download_link_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
+22
-7
@@ -170,7 +170,7 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
i += 4;
|
||||
|
||||
if(header.answer_rrs > 0) {
|
||||
u_int16_t rsp_type /*, rsp_class */;
|
||||
u_int16_t rsp_type;
|
||||
u_int16_t num;
|
||||
|
||||
for(num = 0; num < header.answer_rrs; num++) {
|
||||
@@ -186,9 +186,9 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
i += data_len;
|
||||
|
||||
rsp_type = get16(&i, packet->payload);
|
||||
// rsp_class = get16(&i, packet->payload);
|
||||
|
||||
i += 4;
|
||||
// Skip past the CLASS (2 octets) and TTL (4 octets) fields.
|
||||
i += 6;
|
||||
data_len = get16(&i, packet->payload);
|
||||
|
||||
if((data_len <= 1) || (data_len > (packet->payload_packet_len-i))) {
|
||||
@@ -265,9 +265,10 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
#endif
|
||||
|
||||
if(ndpi_struct->match_dns_host_names)
|
||||
ndpi_match_string_subprotocol(ndpi_struct, flow,
|
||||
ndpi_match_host_subprotocol(ndpi_struct, flow,
|
||||
(char *)flow->host_server_name,
|
||||
strlen((const char*)flow->host_server_name));
|
||||
strlen((const char*)flow->host_server_name),
|
||||
NDPI_PROTOCOL_DNS);
|
||||
}
|
||||
|
||||
i++;
|
||||
@@ -284,11 +285,11 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
|
||||
if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||
/*
|
||||
Do not set the protocol with DNS if ndpi_match_string_subprotocol() has
|
||||
Do not set the protocol with DNS if ndpi_match_host_subprotocol() has
|
||||
matched a subprotocol
|
||||
*/
|
||||
NDPI_LOG(NDPI_PROTOCOL_DNS, ndpi_struct, NDPI_LOG_DEBUG, "found DNS.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, (dport == 5355) ? NDPI_PROTOCOL_LLMNR : NDPI_PROTOCOL_DNS, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, (dport == 5355) ? NDPI_PROTOCOL_LLMNR : NDPI_PROTOCOL_DNS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
} else {
|
||||
flow->protos.dns.bad_packet = 1;
|
||||
@@ -297,4 +298,18 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_dns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DNS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DNS,
|
||||
ndpi_search_dns,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+117
-106
@@ -30,120 +30,131 @@
|
||||
|
||||
static void ndpi_dofus_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_DOFUS, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DOFUS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_dofus(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
|
||||
/* Dofus v 1.x.x */
|
||||
if (packet->payload_packet_len == 13 && get_u_int16_t(packet->payload, 1) == ntohs(0x0508)
|
||||
&& get_u_int16_t(packet->payload, 5) == ntohs(0x04a0)
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) == ntohs(0x0194)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 3 && memcmp(packet->payload, "HG", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 35 && memcmp(packet->payload, "HC", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len > 2 && packet->payload[0] == 'A'
|
||||
&& (packet->payload[1] == 'x' || packet->payload[1] == 'X')
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 12 && memcmp(packet->payload, "Af", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len > 2 && memcmp(packet->payload, "Ad", 2)
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 11 && memcmp(packet->payload, "AT", 2) == 0 && packet->payload[10] == 0x00) {
|
||||
if (flow->l4.tcp.dofus_stage == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 1 && packet->payload_packet_len == 5
|
||||
&& packet->payload[0] == 'A' && packet->payload[4] == 0x00 && (packet->payload[1] == 'T'
|
||||
|| packet->payload[1] == 'k')) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus asym.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* end Dofus 1.x.x */
|
||||
/* Dofus v 1.x.x */
|
||||
if (packet->payload_packet_len == 13 && get_u_int16_t(packet->payload, 1) == ntohs(0x0508)
|
||||
&& get_u_int16_t(packet->payload, 5) == ntohs(0x04a0)
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) == ntohs(0x0194)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 3 && memcmp(packet->payload, "HG", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 35 && memcmp(packet->payload, "HC", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len > 2 && packet->payload[0] == 'A'
|
||||
&& (packet->payload[1] == 'x' || packet->payload[1] == 'X')
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len == 12 && memcmp(packet->payload, "Af", 2) == 0
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 0 && packet->payload_packet_len > 2 && memcmp(packet->payload, "Ad", 2)
|
||||
&& packet->payload[packet->payload_packet_len - 1] == 0) {
|
||||
flow->l4.tcp.dofus_stage = 1;
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "maybe dofus.\n");
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 11 && memcmp(packet->payload, "AT", 2) == 0 && packet->payload[10] == 0x00) {
|
||||
if (flow->l4.tcp.dofus_stage == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (flow->l4.tcp.dofus_stage == 1 && packet->payload_packet_len == 5
|
||||
&& packet->payload[0] == 'A' && packet->payload[4] == 0x00 && (packet->payload[1] == 'T'
|
||||
|| packet->payload[1] == 'k')) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus asym.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* end Dofus 1.x.x */
|
||||
|
||||
|
||||
/* Dofus 2.0 */
|
||||
if ((packet->payload_packet_len == 11 || packet->payload_packet_len == 13 || packet->payload_packet_len == 49)
|
||||
&& get_u_int32_t(packet->payload, 0) == ntohl(0x00050800)
|
||||
&& get_u_int16_t(packet->payload, 4) == ntohs(0x0005)
|
||||
&& get_u_int16_t(packet->payload, 8) == ntohs(0x0005)
|
||||
&& packet->payload[10] == 0x18) {
|
||||
if (packet->payload_packet_len == 13
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) != ntohs(0x0194)) {
|
||||
goto exclude;
|
||||
}
|
||||
if (packet->payload_packet_len == 49 && ntohs(get_u_int16_t(packet->payload, 15)) + 17 != packet->payload_packet_len) {
|
||||
goto exclude;
|
||||
}
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len >= 41 && get_u_int16_t(packet->payload, 0) == ntohs(0x01b9) && packet->payload[2] == 0x26) {
|
||||
u_int16_t len, len2;
|
||||
len = ntohs(get_u_int16_t(packet->payload, 3));
|
||||
if ((len + 5 + 2) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
len2 = ntohs(get_u_int16_t(packet->payload, 5 + len));
|
||||
if (5 + len + 2 + len2 == packet->payload_packet_len) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (packet->payload_packet_len == 56
|
||||
&& memcmp(packet->payload, "\x00\x11\x35\x02\x03\x00\x93\x96\x01\x00", 10) == 0) {
|
||||
u_int16_t len, len2;
|
||||
len = ntohs(get_u_int16_t(packet->payload, 10));
|
||||
if ((len + 12 + 2) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
len2 = ntohs(get_u_int16_t(packet->payload, 12 + len));
|
||||
if ((12 + len + 2 + len2 + 1) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
if (12 + len + 2 + len2 + 1 == packet->payload_packet_len && packet->payload[12 + len + 2 + len2] == 0x01) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
exclude:
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "exclude dofus.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DOFUS);
|
||||
/* Dofus 2.0 */
|
||||
if ((packet->payload_packet_len == 11 || packet->payload_packet_len == 13 || packet->payload_packet_len == 49)
|
||||
&& get_u_int32_t(packet->payload, 0) == ntohl(0x00050800)
|
||||
&& get_u_int16_t(packet->payload, 4) == ntohs(0x0005)
|
||||
&& get_u_int16_t(packet->payload, 8) == ntohs(0x0005)
|
||||
&& packet->payload[10] == 0x18) {
|
||||
if (packet->payload_packet_len == 13
|
||||
&& get_u_int16_t(packet->payload, packet->payload_packet_len - 2) != ntohs(0x0194)) {
|
||||
goto exclude;
|
||||
}
|
||||
if (packet->payload_packet_len == 49 && ntohs(get_u_int16_t(packet->payload, 15)) + 17 != packet->payload_packet_len) {
|
||||
goto exclude;
|
||||
}
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len >= 41 && get_u_int16_t(packet->payload, 0) == ntohs(0x01b9) && packet->payload[2] == 0x26) {
|
||||
u_int16_t len, len2;
|
||||
len = ntohs(get_u_int16_t(packet->payload, 3));
|
||||
if ((len + 5 + 2) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
len2 = ntohs(get_u_int16_t(packet->payload, 5 + len));
|
||||
if (5 + len + 2 + len2 == packet->payload_packet_len) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (packet->payload_packet_len == 56
|
||||
&& memcmp(packet->payload, "\x00\x11\x35\x02\x03\x00\x93\x96\x01\x00", 10) == 0) {
|
||||
u_int16_t len, len2;
|
||||
len = ntohs(get_u_int16_t(packet->payload, 10));
|
||||
if ((len + 12 + 2) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
len2 = ntohs(get_u_int16_t(packet->payload, 12 + len));
|
||||
if ((12 + len + 2 + len2 + 1) > packet->payload_packet_len)
|
||||
goto exclude;
|
||||
if (12 + len + 2 + len2 + 1 == packet->payload_packet_len && packet->payload[12 + len + 2 + len2] == 0x01) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "found dofus.\n");
|
||||
ndpi_dofus_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
exclude:
|
||||
NDPI_LOG(NDPI_PROTOCOL_DOFUS, ndpi_struct, NDPI_LOG_DEBUG, "exclude dofus.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DOFUS);
|
||||
}
|
||||
|
||||
|
||||
void init_dofus_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Dofus", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DOFUS,
|
||||
ndpi_search_dofus,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -29,9 +29,7 @@ static void ndpi_int_dropbox_add_connection(struct ndpi_detection_module_struct
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int8_t due_to_correlation)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_DROPBOX,
|
||||
due_to_correlation ? NDPI_CORRELATED_PROTOCOL : NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,4 +72,18 @@ void ndpi_search_dropbox(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_dropbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DROPBOX", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DROPBOX,
|
||||
ndpi_search_dropbox,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* eaq.c
|
||||
*
|
||||
* Copyright (C) 2015 - ntop.org
|
||||
*
|
||||
* This module is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This module is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
EAQ: Entitade Aferidora da Qualidade de Banda Larga
|
||||
|
||||
http://www.brasilbandalarga.com.br
|
||||
*/
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#define EAQ_DEFAULT_PORT 6000
|
||||
#define EAQ_DEFAULT_SIZE 16
|
||||
|
||||
#ifdef NDPI_PROTOCOL_EAQ
|
||||
static void ndpi_int_eaq_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_EAQ, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
void ndpi_search_eaq(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int16_t sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
|
||||
|
||||
if((packet->payload_packet_len != EAQ_DEFAULT_SIZE)
|
||||
|| ((sport != EAQ_DEFAULT_PORT) && (dport != EAQ_DEFAULT_PORT))) {
|
||||
exclude_eaq:
|
||||
NDPI_LOG(NDPI_PROTOCOL_EAQ, ndpi_struct, NDPI_LOG_DEBUG, "Exclude eaq.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_EAQ);
|
||||
return;
|
||||
}
|
||||
|
||||
if(packet->udp != NULL) {
|
||||
u_int32_t seq = (packet->payload[0] * 1000) + (packet->payload[1] * 100) + (packet->payload[2] * 10) + packet->payload[3];
|
||||
|
||||
if(flow->l4.udp.eaq_pkt_id == 0)
|
||||
flow->l4.udp.eaq_sequence = seq;
|
||||
else {
|
||||
if((flow->l4.udp.eaq_sequence == seq) || ((flow->l4.udp.eaq_sequence+1) == seq)) {
|
||||
; /* Looks good */
|
||||
} else
|
||||
goto exclude_eaq;
|
||||
}
|
||||
|
||||
if(++flow->l4.udp.eaq_pkt_id == 4) {
|
||||
/* We have collected enough packets so we assume it's EAQ */
|
||||
NDPI_LOG(NDPI_PROTOCOL_EAQ, ndpi_struct, NDPI_LOG_DEBUG, "found eaq.\n");
|
||||
ndpi_int_eaq_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
} else
|
||||
goto exclude_eaq;
|
||||
}
|
||||
|
||||
|
||||
void init_eaq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("EAQ", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_EAQ,
|
||||
ndpi_search_eaq,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#ifdef NDPI_PROTOCOL_EDONKEY
|
||||
static void ndpi_int_edonkey_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_EDONKEY, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_EDONKEY, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static int ndpi_edonkey_payload_check(const u_int8_t *data, u_int32_t len) {
|
||||
@@ -208,4 +208,17 @@ void ndpi_search_edonkey(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_edonkey_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("eDonkey", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_EDONKEY,
|
||||
ndpi_search_edonkey,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
static void ndpi_int_fasttrack_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_FASTTRACK, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FASTTRACK, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,4 +79,18 @@ void ndpi_search_fasttrack_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
NDPI_LOG(NDPI_PROTOCOL_FASTTRACK, ndpi_struct, NDPI_LOG_TRACE, "fasttrack/kazaa excluded.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FASTTRACK);
|
||||
}
|
||||
|
||||
|
||||
void init_fasttrack_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("FastTrack", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FASTTRACK,
|
||||
ndpi_search_fasttrack_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* include files */
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_FIESTA
|
||||
@@ -31,7 +29,7 @@
|
||||
|
||||
static void ndpi_int_fiesta_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_FIESTA, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FIESTA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_fiesta(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -94,4 +92,17 @@ void ndpi_search_fiesta(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
ndpi_int_fiesta_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void init_fiesta_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Fiesta", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FIESTA,
|
||||
ndpi_search_fiesta,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
static void ndpi_int_filetopia_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_FILETOPIA, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FILETOPIA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_filetopia_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -80,4 +80,16 @@ void ndpi_search_filetopia_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FILETOPIA);
|
||||
}
|
||||
|
||||
|
||||
void init_filetopia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Filetopia", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FILETOPIA,
|
||||
ndpi_search_filetopia_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
static void ndpi_florensia_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_FLORENSIA, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FLORENSIA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_florensia(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -119,4 +119,17 @@ void ndpi_search_florensia(struct ndpi_detection_module_struct *ndpi_struct, str
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FLORENSIA);
|
||||
}
|
||||
|
||||
|
||||
void init_florensia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Florensia", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FLORENSIA,
|
||||
ndpi_search_florensia,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#ifdef NDPI_PROTOCOL_FTP_CONTROL
|
||||
|
||||
static void ndpi_int_ftp_control_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_FTP_CONTROL, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FTP_CONTROL, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static int ndpi_ftp_control_check_request(const u_int8_t *payload) {
|
||||
@@ -996,4 +996,17 @@ void ndpi_search_ftp_control(struct ndpi_detection_module_struct *ndpi_struct, s
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_ftp_control_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("FTP_CONTROL", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FTP_CONTROL,
|
||||
ndpi_search_ftp_control,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#ifdef NDPI_PROTOCOL_FTP_DATA
|
||||
static void ndpi_int_ftp_data_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_FTP_DATA, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FTP_DATA, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static int ndpi_match_ftp_data_port(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
@@ -56,7 +56,6 @@ static int ndpi_match_ftp_data_directory(struct ndpi_detection_module_struct *nd
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
static int ndpi_match_file_header(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
@@ -216,37 +215,17 @@ static int ndpi_match_file_header(struct ndpi_detection_module_struct *ndpi_stru
|
||||
|
||||
static void ndpi_check_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int32_t payload_len = packet->payload_packet_len;
|
||||
|
||||
/* Check if we so far detected the protocol in the request or not. */
|
||||
if(flow->ftp_data_stage == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "FTP_DATA stage 0: \n");
|
||||
|
||||
if((payload_len > 0) && (ndpi_match_file_header(ndpi_struct, flow) || ndpi_match_ftp_data_directory(ndpi_struct, flow) || ndpi_match_ftp_data_port(ndpi_struct, flow))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "Possible FTP_DATA request detected, we will look further for the response...\n");
|
||||
|
||||
/* Encode the direction of the packet in the stage, so we will know when we need to look for the response packet. */
|
||||
flow->ftp_data_stage = packet->packet_direction + 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "FTP_DATA stage %u: \n", flow->ftp_data_stage);
|
||||
|
||||
/* At first check, if this is for sure a response packet (in another direction. If not, do nothing now and return. */
|
||||
if((flow->ftp_data_stage - packet->packet_direction) == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* This is a packet in another direction. Check if we find the proper response. */
|
||||
if(payload_len == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "Found FTP_DATA.\n");
|
||||
ndpi_int_ftp_data_add_connection(ndpi_struct, flow);
|
||||
} else {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "The reply did not seem to belong to FTP_DATA, resetting the stage to 0...\n");
|
||||
flow->ftp_data_stage = 0;
|
||||
}
|
||||
|
||||
}
|
||||
if((packet->payload_packet_len > 0)
|
||||
&& (ndpi_match_file_header(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_directory(ndpi_struct, flow)
|
||||
|| ndpi_match_ftp_data_port(ndpi_struct, flow)
|
||||
)
|
||||
) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "Possible FTP_DATA request detected...\n");
|
||||
ndpi_int_ftp_data_add_connection(ndpi_struct, flow);
|
||||
} else
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_FTP_DATA);
|
||||
}
|
||||
|
||||
void ndpi_search_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
@@ -259,17 +238,21 @@ void ndpi_search_ftp_data(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
return;
|
||||
}
|
||||
|
||||
/* skip marked or retransmitted packets */
|
||||
if(packet->tcp_retransmission != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_FTP_DATA) {
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_FTP_DATA, ndpi_struct, NDPI_LOG_DEBUG, "FTP_DATA detection...\n");
|
||||
ndpi_check_ftp_data(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_ftp_data_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("FTP_DATA", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_FTP_DATA,
|
||||
ndpi_search_ftp_data,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,15 +30,14 @@
|
||||
#ifdef NDPI_PROTOCOL_GNUTELLA
|
||||
|
||||
static void ndpi_int_gnutella_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
ndpi_protocol_type_t protocol_type)
|
||||
struct ndpi_flow_struct *flow/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_GNUTELLA, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_GNUTELLA, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
if (src != NULL) {
|
||||
src->gnutella_ts = packet->tick_timestamp;
|
||||
@@ -104,13 +103,13 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
/* this case works asymmetrically */
|
||||
if (packet->payload_packet_len > 10 && memcmp(packet->payload, "GNUTELLA/", 9) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE, "GNUTELLA DETECTED\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* this case works asymmetrically */
|
||||
if (packet->payload_packet_len > 17 && memcmp(packet->payload, "GNUTELLA CONNECT/", 17) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE, "GNUTELLA DETECTED\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -125,7 +124,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|| (packet->line[c].len > 36 && memcmp(packet->line[c].ptr,
|
||||
"Content-Type: application/x-gnutella-", 37) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG, "DETECTED GNUTELLA GET.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +136,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|| (packet->accept_line.ptr != NULL && packet->accept_line.len > 24
|
||||
&& memcmp(packet->accept_line.ptr, "application n/x-gnutella", 24) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG, "DETECTED GNUTELLA GET.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -154,7 +153,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
if (c < (packet->payload_packet_len - 9) && memcmp(&packet->payload[c], "urn:sha1:", 9) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"detected GET /get/ or GET /uri-res/.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -163,7 +162,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
* it is searched in the upper paragraph. */
|
||||
if (packet->payload_packet_len > 30 && memcmp(packet->payload, "HEAD /gnutella/push-proxy?", 26) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE, "detected HEAD /gnutella/push-proxy?\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* haven't found any trace with this pattern */
|
||||
@@ -171,7 +170,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
&& memcmp(packet->payload, "\x50\x55\x53\x48\x20\x67\x75\x69\x64\x3a", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"detected \x50\x55\x53\x48\x20\x67\x75\x69\x64\x3a\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* haven't found any trace with this pattern */
|
||||
@@ -192,7 +191,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA,
|
||||
ndpi_struct, NDPI_LOG_TRACE, "FOXY :: GNUTELLA GET 2 DETECTED\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -213,14 +212,14 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
get_u_int32_t(packet->payload, 4) == htonl(0x01000300) && get_u_int32_t(packet->payload, 8) == htonl(0x00002000) &&
|
||||
get_u_int16_t(packet->payload, 12) == htons(0x0034)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE, "detected gnutella len == 46.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 49 &&
|
||||
memcmp(packet->payload, "\x80\x2f\x01\x03\x01\x00\x06\x00\x00\x00\x20\x00\x00\x34\x00\x00\xff\x4d\x6c",
|
||||
19) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE, "detected gnutella len == 49.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 89 && memcmp(&packet->payload[43], "\x20\x4d\x6c", 3) == 0 &&
|
||||
@@ -228,7 +227,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
memcmp(&packet->payload[76], "\x00\x02\x00\x34\x01\x00\x00\x05", 8) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"detected gnutella asymmetrically len == 388.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
} else if (packet->payload_packet_len == 82) {
|
||||
if (get_u_int32_t(packet->payload, 0) == htonl(0x16030100)
|
||||
@@ -237,7 +236,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
&& get_u_int16_t(packet->payload, 76) == htons(0x0002)
|
||||
&& get_u_int32_t(packet->payload, 78) == htonl(0x00340100)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_TRACE, "detected len == 82.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -246,7 +245,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
packet->udp->source == src->detected_gnutella_udp_port2) &&
|
||||
(packet->tick_timestamp - src->gnutella_ts) < ndpi_struct->gnutella_timeout) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG, "port based detection\n\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
/* observations:
|
||||
* all the following patterns send out many packets which are the only ones of their flows,
|
||||
@@ -260,7 +259,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
&& packet->payload[20] == 0x00 && packet->payload[21] == 0x00 && packet->payload[22] == 0x00) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected gnutella udp, len = 23.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -270,28 +269,28 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
&& packet->payload[30] == 0x43 && packet->payload[31] == 0x50 && packet->payload[32] == 0x41) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected gnutella udp, len = 35.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 32
|
||||
&& (memcmp(&packet->payload[16], "\x31\x01\x00\x09\x00\x00\x00\x4c\x49\x4d\x45", 11) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected gnutella udp, len = 32.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 34 && (memcmp(&packet->payload[25], "SCP@", 4) == 0)
|
||||
&& (memcmp(&packet->payload[30], "DNA@", 4) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected gnutella udp, len = 34.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if ((packet->payload_packet_len == 73 || packet->payload_packet_len == 96)
|
||||
&& memcmp(&packet->payload[32], "urn:sha1:", 9) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected gnutella udp, len = 73,96.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -311,7 +310,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|| (packet->payload_packet_len > 300 && (packet->payload[3] == 0x01 || packet->payload[3] == 0x03))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected gnutella udp, GND.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -320,14 +319,14 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
&& memcmp(&packet->payload[16], "\x31\x01\x00\x09\x00\x00\x00", 7) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected gnutella udp, len = 32 ii.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if ((packet->payload_packet_len == 23)
|
||||
&& memcmp(&packet->payload[16], "\x00\x01\x00\x00\x00\x00\x00", 7) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"detected gnutella udp, len = 23 ii.\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -353,7 +352,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
&& NDPI_SRC_OR_DST_HAS_PROTOCOL(src, dst, NDPI_PROTOCOL_GNUTELLA)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "GNUTELLA DETECTED due to message ID match (NEONet protocol)\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
} else if (flow->l4.tcp.gnutella_stage == 2 - packet->packet_direction) {
|
||||
@@ -364,7 +363,7 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
&& NDPI_SRC_OR_DST_HAS_PROTOCOL(src, dst, NDPI_PROTOCOL_GNUTELLA)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GNUTELLA, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "GNUTELLA DETECTED due to message ID match (NEONet protocol)\n");
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_gnutella_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -372,4 +371,19 @@ void ndpi_search_gnutella(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_GNUTELLA);
|
||||
}
|
||||
|
||||
|
||||
void init_gnutella_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Gnutella", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_GNUTELLA,
|
||||
ndpi_search_gnutella,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+14
-1
@@ -60,7 +60,7 @@ static void ndpi_check_gtp(struct ndpi_detection_module_struct *ndpi_struct, str
|
||||
|
||||
if(message_len <= (payload_len-sizeof(struct gtp_header_generic))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_GTP, ndpi_struct, NDPI_LOG_DEBUG, "Found gtp.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_GTP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_GTP, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -82,4 +82,17 @@ void ndpi_search_gtp(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
ndpi_check_gtp(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_gtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("GTP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_GTP,
|
||||
ndpi_search_gtp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,15 +23,13 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* include files */
|
||||
#include "ndpi_protocols.h"
|
||||
#ifdef NDPI_PROTOCOL_GUILDWARS
|
||||
|
||||
|
||||
static void ndpi_int_guildwars_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_GUILDWARS, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_GUILDWARS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_guildwars_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -68,4 +66,17 @@ void ndpi_search_guildwars_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_GUILDWARS);
|
||||
}
|
||||
|
||||
|
||||
void init_guildwars_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Guildwars", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_GUILDWARS,
|
||||
ndpi_search_guildwars_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -43,7 +43,7 @@ void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
/* ISO 8073/X.224 */
|
||||
if((packet->payload[5] == 0xE0 /* CC Connect Request */)
|
||||
|| (packet->payload[5] == 0xD0 /* CC Connect Confirm */)) {
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_RDP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_RDP, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
|
||||
if(flow->l4.tcp.h323_valid_packets >= 2) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_H323, ndpi_struct, NDPI_LOG_DEBUG, "found H323 broadcast.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
} else {
|
||||
/* This is not H.323 */
|
||||
@@ -67,7 +67,7 @@ void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
packet->payload[4] == 0x00 && packet->payload[5] == 0x00)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_H323, ndpi_struct, NDPI_LOG_DEBUG, "found H323 broadcast.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
/* H323 */
|
||||
@@ -76,13 +76,13 @@ void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
if(packet->payload[0] == 0x16 && packet->payload[1] == 0x80 && packet->payload[4] == 0x06 && packet->payload[5] == 0x00)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_H323, ndpi_struct, NDPI_LOG_DEBUG, "found H323 broadcast.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
else if(packet->payload_packet_len >= 20 || packet->payload_packet_len <= 117)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_H323, ndpi_struct, NDPI_LOG_DEBUG, "found H323 broadcast.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_H323, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -94,4 +94,17 @@ void ndpi_search_h323(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void init_h323_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("H323", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_H323,
|
||||
ndpi_search_h323,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
static void ndpi_int_halflife2_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_HALFLIFE2, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HALFLIFE2, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_halflife2(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -62,4 +62,17 @@ void ndpi_search_halflife2(struct ndpi_detection_module_struct *ndpi_struct, str
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_HALFLIFE2);
|
||||
}
|
||||
|
||||
|
||||
void init_halflife2_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("HalfLife2", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_HALFLIFE2,
|
||||
ndpi_search_halflife2,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+217
-46
@@ -39,10 +39,10 @@ static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *nd
|
||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
|
||||
if(protocol != NDPI_PROTOCOL_HTTP) {
|
||||
ndpi_search_tcp_or_udp(ndpi_struct, flow);
|
||||
ndpi_int_add_connection(ndpi_struct, flow, protocol, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_UNKNOWN);
|
||||
} else {
|
||||
ndpi_int_reset_protocol(flow);
|
||||
ndpi_int_add_connection(ndpi_struct, flow, protocol, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,8 @@ static void parseHttpSubprotocol(struct ndpi_detection_module_struct *ndpi_struc
|
||||
*/
|
||||
if(((ntohl(packet->iph->saddr) & 0xFFFFFC00 /* 255.255.252.0 */) == 0xC73B9400 /* 199.59.148.0 */)
|
||||
|| ((ntohl(packet->iph->daddr) & 0xFFFFFC00 /* 255.255.252.0 */) == 0xC73B9400 /* 199.59.148.0 */)) {
|
||||
packet->detected_protocol_stack[0] = NDPI_SERVICE_TWITTER;
|
||||
packet->detected_protocol_stack[0] = NDPI_SERVICE_TWITTER,
|
||||
packet->detected_protocol_stack[1] = NDPI_PROTOCOL_HTTP;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -188,7 +189,8 @@ static void parseHttpSubprotocol(struct ndpi_detection_module_struct *ndpi_struc
|
||||
*/
|
||||
if(((ntohl(packet->iph->saddr) & 0xFFFFE000 /* 255.255.224.0 */) == 0x4535E000 /* 69.53.224.0 */)
|
||||
|| ((ntohl(packet->iph->daddr) & 0xFFFFE000 /* 255.255.224.0 */) == 0x4535E000 /* 69.53.224.0 */)) {
|
||||
packet->detected_protocol_stack[0] = NDPI_SERVICE_NETFLIX;
|
||||
packet->detected_protocol_stack[0] = NDPI_SERVICE_NETFLIX,
|
||||
packet->detected_protocol_stack[1] = NDPI_PROTOCOL_HTTP;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -196,13 +198,24 @@ static void parseHttpSubprotocol(struct ndpi_detection_module_struct *ndpi_struc
|
||||
if((flow->l4.tcp.http_stage == 0)
|
||||
|| (flow->http.url && flow->http_detected)) {
|
||||
/* Try matching subprotocols */
|
||||
// ndpi_match_string_subprotocol(ndpi_struct, flow, (char*)packet->host_line.ptr, packet->host_line.len);
|
||||
// ndpi_match_host_subprotocol(ndpi_struct, flow, (char*)packet->host_line.ptr, packet->host_line.len);
|
||||
|
||||
if(ndpi_struct->http_dissect_response) {
|
||||
/*
|
||||
NOTE
|
||||
|
||||
If http_dont_dissect_response = 1 dissection of HTTP response
|
||||
mime types won't happen
|
||||
*/
|
||||
|
||||
if(!ndpi_struct->http_dont_dissect_response) {
|
||||
if(flow->http.url && flow->http_detected)
|
||||
ndpi_match_string_subprotocol(ndpi_struct, flow, (char *)&flow->http.url[7], strlen((const char *)&flow->http.url[7]));
|
||||
ndpi_match_host_subprotocol(ndpi_struct, flow, (char *)&flow->http.url[7],
|
||||
strlen((const char *)&flow->http.url[7]),
|
||||
NDPI_PROTOCOL_HTTP);
|
||||
} else
|
||||
ndpi_match_string_subprotocol(ndpi_struct, flow, (char *)flow->host_server_name, strlen((const char *)flow->host_server_name));
|
||||
ndpi_match_host_subprotocol(ndpi_struct, flow, (char *)flow->host_server_name,
|
||||
strlen((const char *)flow->host_server_name),
|
||||
NDPI_PROTOCOL_HTTP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +237,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
|
||||
u_int8_t a;
|
||||
|
||||
if(ndpi_struct->http_dissect_response) {
|
||||
if(!ndpi_struct->http_dont_dissect_response) {
|
||||
if((flow->http.url == NULL)
|
||||
&& (packet->http_url_name.len > 0)
|
||||
&& (packet->host_line.len > 0)) {
|
||||
@@ -337,10 +350,13 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "User Agent Type Line found %.*s\n",
|
||||
packet->user_agent_line.len, packet->user_agent_line.ptr);
|
||||
|
||||
if((!ndpi_struct->http_dissect_response) || flow->http_detected)
|
||||
#if 0
|
||||
if((ndpi_struct->http_dont_dissect_response) || flow->http_detected)
|
||||
ndpi_match_content_subprotocol(ndpi_struct, flow,
|
||||
(char*)packet->user_agent_line.ptr,
|
||||
packet->user_agent_line.len);
|
||||
packet->user_agent_line.len,
|
||||
NDPI_PROTOCOL_HTTP);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* check for host line */
|
||||
@@ -350,11 +366,12 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "HOST Line found %.*s\n",
|
||||
packet->host_line.len, packet->host_line.ptr);
|
||||
|
||||
if((!ndpi_struct->http_dissect_response) || flow->http_detected)
|
||||
ndpi_match_content_subprotocol(ndpi_struct, flow,
|
||||
(char*)packet->host_line.ptr,
|
||||
packet->host_line.len);
|
||||
|
||||
if((ndpi_struct->http_dont_dissect_response) || flow->http_detected)
|
||||
ndpi_match_host_subprotocol(ndpi_struct, flow,
|
||||
(char*)packet->host_line.ptr,
|
||||
packet->host_line.len,
|
||||
NDPI_PROTOCOL_HTTP);
|
||||
|
||||
/* Copy result for nDPI apps */
|
||||
len = ndpi_min(packet->host_line.len, sizeof(flow->host_server_name)-1);
|
||||
strncpy((char*)flow->host_server_name, (char*)packet->host_line.ptr, len);
|
||||
@@ -364,21 +381,23 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
strncpy((char*)flow->nat_ip, (char*)packet->forwarded_line.ptr, len);
|
||||
flow->nat_ip[len] = '\0';
|
||||
|
||||
if(!ndpi_struct->http_dissect_response)
|
||||
if(ndpi_struct->http_dont_dissect_response)
|
||||
parseHttpSubprotocol(ndpi_struct, flow);
|
||||
|
||||
if((flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN)
|
||||
&& ((!ndpi_struct->http_dissect_response) || flow->http_detected))
|
||||
ndpi_match_string_subprotocol(ndpi_struct, flow,
|
||||
&& ((ndpi_struct->http_dont_dissect_response) || flow->http_detected))
|
||||
ndpi_match_host_subprotocol(ndpi_struct, flow,
|
||||
(char *)flow->host_server_name,
|
||||
strlen((const char *)flow->host_server_name));
|
||||
strlen((const char *)flow->host_server_name),
|
||||
NDPI_PROTOCOL_HTTP);
|
||||
|
||||
if((flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN)
|
||||
&& ((!ndpi_struct->http_dissect_response) || flow->http_detected)
|
||||
&& ((ndpi_struct->http_dont_dissect_response) || flow->http_detected)
|
||||
&& (packet->http_origin.len > 0))
|
||||
ndpi_match_string_subprotocol(ndpi_struct, flow,
|
||||
ndpi_match_host_subprotocol(ndpi_struct, flow,
|
||||
(char *)packet->http_origin.ptr,
|
||||
packet->http_origin.len);
|
||||
packet->http_origin.len,
|
||||
NDPI_PROTOCOL_HTTP);
|
||||
|
||||
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN) {
|
||||
if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_HTTP) {
|
||||
@@ -388,7 +407,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
}
|
||||
}
|
||||
|
||||
if(ndpi_struct->http_dissect_response && flow->http_detected)
|
||||
if(!ndpi_struct->http_dont_dissect_response && flow->http_detected)
|
||||
parseHttpSubprotocol(ndpi_struct, flow);
|
||||
|
||||
/* check for accept line */
|
||||
@@ -419,8 +438,10 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "Content Type Line found %.*s\n",
|
||||
packet->content_line.len, packet->content_line.ptr);
|
||||
|
||||
if((!ndpi_struct->http_dissect_response) || flow->http_detected)
|
||||
ndpi_match_content_subprotocol(ndpi_struct, flow, (char*)packet->content_line.ptr, packet->content_line.len);
|
||||
if((ndpi_struct->http_dont_dissect_response) || flow->http_detected)
|
||||
ndpi_match_content_subprotocol(ndpi_struct, flow,
|
||||
(char*)packet->content_line.ptr, packet->content_line.len,
|
||||
NDPI_PROTOCOL_HTTP);
|
||||
}
|
||||
|
||||
/* check user agent here too */
|
||||
@@ -495,9 +516,6 @@ static u_int16_t http_request_url_offset(struct ndpi_detection_module_struct *nd
|
||||
static void http_bitmask_exclude(struct ndpi_flow_struct *flow)
|
||||
{
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_HTTP);
|
||||
#ifdef NDPI_PROTOCOL_WINDOWS_UPDATE
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_WINDOWS_UPDATE);
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_MPEG
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_MPEG);
|
||||
#endif
|
||||
@@ -754,7 +772,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
u_int16_t filename_start;
|
||||
|
||||
/* Check if we so far detected the protocol in the request or not. */
|
||||
if (flow->l4.tcp.http_stage == 0) {
|
||||
if(flow->l4.tcp.http_stage == 0) {
|
||||
flow->http_detected = 0;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "HTTP stage %d: \n",
|
||||
@@ -763,10 +781,10 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
filename_start = http_request_url_offset(ndpi_struct, flow);
|
||||
|
||||
|
||||
if (filename_start == 0) {
|
||||
if(filename_start == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"Filename HTTP not found, we look for possible truncate flow...\n");
|
||||
if (packet->payload_packet_len >= 7 && memcmp(packet->payload, "HTTP/1.", 7) == 0) {
|
||||
if(packet->payload_packet_len >= 7 && memcmp(packet->payload, "HTTP/1.", 7) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"HTTP response found (truncated flow ?)\n");
|
||||
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_HTTP);
|
||||
@@ -784,7 +802,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
|
||||
if (packet->parsed_lines <= 1) {
|
||||
if(packet->parsed_lines <= 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"Found just one line, we will look further for the next packet...\n");
|
||||
|
||||
@@ -825,8 +843,6 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"HTTP START Found, we will look for sub-protocols (content and host)...\n");
|
||||
|
||||
check_content_type_and_change_protocol(ndpi_struct, flow);
|
||||
|
||||
if(packet->host_line.ptr != NULL) {
|
||||
/*
|
||||
nDPI is pretty scrupoulous about HTTP so it waits until the
|
||||
@@ -835,7 +851,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
in 99.99% of the cases is like that.
|
||||
*/
|
||||
|
||||
if(!ndpi_struct->http_dissect_response) {
|
||||
if(ndpi_struct->http_dont_dissect_response) {
|
||||
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) /* No subprotocol found */
|
||||
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_HTTP);
|
||||
} else {
|
||||
@@ -845,21 +861,23 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
flow->l4.tcp.http_stage = packet->packet_direction + 1; // packet_direction 0: stage 1, packet_direction 1: stage 2
|
||||
}
|
||||
|
||||
check_content_type_and_change_protocol(ndpi_struct, flow);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "HTTP: REQUEST NOT HTTP CONFORM\n");
|
||||
http_bitmask_exclude(flow);
|
||||
} else if ((flow->l4.tcp.http_stage == 1) || (flow->l4.tcp.http_stage == 2)) {
|
||||
} else if((flow->l4.tcp.http_stage == 1) || (flow->l4.tcp.http_stage == 2)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "HTTP stage %u: \n",
|
||||
flow->l4.tcp.http_stage);
|
||||
|
||||
/* At first check, if this is for sure a response packet (in another direction. If not, if http is detected do nothing now and return,
|
||||
* otherwise check the second packet for the http request . */
|
||||
if ((flow->l4.tcp.http_stage - packet->packet_direction) == 1) {
|
||||
if((flow->l4.tcp.http_stage - packet->packet_direction) == 1) {
|
||||
|
||||
if (flow->http_detected)
|
||||
if(flow->http_detected)
|
||||
return;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
@@ -867,9 +885,9 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
|
||||
if (packet->parsed_lines <= 1) {
|
||||
if(packet->parsed_lines <= 1) {
|
||||
/* wait some packets in case request is split over more than 2 packets */
|
||||
if (flow->packet_counter < 5) {
|
||||
if(flow->packet_counter < 5) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"line still not finished, search next packet\n");
|
||||
return;
|
||||
@@ -882,7 +900,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
}
|
||||
}
|
||||
// http://www.slideshare.net/DSPIP/rtsp-analysis-wireshark
|
||||
if (packet->line[0].len >= 9
|
||||
if(packet->line[0].len >= 9
|
||||
&& memcmp(&packet->line[0].ptr[packet->line[0].len - 9], " HTTP/1.", 8) == 0) {
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "Found HTTP.\n");
|
||||
@@ -899,7 +917,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
/* This is a packet in another direction. Check if we find the proper response. */
|
||||
/* We have received a response for a previously identified partial HTTP request */
|
||||
|
||||
if ((packet->parsed_lines == 1) && (packet->packet_direction == 1 /* server -> client */)) {
|
||||
if((packet->parsed_lines == 1) && (packet->packet_direction == 1 /* server -> client */)) {
|
||||
/*
|
||||
In apache if you do "GET /\n\n" the response comes without any header so we can assume that
|
||||
this can be the case
|
||||
@@ -911,14 +929,14 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
}
|
||||
|
||||
/* If we already detected the http request, we can add the connection and then check for the sub-protocol*/
|
||||
if (flow->http_detected)
|
||||
if(flow->http_detected)
|
||||
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_HTTP);
|
||||
|
||||
/* Parse packet line and we look for the subprotocols */
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
check_content_type_and_change_protocol(ndpi_struct, flow);
|
||||
|
||||
if (packet->empty_line_position_set != 0 || flow->l4.tcp.http_empty_line_seen == 1) {
|
||||
if(packet->empty_line_position_set != 0 || flow->l4.tcp.http_empty_line_seen == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "empty line. check_http_payload.\n");
|
||||
check_http_payload(ndpi_struct, flow);
|
||||
}
|
||||
@@ -934,7 +952,7 @@ void ndpi_search_http_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
/* Break after 20 packets. */
|
||||
if (flow->packet_counter > 20) {
|
||||
if(flow->packet_counter > 20) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_HTTP, ndpi_struct, NDPI_LOG_DEBUG, "Exclude HTTP.\n");
|
||||
http_bitmask_exclude(flow);
|
||||
return;
|
||||
@@ -978,4 +996,157 @@ char* ndpi_get_http_content_type(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
return(flow->http.content_type);
|
||||
}
|
||||
|
||||
|
||||
void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id,
|
||||
NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("HTTP",ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_HTTP,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
|
||||
#if 0
|
||||
ndpi_set_bitmask_protocol_detection("HTTP_Proxy", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_HTTP_PROXY,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
|
||||
#ifdef NDPI_CONTENT_MPEG
|
||||
ndpi_set_bitmask_protocol_detection("MPEG", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_MPEG,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_FLASH
|
||||
ndpi_set_bitmask_protocol_detection("Flash", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_FLASH,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_QUICKTIME
|
||||
ndpi_set_bitmask_protocol_detection("QuickTime", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_QUICKTIME,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_REALMEDIA
|
||||
ndpi_set_bitmask_protocol_detection("RealMedia", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_REALMEDIA,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_WINDOWSMEDIA
|
||||
ndpi_set_bitmask_protocol_detection("WindowsMedia", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_WINDOWSMEDIA,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_MMS
|
||||
ndpi_set_bitmask_protocol_detection("MMS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_MMS,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_XBOX
|
||||
ndpi_set_bitmask_protocol_detection("Xbox", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_XBOX,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_QQ
|
||||
ndpi_set_bitmask_protocol_detection("QQ", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_QQ,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_AVI
|
||||
ndpi_set_bitmask_protocol_detection("AVI", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_AVI,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_OGG
|
||||
ndpi_set_bitmask_protocol_detection("OggVorbis", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_OGG,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_PROTOCOL_MOVE
|
||||
ndpi_set_bitmask_protocol_detection("Move", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MOVE,
|
||||
ndpi_search_http_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
|
||||
/* Update excluded protocol bitmask */
|
||||
NDPI_BITMASK_SET(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask,
|
||||
ndpi_struct->callback_buffer[a].detection_bitmask);
|
||||
|
||||
/*Delete protocol from exluded protocol bitmask*/
|
||||
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_PROTOCOL_QQ);
|
||||
|
||||
#ifdef NDPI_CONTENT_FLASH
|
||||
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_CONTENT_FLASH);
|
||||
#endif
|
||||
|
||||
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_CONTENT_MMS);
|
||||
/* #ifdef NDPI_PROTOCOL_RTSP */
|
||||
/* NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, */
|
||||
/* NDPI_PROTOCOL_RTSP); */
|
||||
/* #endif */
|
||||
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_PROTOCOL_XBOX);
|
||||
|
||||
NDPI_BITMASK_SET(ndpi_struct->generic_http_packet_bitmask, ndpi_struct->callback_buffer[a].detection_bitmask);
|
||||
|
||||
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->generic_http_packet_bitmask, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
/* Update callback_buffer index */
|
||||
a++;
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#ifdef NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC
|
||||
static void ndpi_int_activesync_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC, NDPI_PROTOCOL_HTTP);
|
||||
}
|
||||
|
||||
void ndpi_search_activesync(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -51,4 +51,18 @@ void ndpi_search_activesync(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_http_activesync_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("HTTP_Application_ActiveSync", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC,
|
||||
ndpi_search_activesync,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+16
-1
@@ -24,13 +24,14 @@
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_IAX
|
||||
|
||||
#define NDPI_IAX_MAX_INFORMATION_ELEMENTS 15
|
||||
|
||||
static void ndpi_int_iax_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_IAX, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_IAX, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static void ndpi_search_setup_iax(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -91,4 +92,18 @@ void ndpi_search_iax(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
&& (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN))
|
||||
ndpi_search_setup_iax(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_iax_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("IAX", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IAX,
|
||||
ndpi_search_iax,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
static void ndpi_int_icecast_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_ICECAST, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ICECAST, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_icecast_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -88,4 +88,18 @@ void ndpi_search_icecast_tcp(struct ndpi_detection_module_struct *ndpi_struct, s
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_ICECAST);
|
||||
NDPI_LOG(NDPI_PROTOCOL_ICECAST, ndpi_struct, NDPI_LOG_DEBUG, "Icecast excluded.\n");
|
||||
}
|
||||
|
||||
|
||||
void init_icecast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("IceCast", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_ICECAST,
|
||||
ndpi_search_icecast_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+27
-13
@@ -29,9 +29,9 @@
|
||||
|
||||
|
||||
static void ndpi_int_imesh_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, ndpi_protocol_type_t protocol_type)
|
||||
struct ndpi_flow_struct *flow/* , ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_IMESH, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_IMESH, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
get_u_int32_t(packet->payload, 24) == 0 &&
|
||||
(packet->udp->dest == htons(1864) || packet->udp->source == htons(1864))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "iMesh Login detected\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 36) {
|
||||
@@ -60,7 +60,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
|| packet->payload[packet->payload_packet_len - 1] ==
|
||||
packet->payload[packet->payload_packet_len - 5] - 1)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "iMesh detected\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (get_u_int16_t(packet->payload, 0) == htons(0x0200) && get_u_int16_t(packet->payload, 2) != 0 &&
|
||||
@@ -70,7 +70,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
|| packet->payload[packet->payload_packet_len - 1] ==
|
||||
packet->payload[packet->payload_packet_len - 5] - 1)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "iMesh detected\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
packet->payload[packet->payload_packet_len - 1] - 1 == packet->payload[packet->payload_packet_len - 5] ||
|
||||
packet->payload[packet->payload_packet_len - 1] == packet->payload[packet->payload_packet_len - 5] - 1)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "iMesh detected\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 32 && get_u_int32_t(packet->payload, 0) == htonl(0x02000000) &&
|
||||
@@ -89,12 +89,12 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
get_l16(packet->payload, 24) == htons(packet->udp->source)) {
|
||||
/* packet->payload[28] = source address */
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "iMesh detected\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (get_u_int32_t(packet->payload, 4) == htonl(0x01000082)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "iMesh detected\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
get_u_int32_t(packet->payload, 12) == htonl(0x04800100) && get_u_int32_t(packet->payload, 45) == htonl(0xff020000) &&
|
||||
get_u_int16_t(packet->payload, 49) == htons(0x001a)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "found imesh.\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 95 && get_u_int32_t(packet->payload, 0) == htonl(0x5f000000) &&
|
||||
@@ -117,7 +117,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
get_u_int32_t(packet->payload, 20) == 0 && get_u_int32_t(packet->payload, 28) == htonl(0xc8000400) &&
|
||||
packet->payload[9] == 0x80 && get_u_int32_t(packet->payload, 10) == get_u_int32_t(packet->payload, 24)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "found imesh.\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len == 28 && get_u_int32_t(packet->payload, 0) == htonl(0x1c000000) &&
|
||||
@@ -125,7 +125,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
(get_u_int16_t(packet->payload, packet->payload_packet_len - 2) == htons(0x1900) ||
|
||||
get_u_int16_t(packet->payload, packet->payload_packet_len - 2) == htons(0x1a00))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "found imesh.\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
memcmp(packet->line[4].ptr, "Accept-Encoding: identity",
|
||||
NDPI_STATICSTRING_LEN("Accept-Encoding: identity")) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "iMesh Login detected\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -277,7 +277,7 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
&& (flow->l4.tcp.seen_syn && flow->l4.tcp.seen_syn_ack && flow->l4.tcp.seen_ack) /* We have seen the 3-way handshake */)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_IMESH, ndpi_struct, NDPI_LOG_DEBUG, "found imesh.\n");
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_imesh_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -291,4 +291,18 @@ void ndpi_search_imesh_tcp_udp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
packet->tcp != NULL ? flow->l4.tcp.imesh_stage : 0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_imesh_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("iMESH", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IMESH,
|
||||
ndpi_search_imesh_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+18
-4
@@ -24,12 +24,13 @@
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_IPP
|
||||
|
||||
static void ndpi_int_ipp_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, ndpi_protocol_type_t protocol_type)
|
||||
struct ndpi_flow_struct *flow/* , ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_IPP, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_IPP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_ipp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -90,7 +91,7 @@ void ndpi_search_ipp(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_IPP, ndpi_struct, NDPI_LOG_DEBUG, "found ipp\n");
|
||||
ndpi_int_ipp_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_ipp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,7 +102,7 @@ void ndpi_search_ipp(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
if (packet->content_line.ptr != NULL && packet->content_line.len > 14
|
||||
&& memcmp(packet->content_line.ptr, "application/ipp", 15) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_IPP, ndpi_struct, NDPI_LOG_DEBUG, "found ipp via POST ... application/ipp.\n");
|
||||
ndpi_int_ipp_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_ipp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -109,4 +110,17 @@ void ndpi_search_ipp(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_IPP);
|
||||
}
|
||||
|
||||
|
||||
void init_ipp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("IPP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IPP,
|
||||
ndpi_search_ipp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+14
-1
@@ -35,7 +35,7 @@
|
||||
|
||||
static void ndpi_int_irc_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_IRC, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_IRC, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -801,4 +801,17 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_irc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("IRC", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IRC,
|
||||
ndpi_search_irc_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,9 +41,9 @@ static struct jabber_string jabber_strings[] = {
|
||||
|
||||
static void ndpi_int_jabber_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow,
|
||||
u_int32_t protocol, ndpi_protocol_type_t protocol_type)
|
||||
u_int32_t protocol)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, protocol, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static void check_content_type_and_change_protocol(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
@@ -56,7 +56,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
|
||||
|
||||
for(i=0; jabber_strings[i].string != NULL; i++) {
|
||||
if(ndpi_strnstr((const char*)&packet->payload[x], jabber_strings[i].string, left) != NULL) {
|
||||
ndpi_int_jabber_add_connection(ndpi_struct, flow, jabber_strings[i].ndpi_protocol, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_jabber_add_connection(ndpi_struct, flow, jabber_strings[i].ndpi_protocol);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
"found jabber file transfer.\n");
|
||||
|
||||
ndpi_int_jabber_add_connection(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_UNENCRYPED_JABBER, NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_UNENCRYPED_JABBER);
|
||||
}
|
||||
}
|
||||
if (dst != NULL && dst->jabber_file_transfer_port[0] != 0) {
|
||||
@@ -117,7 +117,7 @@ void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
"found jabber file transfer.\n");
|
||||
|
||||
ndpi_int_jabber_add_connection(ndpi_struct, flow,
|
||||
NDPI_PROTOCOL_UNENCRYPED_JABBER, NDPI_CORRELATED_PROTOCOL);
|
||||
NDPI_PROTOCOL_UNENCRYPED_JABBER);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -282,7 +282,7 @@ void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
|| ndpi_strnstr((const char *)&packet->payload[13], "xmlns:stream=\"http://etherx.jabber.org/streams\"", start)) {
|
||||
|
||||
/* Protocol family */
|
||||
ndpi_int_jabber_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_UNENCRYPED_JABBER, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_jabber_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_UNENCRYPED_JABBER);
|
||||
|
||||
/* search for subprotocols */
|
||||
check_content_type_and_change_protocol(ndpi_struct, flow, 13);
|
||||
@@ -304,4 +304,16 @@ void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void init_jabber_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Unencryped_Jabber", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_UNENCRYPED_JABBER,
|
||||
ndpi_search_jabber_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* kakaotalk_voice.c
|
||||
*
|
||||
* Copyright (C) 2015 - ntop.org
|
||||
*
|
||||
* This module is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This module is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
KakaoTalk (call only)
|
||||
|
||||
http://www.kakao.com/services/talk/voices
|
||||
*/
|
||||
#include "ndpi_api.h"
|
||||
|
||||
|
||||
#ifdef NDPI_SERVICE_KAKAOTALK_VOICE
|
||||
void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
unsigned char *vers;
|
||||
int ver_offs;
|
||||
|
||||
if(packet->iph
|
||||
&& packet->udp
|
||||
&& (packet->payload_packet_len > 0)
|
||||
) {
|
||||
if((packet->payload[0] == 0x81)
|
||||
|| (packet->payload[1] == 0xC8)
|
||||
|| (packet->payload[2] == 0x00)
|
||||
|| (packet->payload[3] == 0x0C)) {
|
||||
/* Looks good so far */
|
||||
|
||||
/*
|
||||
inetnum: 1.201.0.0 - 1.201.255.255
|
||||
netname: KINXINC-KR
|
||||
*/
|
||||
|
||||
if(((ntohl(packet->iph->saddr) & 0xFFFF0000 /* 255.255.0.0 */) == 0x01C90000 /* 1.201.0.0/16 */)
|
||||
|| ((ntohl(packet->iph->daddr) & 0xFFFF0000 /* 255.255.0.0 */) == 0x01C90000 /* 1.201.0.0/16 */)) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_SERVICE_KAKAOTALK_VOICE, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_KAKAOTALK_VOICE, ndpi_struct, NDPI_LOG_DEBUG, "Exclude kakaotalk_voice.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_SERVICE_KAKAOTALK_VOICE);
|
||||
}
|
||||
|
||||
|
||||
void init_kakaotalk_voice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("KakaoTalk_Voice", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_SERVICE_KAKAOTALK_VOICE,
|
||||
ndpi_search_kakaotalk_voice,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -23,16 +23,14 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* include files */
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_KERBEROS
|
||||
|
||||
static void ndpi_int_kerberos_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_KERBEROS, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_KERBEROS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,15 +66,21 @@ void ndpi_search_kerberos(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_KERBEROS, ndpi_struct, NDPI_LOG_DEBUG, "no KERBEROS detected.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_KERBEROS);
|
||||
}
|
||||
|
||||
|
||||
void init_kerberos_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Kerberos", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_KERBEROS,
|
||||
ndpi_search_kerberos,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,12 +24,13 @@
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_KONTIKI
|
||||
|
||||
static void ndpi_int_kontiki_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_KONTIKI, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_KONTIKI, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_kontiki(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -62,4 +63,17 @@ void ndpi_search_kontiki(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_KONTIKI);
|
||||
}
|
||||
|
||||
|
||||
void init_kontiki_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Kontiki", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_KONTIKI,
|
||||
ndpi_search_kontiki,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,16 +23,14 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* include files */
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_LDAP
|
||||
|
||||
static void ndpi_int_ldap_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_LDAP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_LDAP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_ldap(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -98,4 +96,17 @@ void ndpi_search_ldap(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_LDAP);
|
||||
}
|
||||
|
||||
|
||||
void init_ldap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("LDAP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_LDAP,
|
||||
ndpi_search_ldap,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -59,7 +59,7 @@ static void ndpi_check_lotus_notes(struct ndpi_detection_module_struct *ndpi_str
|
||||
|
||||
if(memcmp(&packet->payload[6], lotus_notes_header, sizeof(lotus_notes_header)) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_LOTUS_NOTES, ndpi_struct, NDPI_LOG_DEBUG, "Found lotus_notes.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_LOTUS_NOTES, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_LOTUS_NOTES, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -84,4 +84,17 @@ void ndpi_search_lotus_notes(struct ndpi_detection_module_struct *ndpi_struct, s
|
||||
ndpi_check_lotus_notes(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_lotus_notes_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("LotusNotes", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_LOTUS_NOTES,
|
||||
ndpi_search_lotus_notes,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_MAIL_IMAP
|
||||
|
||||
static void ndpi_int_mail_imap_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MAIL_IMAP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MAIL_IMAP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -290,4 +291,18 @@ void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
NDPI_LOG(NDPI_PROTOCOL_MAIL_IMAP, ndpi_struct, NDPI_LOG_DEBUG, "exclude IMAP.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MAIL_IMAP);
|
||||
}
|
||||
|
||||
|
||||
void init_mail_imap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MAIL_IMAP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MAIL_IMAP,
|
||||
ndpi_search_mail_imap_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,14 +41,14 @@
|
||||
|
||||
|
||||
static void ndpi_int_mail_pop_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MAIL_POP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MAIL_POP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
static int ndpi_int_mail_pop_check_for_client_commands(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
@@ -201,4 +201,18 @@ void ndpi_search_mail_pop_tcp(struct ndpi_detection_module_struct
|
||||
NDPI_LOG(NDPI_PROTOCOL_MAIL_POP, ndpi_struct, NDPI_LOG_DEBUG, "exclude mail_pop\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MAIL_POP);
|
||||
}
|
||||
|
||||
|
||||
void init_mail_pop_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MAIL_POP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MAIL_POP,
|
||||
ndpi_search_mail_pop_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
static void ndpi_int_mail_smtp_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MAIL_SMTP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MAIL_SMTP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_mail_smtp_tcp(struct ndpi_detection_module_struct
|
||||
@@ -177,4 +177,17 @@ void ndpi_search_mail_smtp_tcp(struct ndpi_detection_module_struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MAIL_SMTP);
|
||||
|
||||
}
|
||||
|
||||
void init_mail_smtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MAIL_SMTP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MAIL_SMTP,
|
||||
ndpi_search_mail_smtp_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,16 +22,13 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_MAPLESTORY
|
||||
|
||||
static void ndpi_int_maplestory_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
ndpi_protocol_type_t protocol_type)
|
||||
static void ndpi_int_maplestory_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MAPLESTORY, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MAPLESTORY, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +46,7 @@ void ndpi_search_maplestory(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
|| ntohl(get_u_int32_t(packet->payload, 0)) == 0x0e004200)
|
||||
&& ntohs(get_u_int16_t(packet->payload, 4)) == 0x0100 && (packet->payload[6] == 0x32 || packet->payload[6] == 0x33)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MAPLESTORY, ndpi_struct, NDPI_LOG_DEBUG, "found maplestory.\n");
|
||||
ndpi_int_maplestory_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_maplestory_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -67,7 +64,7 @@ void ndpi_search_maplestory(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
&& memcmp(packet->user_agent_line.ptr, "Patcher", NDPI_STATICSTRING_LEN("Patcher")) == 0
|
||||
&& memcmp(packet->host_line.ptr, "patch.", NDPI_STATICSTRING_LEN("patch.")) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MAPLESTORY, ndpi_struct, NDPI_LOG_DEBUG, "found maplestory update.\n");
|
||||
ndpi_int_maplestory_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_maplestory_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
} else if (packet->user_agent_line.ptr != NULL && packet->user_agent_line.len == NDPI_STATICSTRING_LEN("AspINet")
|
||||
@@ -75,7 +72,7 @@ void ndpi_search_maplestory(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
NDPI_STATICSTRING_LEN("story/")) == 0
|
||||
&& memcmp(packet->user_agent_line.ptr, "AspINet", NDPI_STATICSTRING_LEN("AspINet")) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MAPLESTORY, ndpi_struct, NDPI_LOG_DEBUG, "found maplestory update.\n");
|
||||
ndpi_int_maplestory_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_maplestory_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -84,4 +81,18 @@ void ndpi_search_maplestory(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MAPLESTORY);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_maplestory_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MapleStory", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MAPLESTORY,
|
||||
ndpi_search_maplestory,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,14 +29,11 @@
|
||||
|
||||
#define NDPI_MAX_MDNS_REQUESTS 128
|
||||
|
||||
/*
|
||||
This module should detect MDNS
|
||||
*/
|
||||
|
||||
static void ndpi_int_mdns_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MDNS, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MDNS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static int ndpi_int_check_mdns_payload(struct ndpi_detection_module_struct
|
||||
@@ -143,4 +140,18 @@ void ndpi_search_mdns(struct ndpi_detection_module_struct *ndpi_struct, struct n
|
||||
}
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MDNS);
|
||||
}
|
||||
|
||||
|
||||
void init_mdns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MDNS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MDNS,
|
||||
ndpi_search_mdns,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -30,12 +30,9 @@
|
||||
static void ndpi_int_meebo_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MEEBO, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MEEBO, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ndpi_search_meebo(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
@@ -162,4 +159,23 @@ void ndpi_search_meebo(struct ndpi_detection_module_struct
|
||||
NDPI_LOG(NDPI_PROTOCOL_MEEBO, ndpi_struct, NDPI_LOG_DEBUG, "exclude meebo.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MEEBO);
|
||||
}
|
||||
|
||||
|
||||
void init_meebo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Meebo", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MEEBO,
|
||||
ndpi_search_meebo,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
/* Add protocol bitmask dependencies to detected bitmask*/
|
||||
#ifdef NDPI_CONTENT_FLASH
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(ndpi_struct->callback_buffer[*id].detection_bitmask, NDPI_CONTENT_FLASH);
|
||||
#endif
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,7 +37,7 @@ void ndpi_search_megaco(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
packet->payload[5] == 'O' && packet->payload[6] == '/' &&
|
||||
packet->payload[7] == '1' && packet->payload[8] == ' ' && packet->payload[9] == '[')) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MEGACO, ndpi_struct, NDPI_LOG_DEBUG, "found MEGACO.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MEGACO, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MEGACO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -46,4 +46,16 @@ void ndpi_search_megaco(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MEGACO);
|
||||
}
|
||||
|
||||
|
||||
void init_megaco_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Megaco", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MEGACO,
|
||||
ndpi_search_megaco,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
#ifdef NDPI_PROTOCOL_MGCP
|
||||
|
||||
static void ndpi_int_mgcp_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MGCP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MGCP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,8 +95,20 @@ __forceinline static
|
||||
|
||||
void ndpi_search_mgcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
ndpi_search_mgcp_connection(ndpi_struct, flow);
|
||||
|
||||
ndpi_search_mgcp_connection(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_mgpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MGCP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MGCP,
|
||||
ndpi_search_mgcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+15
-1
@@ -31,7 +31,7 @@
|
||||
static void ndpi_int_mms_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_CONTENT_MMS, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_CONTENT_MMS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,4 +77,18 @@ void ndpi_search_mms_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
#endif /* NDPI_PROTOCOL_HTTP */
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_mms_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MMS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_CONTENT_MMS,
|
||||
ndpi_search_mms_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* mpegts.c (MPEG Transport Stream)
|
||||
* https://en.wikipedia.org/wiki/MPEG_transport_stream
|
||||
*
|
||||
* Copyright (C) 2015 - ntop.org
|
||||
*
|
||||
* nDPI is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* nDPI is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_MPEGTS
|
||||
|
||||
void ndpi_search_mpegts(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
u_int16_t dport = 0, sport = 0;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MPEGTS, ndpi_struct, NDPI_LOG_DEBUG, "search for MPEGTS.\n");
|
||||
|
||||
if((packet->udp != NULL) && ((packet->payload_packet_len % 188) == 0)) {
|
||||
u_int i, num_chunks = packet->payload_packet_len / 188;
|
||||
u_int32_t pkt_id;
|
||||
|
||||
for(i=0; i<num_chunks; i++) {
|
||||
u_int offset = 188 * i;
|
||||
|
||||
if(packet->payload[offset] != 0x47) goto no_mpegts;
|
||||
}
|
||||
|
||||
/* This looks MPEG TS */
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MPEGTS, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
no_mpegts:
|
||||
NDPI_LOG(NDPI_PROTOCOL_MPEGTS, ndpi_struct, NDPI_LOG_DEBUG, "Excluded MPEGTS.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MPEGTS);
|
||||
}
|
||||
|
||||
|
||||
void init_mpegts_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MPEG_TS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MPEGTS,
|
||||
ndpi_search_mpegts,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
+43
-32
@@ -28,10 +28,10 @@
|
||||
#ifdef NDPI_PROTOCOL_MSN
|
||||
|
||||
#define MAX_PACKETS_FOR_MSN 100
|
||||
static void ndpi_int_msn_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||
ndpi_protocol_type_t protocol_type)
|
||||
static void ndpi_int_msn_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MSN, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MSN, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static u_int8_t ndpi_int_find_xmsn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -72,7 +72,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
if (memcmp(packet->payload + 24, "MSNSLP", 6) == 0
|
||||
|| (get_u_int32_t(packet->payload, 0) == htonl(0x30000000) && get_u_int32_t(packet->payload, 4) == 0x00000000)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "detected MSN File Transfer, ifdef ssl.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -85,15 +85,13 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
if (flow->l4.tcp.msn_ssl_ft == 2) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"detected MSN File Transfer, ifdef ssl 2.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* we detect the initial connection only ! */
|
||||
/* match: "VER " ..... "CVR" x 0x0d 0x0a
|
||||
* len should be small, lets say less than 100 bytes
|
||||
@@ -119,9 +117,9 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
/* if (packet->payload_packet_len > 100 &&
|
||||
get_u_int16_t(packet->payload, 86) == htons(0x05dc)) { */
|
||||
if (packet->payload_packet_len > 101 && packet->payload[101] == 0x02) {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
} else {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -138,13 +136,13 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
3) == 0 || memcmp(&packet->payload[packet->payload_packet_len - 8], "MSNP", 4) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"found MSN by pattern VER...CVR/MSNP ODOA.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (memcmp(&packet->payload[4], "MSNFT", 5) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"found MSN FT by pattern VER MSNFT...0d0a.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -161,7 +159,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
if (packet->user_agent_line.ptr != NULL &&
|
||||
packet->user_agent_line.len > NDPI_STATICSTRING_LEN("Messenger/") &&
|
||||
memcmp(packet->user_agent_line.ptr, "Messenger/", NDPI_STATICSTRING_LEN("Messenger/")) == 0) {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -190,7 +188,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
NDPI_STATICSTRING_LEN("text/x-msnmsgr")) == 0))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"found MSN by pattern POST http:// .... application/x-msn-messenger.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -251,7 +249,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
!= 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"found MSN with pattern text/xml; charset=utf-8.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
for (a = 0; a < packet->parsed_lines; a++) {
|
||||
@@ -263,7 +261,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
"found MSN with pattern text/sml; charset0utf-8.\n");
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct,
|
||||
NDPI_LOG_TRACE, "MSN xml CVS / VER / ANS found\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -294,12 +292,12 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
NDPI_STATICSTRING_LEN("text/x-msnmsgr")) == 0))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"HTTP/1.0 200 OK .... application/x-msn-messenger.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (ndpi_int_find_xmsn(ndpi_struct, flow) == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "HTTP/1.0 200 OK .... X-MSN.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -312,7 +310,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
if (memcmp(packet->payload, "CONNECT messenger.hotmail.com:1863 HTTP/1.", 42) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"found MSN with pattern CONNECT messenger.hotmail.com:1863 HTTP/1..\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -353,7 +351,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
}
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"found MSN with pattern USR/ANS ...mail_address.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -385,20 +383,17 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
memcmp(packet->content_line.ptr, "text/x-msnmsgr", NDPI_STATICSTRING_LEN("text/x-msnmsgr")) == 0))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE,
|
||||
"HTTP/1.0 200 OK .... application/x-msn-messenger.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (ndpi_int_find_xmsn(ndpi_struct, flow) == 1) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "HTTP/1.0 200 OK .... X-MSN.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* finished examining the secone packet only */
|
||||
/* direct user connection (file transfer,...) */
|
||||
|
||||
@@ -408,7 +403,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
if (flow->packet_counter == 1 &&
|
||||
packet->payload_packet_len > 12 && memcmp(packet->payload, "recipientid=", 12) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_DEBUG, "detected file transfer.\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -435,7 +430,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
/* asymmetric detection to this pattern is asym (2) */
|
||||
} else if (flow->l4.tcp.msn_stage == 1 + packet->packet_direction) {
|
||||
if (packet->payload_packet_len > 10 && get_u_int32_t(packet->payload, 0) == htonl(0x666f6f00)) {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "MSN File Transfer detected 1\n");
|
||||
return;
|
||||
}
|
||||
@@ -449,26 +444,26 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
|
||||
} else if (flow->l4.tcp.msn_stage == 2 - packet->packet_direction
|
||||
&& packet->payload_packet_len == 4 && get_u_int32_t(packet->payload, 0) == htonl(0x30000000)) {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "MSN File Transfer detected 2\n");
|
||||
return;
|
||||
} else if ((flow->l4.tcp.msn_stage == 3 + packet->packet_direction)
|
||||
|| (flow->l4.tcp.msn_stage == 4 - packet->packet_direction)) {
|
||||
if (packet->payload_packet_len == 4 && get_u_int32_t(packet->payload, 0) == htonl(0x30000000)) {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "MSN File Transfer detected 2\n");
|
||||
return;
|
||||
}
|
||||
} else if (flow->l4.tcp.msn_stage == 6 - packet->packet_direction) {
|
||||
if ((packet->payload_packet_len == 4) &&
|
||||
(get_u_int32_t(packet->payload, 0) == htonl(0x10000000) || get_u_int32_t(packet->payload, 0) == htonl(0x30000000))) {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "MSN File Transfer detected 3\n");
|
||||
return;
|
||||
}
|
||||
} else if (flow->l4.tcp.msn_stage == 5 + packet->packet_direction) {
|
||||
if ((packet->payload_packet_len == 20) && get_u_int32_t(packet->payload, 0) == htonl(0x10000000)) {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "MSN File Transfer detected 3\n");
|
||||
return;
|
||||
}
|
||||
@@ -481,7 +476,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
|
||||
if (memcmp(&packet->payload[40], "INVITE MSNMSGR", 14) == 0
|
||||
|| memcmp(&packet->payload[56], "INVITE MSNMSGR", 14) == 0
|
||||
|| memcmp(&packet->payload[172], "INVITE MSNMSGR", 14) == 0) {
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "MSN File Transfer detected 3\n");
|
||||
return;
|
||||
@@ -521,7 +516,7 @@ static void ndpi_search_udp_msn_misc(struct ndpi_detection_module_struct
|
||||
&& get_u_int32_t(packet->payload, 4) == 0 && packet->payload[9] == 0
|
||||
&& get_u_int16_t(packet->payload, 10) == htons(0x0100)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSN, ndpi_struct, NDPI_LOG_TRACE, "msn udp misc data connection detected\n");
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_msn_add_connection(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
/* asymmetric detection working. */
|
||||
@@ -560,4 +555,20 @@ void ndpi_search_msn(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_msn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
|
||||
NDPI_BITMASK_RESET(ndpi_struct->callback_buffer[*id].excluded_protocol_bitmask);
|
||||
|
||||
ndpi_set_bitmask_protocol_detection("MSN", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MSN,
|
||||
ndpi_search_msn,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+30
-23
@@ -19,43 +19,50 @@
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* include files */
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_MSSQL
|
||||
|
||||
static void ndpi_int_mssql_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MSSQL, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MSSQL, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_mssql(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSSQL, ndpi_struct, NDPI_LOG_DEBUG, "search mssql.\n");
|
||||
|
||||
if (packet->payload_packet_len > 51 && ntohs(get_u_int32_t(packet->payload, 0)) == 0x1201
|
||||
&& ntohs(get_u_int16_t(packet->payload, 2)) == packet->payload_packet_len
|
||||
&& ntohl(get_u_int32_t(packet->payload, 4)) == 0x00000100 && memcmp(&packet->payload[41], "sqlexpress", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSSQL, ndpi_struct, NDPI_LOG_DEBUG, "found mssql.\n");
|
||||
ndpi_int_mssql_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSSQL, ndpi_struct, NDPI_LOG_DEBUG, "search mssql.\n");
|
||||
|
||||
|
||||
if (packet->payload_packet_len > 51 && ntohs(get_u_int32_t(packet->payload, 0)) == 0x1201
|
||||
&& ntohs(get_u_int16_t(packet->payload, 2)) == packet->payload_packet_len
|
||||
&& ntohl(get_u_int32_t(packet->payload, 4)) == 0x00000100 && memcmp(&packet->payload[41], "sqlexpress", 10) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSSQL, ndpi_struct, NDPI_LOG_DEBUG, "found mssql.\n");
|
||||
ndpi_int_mssql_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSSQL, ndpi_struct, NDPI_LOG_DEBUG, "exclude mssql.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MSSQL);
|
||||
NDPI_LOG(NDPI_PROTOCOL_MSSQL, ndpi_struct, NDPI_LOG_DEBUG, "exclude mssql.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MSSQL);
|
||||
}
|
||||
|
||||
|
||||
void init_mssql_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MsSQL", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MSSQL,
|
||||
ndpi_search_mssql,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+41
-28
@@ -24,47 +24,60 @@
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_MYSQL
|
||||
|
||||
static void ndpi_int_mysql_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_MYSQL, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_MYSQL, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_mysql_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
if (packet->payload_packet_len > 37 //min length
|
||||
&& get_u_int16_t(packet->payload, 0) == packet->payload_packet_len - 4 //first 3 bytes are length
|
||||
&& get_u_int8_t(packet->payload, 2) == 0x00 //3rd byte of packet length
|
||||
&& get_u_int8_t(packet->payload, 3) == 0x00 //packet sequence number is 0 for startup packet
|
||||
&& get_u_int8_t(packet->payload, 5) > 0x30 //server version > 0
|
||||
&& get_u_int8_t(packet->payload, 5) < 0x37 //server version < 7
|
||||
&& get_u_int8_t(packet->payload, 6) == 0x2e //dot
|
||||
) {
|
||||
u_int32_t a;
|
||||
for (a = 7; a + 31 < packet->payload_packet_len; a++) {
|
||||
if (packet->payload[a] == 0x00) {
|
||||
if (get_u_int8_t(packet->payload, a + 13) == 0x00 //filler byte
|
||||
&& get_u_int64_t(packet->payload, a + 19) == 0x0ULL //13 more
|
||||
&& get_u_int32_t(packet->payload, a + 27) == 0x0 //filler bytes
|
||||
&& get_u_int8_t(packet->payload, a + 31) == 0x0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MYSQL, ndpi_struct, NDPI_LOG_DEBUG, "MySQL detected.\n");
|
||||
ndpi_int_mysql_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (packet->payload_packet_len > 37 //min length
|
||||
&& get_u_int16_t(packet->payload, 0) == packet->payload_packet_len - 4 //first 3 bytes are length
|
||||
&& get_u_int8_t(packet->payload, 2) == 0x00 //3rd byte of packet length
|
||||
&& get_u_int8_t(packet->payload, 3) == 0x00 //packet sequence number is 0 for startup packet
|
||||
&& get_u_int8_t(packet->payload, 5) > 0x30 //server version > 0
|
||||
&& get_u_int8_t(packet->payload, 5) < 0x37 //server version < 7
|
||||
&& get_u_int8_t(packet->payload, 6) == 0x2e //dot
|
||||
) {
|
||||
u_int32_t a;
|
||||
for (a = 7; a + 31 < packet->payload_packet_len; a++) {
|
||||
if (packet->payload[a] == 0x00) {
|
||||
if (get_u_int8_t(packet->payload, a + 13) == 0x00 //filler byte
|
||||
&& get_u_int64_t(packet->payload, a + 19) == 0x0ULL //13 more
|
||||
&& get_u_int32_t(packet->payload, a + 27) == 0x0 //filler bytes
|
||||
&& get_u_int8_t(packet->payload, a + 31) == 0x0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_MYSQL, ndpi_struct, NDPI_LOG_DEBUG, "MySQL detected.\n");
|
||||
ndpi_int_mysql_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MYSQL);
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MYSQL);
|
||||
}
|
||||
|
||||
|
||||
void init_mysql_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("MySQL", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_MYSQL,
|
||||
ndpi_search_mysql_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,7 +63,7 @@ static int netbios_name_interpret(char *in, char *out, u_int out_len) {
|
||||
static void ndpi_int_netbios_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_NETBIOS, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_NETBIOS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
@@ -365,4 +365,18 @@ void ndpi_search_netbios(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_NETBIOS);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void init_netbios_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("NETBIOS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_NETBIOS,
|
||||
ndpi_search_netbios,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+103
-6
@@ -30,6 +30,73 @@ extern int gettimeofday(struct timeval * tp, struct timezone * tzp);
|
||||
#define do_gettimeofday(a) gettimeofday(a, NULL)
|
||||
#endif
|
||||
|
||||
struct flow_ver1_rec {
|
||||
u_int32_t srcaddr; /* Source IP Address */
|
||||
u_int32_t dstaddr; /* Destination IP Address */
|
||||
u_int32_t nexthop; /* Next hop router's IP Address */
|
||||
u_int16_t input; /* Input interface index */
|
||||
u_int16_t output; /* Output interface index */
|
||||
u_int32_t dPkts; /* Packets sent in Duration */
|
||||
u_int32_t dOctets; /* Octets sent in Duration */
|
||||
u_int32_t first; /* SysUptime at start of flow */
|
||||
u_int32_t last; /* and of last packet of the flow */
|
||||
u_int16_t srcport; /* TCP/UDP source port number (.e.g, FTP, Telnet, etc.,or equivalent) */
|
||||
u_int16_t dstport; /* TCP/UDP destination port number (.e.g, FTP, Telnet, etc.,or equivalent) */
|
||||
u_int16_t pad; /* pad to word boundary */
|
||||
u_int8_t proto; /* IP protocol, e.g., 6=TCP, 17=UDP, etc... */
|
||||
u_int8_t tos; /* IP Type-of-Service */
|
||||
u_int8_t pad2[7]; /* pad to word boundary */
|
||||
};
|
||||
|
||||
struct flow_ver5_rec {
|
||||
u_int32_t srcaddr; /* Source IP Address */
|
||||
u_int32_t dstaddr; /* Destination IP Address */
|
||||
u_int32_t nexthop; /* Next hop router's IP Address */
|
||||
u_int16_t input; /* Input interface index */
|
||||
u_int16_t output; /* Output interface index */
|
||||
u_int32_t dPkts; /* Packets sent in Duration (milliseconds between 1st
|
||||
& last packet in this flow)*/
|
||||
u_int32_t dOctets; /* Octets sent in Duration (milliseconds between 1st
|
||||
& last packet in this flow)*/
|
||||
u_int32_t first; /* SysUptime at start of flow */
|
||||
u_int32_t last; /* and of last packet of the flow */
|
||||
u_int16_t srcport; /* TCP/UDP source port number (.e.g, FTP, Telnet, etc.,or equivalent) */
|
||||
u_int16_t dstport; /* TCP/UDP destination port number (.e.g, FTP, Telnet, etc.,or equivalent) */
|
||||
u_int8_t pad1; /* pad to word boundary */
|
||||
u_int8_t tcp_flags; /* Cumulative OR of tcp flags */
|
||||
u_int8_t proto; /* IP protocol, e.g., 6=TCP, 17=UDP, etc... */
|
||||
u_int8_t tos; /* IP Type-of-Service */
|
||||
u_int16_t src_as; /* source peer/origin Autonomous System */
|
||||
u_int16_t dst_as; /* dst peer/origin Autonomous System */
|
||||
u_int8_t src_mask; /* source route's mask bits */
|
||||
u_int8_t dst_mask; /* destination route's mask bits */
|
||||
u_int16_t pad2; /* pad to word boundary */
|
||||
};
|
||||
|
||||
struct flow_ver7_rec {
|
||||
u_int32_t srcaddr; /* Source IP Address */
|
||||
u_int32_t dstaddr; /* Destination IP Address */
|
||||
u_int32_t nexthop; /* Next hop router's IP Address */
|
||||
u_int16_t input; /* Input interface index */
|
||||
u_int16_t output; /* Output interface index */
|
||||
u_int32_t dPkts; /* Packets sent in Duration */
|
||||
u_int32_t dOctets; /* Octets sent in Duration */
|
||||
u_int32_t first; /* SysUptime at start of flow */
|
||||
u_int32_t last; /* and of last packet of the flow */
|
||||
u_int16_t srcport; /* TCP/UDP source port number (.e.g, FTP, Telnet, etc.,or equivalent) */
|
||||
u_int16_t dstport; /* TCP/UDP destination port number (.e.g, FTP, Telnet, etc.,or equivalent) */
|
||||
u_int8_t flags; /* Shortcut mode(dest only,src only,full flows*/
|
||||
u_int8_t tcp_flags; /* Cumulative OR of tcp flags */
|
||||
u_int8_t proto; /* IP protocol, e.g., 6=TCP, 17=UDP, etc... */
|
||||
u_int8_t tos; /* IP Type-of-Service */
|
||||
u_int16_t dst_as; /* dst peer/origin Autonomous System */
|
||||
u_int16_t src_as; /* source peer/origin Autonomous System */
|
||||
u_int8_t dst_mask; /* destination route's mask bits */
|
||||
u_int8_t src_mask; /* source route's mask bits */
|
||||
u_int16_t pad2; /* pad to word boundary */
|
||||
u_int32_t router_sc; /* Router which is shortcut by switch */
|
||||
};
|
||||
|
||||
static void ndpi_check_netflow(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
@@ -41,19 +108,36 @@ static void ndpi_check_netflow(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if((packet->udp != NULL) && (payload_len >= 24)) {
|
||||
u_int16_t version = (packet->payload[0] << 8) + packet->payload[1], uptime_offset;
|
||||
u_int32_t when, *_when;
|
||||
u_int16_t n = (packet->payload[2] << 8) + packet->payload[3];
|
||||
u_int16_t n = (packet->payload[2] << 8) + packet->payload[3], expected_len = 0;
|
||||
|
||||
switch(version) {
|
||||
case 1:
|
||||
case 5:
|
||||
case 7:
|
||||
case 9:
|
||||
{
|
||||
u_int16_t num_flows = n;
|
||||
if((n == 0) || (n > 30))
|
||||
return;
|
||||
|
||||
if((num_flows == 0) || (num_flows > 30))
|
||||
return;
|
||||
switch(version) {
|
||||
case 1:
|
||||
expected_len = n * sizeof(struct flow_ver1_rec) + 16 /* header */;
|
||||
break;
|
||||
case 5:
|
||||
expected_len = n * sizeof(struct flow_ver5_rec) + 24 /* header */;
|
||||
break;
|
||||
case 7:
|
||||
expected_len = n * sizeof(struct flow_ver7_rec) + 24 /* header */;
|
||||
break;
|
||||
case 9:
|
||||
/* We need to check the template */
|
||||
break;
|
||||
}
|
||||
|
||||
if((expected_len > 0) && (expected_len != payload_len)) {
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_NETFLOW);
|
||||
return;
|
||||
}
|
||||
|
||||
uptime_offset = 8;
|
||||
break;
|
||||
case 10: /* IPFIX */
|
||||
@@ -78,7 +162,7 @@ static void ndpi_check_netflow(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
if(((version == 1) && (when == 0))
|
||||
|| ((when >= 946684800 /* 1/1/2000 */) && (when <= now))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_NETFLOW, ndpi_struct, NDPI_LOG_DEBUG, "Found netflow.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_NETFLOW, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_NETFLOW, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -90,4 +174,17 @@ void ndpi_search_netflow(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
ndpi_check_netflow(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_netflow_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("NetFlow", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_NETFLOW,
|
||||
ndpi_search_netflow,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+16
-2
@@ -24,12 +24,13 @@
|
||||
|
||||
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
#ifdef NDPI_PROTOCOL_NFS
|
||||
|
||||
static void ndpi_int_nfs_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_NFS, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_NFS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_nfs(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -83,4 +84,17 @@ void ndpi_search_nfs(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_NFS);
|
||||
}
|
||||
|
||||
|
||||
void init_nfs_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("NFS", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_NFS,
|
||||
ndpi_search_nfs,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+16
-2
@@ -8,12 +8,12 @@
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
|
||||
#ifdef NDPI_PROTOCOL_NOE
|
||||
|
||||
static void ndpi_int_noe_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_NOE, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_NOE, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_noe(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -49,4 +49,18 @@ void ndpi_search_noe(struct ndpi_detection_module_struct *ndpi_struct, struct nd
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_NOE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_noe_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("NOE", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_NOE,
|
||||
ndpi_search_noe,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,9 +31,8 @@
|
||||
{ \
|
||||
if (NDPI_COMPARE_PROTOCOL_TO_BITMASK(ndpi_struct->detection_bitmask,nprot) != 0) \
|
||||
{ \
|
||||
ndpi_int_add_connection(ndpi_struct, flow, \
|
||||
nprot, \
|
||||
NDPI_REAL_PROTOCOL); \
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, \
|
||||
nprot, NDPI_PROTOCOL_UNKNOWN); \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -105,4 +104,95 @@ void ndpi_search_in_non_tcp_udp(struct ndpi_detection_module_struct
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_non_tcp_udp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
|
||||
/* always add non tcp/udp if one protocol is compiled in */
|
||||
NDPI_SAVE_AS_BITMASK(ndpi_struct->callback_buffer[*id].detection_bitmask, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
#ifdef NDPI_CONTENT_IP_IPSEC
|
||||
ndpi_set_bitmask_protocol_detection("IP_IPSEC", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_IPSEC,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_IP_GRE
|
||||
ndpi_set_bitmask_protocol_detection("IP_GRE", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_GRE,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_IP_ICMP
|
||||
ndpi_set_bitmask_protocol_detection("IP_ICMP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_ICMP,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_IP_IGMP
|
||||
ndpi_set_bitmask_protocol_detection("IP_IGMP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_IGMP,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_IP_EGP
|
||||
ndpi_set_bitmask_protocol_detection("IP_EGP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_EGP,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_IP_SCTP
|
||||
ndpi_set_bitmask_protocol_detection("IP_SCTP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_SCTP,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_IP_OSPF
|
||||
ndpi_set_bitmask_protocol_detection("IP_OSPF", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_OSPF,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_IP_IP_IN_IP
|
||||
ndpi_set_bitmask_protocol_detection("IP_IP_IN_IP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_IP_IN_IP,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
#ifdef NDPI_CONTENT_IP_ICMPV6
|
||||
ndpi_set_bitmask_protocol_detection("IP_ICMPV6", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_IP_ICMPV6,
|
||||
ndpi_search_in_non_tcp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6,
|
||||
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+26
-4
@@ -27,9 +27,9 @@
|
||||
#ifdef NDPI_PROTOCOL_NTP
|
||||
|
||||
static void ndpi_int_ntp_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_NTP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_NTP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
/* detection also works asymmetrically */
|
||||
@@ -46,14 +46,23 @@ void ndpi_search_ntp_udp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "NTP port detected\n");
|
||||
|
||||
if (packet->payload_packet_len != 48)
|
||||
goto exclude_ntp;
|
||||
// It's not correct because packets could be bigger
|
||||
//if (packet->payload_packet_len != 48)
|
||||
// goto exclude_ntp;
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "NTP length detected\n");
|
||||
|
||||
|
||||
if ((((packet->payload[0] & 0x38) >> 3) <= 4)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_NTP, ndpi_struct, NDPI_LOG_DEBUG, "detected NTP.");
|
||||
|
||||
// 38 in binary representation is 00111000
|
||||
flow->protos.ntp.version = (packet->payload[0] & 0x38) >> 3;
|
||||
|
||||
if (flow->protos.ntp.version == 2) {
|
||||
flow->protos.ntp.request_code = packet->payload[3];
|
||||
}
|
||||
|
||||
ndpi_int_ntp_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
@@ -65,4 +74,17 @@ void ndpi_search_ntp_udp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_NTP);
|
||||
}
|
||||
|
||||
|
||||
void init_ntp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("NTP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_NTP,
|
||||
ndpi_search_ntp_udp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#ifdef NDPI_PROTOCOL_OPENFT
|
||||
|
||||
static void ndpi_int_openft_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_OPENFT, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENFT, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_openft_tcp(struct ndpi_detection_module_struct
|
||||
@@ -53,4 +53,18 @@ void ndpi_search_openft_tcp(struct ndpi_detection_module_struct
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_OPENFT);
|
||||
}
|
||||
|
||||
|
||||
void init_openft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("OpenFT", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_OPENFT,
|
||||
ndpi_search_openft_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,7 @@ void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct,
|
||||
packet->payload[2] == 0x00 && packet->payload[3] == 0x00)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OPENVPN, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found openvpn udp 443.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN,
|
||||
NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -39,8 +38,7 @@ void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct,
|
||||
packet->payload[0] == 0x38 || packet->payload[0] == 0x39)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OPENVPN, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found openvpn broadcast udp STD.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN,
|
||||
NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -56,14 +54,25 @@ void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct,
|
||||
(packet->payload[2] == 0x38))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OPENVPN, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"found openvpn broadcast udp STD.\n");
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN,
|
||||
NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask,
|
||||
NDPI_PROTOCOL_OPENVPN);
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_OPENVPN);
|
||||
}
|
||||
|
||||
|
||||
void init_openvpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("OpenVPN", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_OPENVPN,
|
||||
ndpi_search_openvpn,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
static void ndpi_int_oracle_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_ORACLE, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_ORACLE, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_oracle(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -59,4 +59,18 @@ void ndpi_search_oracle(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_ORACLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_oracle_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Oracle", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_ORACLE,
|
||||
ndpi_search_oracle,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+580
-53
@@ -19,24 +19,67 @@
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
#define FLAPVERSION 0x00000001
|
||||
|
||||
/* Flap channels */
|
||||
#define SIGNON 0x01
|
||||
#define DATA 0x02
|
||||
#define ERROR 0x03
|
||||
#define SIGNOFF 0x04
|
||||
#define KEEP_ALIVE 0x05
|
||||
|
||||
/* Signon tags */
|
||||
#define SCREEN_NAME 0x0001
|
||||
#define PASSWD 0x0002
|
||||
#define CLIENT_NAME 0x0003
|
||||
#define BOS 0x0005
|
||||
#define LOGIN_COOKIE 0x0006
|
||||
#define MAJOR_VERSION 0x0017
|
||||
#define MINOR_VERSION 0x0018
|
||||
#define POINT_VERSION 0x0019
|
||||
#define BUILD_NUM 0x001a
|
||||
#define MULTICONN_FLAGS 0x004a
|
||||
#define CLIENT_LANG 0x00OF
|
||||
#define CLIENT_CNTRY 0x00OE
|
||||
#define CLIENT_RECONNECT 0x0094
|
||||
|
||||
/* Family */
|
||||
#define GE_SE_CTL 0x0001
|
||||
#define LOC_SRV 0x0002
|
||||
#define BUDDY_LIST 0x0003
|
||||
#define IM 0x0004
|
||||
#define IS 0x0006
|
||||
#define ACC_ADM 0x0007
|
||||
#define POPUP 0x0008
|
||||
#define PMS 0x0009
|
||||
#define USS 0x000b
|
||||
#define CHAT_ROOM_SETUP 0x000d
|
||||
#define CHAT_ROOM_ACT 0x000e
|
||||
#define USER_SRCH 0x000f
|
||||
#define BUDDY_ICON_SERVER 0x0010
|
||||
#define SERVER_STORED_INFO 0x0013
|
||||
#define ICQ 0x0015
|
||||
#define INIT_AUTH 0x0017
|
||||
#define EMAIL 0x0018
|
||||
#define IS_EXT 0x0085
|
||||
|
||||
#ifdef NDPI_PROTOCOL_OSCAR
|
||||
|
||||
static void ndpi_int_oscar_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow, ndpi_protocol_type_t protocol_type)
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_OSCAR, protocol_type);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OSCAR, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
if (src != NULL) {
|
||||
src->oscar_last_safe_access_time = packet->tick_timestamp;
|
||||
@@ -46,51 +89,521 @@ static void ndpi_int_oscar_add_connection(struct ndpi_detection_module_struct *n
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Oscar connection work on FLAP protocol.
|
||||
|
||||
FLAP is a low-level communications protocol that facilitates the development of higher-level, datagram-oriented, communications layers.
|
||||
It is used on the TCP connection between all clients and servers.
|
||||
Here is format of FLAP datagram
|
||||
**/
|
||||
static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
if (packet->payload_packet_len >= 10 && packet->payload[0] == 0x2a) {
|
||||
|
||||
/* if is a oscar connection, 10 bytes long */
|
||||
int excluded = 0;
|
||||
u_int8_t channel;
|
||||
u_int16_t family;
|
||||
u_int16_t type;
|
||||
u_int16_t flag;
|
||||
u_int32_t req_ID;
|
||||
|
||||
/* OSCAR Connection :: Connection detected at initial packets only
|
||||
* +----+----+------+------+---------------+
|
||||
* |0x2a|Code|SeqNum|PktLen|ProtcolVersion |
|
||||
* +----+----+------+------+---------------+
|
||||
* Code 1 Byte : 0x01 Oscar Connection
|
||||
* SeqNum and PktLen are 2 Bytes each and ProtcolVersion: 0x00000001
|
||||
* */
|
||||
if (get_u_int8_t(packet->payload, 1) == 0x01 && get_u_int16_t(packet->payload, 4) == htons(packet->payload_packet_len - 6)
|
||||
&& get_u_int32_t(packet->payload, 6) == htonl(0x0000000001)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR Connection FOUND \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
return;
|
||||
struct ndpi_packet_struct * packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct * src = flow->src;
|
||||
struct ndpi_id_struct * dst = flow->dst;
|
||||
|
||||
/* FLAP__Header
|
||||
*
|
||||
* [ 6 byte FLAP header ]
|
||||
* +-----------+--------------+-------------+--------------+
|
||||
* | 0x2a (1B) | Channel (1B) | SeqNum (2B) | PyldLen (2B) |
|
||||
* +-----------+--------------+-------------+--------------+
|
||||
*
|
||||
* [ 4 byte of data ]
|
||||
*
|
||||
* */
|
||||
if (packet->payload_packet_len >= 6 && packet->payload[0] == 0x2a)
|
||||
{
|
||||
|
||||
/* FLAP__FRAME_TYPE (Channel)*/
|
||||
u_int8_t channel = get_u_int8_t(packet->payload, 1);
|
||||
|
||||
/*
|
||||
Initialize the FLAP connection.
|
||||
|
||||
SIGNON -> FLAP__SIGNON_FRAME
|
||||
+--------------------------------------------------+
|
||||
+ FLAP__Header | 6 byte +
|
||||
+ FlapVersion | 4 byte (Always 1 = 0x00000001) +
|
||||
+ TLVs | [Class: FLAP__SIGNON_TAGS] TLVs +
|
||||
+--------------------------------------------------+
|
||||
*/
|
||||
if (channel == SIGNON &&
|
||||
get_u_int16_t(packet->payload, 4) == htons(packet->payload_packet_len - 6) &&
|
||||
get_u_int32_t(packet->payload, 6) == htonl(FLAPVERSION))
|
||||
{
|
||||
|
||||
/* No TLVs */
|
||||
if(packet->payload_packet_len == 10)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Sign In \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* /\* SCREEN_NAME *\/ */
|
||||
/* if (get_u_int16_t(packet->payload, 10) == htons(SCREEN_NAME)) /\* packet->payload[10] == 0x00 && packet->payload[11] == 0x01 *\/ */
|
||||
/* { */
|
||||
/* NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Screen Name \n"); */
|
||||
/* ndpi_int_oscar_add_connection(ndpi_struct, flow); */
|
||||
/* return; */
|
||||
/* } */
|
||||
/* /\* PASSWD *\/ */
|
||||
/* if (get_u_int16_t(packet->payload, 10) == htons(PASSWD)) /\* packet->payload[10] == 0x00 && packet->payload[11] == 0x02 *\/ */
|
||||
/* { */
|
||||
/* NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Password (roasted) \n"); */
|
||||
/* ndpi_int_oscar_add_connection(ndpi_struct, flow); */
|
||||
/* return; */
|
||||
/* } */
|
||||
/* CLIENT_NAME */
|
||||
if (get_u_int16_t(packet->payload, 10) == htons(CLIENT_NAME)) /* packet->payload[10] == 0x00 && packet->payload[11] == 0x03 */
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Client Name \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* LOGIN_COOKIE */
|
||||
if (get_u_int16_t(packet->payload, 10) == htons(LOGIN_COOKIE) &&
|
||||
get_u_int16_t(packet->payload, 12) == htons(0x0100))
|
||||
{
|
||||
if(get_u_int16_t(packet->payload, packet->payload_packet_len - 5) == htons(MULTICONN_FLAGS)) /* MULTICONN_FLAGS */
|
||||
{
|
||||
if(get_u_int16_t(packet->payload, packet->payload_packet_len - 3) == htons(0x0001))
|
||||
if((get_u_int8_t(packet->payload, packet->payload_packet_len - 1) == 0x00) ||
|
||||
(get_u_int8_t(packet->payload, packet->payload_packet_len - 1) == 0x01) ||
|
||||
(get_u_int8_t(packet->payload, packet->payload_packet_len - 1) == 0x03))
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Login \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* MAJOR_VERSION */
|
||||
if (get_u_int16_t(packet->payload, 10) == htons(MAJOR_VERSION))
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Major_Version \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* MINOR_VERSION */
|
||||
if (get_u_int16_t(packet->payload, 10) == htons(MINOR_VERSION))
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Minor_Version \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* POINT_VERSION */
|
||||
if (get_u_int16_t(packet->payload, 10) == htons(POINT_VERSION))
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Point_Version \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* BUILD_NUM */
|
||||
if (get_u_int16_t(packet->payload, 10) == htons(BUILD_NUM))
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Build_Num \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/* CLIENT_RECONNECT */
|
||||
if (get_u_int16_t(packet->payload, 10) == htons(CLIENT_RECONNECT))
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR - Client_Reconnect \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Messages using the FLAP connection, usually a SNAC message.
|
||||
|
||||
DATA -> FLAP__DATA_FRAME
|
||||
+-------------------------+
|
||||
+ FLAP__Header | 6 byte +
|
||||
+ SNAC__Header | 10 byte +
|
||||
+ snac | +
|
||||
+-------------------------+
|
||||
|
||||
SNAC__Header
|
||||
+----------------------------------------------+
|
||||
+ ID | 4 byte (2 foodgroup + 2 type) +
|
||||
+ FLAGS | 2 byte +
|
||||
+ requestId | 4 byte +
|
||||
+----------------------------------------------+
|
||||
*/
|
||||
if (channel == DATA)
|
||||
{
|
||||
family = get_u_int16_t(packet->payload, 6);
|
||||
type = get_u_int16_t(packet->payload, 8);
|
||||
flag = get_u_int16_t(packet->payload, 10);
|
||||
req_ID = get_u_int32_t(packet->payload, 12);
|
||||
|
||||
/* Family 0x0001 */
|
||||
if (family == htons(GE_SE_CTL))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
case (0x000a): break;
|
||||
case (0x000b): break;
|
||||
case (0x000c): break;
|
||||
case (0x000d): break;
|
||||
case (0x000e): break;
|
||||
case (0x000f): break;
|
||||
case (0x0010): break;
|
||||
case (0x0011): break;
|
||||
case (0x0012): break;
|
||||
case (0x0013): break;
|
||||
case (0x0014): break;
|
||||
case (0x0015): break;
|
||||
case (0x0016): break;
|
||||
case (0x0017): break;
|
||||
case (0x0018): break;
|
||||
case (0x001e): break;
|
||||
case (0x001f): break;
|
||||
case (0x0020): break;
|
||||
case (0x0021): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0002 */
|
||||
if (family == htons(LOC_SRV))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
case (0x000a): break;
|
||||
case (0x000b): break;
|
||||
case (0x000c): break;
|
||||
case (0x000f): break;
|
||||
case (0x0010): break;
|
||||
case (0x0015): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0003 */
|
||||
if (family == htons(BUDDY_LIST))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
case (0x000a): break;
|
||||
case (0x000b): break;
|
||||
case (0x000c): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0004 */
|
||||
if (family == htons(IM))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
case (0x000a): break;
|
||||
case (0x000b): break;
|
||||
case (0x000c): break;
|
||||
case (0x0014): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0006 */
|
||||
if (family == htons(IS))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0007 */
|
||||
if (family == htons(ACC_ADM))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0008 */
|
||||
if (family == htons(POPUP))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0009 */
|
||||
if (family == htons(PMS))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
case (0x000a): break;
|
||||
case (0x000b): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x000b */
|
||||
if (family == htons(USS))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x000d */
|
||||
if (family == htons(CHAT_ROOM_SETUP))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x000e */
|
||||
if (family == htons(CHAT_ROOM_ACT))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x000f */
|
||||
if (family == htons(USER_SRCH))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0010 */
|
||||
if (family == htons(BUDDY_ICON_SERVER))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0013 */
|
||||
if (family == htons(SERVER_STORED_INFO))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x0008): break;
|
||||
case (0x0009): break;
|
||||
case (0x000a): break;
|
||||
case (0x000e): break;
|
||||
case (0x000f): break;
|
||||
case (0x0011): break;
|
||||
case (0x0012): break;
|
||||
case (0x0014): break;
|
||||
case (0x0015): break;
|
||||
case (0x0016): break;
|
||||
case (0x0018): break;
|
||||
case (0x001a): break;
|
||||
case (0x001b): break;
|
||||
case (0x001c): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0015 */
|
||||
if (family == htons(ICQ))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0017 */
|
||||
if (family == htons(INIT_AUTH))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
case (0x0004): break;
|
||||
case (0x0005): break;
|
||||
case (0x0006): break;
|
||||
case (0x0007): break;
|
||||
case (0x000a): break;
|
||||
case (0x000b): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
/* Family 0x0018 */
|
||||
if (family == htons(EMAIL))
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
/* Family 0x0085 */
|
||||
if (family == htons(IS_EXT))
|
||||
{
|
||||
switch (type) {
|
||||
|
||||
case (0x0001): break;
|
||||
case (0x0002): break;
|
||||
case (0x0003): break;
|
||||
default: excluded = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(excluded == 1)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "exclude oscar.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_OSCAR);
|
||||
}
|
||||
|
||||
/* flag */
|
||||
if (flag == htons(0x0000)|| flag == htons(0x8000) || flag == htons(0x0001))
|
||||
{
|
||||
/* request ID */
|
||||
if((req_ID <= 4294967295))
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR Detected \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
ERROR -> FLAP__ERROR_CHANNEL_0x03
|
||||
A FLAP error - rare
|
||||
*/
|
||||
if (channel == ERROR)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR Detected - Error frame \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
Close down the FLAP connection gracefully.
|
||||
SIGNOFF: FLAP__SIGNOFF_CHANNEL_0x04
|
||||
*/
|
||||
if (channel == SIGNOFF)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR Detected - Signoff frame \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
Send a heartbeat to server to help keep connection open.
|
||||
KEEP_ALIVE: FLAP__KEEP_ALIVE_CHANNEL_0x05
|
||||
*/
|
||||
if (channel == KEEP_ALIVE)
|
||||
{
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR Detected - Keep Alive frame \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* OSCAR IM
|
||||
* +----+----+------+------+----------+-----------+
|
||||
* |0x2a|Code|SeqNum|PktLen|FNACfamily|FNACsubtype|
|
||||
* +----+----+------+------+----------+-----------+
|
||||
* Code 1 Byte : 0x02 SNAC Header Code;
|
||||
* SeqNum and PktLen are 2 Bytes each
|
||||
* FNACfamily 2 Byte : 0x0004 IM Messaging
|
||||
* FNACEsubtype 2 Byte : 0x0006 IM Outgoing Message, 0x000c IM Message Acknowledgment
|
||||
* */
|
||||
if (packet->payload[1] == 0x02
|
||||
&& ntohs(get_u_int16_t(packet->payload, 4)) >=
|
||||
packet->payload_packet_len - 6 && get_u_int16_t(packet->payload, 6) == htons(0x0004)
|
||||
&& (get_u_int16_t(packet->payload, 8) == htons(0x0006)
|
||||
|| get_u_int16_t(packet->payload, 8) == htons(0x000c))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR IM Detected \n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* detect http connections */
|
||||
if (packet->payload_packet_len >= 18) {
|
||||
@@ -100,7 +613,7 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
if (memcmp(packet->host_line.ptr, "lifestream.aol.com", 18) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"OSCAR over HTTP found, POST method\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +627,7 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
(memcmp(&packet->payload[5], "b/ss/aolwpaim", 13) == 0) ||
|
||||
(memcmp(&packet->payload[5], "hss/storage/aimtmpshare", 23) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR over HTTP found, GET /aim/\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,7 +640,7 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
(memcmp(packet->user_agent_line.ptr, "AIM%20Free/", NDPI_STATICSTRING_LEN("AIM%20Free/")) == 0) ||
|
||||
(memcmp(packet->user_agent_line.ptr, "AIM/", 4) == 0))) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR over HTTP found\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -142,7 +655,7 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
if (memcmp(&packet->referer_line.ptr[i + 1], "im/gromit/aim_express", 21) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"OSCAR over HTTP found : aim/gromit/aim_express\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -153,12 +666,12 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
if (memcmp(packet->payload, "CONNECT ", 8) == 0) {
|
||||
if (memcmp(packet->payload, "CONNECT login.icq.com:443 HTTP/1.", 33) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR ICQ-HTTP FOUND\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (memcmp(packet->payload, "CONNECT login.oscar.aol.com:5190 HTTP/1.", 40) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR AIM-HTTP FOUND\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,14 +681,14 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
if (packet->payload_packet_len > 43
|
||||
&& memcmp(packet->payload, "GET http://http.proxy.icq.com/hello HTTP/1.", 43) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR ICQ-HTTP PROXY FOUND\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len > 46
|
||||
&& memcmp(packet->payload, "GET http://aimhttp.oscar.aol.com/hello HTTP/1.", 46) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR AIM-HTTP PROXY FOUND\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_CORRELATED_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -194,7 +707,7 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
memcmp(&packet->payload[packet->payload_packet_len - 26],
|
||||
"\x67\x00\x65\x00\x74\x00\x43\x00\x61\x00\x74\x00\x61\x00\x6c\x00\x6f\x00\x67", 19) == 0) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR PICTURE TRANSFER\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +735,7 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
)))) {
|
||||
// FILE TRANSFER PATTERN:: OFT3 or OFT2
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR FILE TRANSFER\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -230,7 +743,7 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
//PICTURE TRANSFER PATTERN EXMAPLE::
|
||||
//4f 44 43 32 00 4c 00 01 00 06 00 00 00 00 00 00 ODC2.L..........
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR PICTURE TRANSFER\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -241,7 +754,7 @@ static void ndpi_search_oscar_tcp_connect(struct ndpi_detection_module_struct
|
||||
&& (memcmp(&packet->payload[packet->payload_packet_len - 6], "DEST", 4) == 0)
|
||||
&& (memcmp(&packet->payload[packet->payload_packet_len - 2], "\x00\x00", 2) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_OSCAR, ndpi_struct, NDPI_LOG_DEBUG, "OSCAR PICTURE TRANSFER\n");
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow, NDPI_REAL_PROTOCOL);
|
||||
ndpi_int_oscar_add_connection(ndpi_struct, flow);
|
||||
if (ntohs(packet->tcp->dest) == 443 || ntohs(packet->tcp->source) == 443) {
|
||||
flow->oscar_ssl_voice_stage = 1;
|
||||
}
|
||||
@@ -270,4 +783,18 @@ void ndpi_search_oscar(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
ndpi_search_oscar_tcp_connect(ndpi_struct, flow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void init_oscar_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Oscar", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_OSCAR,
|
||||
ndpi_search_oscar,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
#ifdef NDPI_PROTOCOL_PANDO
|
||||
static void ndpi_int_pando_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_PANDO, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_PANDO, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static void ndpi_check_pando_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
@@ -154,4 +154,17 @@ void ndpi_search_pando(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
ndpi_check_pando_udp(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_pando_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("Pando_Media_Booster", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_PANDO,
|
||||
ndpi_search_pando,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,29 +27,42 @@
|
||||
#ifdef NDPI_PROTOCOL_PCANYWHERE
|
||||
|
||||
static void ndpi_int_pcanywhere_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_PCANYWHERE, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_PCANYWHERE, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_pcanywhere(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
// struct ndpi_id_struct *src=ndpi_struct->src;
|
||||
// struct ndpi_id_struct *dst=ndpi_struct->dst;
|
||||
|
||||
if (packet->udp != NULL && packet->udp->dest == htons(5632)
|
||||
&& packet->payload_packet_len == 2
|
||||
&& (memcmp(packet->payload, "NQ", 2) == 0 || memcmp(packet->payload, "ST", 2) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_PCANYWHERE, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"PC Anywhere name or status query detected.\n");
|
||||
ndpi_int_pcanywhere_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->udp != NULL && packet->udp->dest == htons(5632)
|
||||
&& packet->payload_packet_len == 2
|
||||
&& (memcmp(packet->payload, "NQ", 2) == 0 || memcmp(packet->payload, "ST", 2) == 0)) {
|
||||
NDPI_LOG(NDPI_PROTOCOL_PCANYWHERE, ndpi_struct, NDPI_LOG_DEBUG,
|
||||
"PC Anywhere name or status query detected.\n");
|
||||
ndpi_int_pcanywhere_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_PCANYWHERE);
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_PCANYWHERE);
|
||||
}
|
||||
|
||||
|
||||
void init_pcanywhere_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("PcAnywhere", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_PCANYWHERE,
|
||||
ndpi_search_pcanywhere,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
|
||||
|
||||
static void ndpi_int_postgres_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_POSTGRES, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_POSTGRES, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_postgres_tcp(struct ndpi_detection_module_struct
|
||||
@@ -117,4 +117,17 @@ void ndpi_search_postgres_tcp(struct ndpi_detection_module_struct
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_POSTGRES);
|
||||
}
|
||||
|
||||
|
||||
void init_postgres_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("PostgreSQL", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_POSTGRES,
|
||||
ndpi_search_postgres_tcp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#ifdef NDPI_PROTOCOL_PPLIVE
|
||||
static void ndpi_int_pplive_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_PPLIVE, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_PPLIVE, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static void ndpi_check_pplive_udp1(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
@@ -217,4 +217,17 @@ void ndpi_search_pplive(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
ndpi_check_pplive_udp3(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_pplive_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("PPLive", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_PPLIVE,
|
||||
ndpi_search_pplive,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
static void ndpi_int_ppstream_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_PPSTREAM, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_PPSTREAM, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_ppstream(struct ndpi_detection_module_struct
|
||||
@@ -94,12 +94,23 @@ void ndpi_search_ppstream(struct ndpi_detection_module_struct
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
NDPI_LOG(NDPI_PROTOCOL_PPSTREAM, ndpi_struct, NDPI_LOG_DEBUG, "exclude ppstream.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_PPSTREAM);
|
||||
}
|
||||
|
||||
|
||||
void init_ppstream_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("PPStream", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_PPSTREAM,
|
||||
ndpi_search_ppstream,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
static void ndpi_int_pptp_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_int_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_PPTP, NDPI_REAL_PROTOCOL);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_PPTP, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_pptp(struct ndpi_detection_module_struct
|
||||
@@ -58,4 +58,18 @@ void ndpi_search_pptp(struct ndpi_detection_module_struct
|
||||
NDPI_LOG(NDPI_PROTOCOL_PPTP, ndpi_struct, NDPI_LOG_DEBUG, "exclude pptp.\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_PPTP);
|
||||
}
|
||||
|
||||
|
||||
void init_pptp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("PPTP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_PPTP,
|
||||
ndpi_search_pptp,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user