Fixed invalid password report on telnet
This commit is contained in:
@@ -1246,7 +1246,7 @@ struct ndpi_flow_struct {
|
|||||||
struct {
|
struct {
|
||||||
u_int8_t username_detected:1, username_found:1,
|
u_int8_t username_detected:1, username_found:1,
|
||||||
password_detected:1, password_found:1,
|
password_detected:1, password_found:1,
|
||||||
skip_next:1, _pad:3;
|
_pad:4;
|
||||||
u_int8_t character_id;
|
u_int8_t character_id;
|
||||||
char username[32], password[32];
|
char username[32], password[32];
|
||||||
} telnet;
|
} telnet;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
struct ndpi_packet_struct *packet = &flow->packet;
|
struct ndpi_packet_struct *packet = &flow->packet;
|
||||||
|
|
||||||
#ifdef TELNET_DEBUG
|
#ifdef TELNET_DEBUG
|
||||||
printf("==> %s() [%s]\n", __FUNCTION__, packet->payload);
|
printf("==> %s() [%s][direction: %u]\n", __FUNCTION__, packet->payload, packet->packet_direction);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(packet->payload[0] == 0xFF)
|
if(packet->payload[0] == 0xFF)
|
||||||
@@ -67,9 +67,11 @@ static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<packet->payload_packet_len; i++) {
|
if(packet->packet_direction == 0) /* client -> server */ {
|
||||||
if(flow->protos.telnet.character_id < (sizeof(flow->protos.telnet.password)-1))
|
for(i=0; i<packet->payload_packet_len; i++) {
|
||||||
flow->protos.telnet.password[flow->protos.telnet.character_id++] = packet->payload[i];
|
if(flow->protos.telnet.character_id < (sizeof(flow->protos.telnet.password)-1))
|
||||||
|
flow->protos.telnet.password[flow->protos.telnet.character_id++] = packet->payload[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(1);
|
return(1);
|
||||||
@@ -93,12 +95,10 @@ static int search_telnet_again(struct ndpi_detection_module_struct *ndpi_struct,
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(i=0; i<packet->payload_packet_len; i++) {
|
for(i=0; i<packet->payload_packet_len; i++) {
|
||||||
if(!flow->protos.telnet.skip_next) {
|
if(packet->packet_direction == 0) /* client -> server */ {
|
||||||
if(flow->protos.telnet.character_id < (sizeof(flow->protos.telnet.username)-1))
|
if(flow->protos.telnet.character_id < (sizeof(flow->protos.telnet.username)-1))
|
||||||
flow->protos.telnet.username[flow->protos.telnet.character_id++] = packet->payload[i];
|
flow->protos.telnet.username[flow->protos.telnet.character_id++] = packet->payload[i];
|
||||||
flow->protos.telnet.skip_next = 1;
|
}
|
||||||
} else
|
|
||||||
flow->protos.telnet.skip_next = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user