Fixed DCE_RPC protocol when the port is different to default port (135)

This commit is contained in:
valentina
2015-09-20 23:22:48 +02:00
parent ce7866a6a6
commit b383475282
+6 -3
View File
@@ -36,19 +36,22 @@ void ndpi_search_dcerpc(struct ndpi_detection_module_struct *ndpi_struct, struct
{ {
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
u_int16_t len_packet = (packet->payload[9]<<8) | packet->payload[8];
if((packet->tcp != NULL) if((packet->tcp != NULL)
&& (packet->payload_packet_len > 64) && (packet->payload_packet_len >= 64)
&& ((ntohs(packet->tcp->source) == 135) || (ntohs(packet->tcp->dest) == 135))
&& (packet->payload[0] == 0x05) /* version 5 */ && (packet->payload[0] == 0x05) /* version 5 */
&& (packet->payload[2] < 16) /* Packet type */ && (packet->payload[2] < 16) /* Packet type */
&& (len_packet == packet->payload_packet_len) /* Packet Length */
) { ) {
NDPI_LOG(NDPI_PROTOCOL_DCERPC, ndpi_struct, NDPI_LOG_DEBUG, "DCERPC match\n"); NDPI_LOG(NDPI_PROTOCOL_DCERPC, ndpi_struct, NDPI_LOG_DEBUG, "DCERPC match\n");
ndpi_int_dcerpc_add_connection(ndpi_struct, flow); ndpi_int_dcerpc_add_connection(ndpi_struct, flow);
return; return;
} }
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DCERPC); if(packet->payload_packet_len>1){
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_DCERPC);
}
} }