Fixed CPHA missing protocol initialization
Improved IEC104 and IRC detection
This commit is contained in:
@@ -195,7 +195,7 @@ typedef struct ndpi_flow_info {
|
|||||||
struct ndpi_analyze_struct *iat_c_to_s, *iat_s_to_c, *iat_flow,
|
struct ndpi_analyze_struct *iat_c_to_s, *iat_s_to_c, *iat_flow,
|
||||||
*pktlen_c_to_s, *pktlen_s_to_c;
|
*pktlen_c_to_s, *pktlen_s_to_c;
|
||||||
|
|
||||||
char info[160];
|
char info[255];
|
||||||
char flow_extra_info[16];
|
char flow_extra_info[16];
|
||||||
char host_server_name[240];
|
char host_server_name[240];
|
||||||
char bittorent_hash[41];
|
char bittorent_hash[41];
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ void init_fix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
|
|||||||
void init_nintendo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
void init_nintendo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||||
void init_csgo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
void init_csgo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||||
void init_checkmk_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
void init_checkmk_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||||
|
void init_cpha_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||||
void init_apple_push_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
void init_apple_push_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||||
void init_amazon_video_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
void init_amazon_video_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||||
void init_whatsapp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
void init_whatsapp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||||
|
|||||||
@@ -3116,6 +3116,9 @@ void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *n
|
|||||||
/* check_mk */
|
/* check_mk */
|
||||||
init_checkmk_dissector(ndpi_str, &a, detection_bitmask);
|
init_checkmk_dissector(ndpi_str, &a, detection_bitmask);
|
||||||
|
|
||||||
|
/* cpha */
|
||||||
|
init_cpha_dissector(ndpi_str, &a, detection_bitmask);
|
||||||
|
|
||||||
/* AIMINI */
|
/* AIMINI */
|
||||||
init_aimini_dissector(ndpi_str, &a, detection_bitmask);
|
init_aimini_dissector(ndpi_str, &a, detection_bitmask);
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ void ndpi_search_iec60870_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
|
|
||||||
/* Check connection over TCP */
|
/* Check connection over TCP */
|
||||||
NDPI_LOG_DBG(ndpi_struct, "search IEC60870\n");
|
NDPI_LOG_DBG(ndpi_struct, "search IEC60870\n");
|
||||||
|
|
||||||
if(packet->tcp) {
|
if(packet->tcp) {
|
||||||
u_int16_t offset = 0, found = 0;
|
u_int16_t offset = 0, found = 0;
|
||||||
|
|
||||||
@@ -45,8 +45,16 @@ void ndpi_search_iec60870_tcp(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
|
|
||||||
if(len == 0)
|
if(len == 0)
|
||||||
break;
|
break;
|
||||||
else
|
else {
|
||||||
offset += len + 2, found = 1;
|
u_int8_t len = packet->payload[offset+1];
|
||||||
|
|
||||||
|
if((len + offset + 2) == packet->payload_packet_len) {
|
||||||
|
found = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
offset += len + 2;
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-41
@@ -373,7 +373,6 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
struct ndpi_id_struct *dst = flow->dst;
|
struct ndpi_id_struct *dst = flow->dst;
|
||||||
int less;
|
int less;
|
||||||
u_int16_t c = 0;
|
u_int16_t c = 0;
|
||||||
u_int16_t c1 = 0;
|
|
||||||
u_int16_t port = 0;
|
u_int16_t port = 0;
|
||||||
u_int16_t sport = 0;
|
u_int16_t sport = 0;
|
||||||
u_int16_t dport = 0;
|
u_int16_t dport = 0;
|
||||||
@@ -439,38 +438,6 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_IRC
|
|
||||||
&& flow->packet_counter == 2 && (packet->payload_packet_len > 400 && packet->payload_packet_len < 1381)) {
|
|
||||||
for (c1 = 50; c1 < packet->payload_packet_len - 23; c1++) {
|
|
||||||
if (packet->payload[c1] == 'i' || packet->payload[c1] == 'd') {
|
|
||||||
if ((memcmp(&packet->payload[c1], "irc.hackthissite.org0", 21)
|
|
||||||
== 0)
|
|
||||||
|| (memcmp(&packet->payload[c1], "irc.gamepad.ca1", 15) == 0)
|
|
||||||
|| (memcmp(&packet->payload[c1], "dungeon.axenet.org0", 19)
|
|
||||||
== 0)
|
|
||||||
|| (memcmp(&packet->payload[c1], "dazed.nuggethaus.net", 20)
|
|
||||||
== 0)
|
|
||||||
|| (memcmp(&packet->payload[c1], "irc.indymedia.org", 17)
|
|
||||||
== 0)
|
|
||||||
|| (memcmp(&packet->payload[c1], "irc.cccp-project.net", 20)
|
|
||||||
== 0)
|
|
||||||
|| (memcmp(&packet->payload[c1], "dirc.followell.net0", 19)
|
|
||||||
== 0)
|
|
||||||
|| (memcmp(&packet->payload[c1], "irc.discostars.de1", 18)
|
|
||||||
== 0)
|
|
||||||
|| (memcmp(&packet->payload[c1], "irc.rizon.net", 13) == 0)) {
|
|
||||||
NDPI_LOG_INFO(ndpi_struct,
|
|
||||||
"found IRC SSL: - irc.hackthissite.org0 | irc.gamepad.ca1 | dungeon.axenet.org0 "
|
|
||||||
"| dazed.nuggethaus.net | irc.indymedia.org | irc.discostars.de1 ");
|
|
||||||
ndpi_int_irc_add_connection(ndpi_struct, flow);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_IRC &&
|
if (flow->detected_protocol_stack[0] != NDPI_PROTOCOL_IRC &&
|
||||||
ndpi_search_irc_ssl_detect_ninety_percent_but_very_fast(ndpi_struct, flow) != 0) {
|
ndpi_search_irc_ssl_detect_ninety_percent_but_very_fast(ndpi_struct, flow) != 0) {
|
||||||
return;
|
return;
|
||||||
@@ -518,7 +485,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
|| (memcmp(packet->payload, "PRIVMSG ", 8) == 0)
|
|| (memcmp(packet->payload, "PRIVMSG ", 8) == 0)
|
||||||
|| (memcmp(packet->payload, "VERSION ", 8) == 0)) {
|
|| (memcmp(packet->payload, "VERSION ", 8) == 0)) {
|
||||||
NDPI_LOG_DBG2(ndpi_struct,
|
NDPI_LOG_DBG2(ndpi_struct,
|
||||||
"USER, NICK, PASS, NOTICE, PRIVMSG one time");
|
"USER, NICK, PASS, NOTICE, PRIVMSG one time");
|
||||||
if (flow->l4.tcp.irc_stage == 2) {
|
if (flow->l4.tcp.irc_stage == 2) {
|
||||||
NDPI_LOG_INFO(ndpi_struct, "found irc");
|
NDPI_LOG_INFO(ndpi_struct, "found irc");
|
||||||
ndpi_int_irc_add_connection(ndpi_struct, flow);
|
ndpi_int_irc_add_connection(ndpi_struct, flow);
|
||||||
@@ -555,8 +522,8 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
NDPI_LOG_DBG2(ndpi_struct, "packet contains more than one line");
|
NDPI_LOG_DBG2(ndpi_struct, "packet contains more than one line");
|
||||||
for (c = 1; c < packet->parsed_lines; c++) {
|
for (c = 1; c < packet->parsed_lines; c++) {
|
||||||
if (packet->line[c].len > 4 && (memcmp(packet->line[c].ptr, "NICK ", 5) == 0
|
if (packet->line[c].len > 4 && (memcmp(packet->line[c].ptr, "NICK ", 5) == 0
|
||||||
|| memcmp(packet->line[c].ptr, "USER ",
|
|| memcmp(packet->line[c].ptr, "USER ",
|
||||||
5) == 0)) {
|
5) == 0)) {
|
||||||
NDPI_LOG_INFO(ndpi_struct, "found IRC: two icq signal words in the same packet");
|
NDPI_LOG_INFO(ndpi_struct, "found IRC: two icq signal words in the same packet");
|
||||||
ndpi_int_irc_add_connection(ndpi_struct, flow);
|
ndpi_int_irc_add_connection(ndpi_struct, flow);
|
||||||
flow->l4.tcp.irc_stage = 3;
|
flow->l4.tcp.irc_stage = 3;
|
||||||
@@ -580,7 +547,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
if (memcmp(packet->payload, "POST ", 5) == 0) {
|
if (memcmp(packet->payload, "POST ", 5) == 0) {
|
||||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||||
if (packet->parsed_lines) {
|
if (packet->parsed_lines) {
|
||||||
u_int16_t http_header_len = (u_int16_t)((packet->line[packet->parsed_lines - 1].ptr - packet->payload) + 2);
|
u_int16_t http_header_len = (u_int16_t)((packet->line[packet->parsed_lines - 1].ptr - packet->payload) + 2);
|
||||||
if (packet->payload_packet_len > http_header_len) {
|
if (packet->payload_packet_len > http_header_len) {
|
||||||
http_content_ptr_len = packet->payload_packet_len - http_header_len;
|
http_content_ptr_len = packet->payload_packet_len - http_header_len;
|
||||||
}
|
}
|
||||||
@@ -590,7 +557,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
|| ((packet->referer_line.ptr)
|
|| ((packet->referer_line.ptr)
|
||||||
&& (ndpi_check_for_IRC_traces(packet->referer_line.ptr, packet->referer_line.len)))) {
|
&& (ndpi_check_for_IRC_traces(packet->referer_line.ptr, packet->referer_line.len)))) {
|
||||||
NDPI_LOG_DBG2(ndpi_struct,
|
NDPI_LOG_DBG2(ndpi_struct,
|
||||||
"IRC detected from the Http URL/ Referer header ");
|
"IRC detected from the Http URL/ Referer header ");
|
||||||
flow->l4.tcp.irc_stage = 1;
|
flow->l4.tcp.irc_stage = 1;
|
||||||
// HTTP POST Request body is not in the same packet.
|
// HTTP POST Request body is not in the same packet.
|
||||||
if (!http_content_ptr_len) {
|
if (!http_content_ptr_len) {
|
||||||
@@ -637,7 +604,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
if (memcmp(&packet->line[i].ptr[j + 1], "DCC SEND ", 9) == 0
|
if (memcmp(&packet->line[i].ptr[j + 1], "DCC SEND ", 9) == 0
|
||||||
|| memcmp(&packet->line[i].ptr[j + 1], "DCC CHAT ", 9) == 0) {
|
|| memcmp(&packet->line[i].ptr[j + 1], "DCC CHAT ", 9) == 0) {
|
||||||
NDPI_LOG_INFO(ndpi_struct,
|
NDPI_LOG_INFO(ndpi_struct,
|
||||||
"found NOTICE and DCC CHAT or DCC SEND.");
|
"found NOTICE and DCC CHAT or DCC SEND.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -700,7 +667,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
ntohs_ndpi_bytestream_to_number
|
ntohs_ndpi_bytestream_to_number
|
||||||
(&packet->line[i].ptr[j], packet->payload_packet_len - j, &j);
|
(&packet->line[i].ptr[j], packet->payload_packet_len - j, &j);
|
||||||
NDPI_LOG_DBG2(ndpi_struct, "port %u.",
|
NDPI_LOG_DBG2(ndpi_struct, "port %u.",
|
||||||
port);
|
port);
|
||||||
j = k;
|
j = k;
|
||||||
// hier jetzt überlegen, wie die ports abgespeichert werden sollen
|
// hier jetzt überlegen, wie die ports abgespeichert werden sollen
|
||||||
if (src->irc_number_of_port < NDPI_PROTOCOL_IRC_MAXPORT)
|
if (src->irc_number_of_port < NDPI_PROTOCOL_IRC_MAXPORT)
|
||||||
@@ -711,7 +678,7 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
|
|||||||
= port;
|
= port;
|
||||||
src->irc_number_of_port++;
|
src->irc_number_of_port++;
|
||||||
NDPI_LOG_DBG2(ndpi_struct, "found port=%d jjeeeeeeeeeeeeeeeeeeeeeeeee",
|
NDPI_LOG_DBG2(ndpi_struct, "found port=%d jjeeeeeeeeeeeeeeeeeeeeeeeee",
|
||||||
ntohs(get_u_int16_t(src->irc_port, 0)));
|
ntohs(get_u_int16_t(src->irc_port, 0)));
|
||||||
}
|
}
|
||||||
src->irc_ts = packet->current_time_ms;
|
src->irc_ts = packet->current_time_ms;
|
||||||
} else if (port != 0 && src->irc_number_of_port == NDPI_PROTOCOL_IRC_MAXPORT) {
|
} else if (port != 0 && src->irc_number_of_port == NDPI_PROTOCOL_IRC_MAXPORT) {
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
|||||||
|
IEC60870 15 1431 2
|
||||||
|
|
||||||
|
1 TCP 10.175.211.1:2404 <-> 10.119.105.26:54768 [proto: 245/IEC60870][cat: IoT-Scada/31][7 pkts/987 bytes <-> 5 pkts/270 bytes][Goodput ratio: 61/0][2.00 sec][bytes ratio: 0.570 (Upload)][IAT c2s/s2c min/avg/max/stddev: 36/199 360/521 935/935 313/307][Pkt Len c2s/s2c min/avg/max/stddev: 60/54 141/54 306/54 90/0][Plen Bins: 51,0,0,16,0,16,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||||
|
2 TCP 10.175.211.3:2404 <-> 10.119.105.26:54769 [proto: 245/IEC60870][cat: IoT-Scada/31][2 pkts/120 bytes <-> 1 pkts/54 bytes][Goodput ratio: 5/0][0.22 sec][Plen Bins: 100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
|
||||||
Reference in New Issue
Block a user