Skip to content

Commit 806f473

Browse files
committed
Added Sonos protocol detection
1 parent 9f3b7cf commit 806f473

File tree

7 files changed

+43
-9
lines changed

7 files changed

+43
-9
lines changed

src/include/ndpi_protocol_ids.h

+1
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ typedef enum {
458458
NDPI_PROTOCOL_SURFSHARK = 427,
459459
NDPI_PROTOCOL_CACTUSVPN = 428,
460460
NDPI_PROTOCOL_WINDSCRIBE = 429,
461+
NDPI_PROTOCOL_SONOS = 430,
461462

462463
#ifdef CUSTOM_NDPI_PROTOCOLS
463464
#include "../../../nDPI-custom/custom_ndpi_protocol_ids.h"

src/lib/ndpi_content_match.c.inc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,9 @@ static ndpi_protocol_match host_match[] =
16881688
{ "windscribe.com", "Windscribe", NDPI_PROTOCOL_WINDSCRIBE, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_DEFAULT_LEVEL },
16891689
{ "whiskergalaxy.com", "Windscribe", NDPI_PROTOCOL_WINDSCRIBE, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_ACCEPTABLE, NDPI_PROTOCOL_DEFAULT_LEVEL },
16901690

1691+
{ "sonos.com", "Sonos", NDPI_PROTOCOL_SONOS, NDPI_PROTOCOL_CATEGORY_MUSIC, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_DEFAULT_LEVEL },
1692+
{ "sonos.radio", "Sonos", NDPI_PROTOCOL_SONOS, NDPI_PROTOCOL_CATEGORY_MUSIC, NDPI_PROTOCOL_FUN, NDPI_PROTOCOL_DEFAULT_LEVEL },
1693+
16911694
#ifdef CUSTOM_NDPI_PROTOCOLS
16921695
#include "../../../nDPI-custom/custom_ndpi_content_match_host_match.c.inc"
16931696
#endif
@@ -1717,7 +1720,7 @@ static ndpi_tls_cert_name_match tls_certificate_match [] = {
17171720
{ "O=NoMachine", NDPI_PROTOCOL_NOMACHINE },
17181721
{ "O=Private Internet Access", NDPI_PROTOCOL_PIA },
17191722
{ "O=Windscribe", NDPI_PROTOCOL_WINDSCRIBE },
1720-
1723+
{ "O=Sonos, Inc", NDPI_PROTOCOL_SONOS },
17211724
{ "CN=Snapchat Inc.", NDPI_PROTOCOL_SNAPCHAT_CALL },
17221725
{ "CN=NVIDIA GameStream", NDPI_PROTOCOL_GEFORCENOW },
17231726

src/lib/protocols/tls.c

+2-4
Original file line numberDiff line numberDiff line change
@@ -653,8 +653,7 @@ void processCertificateElements(struct ndpi_detection_module_struct *ndpi_struct
653653
if(matched_name == 0) {
654654
#if DEBUG_TLS
655655
printf("[TLS] Trying to match '%s' with '%s'\n",
656-
flow->host_server_name,
657-
dNSName);
656+
flow->host_server_name, dNSName);
658657
#endif
659658

660659
if(dNSName[0] == '*') {
@@ -667,8 +666,7 @@ void processCertificateElements(struct ndpi_detection_module_struct *ndpi_struct
667666
matched_name = 1;
668667
}
669668
}
670-
}
671-
else if(strcmp(flow->host_server_name, dNSName) == 0) {
669+
} else if(strcmp(flow->host_server_name, dNSName) == 0) {
672670
matched_name = 1;
673671
}
674672
}

tests/cfgs/default/pcap/sonos.pcapng

17.5 KB
Binary file not shown.

tests/cfgs/default/result/custom_rules_same-ip_multiple_ports.pcapng.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ CustomProtocolC 3 222 1
2626

2727
Acceptable 8 592 3
2828

29-
1 TCP 192.168.1.245:56866 -> 3.3.3.3:443 [proto: 91.436/TLS.CustomProtocolA][IP: 436/CustomProtocolA][Encrypted][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Web/5][3 pkts/222 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][3.05 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
29+
1 TCP 192.168.1.245:56866 -> 3.3.3.3:443 [proto: 91.437/TLS.CustomProtocolA][IP: 437/CustomProtocolA][Encrypted][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Web/5][3 pkts/222 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][3.05 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
3030
2 TCP 192.168.1.245:58288 -> 3.3.3.3:446 [proto: 800/CustomProtocolC][IP: 800/CustomProtocolC][ClearText][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][3 pkts/222 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][3.04 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
31-
3 TCP 192.168.1.245:59682 -> 3.3.3.3:444 [proto: 437/CustomProtocolB][IP: 437/CustomProtocolB][ClearText][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][2 pkts/148 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][1.02 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
31+
3 TCP 192.168.1.245:59682 -> 3.3.3.3:444 [proto: 438/CustomProtocolB][IP: 438/CustomProtocolB][ClearText][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][2 pkts/148 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][1.02 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
DPI Packets (TCP): 10 (10.00 pkts/flow)
2+
Confidence DPI : 1 (flows)
3+
Num dissector calls: 3 (3.00 diss/flow)
4+
LRU cache ookla: 0/0/0 (insert/search/found)
5+
LRU cache bittorrent: 0/0/0 (insert/search/found)
6+
LRU cache stun: 0/0/0 (insert/search/found)
7+
LRU cache tls_cert: 1/2/0 (insert/search/found)
8+
LRU cache mining: 0/0/0 (insert/search/found)
9+
LRU cache msteams: 0/0/0 (insert/search/found)
10+
LRU cache fpc_dns: 0/1/0 (insert/search/found)
11+
Automa host: 2/0 (search/found)
12+
Automa domain: 2/0 (search/found)
13+
Automa tls cert: 1/1 (search/found)
14+
Automa risk mask: 1/0 (search/found)
15+
Automa common alpns: 0/0 (search/found)
16+
Patricia risk mask: 2/0 (search/found)
17+
Patricia risk mask IPv6: 0/0 (search/found)
18+
Patricia risk: 0/0 (search/found)
19+
Patricia risk IPv6: 0/0 (search/found)
20+
Patricia protocols: 2/0 (search/found)
21+
Patricia protocols IPv6: 0/0 (search/found)
22+
23+
Sonos 44 16059 1
24+
25+
Fun 44 16059 1
26+
27+
JA3 Host Stats:
28+
IP Address # JA3C
29+
1 192.168.1.29 1
30+
31+
32+
1 TCP 192.168.1.29:52425 <-> 192.168.1.70:1443 [proto: 91.430/TLS.Sonos][IP: 0/Unknown][Encrypted][Confidence: DPI][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 10][cat: Music/25][23 pkts/2258 bytes <-> 21 pkts/13801 bytes][Goodput ratio: 32/90][0.09 sec][Hostname/SNI: 192.168.1.70][bytes ratio: -0.719 (Download)][IAT c2s/s2c min/avg/max/stddev: 0/0 4/3 76/36 17/9][Pkt Len c2s/s2c min/avg/max/stddev: 66/60 98/657 333/1514 74/647][Risk: ** Known Proto on Non Std Port **** Weak TLS Cipher **** TLS Cert Mismatch **** TLS (probably) Not Carrying HTTPS **][Risk Score: 260][Risk Info: No ALPN / Cipher TLS_RSA_WITH_AES_128_GCM_SHA256 / 192.168.1.70 vs sonos-347e5cffa26e.local][TLSv1.2][JA3C: ae25e09391d7275844ccf16316569582][JA4: t12i130700_88f5d26691c7_cdbdbcd6f742][ServerNames: sonos-347e5cffa26e.local][JA3S: 2fbcb4e196d5bcba6896e593c6016e09 (WEAK)][Issuer: C=US, ST=California, L=Santa Barbara, O=Sonos, Inc, OU=Sonos Devices, CN=Sonos Device Authentication Root CA][Subject: CN=347E5CFFA26E, OU=Sonos Devices, O=Sonos, Inc, L=Santa Barbara, ST=California, C=US][Certificate SHA-1: 48:71:C5:C1:80:17:50:20:E2:25:2E:E3:C3:F9:AE:76:62:1C:26:7E][Firefox][Validity: 2024-01-03 08:21:55 - 2025-01-29 08:20:55][Cipher: TLS_RSA_WITH_AES_128_GCM_SHA256][Plen Bins: 20,14,0,0,4,4,0,4,4,0,0,4,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,0,0]

tests/cfgs/default/result/synscan.pcap.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Unrated 1848 107192 1844
145145
48 TCP 172.16.0.8:36050 -> 64.13.134.52:2605 [proto: 13/BGP][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Network/14][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
146146
49 TCP 172.16.0.8:36050 -> 64.13.134.52:3000 [proto: 26/ntop][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Network/14][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
147147
50 TCP 172.16.0.8:36050 -> 64.13.134.52:3128 [proto: 131/HTTP_Proxy][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Web/5][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
148-
51 TCP 172.16.0.8:36050 -> 64.13.134.52:3260 [proto: 430/iSCSI][IP: 0/Unknown][ClearText][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
148+
51 TCP 172.16.0.8:36050 -> 64.13.134.52:3260 [proto: 431/iSCSI][IP: 0/Unknown][ClearText][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
149149
52 TCP 172.16.0.8:36050 -> 64.13.134.52:3300 [proto: 381/Ceph][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: DataTransfer/4][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
150150
53 TCP 172.16.0.8:36050 -> 64.13.134.52:3306 [proto: 20/MySQL][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Database/11][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
151151
54 TCP 172.16.0.8:36050 -> 64.13.134.52:3389 [proto: 88/RDP][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: RemoteAccess/12][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Desktop/File Sharing **** Unidirectional Traffic **][Risk Score: 20][Risk Info: No server to client traffic / Found RDP][Plen Bins: 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,0]
@@ -218,7 +218,7 @@ Unrated 1848 107192 1844
218218
121 TCP 172.16.0.8:36051 -> 64.13.134.52:2605 [proto: 13/BGP][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Network/14][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
219219
122 TCP 172.16.0.8:36051 -> 64.13.134.52:3000 [proto: 26/ntop][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Network/14][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
220220
123 TCP 172.16.0.8:36051 -> 64.13.134.52:3128 [proto: 131/HTTP_Proxy][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Web/5][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
221-
124 TCP 172.16.0.8:36051 -> 64.13.134.52:3260 [proto: 430/iSCSI][IP: 0/Unknown][ClearText][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
221+
124 TCP 172.16.0.8:36051 -> 64.13.134.52:3260 [proto: 431/iSCSI][IP: 0/Unknown][ClearText][Confidence: Match by custom rule][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
222222
125 TCP 172.16.0.8:36051 -> 64.13.134.52:3300 [proto: 381/Ceph][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: DataTransfer/4][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
223223
126 TCP 172.16.0.8:36051 -> 64.13.134.52:3306 [proto: 20/MySQL][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: Database/11][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Unidirectional Traffic **][Risk Score: 10][Risk Info: No server to client traffic][Plen Bins: 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,0]
224224
127 TCP 172.16.0.8:36051 -> 64.13.134.52:3389 [proto: 88/RDP][IP: 0/Unknown][ClearText][Confidence: Match by port][FPC: 0/Unknown, Confidence: Unknown][DPI packets: 1][cat: RemoteAccess/12][1 pkts/58 bytes -> 0 pkts/0 bytes][Goodput ratio: 0/0][< 1 sec][Risk: ** Desktop/File Sharing **** Unidirectional Traffic **][Risk Score: 20][Risk Info: No server to client traffic / Found RDP][Plen Bins: 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,0]

0 commit comments

Comments
 (0)