Added ability to extract BitTorrent hash (and eventually peerId)
This commit is contained in:
+14
-1
@@ -197,7 +197,8 @@ typedef struct ndpi_flow {
|
|||||||
// result only, not used for flow identification
|
// result only, not used for flow identification
|
||||||
ndpi_protocol detected_protocol;
|
ndpi_protocol detected_protocol;
|
||||||
|
|
||||||
char host_server_name[256];
|
char host_server_name[192];
|
||||||
|
char bittorent_hash[41];
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char client_certificate[48], server_certificate[48];
|
char client_certificate[48], server_certificate[48];
|
||||||
@@ -528,6 +529,7 @@ static void printFlow(u_int16_t thread_id, struct ndpi_flow *flow) {
|
|||||||
if(flow->host_server_name[0] != '\0') fprintf(out, "[Host: %s]", flow->host_server_name);
|
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.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);
|
if(flow->ssl.server_certificate[0] != '\0') fprintf(out, "[SSL server: %s]", flow->ssl.server_certificate);
|
||||||
|
if(flow->bittorent_hash[0] != '\0') fprintf(out, "[BT Hash: %s]", flow->bittorent_hash);
|
||||||
|
|
||||||
fprintf(out, "\n");
|
fprintf(out, "\n");
|
||||||
} else {
|
} else {
|
||||||
@@ -1066,6 +1068,17 @@ static unsigned int packet_processing(u_int16_t thread_id,
|
|||||||
|
|
||||||
snprintf(flow->host_server_name, sizeof(flow->host_server_name), "%s", flow->ndpi_flow->host_server_name);
|
snprintf(flow->host_server_name, sizeof(flow->host_server_name), "%s", flow->ndpi_flow->host_server_name);
|
||||||
|
|
||||||
|
if(flow->detected_protocol.protocol == NDPI_PROTOCOL_BITTORRENT) {
|
||||||
|
int i, j, n = 0;
|
||||||
|
|
||||||
|
for(i=0, j = 0; i<20; i++) {
|
||||||
|
sprintf(&flow->bittorent_hash[j], "%02x", flow->ndpi_flow->bittorent_hash[i]);
|
||||||
|
j += 2, n += flow->ndpi_flow->bittorent_hash[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(n == 0) flow->bittorent_hash[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
if((proto == IPPROTO_TCP) && (flow->detected_protocol.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.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);
|
snprintf(flow->ssl.server_certificate, sizeof(flow->ssl.server_certificate), "%s", flow->ndpi_flow->protos.ssl.server_certificate);
|
||||||
|
|||||||
@@ -887,11 +887,13 @@ struct ndpi_flow_struct {
|
|||||||
*/
|
*/
|
||||||
struct ndpi_id_struct *server_id;
|
struct ndpi_id_struct *server_id;
|
||||||
/* HTTP host or DNS query */
|
/* HTTP host or DNS query */
|
||||||
u_char host_server_name[256];
|
u_char host_server_name[192];
|
||||||
/* Via HTTP User-Agent */
|
/* Via HTTP User-Agent */
|
||||||
u_char detected_os[32];
|
u_char detected_os[32];
|
||||||
/* Via HTTP X-Forwarded-For */
|
/* Via HTTP X-Forwarded-For */
|
||||||
u_char nat_ip[24];
|
u_char nat_ip[24];
|
||||||
|
/* Bittorrent hash */
|
||||||
|
u_char bittorent_hash[20];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This structure below will not not stay inside the protos
|
This structure below will not not stay inside the protos
|
||||||
|
|||||||
@@ -31,9 +31,24 @@
|
|||||||
#define NDPI_PROTOCOL_PLAIN_DETECTION 0
|
#define NDPI_PROTOCOL_PLAIN_DETECTION 0
|
||||||
#define NDPI_PROTOCOL_WEBSEED_DETECTION 2
|
#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,
|
static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow,
|
||||||
|
int bt_offset,
|
||||||
const u_int8_t save_detection, const u_int8_t encrypted_connection/* , */
|
const u_int8_t save_detection, const u_int8_t encrypted_connection/* , */
|
||||||
/* ndpi_protocol_type_t protocol_type */)
|
/* ndpi_protocol_type_t protocol_type */)
|
||||||
{
|
{
|
||||||
|
const char *bt_hash = NULL; /* 20 bytes long */
|
||||||
|
const char *peer_id = NULL; /* 20 bytes long */
|
||||||
|
|
||||||
|
if(bt_offset == -1) {
|
||||||
|
const char *bt_magic = ndpi_strnstr((const char *)flow->packet.payload,
|
||||||
|
"BitTorrent protocol", flow->packet.payload_packet_len);
|
||||||
|
|
||||||
|
if(bt_magic)
|
||||||
|
bt_hash = &bt_magic[19], peer_id = &bt_magic[39];
|
||||||
|
} else
|
||||||
|
bt_hash = &flow->packet.payload[28], peer_id = &flow->packet.payload[48];
|
||||||
|
|
||||||
|
if(bt_hash) memcpy(flow->bittorent_hash, bt_hash, 20);
|
||||||
|
|
||||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN);
|
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,12 +63,12 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
flow->bittorrent_stage = 0;
|
flow->bittorrent_stage = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (flow->packet_counter == 2 && packet->payload_packet_len > 20) {
|
|
||||||
|
|
||||||
|
if(flow->packet_counter == 2 && packet->payload_packet_len > 20) {
|
||||||
if(memcmp(&packet->payload[0], "BitTorrent protocol", 19) == 0) {
|
if(memcmp(&packet->payload[0], "BitTorrent protocol", 19) == 0) {
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, 19,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_REAL_PROTOCOL */);
|
/* NDPI_REAL_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -65,9 +80,8 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
/* test for match 0x13+"BitTorrent protocol" */
|
/* test for match 0x13+"BitTorrent protocol" */
|
||||||
if(packet->payload[0] == 0x13) {
|
if(packet->payload[0] == 0x13) {
|
||||||
if(memcmp(&packet->payload[1], "BitTorrent protocol", 19) == 0) {
|
if(memcmp(&packet->payload[1], "BitTorrent protocol", 19) == 0) {
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, 20,
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_REAL_PROTOCOL */);
|
/* NDPI_REAL_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -78,7 +92,7 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
if(packet->payload_packet_len > 23 && memcmp(packet->payload, "GET /webseed?info_hash=", 23) == 0) {
|
if(packet->payload_packet_len > 23 && memcmp(packet->payload, "GET /webseed?info_hash=", 23) == 0) {
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||||
NDPI_LOG_TRACE, "BT: plain webseed BitTorrent protocol detected\n");
|
NDPI_LOG_TRACE, "BT: plain webseed BitTorrent protocol detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -90,7 +104,7 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
&& memcmp(packet->payload, "GET /data?fid=", 14) == 0 && memcmp(&packet->payload[54], "&size=", 6) == 0) {
|
&& memcmp(packet->payload, "GET /data?fid=", 14) == 0 && memcmp(&packet->payload[54], "&size=", 6) == 0) {
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||||
NDPI_LOG_TRACE, "BT: plain Bitcomet persistent seed protocol detected\n");
|
NDPI_LOG_TRACE, "BT: plain Bitcomet persistent seed protocol detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -113,7 +127,7 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
|| (packet->user_agent_line.len >= 11 && memcmp(packet->user_agent_line.ptr, "BTWebClient", 11) == 0))) {
|
|| (packet->user_agent_line.len >= 11 && memcmp(packet->user_agent_line.ptr, "BTWebClient", 11) == 0))) {
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||||
NDPI_LOG_TRACE, "Azureus /Bittorrent user agent line detected\n");
|
NDPI_LOG_TRACE, "Azureus /Bittorrent user agent line detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -125,7 +139,7 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
&& packet->line[8].len >= 9 && memcmp(packet->line[8].ptr, "X-Queue: ", 9) == 0)) {
|
&& packet->line[8].len >= 9 && memcmp(packet->line[8].ptr, "X-Queue: ", 9) == 0)) {
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||||
NDPI_LOG_TRACE, "Bittorrent Shareaza detected.\n");
|
NDPI_LOG_TRACE, "Bittorrent Shareaza detected.\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -160,11 +174,10 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
&& packet->line[8].len > 22 && memcmp(packet->line[8].ptr, "Cache-Control: no-cache", 23) == 0) {
|
&& packet->line[8].len > 22 && memcmp(packet->line[8].ptr, "Cache-Control: no-cache", 23) == 0) {
|
||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "Bitcomet LTS detected\n");
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "Bitcomet LTS detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FlashGet pattern */
|
/* FlashGet pattern */
|
||||||
@@ -187,12 +200,12 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
&& packet->line[6].len > 21 && memcmp(packet->line[6].ptr, "Connection: Keep-Alive", 22) == 0) {
|
&& packet->line[6].len > 21 && memcmp(packet->line[6].ptr, "Connection: Keep-Alive", 22) == 0) {
|
||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "FlashGet detected\n");
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "FlashGet detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packet->parsed_lines == 7
|
if(packet->parsed_lines == 7
|
||||||
&& packet->user_agent_line.ptr != NULL
|
&& packet->user_agent_line.ptr != NULL
|
||||||
&& packet->user_agent_line.len > (sizeof("Mozilla/4.0 (compatible; MSIE 6.0;") - 1)
|
&& packet->user_agent_line.len > (sizeof("Mozilla/4.0 (compatible; MSIE 6.0;") - 1)
|
||||||
@@ -209,11 +222,10 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
&& packet->line[5].len > 21 && memcmp(packet->line[5].ptr, "Connection: Keep-Alive", 22) == 0) {
|
&& packet->line[5].len > 21 && memcmp(packet->line[5].ptr, "Connection: Keep-Alive", 22) == 0) {
|
||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "FlashGet detected\n");
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct, NDPI_LOG_TRACE, "FlashGet detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_UNSAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* answer to this pattern is not possible to implement asymmetrically */
|
/* answer to this pattern is not possible to implement asymmetrically */
|
||||||
@@ -280,7 +292,7 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
|
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||||
NDPI_LOG_TRACE, " BT stat: tracker info hash parsed\n");
|
NDPI_LOG_TRACE, " BT stat: tracker info hash parsed\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -310,7 +322,7 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
&& (memcmp(&packet->payload[52], pattern_12_bytes, 12) == 0)) {
|
&& (memcmp(&packet->payload[52], pattern_12_bytes, 12) == 0)) {
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT, ndpi_struct,
|
||||||
NDPI_LOG_TRACE, "BT: Warez - Plain BitTorrent protocol detected\n");
|
NDPI_LOG_TRACE, "BT: Warez - Plain BitTorrent protocol detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_REAL_PROTOCOL */);
|
/* NDPI_REAL_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -327,7 +339,7 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||||
ndpi_struct, NDPI_LOG_TRACE,
|
ndpi_struct, NDPI_LOG_TRACE,
|
||||||
"BT: Warez - Plain BitTorrent protocol detected due to Host: ip2p.com: pattern\n");
|
"BT: Warez - Plain BitTorrent protocol detected due to Host: ip2p.com: pattern\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_WEBSEED_DETECTION/* , */
|
||||||
/* NDPI_CORRELATED_PROTOCOL */);
|
/* NDPI_CORRELATED_PROTOCOL */);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -341,7 +353,6 @@ static u_int8_t ndpi_int_search_bittorrent_tcp_zero(struct ndpi_detection_module
|
|||||||
/*Search for BitTorrent commands*/
|
/*Search for BitTorrent commands*/
|
||||||
static void ndpi_int_search_bittorrent_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
static void ndpi_int_search_bittorrent_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;
|
||||||
|
|
||||||
if(packet->payload_packet_len == 0) {
|
if(packet->payload_packet_len == 0) {
|
||||||
@@ -400,7 +411,7 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
|||||||
|
|
||||||
if(packet->payload_packet_len >= 23 /* min header size */) {
|
if(packet->payload_packet_len >= 23 /* min header size */) {
|
||||||
if(strncmp((const char*)packet->payload, bt_search, strlen(bt_search)) == 0) {
|
if(strncmp((const char*)packet->payload, bt_search, strlen(bt_search)) == 0) {
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_REAL_PROTOCOL */);
|
/* NDPI_REAL_PROTOCOL */);
|
||||||
return;
|
return;
|
||||||
@@ -456,7 +467,7 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
|||||||
bittorrent_found:
|
bittorrent_found:
|
||||||
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
NDPI_LOG(NDPI_PROTOCOL_BITTORRENT,
|
||||||
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
ndpi_struct, NDPI_LOG_TRACE, "BT: plain BitTorrent protocol detected\n");
|
||||||
ndpi_add_connection_as_bittorrent(ndpi_struct, flow,
|
ndpi_add_connection_as_bittorrent(ndpi_struct, flow, -1,
|
||||||
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
NDPI_PROTOCOL_SAFE_DETECTION, NDPI_PROTOCOL_PLAIN_DETECTION/* , */
|
||||||
/* NDPI_REAL_PROTOCOL */);
|
/* NDPI_REAL_PROTOCOL */);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,26 @@
|
|||||||
|
BitTorrent 299 305728 24
|
||||||
|
|
||||||
|
1 TCP 192.168.1.3:52908 <-> 79.55.129.22:12097 [proto: 37/BitTorrent][1 pkts/134 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
2 TCP 79.53.228.2:14627 <-> 192.168.1.3:52896 [proto: 37/BitTorrent][5 pkts/1180 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
3 TCP 192.168.1.3:52922 <-> 95.237.193.34:11321 [proto: 37/BitTorrent][5 pkts/1205 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
4 TCP 192.168.1.3:52925 <-> 93.65.227.100:19116 [proto: 37/BitTorrent][1 pkts/134 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
5 TCP 192.168.1.3:52907 <-> 82.58.216.115:38305 [proto: 37/BitTorrent][4 pkts/1401 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
6 TCP 192.168.1.3:52897 <-> 151.26.95.30:22673 [proto: 37/BitTorrent][5 pkts/1281 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
7 TCP 192.168.1.3:52911 <-> 151.26.95.30:22673 [proto: 37/BitTorrent][5 pkts/1213 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
8 TCP 192.168.1.3:52921 <-> 95.234.159.16:41205 [proto: 37/BitTorrent][5 pkts/1212 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
9 TCP 192.168.1.3:52894 <-> 120.62.33.241:39332 [proto: 37/BitTorrent][1 pkts/134 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
10 TCP 192.168.1.3:52910 <-> 120.62.33.241:39332 [proto: 37/BitTorrent][1 pkts/134 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
11 TCP 192.168.1.3:52895 <-> 83.216.184.241:51413 [proto: 37/BitTorrent][8 pkts/1558 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
12 TCP 192.168.1.3:52927 <-> 83.216.184.241:51413 [proto: 37/BitTorrent][5 pkts/1378 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
13 TCP 192.168.1.3:52906 <-> 82.57.97.83:53137 [proto: 37/BitTorrent][5 pkts/1205 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
14 TCP 192.168.1.3:52902 <-> 190.103.195.56:46633 [proto: 37/BitTorrent][4 pkts/614 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
15 TCP 192.168.1.3:52914 <-> 190.103.195.56:46633 [proto: 37/BitTorrent][7 pkts/1550 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
16 TCP 192.168.1.3:52893 <-> 79.55.129.22:12097 [proto: 37/BitTorrent][1 pkts/134 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
17 TCP 192.168.1.3:52912 <-> 151.72.255.163:59928 [proto: 37/BitTorrent][4 pkts/612 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
18 TCP 79.53.228.2:14627 <-> 192.168.1.3:52909 [proto: 37/BitTorrent][1 pkts/134 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
19 TCP 192.168.1.3:52903 <-> 198.100.146.9:60163 [proto: 37/BitTorrent][6 pkts/1261 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
20 TCP 192.168.1.3:52915 <-> 198.100.146.9:60163 [proto: 37/BitTorrent][210 pkts/285139 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
21 TCP 192.168.1.3:52926 <-> 93.65.249.100:31336 [proto: 37/BitTorrent][3 pkts/930 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
22 TCP 192.168.1.3:52888 <-> 82.58.216.115:38305 [proto: 37/BitTorrent][2 pkts/758 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
23 TCP 192.168.1.3:52887 <-> 82.57.97.83:53137 [proto: 37/BitTorrent][5 pkts/1201 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
|
24 TCP 192.168.1.3:52917 <-> 151.15.48.189:47001 [proto: 37/BitTorrent][5 pkts/1226 bytes][BT Hash: dcfcdccfb9e670ccc3dd40c78c161f2bea243126]
|
||||||
Reference in New Issue
Block a user