Implemented FTP user/pwd extraction

This commit is contained in:
Luca Deri
2019-10-20 21:49:45 +02:00
parent c1ba4764b5
commit 1a5c7daaf6
5 changed files with 709 additions and 621 deletions
+6
View File
@@ -947,6 +947,12 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
else if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_UBNTAC2) { else if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_UBNTAC2) {
snprintf(flow->info, sizeof(flow->info), "%s", flow->ndpi_flow->protos.ubntac2.version); snprintf(flow->info, sizeof(flow->info), "%s", flow->ndpi_flow->protos.ubntac2.version);
} }
/* FTP */
else if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_FTP_CONTROL) {
snprintf(flow->info, sizeof(flow->info), "User: %s][Pwd: %s",
flow->ndpi_flow->protos.ftp.username,
flow->ndpi_flow->protos.ftp.password);
}
/* KERBEROS */ /* KERBEROS */
else if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_KERBEROS) { else if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_KERBEROS) {
if(flow->ndpi_flow->protos.kerberos.cname[0] != '\0') { if(flow->ndpi_flow->protos.kerberos.cname[0] != '\0') {
+4
View File
@@ -1234,6 +1234,10 @@ struct ndpi_flow_struct {
u_char nat_ip[24]; u_char nat_ip[24];
} http; } http;
struct {
char username[16], password[16];
} ftp;
struct { struct {
/* Bittorrent hash */ /* Bittorrent hash */
u_char hash[20]; u_char hash[20];
+9
View File
@@ -881,6 +881,13 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_serialize_end_of_block(serializer); ndpi_serialize_end_of_block(serializer);
break; break;
case NDPI_PROTOCOL_FTP_CONTROL:
ndpi_serialize_start_of_block(serializer, "ftp");
ndpi_serialize_string_string(serializer, "user", flow->protos.ftp.username);
ndpi_serialize_string_string(serializer, "password", flow->protos.ftp.password);
ndpi_serialize_end_of_block(serializer);
break;
case NDPI_PROTOCOL_SSH: case NDPI_PROTOCOL_SSH:
ndpi_serialize_start_of_block(serializer, "ssh"); ndpi_serialize_start_of_block(serializer, "ssh");
ndpi_serialize_string_string(serializer, "client_signature", flow->protos.ssh.client_signature); ndpi_serialize_string_string(serializer, "client_signature", flow->protos.ssh.client_signature);
@@ -909,10 +916,12 @@ int ndpi_flow2json(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_serialize_string_string(serializer, "client_cert", flow->protos.stun_ssl.ssl.client_certificate); ndpi_serialize_string_string(serializer, "client_cert", flow->protos.stun_ssl.ssl.client_certificate);
ndpi_serialize_string_string(serializer, "server_cert", flow->protos.stun_ssl.ssl.server_certificate); ndpi_serialize_string_string(serializer, "server_cert", flow->protos.stun_ssl.ssl.server_certificate);
ndpi_serialize_string_string(serializer, "issuer", flow->protos.stun_ssl.ssl.server_organization); ndpi_serialize_string_string(serializer, "issuer", flow->protos.stun_ssl.ssl.server_organization);
if(before) { if(before) {
strftime(notBefore, sizeof(notBefore), "%F %T", before); strftime(notBefore, sizeof(notBefore), "%F %T", before);
ndpi_serialize_string_string(serializer, "notbefore", notBefore); ndpi_serialize_string_string(serializer, "notbefore", notBefore);
} }
if(after) { if(after) {
strftime(notAfter, sizeof(notAfter), "%F %T", after); strftime(notAfter, sizeof(notAfter), "%F %T", after);
ndpi_serialize_string_string(serializer, "notafter", notAfter); ndpi_serialize_string_string(serializer, "notafter", notAfter);
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@ Unknown 1115 1122198 1
FTP_CONTROL 68 5571 1 FTP_CONTROL 68 5571 1
FTP_DATA 9 1819 1 FTP_DATA 9 1819 1
1 TCP 192.168.1.212:50694 <-> 90.130.70.73:21 [proto: 1/FTP_CONTROL][cat: Download-FileTransfer-FileSharing/7][41 pkts/2892 bytes <-> 27 pkts/2679 bytes][bytes ratio: 0.038 (Mixed)][IAT c2s/s2c min/avg/max/stddev: 0/0 235.6/108.5 4743/1377 848.9/304.6][Pkt Len c2s/s2c min/avg/max/stddev: 66/66 70.5/99.2 96/307 6.7/44.9][PLAIN TEXT (vsFTPd 3.0.3)] 1 TCP 192.168.1.212:50694 <-> 90.130.70.73:21 [proto: 1/FTP_CONTROL][cat: Download-FileTransfer-FileSharing/7][41 pkts/2892 bytes <-> 27 pkts/2679 bytes][User: anonymous][Pwd: NcFTP@][bytes ratio: 0.038 (Mixed)][IAT c2s/s2c min/avg/max/stddev: 0/0 235.6/108.5 4743/1377 848.9/304.6][Pkt Len c2s/s2c min/avg/max/stddev: 66/66 70.5/99.2 96/307 6.7/44.9][PLAIN TEXT (vsFTPd 3.0.3)]
2 TCP 192.168.1.212:50695 <-> 90.130.70.73:25685 [proto: 175/FTP_DATA][cat: Download-FileTransfer-FileSharing/7][5 pkts/342 bytes <-> 4 pkts/1477 bytes][bytes ratio: -0.624 (Download)][IAT c2s/s2c min/avg/max/stddev: 0/28 14.2/28.5 29/29 14.3/0.5][Pkt Len c2s/s2c min/avg/max/stddev: 66/66 68.4/369.2 78/1271 4.8/520.6][PLAIN TEXT ( 1 0 0 1073741)] 2 TCP 192.168.1.212:50695 <-> 90.130.70.73:25685 [proto: 175/FTP_DATA][cat: Download-FileTransfer-FileSharing/7][5 pkts/342 bytes <-> 4 pkts/1477 bytes][bytes ratio: -0.624 (Download)][IAT c2s/s2c min/avg/max/stddev: 0/28 14.2/28.5 29/29 14.3/0.5][Pkt Len c2s/s2c min/avg/max/stddev: 66/66 68.4/369.2 78/1271 4.8/520.6][PLAIN TEXT ( 1 0 0 1073741)]