Compare commits

...
126 Commits
Author SHA1 Message Date
Luca Deri c2f476c869 Moved to 2.4 2018-08-22 08:29:35 +02:00
Simone Mainardi e6c3c0139a Updates changelog release date 2018-08-21 18:13:54 +02:00
Simone Mainardi aad896c2a8 Updates ChangeLog 2018-08-21 18:12:36 +02:00
Luca Deri 1a6a9593fb Changed type to ease compilation accross platforms 2018-08-20 14:49:59 +02:00
Luca Deri 6cb40ac75e Compilation fix 2018-08-20 12:39:55 +02:00
Luca Deri 50591238e5 Merge pull request #586 from eglooca/pr-sys-types-include-for-actypes-h
Include <sys/types.h> for u_int16_t.
2018-08-17 14:18:27 +02:00
Simone Mainardi 291acb9459 Hyperscan regex for domains such as .com.cn or .co.uk 2018-08-17 13:13:26 +02:00
Simone Mainardi 47c2ad1b5f Webex category fix 2018-08-17 12:59:19 +02:00
Simone Mainardi 6491568e15 Fixes hyperscan WeChat detection 2018-08-17 12:48:53 +02:00
Simone Mainardi 28ac30d827 Fixes hyperscan skype detection 2018-08-17 12:41:35 +02:00
Simone Mainardi db74459ca2 Fixes weibo detection 2018-08-17 12:29:08 +02:00
Simone Mainardi d2bc3ea209 Initial hyperscan support for all protocols 2018-08-17 12:00:28 +02:00
Darryl Sokoloski cd9d456994 Include sys/types.h for u_int16_t.
On various embedded environments (OpenWrt, EdgeOS), <sys/types.h> must be included for u_intX_t types.  The Hyperscan changes made recently introducted a u_int16_t member in actypes.h which is undeclared in certainly environments without this include.

Signed-off-by: Darryl Sokoloski <darryl@sokoloski.ca>
2018-08-16 22:31:23 -04:00
Simone Mainardi 579f1b05db Adds hyperscan support for Apple and Dropbox 2018-08-16 19:42:04 +02:00
Simone Mainardi 7e41309fa9 Hyperscan compilation fix 2018-08-16 15:43:35 +02:00
Luca Deri 3091dc3c48 Fix for #400 2018-08-16 15:23:30 +02:00
Luca Deri 01bf295a19 Completed custom category implementation 2018-08-16 14:57:44 +02:00
Luca Deri f88648fbc8 Tests update 2018-08-16 12:05:07 +02:00
Luca Deri 18b9589e50 Merge branch 'dev' of https://github.com/ntop/nDPI into dev 2018-08-16 12:03:23 +02:00
Luca Deri 9847c2ccbb Generic protocol cleanup (work in progress) 2018-08-16 12:03:09 +02:00
Simone Mainardi 335b336968 Hyperscan compilation fixes 2018-08-16 11:47:10 +02:00
Luca Deri 70eb619b86 Merge pull request #584 from eglooca/pr-memcached
Added new dissector for Memcached.
2018-08-16 09:36:35 +02:00
Darryl Sokoloski b3b8feabf1 Added new dissector for Memcached.
Signed-off-by: Darryl Sokoloski <darryl@sokoloski.ca>
2018-08-15 16:47:21 -04:00
Luca Deri d9cf798753 Updated YouTube support 2018-08-06 10:34:45 +02:00
Luca Deri cbb2eb8c8f Merge pull request #576 from eglooca/pr-ssdp-min-length
Adjust the SSDP dissector's minimum packet length
2018-07-25 08:18:17 +02:00
Luca Deri 6474125c93 Merge pull request #577 from eglooca/pr-parse-packet-line-info-length
Fix end-of-line bounds handling.
2018-07-25 08:17:32 +02:00
Luca Deri 5100cc0eae Added checks for missing protocol initialization
Fixed missing LOG_ERR initialization
Fixed logging warnings
2018-07-23 14:58:16 +02:00
Luca Deri 49ed41142c Fixed SEGV with undepcified protos 2018-07-22 21:06:10 +02:00
Luca Deri 659649d2e9 Fixed warning 2018-07-21 18:23:48 +02:00
Luca 5246656ae0 Fixed required library prefix 2018-07-21 16:27:05 +02:00
Luca f828dfc202 Added comment about typedefs 2018-07-21 16:17:12 +02:00
Luca 591158bb92 Defined type ndpi_protocol_id_t for protocol identifiers 2018-07-21 16:09:32 +02:00
Luca 667e77c609 Major code cleanup
Converted some not popular protocols to NDPI_PROTOCOL_GENERIC with category detection
2018-07-21 16:02:54 +02:00
Luca a499f369a5 Updated results based on the new output format 2018-07-21 15:20:11 +02:00
Darryl Sokoloski fbf6bd2be8 Fix end-of-line bounds handling.
The existing implementation misses ending lines and as a result, fails
to match certain protocols (SMTP for example, which needs to see at
least 3 commain/response matches).  It appears from the commit history
that an attempt was made (end-1) to prevent reads past payload length.

This can be ensured by simply not reading any payload that is < 3 bytes.

The updated logic for this loop is:
- Payload length is >= 3 bytes, or return.
- Loop over payload, compare for EOL (CR + NL) sequence.
- If found, process string.
- If index 'a' plus two is less than payload length, increment 'a' by
  one and continue.
- Loop return always increments index 'a' by one.
2018-07-20 13:51:17 -04:00
Darryl Sokoloski 212598b45e Added example SSDP M-SEARCH capture file. 2018-07-20 13:28:38 -04:00
Darryl Sokoloski 8b0e735f67 Decreased minimum packet payload length down to 19 from 100 for SSDP.
The minimum packet payload length is: "NOTIFY * HTTP/1.1" + 0x0d + 0x0a (19 bytes).
2018-07-20 13:26:44 -04:00
Simone Mainardi d9c963061b Fixes invalid NDPI_MAX_SUPPORTED_PROTOCOLS 2018-07-20 18:52:00 +02:00
Luca Deri 30b72eae64 Changed RTP from VoIP to Media category 2018-07-18 21:29:26 +02:00
Luca Deri 475f54e9d1 Fixed name clash 2018-07-18 17:33:28 +02:00
Luca Deri 34dfe7d375 Improved tor detection to limit false positives 2018-07-17 18:21:06 +02:00
Luca Deri 06789406ad Pattern match improvements 2018-07-17 17:49:59 +02:00
Luca Deri 1ebc510bcb Fied substring matching 2018-07-17 15:48:24 +02:00
Luca Deri 90ffa1fc2c Updated twitter invalid address range
Using content substring match in category search
2018-07-16 09:21:34 +02:00
Michele Campus f942cef2f1 Merge pull request #573 from protohuf/dev
Added showmax.com detection
2018-07-02 23:04:31 +02:00
Marcus Hufvudsson 7fce8f02d2 Added showmax.com detection 2018-07-02 19:54:37 +02:00
Luca 3986a951d8 Suppressed invalid messages with -q
-j now accepts - as stdout
2018-06-21 16:13:18 +02:00
Luca Deri 22356fa69b Added site unavailable category 2018-06-11 17:01:20 +02:00
Luca Deri e00b06926e Fix for handling IP address based custom categories 2018-06-11 16:22:02 +02:00
Luca Deri dc9409ae12 Added missing include 2018-06-05 23:02:24 +02:00
Simone Mainardi 2b4321b5c3 Fixes invalid NDPI_MAX_SUPPORTED_PROTOCOLS
Fixes https://github.com/ntop/nDPI/commit/c77ec63e
2018-05-31 16:19:48 +02:00
Luca Deri 6b16ad709e Fix for #560 2018-05-29 22:50:18 +02:00
Campus 3407db11cd added new viber pcap and updated results 2018-05-29 20:37:02 +02:00
Luca Deri 326a2fb7ed Fix for https://github.com/ntop/nDPI/issues/572 2018-05-28 18:18:19 +02:00
Luca Deri eef175e579 Merge pull request #571 from Dark-Vex/rapidvideo
Added Rapidvideo
2018-05-28 17:27:53 +02:00
Daniele De Lorenzi 9af00fdb4c Merge branch 'dev' into rapidvideo 2018-05-25 21:57:38 +02:00
Daniele De Lorenzi 6c2cfb34f7 Merge pull request #7 from Dark-Vex/vidto
Added VidTO streaming service
2018-05-25 21:51:15 +02:00
Daniele 5171309c43 Added RapidVideo 2018-05-25 21:41:14 +02:00
Daniele c77ec63ed8 Added VidTO streaming service 2018-05-25 20:34:37 +02:00
Daniele De Lorenzi 30afa082e4 Merge pull request #6 from ntop/dev
Merge branch 'Dark-Vex-viber' into dev
2018-05-25 18:54:26 +02:00
Daniele De Lorenzi ea64f8b0da Merge pull request #5 from Dark-Vex/viber
Viber
2018-05-25 18:52:06 +02:00
Daniele De Lorenzi e2310751f1 Updated Viber ports
New ports taken from
https://support.viber.com/customer/portal/articles/1506350-opening-ports-for-viber-desktop
2018-05-24 12:14:09 +02:00
Daniele De Lorenzi 47b5e45f13 Updated Viber subnet and domain
Added the new subnet, added viber.it and removed the old subnet 54.169.X since are no more part of viber network

daniele@bart:~$ whois 54.169.63.160
[Querying whois.arin.net]
[whois.arin.net]

#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/whois_tou.html
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/whois_reporting/index.html
#


NetRange:       54.160.0.0 - 54.175.255.255
CIDR:           54.160.0.0/12
NetName:        AMAZON-2011L
NetHandle:      NET-54-160-0-0-1
Parent:         NET54 (NET-54-0-0-0-0)
NetType:        Direct Allocation
OriginAS:       
Organization:   Amazon Technologies Inc. (AT-88-Z)
RegDate:        2014-06-20
Updated:        2014-06-20
Ref:            https://whois.arin.net/rest/net/NET-54-160-0-0-1
2018-05-24 12:14:09 +02:00
Campus 31275398aa Merge branch 'Dark-Vex-viber' into dev 2018-05-24 11:40:51 +02:00
Daniele De Lorenzi c1166c37d1 Updated Viber ports
New ports taken from
https://support.viber.com/customer/portal/articles/1506350-opening-ports-for-viber-desktop
2018-05-24 11:16:32 +02:00
Daniele De Lorenzi 5420b6359b Updated Viber subnet and domain
Added the new subnet, added viber.it and removed the old subnet 54.169.X since are no more part of viber network

daniele@bart:~$ whois 54.169.63.160
[Querying whois.arin.net]
[whois.arin.net]

#
# ARIN WHOIS data and services are subject to the Terms of Use
# available at: https://www.arin.net/whois_tou.html
#
# If you see inaccuracies in the results, please report at
# https://www.arin.net/resources/whois_reporting/index.html
#


NetRange:       54.160.0.0 - 54.175.255.255
CIDR:           54.160.0.0/12
NetName:        AMAZON-2011L
NetHandle:      NET-54-160-0-0-1
Parent:         NET54 (NET-54-0-0-0-0)
NetType:        Direct Allocation
OriginAS:       
Organization:   Amazon Technologies Inc. (AT-88-Z)
RegDate:        2014-06-20
Updated:        2014-06-20
Ref:            https://whois.arin.net/rest/net/NET-54-160-0-0-1
2018-05-24 11:12:15 +02:00
Daniele De Lorenzi 5e47871256 Merge pull request #1 from ntop/dev
fetch new commit
2018-05-24 10:57:28 +02:00
Luca Deri 1585503809 Added Musical.ly support 2018-05-23 22:53:03 +02:00
Campus 60636a9a88 Merge branch 'dev' of https://github.com/ntop/nDPI into dev 2018-05-23 18:32:04 +02:00
Campus fcf4b25bc3 update google hangout detection from string 2018-05-23 18:31:27 +02:00
Luca 0efc4a706d Added custom categories
CUSTOM_CATEGORY_MINING = 99
 CUSTOM_CATEGORY_MALWARE = 100
 CUSTOM_CATEGORY_ADVERTISEMENT = 101
 CUSTOM_CATEGORY_BANNED_SITE = 102

Updated test results
2018-05-23 17:49:07 +02:00
Luca Deri fb7416cb9d Merge pull request #565 from Dark-Vex/dev
SMTPS on port 587 is not detected and Updated AmazonVideo
2018-05-23 16:53:26 +02:00
Daniele De Lorenzi 32c62faa78 Updated AmazonVideo
Updated CDN list of PrimeVideo
2018-05-22 11:28:17 +02:00
Daniele De Lorenzi 363deeb23d Added support for SMTPS on port 587
Added support for SMTPS on port 587
2018-05-21 17:26:00 +02:00
Daniele De Lorenzi 131f68117b Update ssl.c
Added support for SMTPS on port 587
2018-05-21 17:23:32 +02:00
Michele Campus 05cef1d69a Merge pull request #564 from Dark-Vex/dev
Cloudflare detection
2018-05-21 16:31:11 +02:00
Daniele De Lorenzi 71ef54f561 Update ndpi_content_match.c.inc
Removed 64.68.192.0 since is no more part of Cloudflare according to the whois data

NetRange:       64.68.192.0 - 64.68.207.255
CIDR:           64.68.192.0/20
NetName:        EDNS
NetHandle:      NET-64-68-192-0-1
Parent:         NET64 (NET-64-0-0-0-0)
NetType:        Direct Assignment
OriginAS:       AS16686
Organization:   easyDNS Technologies, Inc. (EASYD-2)
RegDate:        2008-06-12
Updated:        2012-03-02
Comment:        ARINA51-ARIN
Ref:            https://whois.arin.net/rest/net/NET-64-68-192-0-1
2018-05-21 08:14:01 +02:00
Daniele De Lorenzi f9c217e42a Update ndpi_content_match.c.inc
Updated Cloudflare subnet
2018-05-19 20:21:26 +02:00
Luca Deri 36c1b72118 Updated test resuls 2018-05-18 23:22:14 +02:00
Luca Deri 6dd42d19f7 Implemented Facebook Messenger (mobile) support
Code cleanup
2018-05-18 23:10:00 +02:00
Luca Deri 5d3ac78250 Fixed memory leak
Optimized memory usage
2018-05-18 10:15:05 +02:00
Luca Deri f56b083bc3 Implemented FacebookZero protocol support
https://code.facebook.com/posts/608854979307125/building-zero-protocol-for-fast-secure-mobile-connections/

Discontinued filetopia protocol
2018-05-18 00:55:21 +02:00
Campus 79be44ddea fix spotify detection 2018-05-17 22:54:03 +02:00
Luca Deri dcdd7562f4 Implemented hash-based categories 2018-05-16 00:09:12 +02:00
Luca Deri 66b759ca69 Hidden ndpi_detection_module_struct definition 2018-05-14 22:58:14 +02:00
Luca Deri 529492e81f Updated test results 2018-05-14 21:42:19 +02:00
Luca Deri 1076455c01 Added ndpi_set_detection_preferences() APi call 2018-05-14 21:40:27 +02:00
Luca Deri 2d486aeed8 Skype CallIn/CallOut are not set as
Skype.SkypeCallOut
Skype.SkypeCallIn
2018-05-14 19:23:15 +02:00
Luca Deri 00c35e48a2 Added
- ndpi_load_hostname_category()
- ndpi_enable_loaded_categories()

in the list of exported API calls
2018-05-11 16:04:47 +02:00
Luca Deri 8380b505f4 Merge branch 'dev' of https://github.com/ntop/nDPI into dev 2018-05-11 13:49:11 +02:00
Luca Deri 564d622cc9 Added ndpi_fill_protocol_category call
Introduced intitial Skype in/out support
2018-05-11 13:48:14 +02:00
Luca Deri a067350098 Hyperscan fixes 2018-05-11 09:06:07 +02:00
Luca Deri 50216991bd Improved hyperscan support and category definition 2018-05-10 23:46:35 +02:00
Alfredo Cardigliano 3707553906 host_server_name size fix 2018-05-05 10:01:02 +00:00
Michele Campus b8fec1e3ce Merge pull request #557 from dsokoloski/pr-gitignore-updates
Clean-up/sort: .gitignore
2018-05-04 18:50:44 +02:00
Michele Campus 979330392e Merge pull request #558 from gozzy/dev
SSH: increase client's maximum payload length from 100 to 500
2018-05-04 18:49:56 +02:00
Alexander Gozman 11898f0268 SSH: increase client's maximum payload length from 100 to 500
According to RFC4253, a client may send additional data right after
its identification string (before receiving the server's identification
string). For instance, PuTTY sends supported ciphers. This exceeds
100 bytes and nDPI fails to detect such SSH sessions.
2018-05-04 07:17:17 +00:00
Luca Deri 78176d2b7b Added timeseries dump (disabled by default) 2018-05-02 00:11:55 +02:00
Luca Deri 64633939e0 Added NetFlix block for Rogers 2018-04-28 10:07:54 +02:00
emanuele-f f717be19cb Fix custom categories matching 2018-04-27 15:02:51 +02:00
Darryl Sokoloski 9c6c15cd6b Clean-up/sort: .gitignore 2018-04-26 16:33:58 -04:00
Luca 3adccc98f7 Implemented custom category loading.
Modified ndpiReader with -c <file> (use mining_hosts.txt as example) for loading name-based categories
2018-04-26 21:10:59 +02:00
Michele Campus 79f3199339 Merge pull request #553 from dsokoloski/pr-debug-call-back
Added missing file, func, and line parameters to call-back typedef.
2018-04-26 11:45:36 +02:00
Campus 23042b3c9a Merge branch 'dsokoloski-pr-autoconf-config-include-fix' into dev 2018-04-26 11:43:59 +02:00
Campus e819899221 Merge branch 'pr-autoconf-config-include-fix' of https://github.com/dsokoloski/nDPI into dsokoloski-pr-autoconf-config-include-fix 2018-04-26 11:43:00 +02:00
Luca Deri b92541a08e Added flow and timing support 2018-04-26 00:04:26 +02:00
Darryl Sokoloski c54a8f8cfa Moved ndpi_config.h from ndpi_main.h to ndpi_main.c, and example source files. 2018-04-24 10:21:47 -04:00
Darryl Sokoloski 3b5f32f261 Added missing file, func, and line parameters to debug call-back typedef. 2018-04-24 10:20:06 -04:00
Luca Deri 7798b964fe Replaces outdates socrates protocol with ntop 2018-04-24 15:48:46 +02:00
Campus 44e2e0beea Merge branch 'leonn-AJP_protocol' into dev 2018-04-23 15:50:06 +02:00
Campus 32a9b8fd14 Merge branch 'AJP_protocol' of https://github.com/leonn/nDPI into leonn-AJP_protocol 2018-04-23 15:48:46 +02:00
Leonn 5a7f58d23f 💡 Add Apache JServ Protocol Dissector 2018-04-22 01:54:28 -03:00
Luca 6aaca82d0e Added fbsbx.com to the list of FaceBook sites 2018-04-18 18:25:11 +02:00
Luca Deri 07a81f5e15 Updated results 2018-04-16 14:21:59 +02:00
Luca Deri c9a2eb54c1 Merge pull request #539 from felix-jia/fix-mem-leak
Fixed memory leak when flow is zeroed out.
2018-04-16 14:19:00 +02:00
Luca Deri 8a59581668 Merge pull request #547 from zyingp/free-after-detect
Fix several bugs found by Address Sanitizer (ASan)
2018-04-16 14:16:09 +02:00
Yingpei Zeng 5950ad7ef8 Add length check before several memcmps in msn.c [ASan detected]. 2018-04-16 18:47:49 +08:00
Yingpei Zeng 4b720c4f3c Add length check before do memcmp to "x-steam-sid" in http.c 2018-04-16 16:07:01 +08:00
Yingpei Zeng 480791a057 Add length check before checking a Tor certificate name 2018-04-16 16:01:31 +08:00
Yingpei Zeng 076bd3d1f4 Add a new file to Xcode project 2018-04-16 10:48:30 +08:00
NETAGO d8e4111a9d Improved netflix support 2018-04-13 16:36:33 -04:00
Michele Campus 9c1029ff6c Merge pull request #543 from vel21ripn/fix_packet_time
Repaired wrong timestamp calculation.
2018-04-09 16:44:38 +02:00
Michele Campus 56f14ebee4 Merge pull request #545 from vpiserchia/dev
added ndpi_process_extra_packet to exported symbols
2018-04-09 16:40:05 +02:00
Vito Piserchia aa5d06bb1a added ndpi_process_extra_packet to exported symbols 2018-04-09 00:37:34 +02:00
Vitaly Lavrov 025ca46981 Repaired wrong timestamp calculation.
Fixed incorrect type conversion.
  Hardcoded constant replaced by structure field.
2018-04-06 22:56:43 +03:00
Felix Jia 5281fcf3cd Fixed memory leak when flow is zeroed out. 2018-03-26 10:20:03 +13:00
258 changed files with 5486 additions and 4622 deletions
+36 -33
View File
@@ -1,51 +1,54 @@
*.[oa]
*~ *~
*o.cmd /aclocal.m4
*.lo /autom4te.cache/
*.obj
*o.cmd
*.ko
*.swp
*.in
*.la
.libs
.dirstamp
.autotools .autotools
.cproject compile
.project /compile
.settings
stamp-h1
/configure
/configure.ac
/config.guess /config.guess
/config.h /config.h
/config.h.in /config.h.in
/config.sub
/config.log /config.log
/config.status /config.status
/config.sub
/configure
/configure.ac
/configure.tmp
.cproject
/depcomp /depcomp
/install-sh .dirstamp
/ltmain.sh /example/.deps/
/missing
/Makefile
/libndpi.pc
/libtool
/src/lib/Makefile
/src/include/Makefile
/example/ndpiReader
/example/Makefile /example/Makefile
/aclocal.m4 /example/ndpiReader
*.in
/install-sh
*.ko
*.la
/libndpi.pc
.libs
/libtool
*.lo
/ltmain.sh
/m4/libtool.m4 /m4/libtool.m4
/m4/lt~obsolete.m4
/m4/ltoptions.m4 /m4/ltoptions.m4
/m4/ltsugar.m4 /m4/ltsugar.m4
/m4/ltversion.m4 /m4/ltversion.m4
/m4/lt~obsolete.m4 /Makefile
/autom4te.cache/ /missing
/compile *.[oa]
/example/.deps/ *.obj
*o.cmd
*o.cmd
.project
.settings
/src/include/Makefile
/src/include/ndpi_config.h
/src/include/ndpi_define.h
/src/lib/.deps/ /src/lib/.deps/
/src/lib/Makefile
/src/lib/protocols/.deps/ /src/lib/protocols/.deps/
/src/lib/third_party/src/.deps/ /src/lib/third_party/src/.deps/
/src/include/ndpi_define.h stamp-h1
*.swp
/test-driver /test-driver
/tests/Makefile /tests/Makefile
+60 -2
View File
@@ -1,5 +1,63 @@
# CHANGELOG # CHANGELOG
#### nDPI 2.4 (August 2018)
## New Supported Protocols and Services
* Showmax.com
* Musical.ly
* RapidVideo
* VidTO streaming service
* Apache JServ Protocol
* Facebook Messenger
* FacebookZero protocol
## Improvements
* Improved YouTube support
* Improved Netflix support
* Updated Google Hangout detection
* Updated Twitter address range
* Updated Viber ports, subnet and domain
* Updated AmazonVideo detection
* Updated list of FaceBook sites
* Initial Skype in/out support
* Improved Tor detection
* Improved hyperscan support and category definition
* Custom categories loading, extended ndpiReader (`-c <file>`) for loading name-based categories
## Fixes
* Fixes for Instagram flows classified as Facebook
* Fixed Spotify detection
* Fixed minimum packet payload length for SSDP
* Fixed length check in MSN, x-steam-sid, Tor certificate name
* Increase client's maximum payload length for SSH
* Fixed end-of-line bounds handling
* Fixed substring matching
* Fix for handling IP address based custom categories
* Repaired wrong timestamp calculation
* Fixed memory leak
* Optimized memory usage
## Other/Changes
* New API calls:
* `ndpi_set_detection_preferences()`
* `ndpi_load_hostname_category()`
* `ndpi_enable_loaded_categories()`
* `ndpi_fill_protocol_category()`
* `ndpi_process_extra_packet()`
* Skype CallIn/CallOut are now set as Skype.SkypeCallOut Skype.SkypeCallIn
* Added support for SMTPS on port 587
* Changed RTP from VoIP to Media category
* Added site unavailable category
* Added custom categories CUSTOM_CATEGORY_MINING, CUSTOM_CATEGORY_MALWARE, CUSTOM_CATEGORY_ADVERTISEMENT, CUSTOM_CATEGORY_BANNED_SITE
* Implemented hash-based categories
* Converted some not popular protocols to NDPI_PROTOCOL_GENERIC with category detection
------------------------------------------------------------------------
#### nDPI 2.2.2 (April 2018) #### nDPI 2.2.2 (April 2018)
## Main New Features ## Main New Features
@@ -95,7 +153,7 @@
* Ubiquity AirControl 2 * Ubiquity AirControl 2
* HEP (Extensible Encapsulation Protocol) * HEP (Extensible Encapsulation Protocol)
* WhatsApp Voice vs WhatsApp (chat, no voice) * WhatsApp Voice vs WhatsApp (chat, no voice)
* Viber * Viber
* Wechat * Wechat
* Github * Github
* Hotmail * Hotmail
@@ -124,7 +182,7 @@
* Improved HTTP subprotocol matching * Improved HTTP subprotocol matching
* Implemented DHCP host name extraction * Implemented DHCP host name extraction
* Updated Facebook detection by ip server ranges * Updated Facebook detection by ip server ranges
* Updated Twitter networks * Updated Twitter networks
* Improved Microsoft detection * Improved Microsoft detection
* Enhanced Google detection * Enhanced Google detection
* Improved BT-uTP protocol dissection * Improved BT-uTP protocol dissection
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
NDPI_MAJOR="2" NDPI_MAJOR="2"
NDPI_MINOR="3" NDPI_MINOR="4"
NDPI_PATCH="0" NDPI_PATCH="0"
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH" NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
+18 -6
View File
@@ -54,12 +54,24 @@ fi
HS_LIB= HS_LIB=
HS_INC= HS_INC=
AC_ARG_WITH(hyperscan, [ --with-hyperscan Enable Intel Hyperscan (if available)])
if test "${with_hyperscan}" == "yes"; then : AC_ARG_WITH(hyperscan, [ --with-hyperscan Enable nDPI build with Intel Hyperscan])
AC_CHECK_LIB([hs], [hs_compile_multi], AC_DEFINE_UNQUOTED(HAVE_HYPERSCAN, 1, [Intel Hyperscan is present]))
HS_INC=`pkg-config --cflags libhs` if test "${with_hyperscan+set}" = set; then
HS_LIB=`pkg-config --libs libhs` BKP=$LIBS
LIBS="$LIBS -lstdc++ -lm"
AC_CHECK_LIB([hs], [hs_compile_multi], AC_DEFINE_UNQUOTED(HAVE_HYPERSCAN, 1, [Intel Hyperscan is present]))
LIBS=$BKP
if test "x$ac_cv_lib_hs_hs_compile_multi" = xyes; then :
AC_CHECK_LIB([m], [pow])
AC_CHECK_LIB([stdc++], [main])
HS_INC=`pkg-config --cflags libhs`
HS_LIB=`pkg-config --libs libhs`
else
AC_MSG_RESULT([Intel Hyperscan not found, exiting. See https://github.com/intel/hyperscan/blob/master/doc/dev-reference/getting_started.rst for install/build instructions])
exit 1
fi
fi fi
if test -f $PCAP_HOME/libpcap/libpcap.a; then : if test -f $PCAP_HOME/libpcap/libpcap.a; then :
@@ -115,7 +127,7 @@ AC_ARG_ENABLE([debug-messages],
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np])) AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))
AC_CONFIG_FILES([Makefile src/lib/Makefile example/Makefile tests/Makefile libndpi.pc src/include/ndpi_define.h]) AC_CONFIG_FILES([Makefile example/Makefile tests/Makefile libndpi.pc src/include/ndpi_define.h])
AC_CONFIG_HEADERS(src/include/ndpi_config.h) AC_CONFIG_HEADERS(src/include/ndpi_config.h)
AC_SUBST(GIT_RELEASE) AC_SUBST(GIT_RELEASE)
AC_SUBST(NDPI_MAJOR) AC_SUBST(NDPI_MAJOR)
@@ -7,6 +7,7 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
E32F1ECB20844620005739B7 /* whatsapp.c in Sources */ = {isa = PBXBuildFile; fileRef = E32F1ECA20844620005739B7 /* whatsapp.c */; };
E3953F5420254989000BBA0D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E3953F5320254989000BBA0D /* AppDelegate.m */; }; E3953F5420254989000BBA0D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E3953F5320254989000BBA0D /* AppDelegate.m */; };
E3953F5720254989000BBA0D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E3953F5620254989000BBA0D /* ViewController.m */; }; E3953F5720254989000BBA0D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E3953F5620254989000BBA0D /* ViewController.m */; };
E3953F5920254989000BBA0D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E3953F5820254989000BBA0D /* Assets.xcassets */; }; E3953F5920254989000BBA0D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E3953F5820254989000BBA0D /* Assets.xcassets */; };
@@ -187,6 +188,7 @@
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
E32F1ECA20844620005739B7 /* whatsapp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = whatsapp.c; sourceTree = "<group>"; };
E3953F4F20254989000BBA0D /* ndpiExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ndpiExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; E3953F4F20254989000BBA0D /* ndpiExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ndpiExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
E3953F5220254989000BBA0D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; E3953F5220254989000BBA0D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
E3953F5320254989000BBA0D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; E3953F5320254989000BBA0D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@@ -644,6 +646,7 @@
E39542ED20255354000BBA0D /* yahoo.c */, E39542ED20255354000BBA0D /* yahoo.c */,
E39542EE20255354000BBA0D /* zattoo.c */, E39542EE20255354000BBA0D /* zattoo.c */,
E39542EF20255354000BBA0D /* zeromq.c */, E39542EF20255354000BBA0D /* zeromq.c */,
E32F1ECA20844620005739B7 /* whatsapp.c */,
); );
path = protocols; path = protocols;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -947,6 +950,7 @@
E395454420255355000BBA0D /* zattoo.c in Sources */, E395454420255355000BBA0D /* zattoo.c in Sources */,
E39544FD20255354000BBA0D /* noe.c in Sources */, E39544FD20255354000BBA0D /* noe.c in Sources */,
E395451620255354000BBA0D /* shoutcast.c in Sources */, E395451620255354000BBA0D /* shoutcast.c in Sources */,
E32F1ECB20844620005739B7 /* whatsapp.c in Sources */,
E395455E202558E6000BBA0D /* ndpi_util.c in Sources */, E395455E202558E6000BBA0D /* ndpi_util.c in Sources */,
E3953F5420254989000BBA0D /* AppDelegate.m in Sources */, E3953F5420254989000BBA0D /* AppDelegate.m in Sources */,
E39543C520255354000BBA0D /* dropbox.c in Sources */, E39543C520255354000BBA0D /* dropbox.c in Sources */,
+1 -1
View File
@@ -3,7 +3,7 @@ bin_PROGRAMS = ndpiReader
AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/lib/third_party/include @PCAP_INC@ @HS_INC@ AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/lib/third_party/include @PCAP_INC@ @HS_INC@
AM_CFLAGS = @PTHREAD_CFLAGS@ # --coverage AM_CFLAGS = @PTHREAD_CFLAGS@ # --coverage
LDADD = $(top_builddir)/src/lib/libndpi.la @JSON_C_LIB@ @PTHREAD_LIBS@ @PCAP_LIB@ @DL_LIB@ @HS_LIB@ -lm LDADD = $(top_builddir)/src/lib/libndpi.a @JSON_C_LIB@ @PTHREAD_LIBS@ @PCAP_LIB@ @DL_LIB@ @HS_LIB@ -lm
AM_LDFLAGS = -static @DL_LIB@ @HS_LIB@ AM_LDFLAGS = -static @DL_LIB@ @HS_LIB@
ndpiReader_SOURCES = ndpiReader.c ndpi_util.c ndpi_util.h uthash.h ndpiReader_SOURCES = ndpiReader.c ndpi_util.c ndpi_util.h uthash.h
+262
View File
@@ -0,0 +1,262 @@
# NoCoin Filter List
# Blocking Web Browser Bitcoin Mining
#
# Homepage: https://github.com/hoshsadiq/adblock-nocoin-list/
# Contribute: https://github.com/hoshsadiq/adblock-nocoin-list/issues
# Changelog: https://github.com/hoshsadiq/adblock-nocoin-list/commits/master/hosts.txt
# License: https://mit-license.org/
#
# Last modified: 24 April 2018
#
cnhv.co 99
coin-hive.com 99
coinhive.com 99
authedmine.com 99
gus.host 99
load.jsecoin.com 99
miner.pr0gramm.com 99
minemytraffic.com 99
ppoi.org 99
projectpoi.com 99
crypto-loot.com 99
coinerra.com 99
coin-have.com 99
minero.pw 99
minero-proxy-01.now.sh 99
minero-proxy-02.now.sh 99
minero-proxy-03.now.sh 99
api.inwemo.com 99
rocks.io 99
adminer.com 99
ad-miner.com 99
jsccnn.com 99
jscdndel.com 99
coinhiveproxy.com 99
coinblind.com 99
coinnebula.com 99
monerominer.rocks 99
cdn.cloudcoins.co 99
coinlab.biz 99
go.megabanners.cf 99
baiduccdn1.com 99
wsp.marketgid.com 99
papoto.com 99
flare-analytics.com 99
www.sparechange.io 99
static.sparechange.io 99
miner.nablabee.com 99
m.anyfiles.ovh 99
www.freecontent.bid 99
www.freecontent.loan 99
www.freecontent.win 99
www.cryptonoter.com 99
www.mutuza.win 99
cryweb.github.io 99
crywebber.github.io 99
crypto-webminer.com 99
cdn.adless.io 99
hegrinhar.com 99
verresof.com 99
hemnes.win 99
tidafors.xyz 99
moneone.ga 99
plexcoin.info 99
www.monkeyminer.net 99
go2.mercy.ga 99
coinpirate.cf 99
d.cpufan.club 99
krb.devphp.org.ua 99
nfwebminer.com 99
cfcdist.gdn 99
node.cfcdist.gdn 99
webxmr.com 99
xmr.mining.best 99
webminepool.com 99
webminepool.tk 99
hive.tubetitties.com 99
playerassets.info 99
tokyodrift.ga 99
webassembly.stream 99
okeyletsgo.ml 99
candid.zone 99
webmine.pro 99
andlache.com 99
bablace.com 99
bewaslac.com 99
biberukalap.com 99
bowithow.com 99
butcalve.com 99
evengparme.com 99
gridiogrid.com 99
hatcalter.com 99
kedtise.com 99
ledinund.com 99
nathetsof.com 99
renhertfo.com 99
rintindown.com 99
sparnove.com 99
witthethim.com 99
1q2w3.fun 99
1q2w3.me 99
cryptoloot.pro 99
bjorksta.men 99
crypto.csgocpu.com 99
noblock.pro 99
miner.cryptobara.com 99
digger.cryptobara.com 99
dev.cryptobara.com 99
reservedoffers.club 99
mine.torrent.pw 99
host.d-ns.ga 99
abc.pema.cl 99
mine.nahnoji.cz 99
webmine.cz 99
intactoffers.club 99
analytics.blue 99
smectapop12.pl 99
berserkpl.net.pl 99
hodlers.party 99
hodling.faith 99
chainblock.science 99
minescripts.info 99
cdn.minescripts.info 99
miner.nablabee.com 99
wss.nablabee.com 99
clickwith.bid 99
dronml.ml 99
niematego.tk 99
tulip18.com 99
p.estream.to 99
didnkinrab.com 99
ledhenone.com 99
losital.ru 99
mebablo.com 99
moonsade.com 99
nebabrop.com 99
pearno.com 99
rintinwa.com 99
willacrit.com 99
www2.adfreetv.ch 99
minr.pw 99
new.minr.pw 99
test.minr.pw 99
staticsfs.host 99
cdn-code.host 99
g-content.bid 99
ad.g-content.bid 99
cdn.static-cnt.bid 99
cnt.statistic.date 99
cdn.jquery-uim.download 99
cdn-jquery.host 99
p1.interestingz.pw 99
kippbeak.cf 99
pasoherb.gq 99
axoncoho.tk 99
depttake.ga 99
flophous.cf 99
pr0gram.org 99
authedmine.eu 99
www.monero-miner.com 99
www.datasecu.download 99
www.jquery-cdn.download 99
www.etzbnfuigipwvs.ru 99
www.terethat.ru 99
freshrefresher.com 99
api.pzoifaum.info 99
ws.pzoifaum.info 99
api.bhzejltg.info 99
ws.bhzejltg.info 99
d.cfcnet.top 99
vip.cfcnet.top 99
eu.cfcnet.top 99
as.cfcnet.top 99
us.cfcnet.top 99
eu.cfcdist.loan 99
as.cfcdist.loan 99
us.cfcdist.loan 99
gustaver.ddns.net 99
worker.salon.com 99
s2.appelamule.com 99
mepirtedic.com 99
cdn.streambeam.io 99
adzjzewsma.cf 99
ffinwwfpqi.gq 99
ininmacerad.pro 99
mhiobjnirs.gq 99
open-hive-server-1.pp.ua 99
pool.hws.ru 99
pool.etn.spacepools.org 99
api.aalbbh84.info 99
www.aymcsx.ru 99
aeros01.tk 99
aeros02.tk 99
aeros03.tk 99
aeros04.tk 99
aeros05.tk 99
aeros06.tk 99
aeros07.tk 99
aeros08.tk 99
aeros09.tk 99
aeros10.tk 99
aeros11.tk 99
aeros12.tk 99
npcdn1.now.sh 99
mxcdn2.now.sh 99
sxcdn6.now.sh 99
mxcdn1.now.sh 99
sxcdn02.now.sh 99
sxcdn4.now.sh 99
jqcdn2.herokuapp.com 99
sxcdn1.herokuapp.com 99
sxcdn5.herokuapp.com 99
wpcdn1.herokuapp.com 99
jqcdn01.herokuapp.com 99
jqcdn03.herokuapp.com 99
1q2w3.website 99
video.videos.vidto.me 99
video.streaming.estream.to 99
eth-pocket.de 99
xvideosharing.site 99
bestcoinsignals.com 99
eucsoft.com 99
traviilo.com 99
wasm24.ru 99
xmr.cool 99
api.netflare.info 99
cdnjs.cloudflane.com 99
www.cloudflane.com 99
hide.ovh 99
graftpool.ovh 99
encoding.ovh 99
altavista.ovh 99
scaleway.ovh 99
nexttime.ovh 99
never.ovh 99
2giga.download 99
support.2giga.link 99
webminerpool.com 99
minercry.pt 99
adplusplus.fr 99
# Does not seem to work anymore, but keeping it here just in case it gets revived
azvjudwr.info 99
jroqvbvw.info 99
jyhfuqoh.info 99
kdowqlpt.info 99
xbasfbno.info 99
# These were Obfuscated
1beb2a44.space 99
300ca0d0.space 99
310ca263.space 99
320ca3f6.space 99
330ca589.space 99
340ca71c.space 99
360caa42.space 99
370cabd5.space 99
3c0cb3b4.space 99
3d0cb547.space 99
imageshack.us 99
img265.imageshack.us 99
+239 -150
View File
@@ -1,7 +1,7 @@
/* /*
* ndpiReader.c * ndpiReader.c
* *
* Copyright (C) 2011-17 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -18,6 +18,10 @@
* *
*/ */
#ifdef HAVE_CONFIG_H
#include "ndpi_config.h"
#endif
#ifdef linux #ifdef linux
#define _GNU_SOURCE #define _GNU_SOURCE
#include <sched.h> #include <sched.h>
@@ -63,6 +67,7 @@ static FILE *results_file = NULL;
static char *results_path = NULL; static char *results_path = NULL;
static char * bpfFilter = NULL; /**< bpf filter */ static char * bpfFilter = NULL; /**< bpf filter */
static char *_protoFilePath = NULL; /**< Protocol file path */ static char *_protoFilePath = NULL; /**< Protocol file path */
static char *_customCategoryFilePath= NULL; /**< Custom categories file path */
#ifdef HAVE_JSON_C #ifdef HAVE_JSON_C
static char *_statsFilePath = NULL; /**< Top stats file path */ static char *_statsFilePath = NULL; /**< Top stats file path */
static char *_diagnoseFilePath = NULL; /**< Top stats file path */ static char *_diagnoseFilePath = NULL; /**< Top stats file path */
@@ -100,13 +105,12 @@ static u_int32_t num_flows;
static struct ndpi_detection_module_struct *ndpi_info_mod = NULL; static struct ndpi_detection_module_struct *ndpi_info_mod = NULL;
struct flow_info { struct flow_info {
struct ndpi_flow_info *flow; struct ndpi_flow_info *flow;
u_int16_t thread_id; u_int16_t thread_id;
}; };
static struct flow_info *all_flows; static struct flow_info *all_flows;
struct info_pair { struct info_pair {
u_int32_t addr; u_int32_t addr;
u_int8_t version; /* IP version */ u_int8_t version; /* IP version */
@@ -130,16 +134,15 @@ struct port_stats {
u_int32_t cumulative_addr; /*cumulative some of IP addresses */ u_int32_t cumulative_addr; /*cumulative some of IP addresses */
addr_node *addr_tree; /* tree of distinct IP addresses */ addr_node *addr_tree; /* tree of distinct IP addresses */
struct info_pair top_ip_addrs[MAX_NUM_IP_ADDRESS]; struct info_pair top_ip_addrs[MAX_NUM_IP_ADDRESS];
u_int8_t hasTopHost; /* as boolean flag*/ u_int8_t hasTopHost; /* as boolean flag */
u_int32_t top_host; /*host that is contributed to > 95% of traffic*/ u_int32_t top_host; /* host that is contributed to > 95% of traffic */
u_int8_t version; /* top host's ip version */ u_int8_t version; /* top host's ip version */
char proto[16]; /*application level protocol of top host */ char proto[16]; /* application level protocol of top host */
UT_hash_handle hh; /* makes this structure hashable */ UT_hash_handle hh; /* makes this structure hashable */
}; };
struct port_stats *srcStats = NULL, *dstStats = NULL; struct port_stats *srcStats = NULL, *dstStats = NULL;
// struct to hold count of flows received by destination ports // struct to hold count of flows received by destination ports
struct port_flow_info { struct port_flow_info {
u_int32_t port; /* key */ u_int32_t port; /* key */
@@ -226,7 +229,7 @@ static void help(u_int long_help) {
printf("ndpiReader -i <file|device> [-f <filter>][-s <duration>][-m <duration>]\n" printf("ndpiReader -i <file|device> [-f <filter>][-s <duration>][-m <duration>]\n"
" [-p <protos>][-l <loops> [-q][-d][-h][-t][-v <level>]\n" " [-p <protos>][-l <loops> [-q][-d][-h][-t][-v <level>]\n"
" [-n <threads>] [-w <file>] [-j <file>] [-x <file>] \n\n" " [-n <threads>][-w <file>][-c <file>][-j <file>][-x <file>]\n\n"
"Usage:\n" "Usage:\n"
" -i <file.pcap|device> | Specify a pcap file/playlist to read packets from or a\n" " -i <file.pcap|device> | Specify a pcap file/playlist to read packets from or a\n"
" | device for live capture (comma-separated list)\n" " | device for live capture (comma-separated list)\n"
@@ -245,6 +248,7 @@ static void help(u_int long_help) {
" -q | Quiet mode\n" " -q | Quiet mode\n"
" -t | Dissect GTP/TZSP tunnels\n" " -t | Dissect GTP/TZSP tunnels\n"
" -r | Print nDPI version and git revision\n" " -r | Print nDPI version and git revision\n"
" -c <path> | Load custom categories from the specified file\n"
" -w <path> | Write test output on the specified file. This is useful for\n" " -w <path> | Write test output on the specified file. This is useful for\n"
" | testing purposes in order to compare results across runs\n" " | testing purposes in order to compare results across runs\n"
" -h | This help\n" " -h | This help\n"
@@ -272,7 +276,7 @@ static void help(u_int long_help) {
" --fifo <path to file or pipe>\n" " --fifo <path to file or pipe>\n"
" --debug\n" " --debug\n"
" --dbg-proto proto|num[,...]\n" " --dbg-proto proto|num[,...]\n"
); );
#endif #endif
if(long_help) { if(long_help) {
@@ -343,6 +347,8 @@ struct ndpi_proto_sorter {
char name[16]; char name[16];
}; };
/* ********************************** */
int cmpProto(const void *_a, const void *_b) { int cmpProto(const void *_a, const void *_b) {
struct ndpi_proto_sorter *a = (struct ndpi_proto_sorter*)_a; struct ndpi_proto_sorter *a = (struct ndpi_proto_sorter*)_a;
struct ndpi_proto_sorter *b = (struct ndpi_proto_sorter*)_b; struct ndpi_proto_sorter *b = (struct ndpi_proto_sorter*)_b;
@@ -350,13 +356,15 @@ int cmpProto(const void *_a, const void *_b) {
return(strcmp(a->name, b->name)); return(strcmp(a->name, b->name));
} }
/* ********************************** */
int cmpFlows(const void *_a, const void *_b) { int cmpFlows(const void *_a, const void *_b) {
struct ndpi_flow_info *fa = ((struct flow_info*)_a)->flow; struct ndpi_flow_info *fa = ((struct flow_info*)_a)->flow;
struct ndpi_flow_info *fb = ((struct flow_info*)_b)->flow; struct ndpi_flow_info *fb = ((struct flow_info*)_b)->flow;
uint64_t a_size = fa->src2dst_bytes + fa->dst2src_bytes; uint64_t a_size = fa->src2dst_bytes + fa->dst2src_bytes;
uint64_t b_size = fb->src2dst_bytes + fb->dst2src_bytes; uint64_t b_size = fb->src2dst_bytes + fb->dst2src_bytes;
if(a_size != b_size) if(a_size != b_size)
return a_size < b_size ? 1 : -1; return a_size < b_size ? 1 : -1;
// copy from ndpi_workflow_node_cmp(); // copy from ndpi_workflow_node_cmp();
@@ -369,9 +377,13 @@ int cmpFlows(const void *_a, const void *_b) {
return(0); return(0);
} }
/* ********************************** */
void extcap_config() { void extcap_config() {
int i, argidx = 0; int i, argidx = 0;
struct ndpi_proto_sorter *protos; struct ndpi_proto_sorter *protos;
u_int ndpi_num_supported_protocols = ndpi_get_ndpi_num_supported_protocols(ndpi_info_mod);
ndpi_proto_defaults_t *proto_defaults = ndpi_get_proto_defaults(ndpi_info_mod);
/* -i <interface> */ /* -i <interface> */
printf("arg {number=%d}{call=-i}{display=Capture Interface}{type=string}" printf("arg {number=%d}{call=-i}{display=Capture Interface}{type=string}"
@@ -379,22 +391,22 @@ void extcap_config() {
printf("arg {number=%d}{call=-i}{display=Pcap File to Analyze}{type=fileselect}" printf("arg {number=%d}{call=-i}{display=Pcap File to Analyze}{type=fileselect}"
"{tooltip=The pcap file to analyze (if the interface is unspecified)}\n", argidx++); "{tooltip=The pcap file to analyze (if the interface is unspecified)}\n", argidx++);
protos = (struct ndpi_proto_sorter*)malloc(sizeof(struct ndpi_proto_sorter) * ndpi_info_mod->ndpi_num_supported_protocols); protos = (struct ndpi_proto_sorter*)malloc(sizeof(struct ndpi_proto_sorter) * ndpi_num_supported_protocols);
if(!protos) exit(0); if(!protos) exit(0);
for(i=0; i<(int) ndpi_info_mod->ndpi_num_supported_protocols; i++) { for(i=0; i<(int) ndpi_num_supported_protocols; i++) {
protos[i].id = i; protos[i].id = i;
snprintf(protos[i].name, sizeof(protos[i].name), "%s", ndpi_info_mod->proto_defaults[i].protoName); snprintf(protos[i].name, sizeof(protos[i].name), "%s", proto_defaults[i].protoName);
} }
qsort(protos, ndpi_info_mod->ndpi_num_supported_protocols, sizeof(struct ndpi_proto_sorter), cmpProto); qsort(protos, ndpi_num_supported_protocols, sizeof(struct ndpi_proto_sorter), cmpProto);
printf("arg {number=%d}{call=-9}{display=nDPI Protocol Filter}{type=selector}" printf("arg {number=%d}{call=-9}{display=nDPI Protocol Filter}{type=selector}"
"{tooltip=nDPI Protocol to be filtered}\n", argidx); "{tooltip=nDPI Protocol to be filtered}\n", argidx);
printf("value {arg=%d}{value=%d}{display=%s}\n", argidx, -1, "All Protocols (no nDPI filtering)"); printf("value {arg=%d}{value=%d}{display=%s}\n", argidx, -1, "All Protocols (no nDPI filtering)");
for(i=0; i<(int)ndpi_info_mod->ndpi_num_supported_protocols; i++) for(i=0; i<(int)ndpi_num_supported_protocols; i++)
printf("value {arg=%d}{value=%d}{display=%s (%d)}\n", argidx, protos[i].id, printf("value {arg=%d}{value=%d}{display=%s (%d)}\n", argidx, protos[i].id,
protos[i].name, protos[i].id); protos[i].name, protos[i].id);
@@ -445,7 +457,7 @@ static void parseOptions(int argc, char **argv) {
if(trace) fprintf(trace, " #### %s #### \n", __FUNCTION__); if(trace) fprintf(trace, " #### %s #### \n", __FUNCTION__);
#endif #endif
while ((opt = getopt_long(argc, argv, "df:g:i:hp:l:s:tv:V:n:j:rp:w:q0123:456:7:89:m:b:x:", longopts, &option_idx)) != EOF) { while ((opt = getopt_long(argc, argv, "c:df:g:i:hp:l:s:tv:V:n:j:rp:w:q0123:456:7:89:m:b:x:", longopts, &option_idx)) != EOF) {
#ifdef DEBUG_TRACE #ifdef DEBUG_TRACE
if(trace) fprintf(trace, " #### -%c [%s] #### \n", opt, optarg ? optarg : ""); if(trace) fprintf(trace, " #### -%c [%s] #### \n", opt, optarg ? optarg : "");
#endif #endif
@@ -503,6 +515,10 @@ static void parseOptions(int argc, char **argv) {
_protoFilePath = optarg; _protoFilePath = optarg;
break; break;
case 'c':
_customCategoryFilePath = optarg;
break;
case 's': case 's':
capture_for = atoi(optarg); capture_for = atoi(optarg);
capture_until = capture_for + time(NULL); capture_until = capture_for + time(NULL);
@@ -524,8 +540,8 @@ static void parseOptions(int argc, char **argv) {
nDPI_LogLevel = atoi(optarg); nDPI_LogLevel = atoi(optarg);
if(nDPI_LogLevel < 0) nDPI_LogLevel = 0; if(nDPI_LogLevel < 0) nDPI_LogLevel = 0;
if(nDPI_LogLevel > 3) { if(nDPI_LogLevel > 3) {
nDPI_LogLevel = 3; nDPI_LogLevel = 3;
_debug_protocols = strdup("all"); _debug_protocols = strdup("all");
} }
break; break;
@@ -535,7 +551,7 @@ static void parseOptions(int argc, char **argv) {
case 'j': case 'j':
#ifndef HAVE_JSON_C #ifndef HAVE_JSON_C
printf("WARNING: this copy of ndpiReader has been compiled without JSON-C: json export disabled\n"); printf("WARNING: this copy of ndpiReader has been compiled without json-c: JSON export disabled\n");
#else #else
_jsonFilePath = optarg; _jsonFilePath = optarg;
json_flag = 1; json_flag = 1;
@@ -589,7 +605,7 @@ static void parseOptions(int argc, char **argv) {
extcap_packet_filter = ndpi_get_proto_by_name(ndpi_info_mod, optarg); extcap_packet_filter = ndpi_get_proto_by_name(ndpi_info_mod, optarg);
if (extcap_packet_filter == NDPI_PROTOCOL_UNKNOWN) extcap_packet_filter = atoi(optarg); if (extcap_packet_filter == NDPI_PROTOCOL_UNKNOWN) extcap_packet_filter = atoi(optarg);
break; break;
case 257: case 257:
_debug_protocols = strdup(optarg); _debug_protocols = strdup(optarg);
break; break;
@@ -644,12 +660,12 @@ static void parseOptions(int argc, char **argv) {
#endif #endif
} }
/* ********************************** */
/** /**
* @brief From IPPROTO to string NAME * @brief From IPPROTO to string NAME
*/ */
static char* ipProto2Name(u_int16_t proto_id) { static char* ipProto2Name(u_int16_t proto_id) {
static char proto[8]; static char proto[8];
switch(proto_id) { switch(proto_id) {
@@ -677,12 +693,12 @@ static char* ipProto2Name(u_int16_t proto_id) {
return(proto); return(proto);
} }
/* ********************************** */
/** /**
* @brief A faster replacement for inet_ntoa(). * @brief A faster replacement for inet_ntoa().
*/ */
char* intoaV4(u_int32_t addr, char* buf, u_int16_t bufLen) { char* intoaV4(u_int32_t addr, char* buf, u_int16_t bufLen) {
char *cp, *retStr; char *cp, *retStr;
uint byte; uint byte;
int n; int n;
@@ -711,6 +727,8 @@ char* intoaV4(u_int32_t addr, char* buf, u_int16_t bufLen) {
return(retStr); return(retStr);
} }
/* ********************************** */
/** /**
* @brief Print the flow * @brief Print the flow
*/ */
@@ -734,7 +752,7 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa
flow->bidirectional ? "<->" : "->", flow->bidirectional ? "<->" : "->",
(flow->ip_version == 6) ? "[" : "", (flow->ip_version == 6) ? "[" : "",
flow->dst_name, (flow->ip_version == 6) ? "]" : "", ntohs(flow->dst_port) flow->dst_name, (flow->ip_version == 6) ? "]" : "", ntohs(flow->dst_port)
); );
if(flow->vlan_id > 0) fprintf(out, "[VLAN: %u]", flow->vlan_id); if(flow->vlan_id > 0) fprintf(out, "[VLAN: %u]", flow->vlan_id);
@@ -750,6 +768,12 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa
flow->detected_protocol.app_protocol, flow->detected_protocol.app_protocol,
ndpi_get_proto_name(ndpi_thread_info[thread_id].workflow->ndpi_struct, flow->detected_protocol.app_protocol)); ndpi_get_proto_name(ndpi_thread_info[thread_id].workflow->ndpi_struct, flow->detected_protocol.app_protocol));
if(flow->detected_protocol.category != 0)
fprintf(out, "[cat: %s/%u]",
ndpi_category_get_name(ndpi_thread_info[thread_id].workflow->ndpi_struct,
flow->detected_protocol.category),
(unsigned int)flow->detected_protocol.category);
fprintf(out, "[%u pkts/%llu bytes ", flow->src2dst_packets, (long long unsigned int) flow->src2dst_bytes); fprintf(out, "[%u pkts/%llu bytes ", flow->src2dst_packets, (long long unsigned int) flow->src2dst_bytes);
fprintf(out, "%s %u pkts/%llu bytes]", fprintf(out, "%s %u pkts/%llu bytes]",
(flow->dst2src_packets > 0) ? "<->" : "->", (flow->dst2src_packets > 0) ? "<->" : "->",
@@ -774,16 +798,20 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa
json_object_object_add(jObj,"host_b.port",json_object_new_int(ntohs(flow->dst_port))); json_object_object_add(jObj,"host_b.port",json_object_new_int(ntohs(flow->dst_port)));
if(flow->detected_protocol.master_protocol) if(flow->detected_protocol.master_protocol)
json_object_object_add(jObj,"detected.master_protocol",json_object_new_int(flow->detected_protocol.master_protocol)); json_object_object_add(jObj,"detected.master_protocol",
json_object_new_int(flow->detected_protocol.master_protocol));
json_object_object_add(jObj,"detected.app_protocol",json_object_new_int(flow->detected_protocol.app_protocol)); json_object_object_add(jObj,"detected.app_protocol",
json_object_new_int(flow->detected_protocol.app_protocol));
if(flow->detected_protocol.master_protocol) { if(flow->detected_protocol.master_protocol) {
char tmp[256]; char tmp[256];
snprintf(tmp, sizeof(tmp), "%s.%s", snprintf(tmp, sizeof(tmp), "%s.%s",
ndpi_get_proto_name(ndpi_thread_info[thread_id].workflow->ndpi_struct, flow->detected_protocol.master_protocol), ndpi_get_proto_name(ndpi_thread_info[thread_id].workflow->ndpi_struct,
ndpi_get_proto_name(ndpi_thread_info[thread_id].workflow->ndpi_struct, flow->detected_protocol.app_protocol)); flow->detected_protocol.master_protocol),
ndpi_get_proto_name(ndpi_thread_info[thread_id].workflow->ndpi_struct,
flow->detected_protocol.app_protocol));
json_object_object_add(jObj,"detected.protocol.name", json_object_object_add(jObj,"detected.protocol.name",
json_object_new_string(tmp)); json_object_new_string(tmp));
@@ -818,41 +846,45 @@ static void printFlow(u_int16_t id, struct ndpi_flow_info *flow, u_int16_t threa
} }
} }
/* ********************************** */
/** /**
* @brief Unknown Proto Walker * @brief Unknown Proto Walker
*/ */
static void node_print_unknown_proto_walker(const void *node, ndpi_VISIT which, int depth, void *user_data) { static void node_print_unknown_proto_walker(const void *node,
ndpi_VISIT which, int depth, void *user_data) {
struct ndpi_flow_info *flow = *(struct ndpi_flow_info**)node; struct ndpi_flow_info *flow = *(struct ndpi_flow_info**)node;
u_int16_t thread_id = *((u_int16_t*)user_data); u_int16_t thread_id = *((u_int16_t*)user_data);
if(flow->detected_protocol.app_protocol != NDPI_PROTOCOL_UNKNOWN) return; if(flow->detected_protocol.app_protocol != NDPI_PROTOCOL_UNKNOWN) return;
if((which == ndpi_preorder) || (which == ndpi_leaf)) { if((which == ndpi_preorder) || (which == ndpi_leaf)) {
/* Avoid walking the same node multiple times */ /* Avoid walking the same node multiple times */
all_flows[num_flows].thread_id = thread_id, all_flows[num_flows].flow = flow; all_flows[num_flows].thread_id = thread_id, all_flows[num_flows].flow = flow;
num_flows++; num_flows++;
} }
} }
/* ********************************** */
/** /**
* @brief Known Proto Walker * @brief Known Proto Walker
*/ */
static void node_print_known_proto_walker(const void *node, ndpi_VISIT which, int depth, void *user_data) { static void node_print_known_proto_walker(const void *node,
ndpi_VISIT which, int depth, void *user_data) {
struct ndpi_flow_info *flow = *(struct ndpi_flow_info**)node; struct ndpi_flow_info *flow = *(struct ndpi_flow_info**)node;
u_int16_t thread_id = *((u_int16_t*)user_data); u_int16_t thread_id = *((u_int16_t*)user_data);
if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_UNKNOWN) return; if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_UNKNOWN) return;
if((which == ndpi_preorder) || (which == ndpi_leaf)) { if((which == ndpi_preorder) || (which == ndpi_leaf)) {
/* Avoid walking the same node multiple times */ /* Avoid walking the same node multiple times */
all_flows[num_flows].thread_id = thread_id, all_flows[num_flows].flow = flow; all_flows[num_flows].thread_id = thread_id, all_flows[num_flows].flow = flow;
num_flows++; num_flows++;
} }
} }
/* ********************************** */
/** /**
* @brief Guess Undetected Protocol * @brief Guess Undetected Protocol
@@ -872,6 +904,7 @@ static u_int16_t node_guess_undetected_protocol(u_int16_t thread_id, struct ndpi
return(flow->detected_protocol.app_protocol); return(flow->detected_protocol.app_protocol);
} }
/* ********************************** */
/** /**
* @brief Proto Guess Walker * @brief Proto Guess Walker
@@ -891,6 +924,7 @@ static void node_proto_guess_walker(const void *node, ndpi_VISIT which, int dept
} }
process_ndpi_collected_info(ndpi_thread_info[thread_id].workflow, flow); process_ndpi_collected_info(ndpi_thread_info[thread_id].workflow, flow);
ndpi_thread_info[thread_id].workflow->stats.protocol_counter[flow->detected_protocol.app_protocol] += flow->src2dst_packets + flow->dst2src_packets; ndpi_thread_info[thread_id].workflow->stats.protocol_counter[flow->detected_protocol.app_protocol] += flow->src2dst_packets + flow->dst2src_packets;
ndpi_thread_info[thread_id].workflow->stats.protocol_counter_bytes[flow->detected_protocol.app_protocol] += flow->src2dst_bytes + flow->dst2src_bytes; ndpi_thread_info[thread_id].workflow->stats.protocol_counter_bytes[flow->detected_protocol.app_protocol] += flow->src2dst_bytes + flow->dst2src_bytes;
ndpi_thread_info[thread_id].workflow->stats.protocol_flows[flow->detected_protocol.app_protocol]++; ndpi_thread_info[thread_id].workflow->stats.protocol_flows[flow->detected_protocol.app_protocol]++;
@@ -944,7 +978,7 @@ void updateScanners(struct single_flow_info **scanners, u_int32_t saddr,
/* *********************************************** */ /* *********************************************** */
int updateIpTree(u_int32_t key, u_int8_t version, int updateIpTree(u_int32_t key, u_int8_t version,
addr_node **vrootp, const char *proto) { addr_node **vrootp, const char *proto) {
addr_node *q; addr_node *q;
addr_node **rootp = vrootp; addr_node **rootp = vrootp;
@@ -1112,7 +1146,7 @@ static int receivers_sort_asc(void *_a, void *_b) {
/* ***************************************************** */ /* ***************************************************** */
/*@brief removes first (size - max) elements from hash table. /*@brief removes first (size - max) elements from hash table.
* hash table is ordered in ascending order. * hash table is ordered in ascending order.
*/ */
static struct receiver *cutBackTo(struct receiver **receivers, u_int32_t size, u_int32_t max) { static struct receiver *cutBackTo(struct receiver **receivers, u_int32_t size, u_int32_t max) {
struct receiver *r, *tmp; struct receiver *r, *tmp;
int i=0; int i=0;
@@ -1139,7 +1173,7 @@ static struct receiver *cutBackTo(struct receiver **receivers, u_int32_t size, u
* if element already in the second table * if element already in the second table
* then updates its value * then updates its value
* else adds it to the second table * else adds it to the second table
*/ */
static void mergeTables(struct receiver **primary, struct receiver **secondary) { static void mergeTables(struct receiver **primary, struct receiver **secondary) {
struct receiver *r, *s, *tmp; struct receiver *r, *s, *tmp;
@@ -1187,7 +1221,7 @@ static void deleteReceivers(struct receiver *receivers) {
* } * }
* else * else
* update table1 * update table1
*/ */
static void updateReceivers(struct receiver **receivers, u_int32_t dst_addr, static void updateReceivers(struct receiver **receivers, u_int32_t dst_addr,
u_int8_t version, u_int32_t num_pkts, u_int8_t version, u_int32_t num_pkts,
struct receiver **topReceivers) { struct receiver **topReceivers) {
@@ -1198,7 +1232,7 @@ static void updateReceivers(struct receiver **receivers, u_int32_t dst_addr,
HASH_FIND_INT(*receivers, (int *)&dst_addr, r); HASH_FIND_INT(*receivers, (int *)&dst_addr, r);
if(r == NULL) { if(r == NULL) {
if(((size = HASH_COUNT(*receivers)) < MAX_TABLE_SIZE_1) if(((size = HASH_COUNT(*receivers)) < MAX_TABLE_SIZE_1)
|| ((a = acceptable(num_pkts)) != 0)){ || ((a = acceptable(num_pkts)) != 0)){
r = (struct receiver *)malloc(sizeof(struct receiver)); r = (struct receiver *)malloc(sizeof(struct receiver));
if(!r) return; if(!r) return;
@@ -1316,7 +1350,7 @@ static void port_stats_walker(const void *node, ndpi_VISIT which, int depth, voi
if(((r = strcmp(ipProto2Name(flow->protocol), "TCP")) == 0) if(((r = strcmp(ipProto2Name(flow->protocol), "TCP")) == 0)
&& (flow->src2dst_packets == 1) && (flow->dst2src_packets == 0)) { && (flow->src2dst_packets == 1) && (flow->dst2src_packets == 0)) {
updateScanners(&scannerHosts, flow->src_ip, flow->ip_version, dport); updateScanners(&scannerHosts, flow->src_ip, flow->ip_version, dport);
} }
updateReceivers(&receivers, flow->dst_ip, flow->ip_version, updateReceivers(&receivers, flow->dst_ip, flow->ip_version,
@@ -1336,7 +1370,6 @@ static void port_stats_walker(const void *node, ndpi_VISIT which, int depth, voi
* @brief Idle Scan Walker * @brief Idle Scan Walker
*/ */
static void node_idle_scan_walker(const void *node, ndpi_VISIT which, int depth, void *user_data) { static void node_idle_scan_walker(const void *node, ndpi_VISIT which, int depth, void *user_data) {
struct ndpi_flow_info *flow = *(struct ndpi_flow_info **) node; struct ndpi_flow_info *flow = *(struct ndpi_flow_info **) node;
u_int16_t thread_id = *((u_int16_t *) user_data); u_int16_t thread_id = *((u_int16_t *) user_data);
@@ -1368,7 +1401,6 @@ static void node_idle_scan_walker(const void *node, ndpi_VISIT which, int depth,
static void on_protocol_discovered(struct ndpi_workflow * workflow, static void on_protocol_discovered(struct ndpi_workflow * workflow,
struct ndpi_flow_info * flow, struct ndpi_flow_info * flow,
void * udata) { void * udata) {
const u_int16_t thread_id = (uintptr_t) udata; const u_int16_t thread_id = (uintptr_t) udata;
if(verbose > 1) { if(verbose > 1) {
@@ -1428,7 +1460,6 @@ static void debug_printf(u_int32_t protocol, void *id_struct,
* @brief Setup for detection begin * @brief Setup for detection begin
*/ */
static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) { static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) {
NDPI_PROTOCOL_BITMASK all; NDPI_PROTOCOL_BITMASK all;
struct ndpi_workflow_prefs prefs; struct ndpi_workflow_prefs prefs;
@@ -1442,23 +1473,71 @@ static void setupDetection(u_int16_t thread_id, pcap_t * pcap_handle) {
ndpi_thread_info[thread_id].workflow = ndpi_workflow_init(&prefs, pcap_handle); ndpi_thread_info[thread_id].workflow = ndpi_workflow_init(&prefs, pcap_handle);
/* Preferences */ /* Preferences */
ndpi_thread_info[thread_id].workflow->ndpi_struct->http_dont_dissect_response = 0; ndpi_set_detection_preferences(ndpi_thread_info[thread_id].workflow->ndpi_struct,
ndpi_thread_info[thread_id].workflow->ndpi_struct->dns_dissect_response = 0; ndpi_pref_http_dont_dissect_response, 0);
ndpi_set_detection_preferences(ndpi_thread_info[thread_id].workflow->ndpi_struct,
ndpi_pref_dns_dissect_response, 0);
ndpi_set_detection_preferences(ndpi_thread_info[thread_id].workflow->ndpi_struct,
ndpi_pref_enable_category_substring_match, 1);
ndpi_workflow_set_flow_detected_callback(ndpi_thread_info[thread_id].workflow, ndpi_workflow_set_flow_detected_callback(ndpi_thread_info[thread_id].workflow,
on_protocol_discovered, (void *)(uintptr_t)thread_id); on_protocol_discovered,
(void *)(uintptr_t)thread_id);
// enable all protocols // enable all protocols
NDPI_BITMASK_SET_ALL(all); NDPI_BITMASK_SET_ALL(all);
ndpi_set_protocol_detection_bitmask2(ndpi_thread_info[thread_id].workflow->ndpi_struct, &all); ndpi_set_protocol_detection_bitmask2(ndpi_thread_info[thread_id].workflow->ndpi_struct, &all);
// clear memory for results // clear memory for results
memset(ndpi_thread_info[thread_id].workflow->stats.protocol_counter, 0, sizeof(ndpi_thread_info[thread_id].workflow->stats.protocol_counter)); memset(ndpi_thread_info[thread_id].workflow->stats.protocol_counter, 0,
memset(ndpi_thread_info[thread_id].workflow->stats.protocol_counter_bytes, 0, sizeof(ndpi_thread_info[thread_id].workflow->stats.protocol_counter_bytes)); sizeof(ndpi_thread_info[thread_id].workflow->stats.protocol_counter));
memset(ndpi_thread_info[thread_id].workflow->stats.protocol_flows, 0, sizeof(ndpi_thread_info[thread_id].workflow->stats.protocol_flows)); memset(ndpi_thread_info[thread_id].workflow->stats.protocol_counter_bytes, 0,
sizeof(ndpi_thread_info[thread_id].workflow->stats.protocol_counter_bytes));
memset(ndpi_thread_info[thread_id].workflow->stats.protocol_flows, 0,
sizeof(ndpi_thread_info[thread_id].workflow->stats.protocol_flows));
if(_protoFilePath != NULL) if(_protoFilePath != NULL)
ndpi_load_protocols_file(ndpi_thread_info[thread_id].workflow->ndpi_struct, _protoFilePath); ndpi_load_protocols_file(ndpi_thread_info[thread_id].workflow->ndpi_struct, _protoFilePath);
if(_customCategoryFilePath) {
FILE *fd = fopen(_customCategoryFilePath, "r");
if(fd) {
while(fd) {
char buffer[512], *line, *name, *category;
int i;
if(!(line = fgets(buffer, sizeof(buffer), fd)))
break;
if(((i = strlen(line)) <= 1) || (line[0] == '#'))
continue;
else
line[i-1] = '\0';
name = strtok(line, "\t");
if(name) {
category = strtok(NULL, "\t");
if(category) {
int fields[4];
// printf("Loading %s\t%s\n", name, category);
if(sscanf(name, "%d.%d.%d.%d", &fields[0], &fields[1], &fields[2], &fields[3]) == 4)
ndpi_load_ip_category(ndpi_thread_info[thread_id].workflow->ndpi_struct,
name, (ndpi_protocol_category_t)atoi(category));
else
ndpi_load_hostname_category(ndpi_thread_info[thread_id].workflow->ndpi_struct,
name, (ndpi_protocol_category_t)atoi(category));
}
}
}
ndpi_enable_loaded_categories(ndpi_thread_info[thread_id].workflow->ndpi_struct);
} else
printf("ERROR: Unable to read file %s\n", _customCategoryFilePath);
}
} }
@@ -1546,7 +1625,9 @@ static void json_open_stats_file() {
static void json_close_stats_file() { static void json_close_stats_file() {
json_object *jObjFinal = json_object_new_object(); json_object *jObjFinal = json_object_new_object();
json_object_object_add(jObjFinal,"duration.in.seconds",json_object_new_int(pcap_analysis_duration));
json_object_object_add(jObjFinal,"duration.in.seconds",
json_object_new_int(pcap_analysis_duration));
json_object_object_add(jObjFinal,"statistics", jArray_topStats); json_object_object_add(jObjFinal,"statistics", jArray_topStats);
fprintf(stats_fp,"%s\n",json_object_to_json_string(jObjFinal)); fprintf(stats_fp,"%s\n",json_object_to_json_string(jObjFinal));
fclose(stats_fp); fclose(stats_fp);
@@ -1835,6 +1916,7 @@ static void printResults(u_int64_t tot_usec) {
char buf[32]; char buf[32];
#ifdef HAVE_JSON_C #ifdef HAVE_JSON_C
FILE *json_fp = NULL; FILE *json_fp = NULL;
u_int8_t dont_close_json_fp = 0;
json_object *jObj_main = NULL, *jObj_trafficStats, *jArray_detProto = NULL, *jObj; json_object *jObj_main = NULL, *jObj_trafficStats, *jArray_detProto = NULL, *jObj;
#endif #endif
long long unsigned int breed_stats[NUM_BREEDS] = { 0 }; long long unsigned int breed_stats[NUM_BREEDS] = { 0 };
@@ -1847,8 +1929,10 @@ static void printResults(u_int64_t tot_usec) {
continue; continue;
for(i=0; i<NUM_ROOTS; i++) { for(i=0; i<NUM_ROOTS; i++) {
ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], node_proto_guess_walker, &thread_id); ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
if(verbose == 3 || stats_flag) ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i], port_stats_walker, &thread_id); node_proto_guess_walker, &thread_id);
if(verbose == 3 || stats_flag) ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[i],
port_stats_walker, &thread_id);
} }
/* Stats aggregation */ /* Stats aggregation */
@@ -1882,7 +1966,7 @@ static void printResults(u_int64_t tot_usec) {
if(!quiet_mode) { if(!quiet_mode) {
printf("\nnDPI Memory statistics:\n"); printf("\nnDPI Memory statistics:\n");
printf("\tnDPI Memory (once): %-13s\n", formatBytes(sizeof(struct ndpi_detection_module_struct), buf, sizeof(buf))); printf("\tnDPI Memory (once): %-13s\n", formatBytes(ndpi_get_ndpi_detection_module_size(), buf, sizeof(buf)));
printf("\tFlow Memory (per flow): %-13s\n", formatBytes(sizeof(struct ndpi_flow_struct), buf, sizeof(buf))); printf("\tFlow Memory (per flow): %-13s\n", formatBytes(sizeof(struct ndpi_flow_struct), buf, sizeof(buf)));
printf("\tActual Memory: %-13s\n", formatBytes(current_ndpi_memory, buf, sizeof(buf))); printf("\tActual Memory: %-13s\n", formatBytes(current_ndpi_memory, buf, sizeof(buf)));
printf("\tPeak Memory: %-13s\n", formatBytes(max_ndpi_memory, buf, sizeof(buf))); printf("\tPeak Memory: %-13s\n", formatBytes(max_ndpi_memory, buf, sizeof(buf)));
@@ -1943,10 +2027,14 @@ static void printResults(u_int64_t tot_usec) {
if(json_flag) { if(json_flag) {
#ifdef HAVE_JSON_C #ifdef HAVE_JSON_C
if((json_fp = fopen(_jsonFilePath,"w")) == NULL) { if(!strcmp(_jsonFilePath, "-"))
json_fp = stderr, dont_close_json_fp = 1;
else if((json_fp = fopen(_jsonFilePath,"w")) == NULL) {
printf("Error creating .json file %s\n", _jsonFilePath); printf("Error creating .json file %s\n", _jsonFilePath);
json_flag = 0; json_flag = 0;
} else { }
if(json_flag) {
jObj_main = json_object_new_object(); jObj_main = json_object_new_object();
jObj_trafficStats = json_object_new_object(); jObj_trafficStats = json_object_new_object();
jArray_detProto = json_object_new_array(); jArray_detProto = json_object_new_array();
@@ -2041,8 +2129,8 @@ static void printResults(u_int64_t tot_usec) {
total_flows += ndpi_thread_info[thread_id].workflow->num_allocated_flows; total_flows += ndpi_thread_info[thread_id].workflow->num_allocated_flows;
if((all_flows = (struct flow_info*)malloc(sizeof(struct flow_info)*total_flows)) == NULL) { if((all_flows = (struct flow_info*)malloc(sizeof(struct flow_info)*total_flows)) == NULL) {
printf("Fatal error: not enough memory\n"); printf("Fatal error: not enough memory\n");
exit(-1); exit(-1);
} }
if(!json_flag) fprintf(out, "\n"); if(!json_flag) fprintf(out, "\n");
@@ -2097,7 +2185,7 @@ static void printResults(u_int64_t tot_usec) {
json_object_object_add(jObj_main,"unknown.flows",jArray_unknown_flows); json_object_object_add(jObj_main,"unknown.flows",jArray_unknown_flows);
fprintf(json_fp,"%s\n",json_object_to_json_string(jObj_main)); fprintf(json_fp,"%s\n",json_object_to_json_string(jObj_main));
fclose(json_fp); if(!dont_close_json_fp) fclose(json_fp);
#endif #endif
} }
@@ -2126,12 +2214,12 @@ static void printResults(u_int64_t tot_usec) {
saveScannerStats(&jObj_stats, &scannerHosts); saveScannerStats(&jObj_stats, &scannerHosts);
if((count = HASH_COUNT(topReceivers)) == 0){ if((count = HASH_COUNT(topReceivers)) == 0){
HASH_SORT(receivers, receivers_sort); HASH_SORT(receivers, receivers_sort);
saveReceiverStats(&jObj_stats, &receivers, cumulative_stats.ip_packet_count); saveReceiverStats(&jObj_stats, &receivers, cumulative_stats.ip_packet_count);
} }
else{ else{
HASH_SORT(topReceivers, receivers_sort); HASH_SORT(topReceivers, receivers_sort);
saveReceiverStats(&jObj_stats, &topReceivers, cumulative_stats.ip_packet_count); saveReceiverStats(&jObj_stats, &topReceivers, cumulative_stats.ip_packet_count);
} }
u_int64_t total_src_addr = getTopStats(srcStats); u_int64_t total_src_addr = getTopStats(srcStats);
@@ -2147,7 +2235,7 @@ static void printResults(u_int64_t tot_usec) {
#endif #endif
} }
free_stats: free_stats:
if(scannerHosts) { if(scannerHosts) {
deleteScanners(scannerHosts); deleteScanners(scannerHosts);
scannerHosts = NULL; scannerHosts = NULL;
@@ -2209,7 +2297,7 @@ static int getNextPcapFileFromPlaylist(u_int16_t thread_id, char filename[], u_i
return -1; return -1;
} }
next_line: next_line:
if(fgets(filename, filename_len, playlist_fp[thread_id])) { if(fgets(filename, filename_len, playlist_fp[thread_id])) {
int l = strlen(filename); int l = strlen(filename);
if(filename[0] == '\0' || filename[0] == '#') goto next_line; if(filename[0] == '\0' || filename[0] == '#') goto next_line;
@@ -2268,7 +2356,7 @@ static pcap_t * openPcapFileOrDevice(u_int16_t thread_id, const u_char * pcap_fi
if(strstr((char*)pcap_file, (char*)".pcap")) if(strstr((char*)pcap_file, (char*)".pcap"))
printf("ERROR: could not open pcap file %s: %s\n", pcap_file, pcap_error_buffer); printf("ERROR: could not open pcap file %s: %s\n", pcap_file, pcap_error_buffer);
else if((getNextPcapFileFromPlaylist(thread_id, filename, sizeof(filename)) != 0) else if((getNextPcapFileFromPlaylist(thread_id, filename, sizeof(filename)) != 0)
|| ((pcap_handle = pcap_open_offline(filename, pcap_error_buffer)) == NULL)) { || ((pcap_handle = pcap_open_offline(filename, pcap_error_buffer)) == NULL)) {
printf("ERROR: could not open playlist %s: %s\n", filename, pcap_error_buffer); printf("ERROR: could not open playlist %s: %s\n", filename, pcap_error_buffer);
exit(-1); exit(-1);
} else { } else {
@@ -2329,11 +2417,11 @@ static void pcap_process_packet(u_char *args,
if(live_capture) { if(live_capture) {
if(ndpi_thread_info[thread_id].last_idle_scan_time + IDLE_SCAN_PERIOD < ndpi_thread_info[thread_id].workflow->last_time) { if(ndpi_thread_info[thread_id].last_idle_scan_time + IDLE_SCAN_PERIOD < ndpi_thread_info[thread_id].workflow->last_time) {
/* scan for idle flows */ /* scan for idle flows */
ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[ndpi_thread_info[thread_id].idle_scan_idx], node_idle_scan_walker, &thread_id); ndpi_twalk(ndpi_thread_info[thread_id].workflow->ndpi_flows_root[ndpi_thread_info[thread_id].idle_scan_idx],
node_idle_scan_walker, &thread_id);
/* remove idle flows (unfortunately we cannot do this inline) */ /* remove idle flows (unfortunately we cannot do this inline) */
while (ndpi_thread_info[thread_id].num_idle_flows > 0) { while(ndpi_thread_info[thread_id].num_idle_flows > 0) {
/* search and delete the idle flow from the "ndpi_flow_root" (see struct reader thread) - here flows are the node of a b-tree */ /* search and delete the idle flow from the "ndpi_flow_root" (see struct reader thread) - here flows are the node of a b-tree */
ndpi_tdelete(ndpi_thread_info[thread_id].idle_flows[--ndpi_thread_info[thread_id].num_idle_flows], ndpi_tdelete(ndpi_thread_info[thread_id].idle_flows[--ndpi_thread_info[thread_id].num_idle_flows],
&ndpi_thread_info[thread_id].workflow->ndpi_flows_root[ndpi_thread_info[thread_id].idle_scan_idx], &ndpi_thread_info[thread_id].workflow->ndpi_flows_root[ndpi_thread_info[thread_id].idle_scan_idx],
@@ -2357,8 +2445,8 @@ static void pcap_process_packet(u_char *args,
&& ((extcap_packet_filter == (u_int16_t)-1) && ((extcap_packet_filter == (u_int16_t)-1)
|| (p.app_protocol == extcap_packet_filter) || (p.app_protocol == extcap_packet_filter)
|| (p.master_protocol == extcap_packet_filter) || (p.master_protocol == extcap_packet_filter)
) )
) { ) {
struct pcap_pkthdr h; struct pcap_pkthdr h;
uint32_t *crc, delta = sizeof(struct ndpi_packet_trailer) + 4 /* ethernet trailer */; uint32_t *crc, delta = sizeof(struct ndpi_packet_trailer) + 4 /* ethernet trailer */;
struct ndpi_packet_trailer *trailer; struct ndpi_packet_trailer *trailer;
@@ -2411,7 +2499,8 @@ static void pcap_process_packet(u_char *args,
memset(&ndpi_thread_info[thread_id].workflow->stats, 0, sizeof(struct ndpi_stats)); memset(&ndpi_thread_info[thread_id].workflow->stats, 0, sizeof(struct ndpi_stats));
} }
printf("\n-------------------------------------------\n\n"); if(!quiet_mode)
printf("\n-------------------------------------------\n\n");
memcpy(&begin, &end, sizeof(begin)); memcpy(&begin, &end, sizeof(begin));
memcpy(&pcap_start, &pcap_end, sizeof(pcap_start)); memcpy(&pcap_start, &pcap_end, sizeof(pcap_start));
@@ -2450,7 +2539,7 @@ void * processing_thread(void *_thread_id) {
#endif #endif
if((!json_flag) && (!quiet_mode)) printf("Running thread %ld...\n", thread_id); if((!json_flag) && (!quiet_mode)) printf("Running thread %ld...\n", thread_id);
pcap_loop: pcap_loop:
runPcapLoop(thread_id); runPcapLoop(thread_id);
if(playlist_fp[thread_id] != NULL) { /* playlist: read next file */ if(playlist_fp[thread_id] != NULL) { /* playlist: read next file */
@@ -2877,8 +2966,8 @@ void getSourcePorts(struct json_object *jObj_stat, int srcPortArray[], int size,
if((flows_packets > FLOWS_PACKETS_THRESHOLD) if((flows_packets > FLOWS_PACKETS_THRESHOLD)
&& (flows_percent >= FLOWS_PERCENT_THRESHOLD) && (flows_percent >= FLOWS_PERCENT_THRESHOLD)
&& packets_number >= threshold) { && packets_number >= threshold) {
if((res = json_object_object_get_ex(src_pkts_stat, "port", &jObj_port)) == 0) { if((res = json_object_object_get_ex(src_pkts_stat, "port", &jObj_port)) == 0) {
fprintf(stderr, "ERROR: can't get \"port\", use -x flag only with .json files generated by ndpiReader -b flag.\n"); fprintf(stderr, "ERROR: can't get \"port\", use -x flag only with .json files generated by ndpiReader -b flag.\n");
exit(-1); exit(-1);
@@ -2963,7 +3052,7 @@ void getScannerHosts(struct json_object *jObj_stat, int duration,
#ifdef HAVE_JSON_C #ifdef HAVE_JSON_C
void getDestinationHosts(struct json_object *jObj_stat, int duration, void getDestinationHosts(struct json_object *jObj_stat, int duration,
const char *dstHostArray[16], int size) { const char *dstHostArray[16], int size) {
int j; int j;
for(j=0; j<json_object_array_length(jObj_stat); j++) { for(j=0; j<json_object_array_length(jObj_stat); j++) {
@@ -3115,7 +3204,7 @@ static void produceBpfFilter(char *filePath) {
jObj_bpfFilter = json_object_new_object(); jObj_bpfFilter = json_object_new_object();
bpf_filter_pkt_peak_filter(&jObj_bpfFilter, filterSrcPorts, PORT_ARRAY_SIZE, bpf_filter_pkt_peak_filter(&jObj_bpfFilter, filterSrcPorts, PORT_ARRAY_SIZE,
filterSrcHosts, HOST_ARRAY_SIZE, filterPktDstHosts, HOST_ARRAY_SIZE/2); filterSrcHosts, HOST_ARRAY_SIZE, filterPktDstHosts, HOST_ARRAY_SIZE/2);
bpf_filter_host_peak_filter(&jObj_bpfFilter, filterDstHosts, HOST_ARRAY_SIZE); bpf_filter_host_peak_filter(&jObj_bpfFilter, filterDstHosts, HOST_ARRAY_SIZE);
@@ -3138,55 +3227,55 @@ static void produceBpfFilter(char *filePath) {
#ifdef APP_HAS_OWN_MAIN #ifdef APP_HAS_OWN_MAIN
int orginal_main(int argc, char **argv) { int orginal_main(int argc, char **argv) {
#else #else
int main(int argc, char **argv) { int main(int argc, char **argv) {
#endif #endif
int i; int i;
if(ndpi_get_api_version() != NDPI_API_VERSION) { if(ndpi_get_api_version() != NDPI_API_VERSION) {
printf("nDPI Library version mismatch: please make sure this code and the nDPI library are in sync\n"); printf("nDPI Library version mismatch: please make sure this code and the nDPI library are in sync\n");
return(-1); return(-1);
} }
automataUnitTest();
ndpi_info_mod = ndpi_init_detection_module(); automataUnitTest();
if (ndpi_info_mod == NULL) return -1;
memset(ndpi_thread_info, 0, sizeof(ndpi_thread_info)); ndpi_info_mod = ndpi_init_detection_module();
if (ndpi_info_mod == NULL) return -1;
parseOptions(argc, argv); memset(ndpi_thread_info, 0, sizeof(ndpi_thread_info));
if(bpf_filter_flag) { parseOptions(argc, argv);
if(bpf_filter_flag) {
#ifdef HAVE_JSON_C #ifdef HAVE_JSON_C
produceBpfFilter(_diagnoseFilePath); produceBpfFilter(_diagnoseFilePath);
return 0; return 0;
#endif #endif
}
if((!json_flag) && (!quiet_mode)) {
printf("\n-----------------------------------------------------------\n"
"* NOTE: This is demo app to show *some* nDPI features.\n"
"* In this demo we have implemented only some basic features\n"
"* just to show you what you can do with the library. Feel \n"
"* free to extend it and send us the patches for inclusion\n"
"------------------------------------------------------------\n\n");
printf("Using nDPI (%s) [%d thread(s)]\n", ndpi_revision(), num_threads);
}
signal(SIGINT, sigproc);
for(i=0; i<num_loops; i++)
test_lib();
if(results_path) free(results_path);
if(results_file) fclose(results_file);
if(extcap_dumper) pcap_dump_close(extcap_dumper);
if(ndpi_info_mod) ndpi_exit_detection_module(ndpi_info_mod);
return 0;
} }
if((!json_flag) && (!quiet_mode)) {
printf("\n-----------------------------------------------------------\n"
"* NOTE: This is demo app to show *some* nDPI features.\n"
"* In this demo we have implemented only some basic features\n"
"* just to show you what you can do with the library. Feel \n"
"* free to extend it and send us the patches for inclusion\n"
"------------------------------------------------------------\n\n");
printf("Using nDPI (%s) [%d thread(s)]\n", ndpi_revision(), num_threads);
}
signal(SIGINT, sigproc);
for(i=0; i<num_loops; i++)
test_lib();
if(results_path) free(results_path);
if(results_file) fclose(results_file);
if(extcap_dumper) pcap_dump_close(extcap_dumper);
if(ndpi_info_mod) ndpi_exit_detection_module(ndpi_info_mod);
return 0;
}
#ifdef WIN32 #ifdef WIN32
#ifndef __GNUC__ #ifndef __GNUC__
#define EPOCHFILETIME (116444736000000000i64) #define EPOCHFILETIME (116444736000000000i64)
@@ -3197,42 +3286,42 @@ int main(int argc, char **argv) {
/** /**
@brief Timezone @brief Timezone
**/ **/
struct timezone { struct timezone {
int tz_minuteswest; /* minutes W of Greenwich */ int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */ int tz_dsttime; /* type of dst correction */
}; };
/** /**
@brief Set time @brief Set time
**/ **/
int gettimeofday(struct timeval *tv, struct timezone *tz) { int gettimeofday(struct timeval *tv, struct timezone *tz) {
FILETIME ft; FILETIME ft;
LARGE_INTEGER li; LARGE_INTEGER li;
__int64 t; __int64 t;
static int tzflag; static int tzflag;
if(tv) { if(tv) {
GetSystemTimeAsFileTime(&ft); GetSystemTimeAsFileTime(&ft);
li.LowPart = ft.dwLowDateTime; li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime; li.HighPart = ft.dwHighDateTime;
t = li.QuadPart; /* In 100-nanosecond intervals */ t = li.QuadPart; /* In 100-nanosecond intervals */
t -= EPOCHFILETIME; /* Offset to the Epoch time */ t -= EPOCHFILETIME; /* Offset to the Epoch time */
t /= 10; /* In microseconds */ t /= 10; /* In microseconds */
tv->tv_sec = (long)(t / 1000000); tv->tv_sec = (long)(t / 1000000);
tv->tv_usec = (long)(t % 1000000); tv->tv_usec = (long)(t % 1000000);
}
if(tz) {
if(!tzflag) {
_tzset();
tzflag++;
} }
tz->tz_minuteswest = _timezone / 60; if(tz) {
tz->tz_dsttime = _daylight; if(!tzflag) {
} _tzset();
tzflag++;
}
return 0; tz->tz_minuteswest = _timezone / 60;
} tz->tz_dsttime = _daylight;
}
return 0;
}
#endif /* WIN32 */ #endif /* WIN32 */
+120 -103
View File
@@ -1,7 +1,7 @@
/* /*
* ndpi_util.c * ndpi_util.c
* *
* Copyright (C) 2011-17 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -21,6 +21,10 @@
* *
*/ */
#ifdef HAVE_CONFIG_H
#include "ndpi_config.h"
#endif
#include <stdlib.h> #include <stdlib.h>
#ifdef WIN32 #ifdef WIN32
@@ -109,50 +113,56 @@ static uint16_t ndpi_get_proto_id(struct ndpi_detection_module_struct *ndpi_mod,
uint16_t proto_id; uint16_t proto_id;
char *e; char *e;
unsigned long p = strtol(name,&e,0); unsigned long p = strtol(name,&e,0);
ndpi_proto_defaults_t *proto_defaults = ndpi_get_proto_defaults(ndpi_mod);
if(e && !*e) { if(e && !*e) {
if(p < NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS && if(p < NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS &&
ndpi_mod->proto_defaults[p].protoName) return (uint16_t)p; proto_defaults[p].protoName) return (uint16_t)p;
return NDPI_PROTOCOL_UNKNOWN; return NDPI_PROTOCOL_UNKNOWN;
} }
for(proto_id=NDPI_PROTOCOL_UNKNOWN; proto_id < NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS; proto_id++) { for(proto_id=NDPI_PROTOCOL_UNKNOWN; proto_id < NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS; proto_id++) {
if(ndpi_mod->proto_defaults[proto_id].protoName && if(proto_defaults[proto_id].protoName &&
!strcasecmp(ndpi_mod->proto_defaults[proto_id].protoName,name)) !strcasecmp(proto_defaults[proto_id].protoName,name))
return proto_id; return proto_id;
} }
return NDPI_PROTOCOL_UNKNOWN; return NDPI_PROTOCOL_UNKNOWN;
} }
/* ***************************************************** */
static NDPI_PROTOCOL_BITMASK debug_bitmask; static NDPI_PROTOCOL_BITMASK debug_bitmask;
static char _proto_delim[] = " \t,:;"; static char _proto_delim[] = " \t,:;";
static int parse_debug_proto(struct ndpi_detection_module_struct *ndpi_mod, char *str) { static int parse_debug_proto(struct ndpi_detection_module_struct *ndpi_mod, char *str) {
char *n; char *n;
uint16_t proto; uint16_t proto;
char op=1; char op=1;
for(n = strtok(str,_proto_delim); n && *n; n = strtok(NULL,_proto_delim)) { for(n = strtok(str,_proto_delim); n && *n; n = strtok(NULL,_proto_delim)) {
if(*n == '-') { if(*n == '-') {
op = 0; op = 0;
n++; n++;
} else if(*n == '+') { } else if(*n == '+') {
op = 1; op = 1;
n++; n++;
} }
if(!strcmp(n,"all")) { if(!strcmp(n,"all")) {
if(op) if(op)
NDPI_BITMASK_SET_ALL(debug_bitmask); NDPI_BITMASK_SET_ALL(debug_bitmask);
else else
NDPI_BITMASK_RESET(debug_bitmask); NDPI_BITMASK_RESET(debug_bitmask);
continue; continue;
} }
proto = ndpi_get_proto_id(ndpi_mod, n); proto = ndpi_get_proto_id(ndpi_mod, n);
if(proto == NDPI_PROTOCOL_UNKNOWN && strcmp(n,"unknown") && strcmp(n,"0")) { if(proto == NDPI_PROTOCOL_UNKNOWN && strcmp(n,"unknown") && strcmp(n,"0")) {
fprintf(stderr,"Invalid protocol %s\n",n); fprintf(stderr,"Invalid protocol %s\n",n);
return 1; return 1;
} }
if(op) if(op)
NDPI_BITMASK_ADD(debug_bitmask,proto); NDPI_BITMASK_ADD(debug_bitmask,proto);
else else
NDPI_BITMASK_DEL(debug_bitmask,proto); NDPI_BITMASK_DEL(debug_bitmask,proto);
} }
return 0; return 0;
} }
/* ***************************************************** */ /* ***************************************************** */
@@ -160,7 +170,8 @@ return 0;
extern char *_debug_protocols; extern char *_debug_protocols;
static int _debug_protocols_ok = 0; static int _debug_protocols_ok = 0;
struct ndpi_workflow * ndpi_workflow_init(const struct ndpi_workflow_prefs * prefs, pcap_t * pcap_handle) { struct ndpi_workflow* ndpi_workflow_init(const struct ndpi_workflow_prefs * prefs,
pcap_t * pcap_handle) {
set_ndpi_malloc(malloc_wrapper), set_ndpi_free(free_wrapper); set_ndpi_malloc(malloc_wrapper), set_ndpi_free(free_wrapper);
set_ndpi_flow_malloc(NULL), set_ndpi_flow_free(NULL); set_ndpi_flow_malloc(NULL), set_ndpi_flow_free(NULL);
/* TODO: just needed here to init ndpi malloc wrapper */ /* TODO: just needed here to init ndpi malloc wrapper */
@@ -169,26 +180,30 @@ struct ndpi_workflow * ndpi_workflow_init(const struct ndpi_workflow_prefs * pre
struct ndpi_workflow * workflow = ndpi_calloc(1, sizeof(struct ndpi_workflow)); struct ndpi_workflow * workflow = ndpi_calloc(1, sizeof(struct ndpi_workflow));
workflow->pcap_handle = pcap_handle; workflow->pcap_handle = pcap_handle;
workflow->prefs = *prefs; workflow->prefs = *prefs;
workflow->ndpi_struct = module; workflow->ndpi_struct = module;
if(workflow->ndpi_struct == NULL) { if(workflow->ndpi_struct == NULL) {
NDPI_LOG(0, NULL, NDPI_LOG_ERROR, "global structure initialization failed\n"); NDPI_LOG(0, NULL, NDPI_LOG_ERROR, "global structure initialization failed\n");
exit(-1); exit(-1);
} }
module->ndpi_log_level = nDPI_LogLevel;
ndpi_set_log_level(module, nDPI_LogLevel);
if(_debug_protocols != NULL && ! _debug_protocols_ok) { if(_debug_protocols != NULL && ! _debug_protocols_ok) {
if(parse_debug_proto(module,_debug_protocols)) if(parse_debug_proto(module,_debug_protocols))
exit(-1); exit(-1);
_debug_protocols_ok = 1; _debug_protocols_ok = 1;
} }
#ifdef NDPI_ENABLE_DEBUG_MESSAGES #ifdef NDPI_ENABLE_DEBUG_MESSAGES
NDPI_BITMASK_RESET(module->debug_bitmask); NDPI_BITMASK_RESET(module->debug_bitmask);
if(_debug_protocols_ok) if(_debug_protocols_ok)
module->debug_bitmask = debug_bitmask; module->debug_bitmask = debug_bitmask;
#endif #endif
workflow->ndpi_flows_root = ndpi_calloc(workflow->prefs.num_roots, sizeof(void *)); workflow->ndpi_flows_root = ndpi_calloc(workflow->prefs.num_roots, sizeof(void *));
return workflow; return workflow;
} }
@@ -228,20 +243,20 @@ int ndpi_workflow_node_cmp(const void *a, const void *b) {
if(fa->protocol < fb->protocol ) return(-1); else { if(fa->protocol > fb->protocol ) return(1); } if(fa->protocol < fb->protocol ) return(-1); else { if(fa->protocol > fb->protocol ) return(1); }
if( if(
( (
(fa->src_ip == fb->src_ip ) (fa->src_ip == fb->src_ip )
&& (fa->src_port == fb->src_port) && (fa->src_port == fb->src_port)
&& (fa->dst_ip == fb->dst_ip ) && (fa->dst_ip == fb->dst_ip )
&& (fa->dst_port == fb->dst_port) && (fa->dst_port == fb->dst_port)
) )
|| ||
( (
(fa->src_ip == fb->dst_ip ) (fa->src_ip == fb->dst_ip )
&& (fa->src_port == fb->dst_port) && (fa->src_port == fb->dst_port)
&& (fa->dst_ip == fb->src_ip ) && (fa->dst_ip == fb->src_ip )
&& (fa->dst_port == fb->src_port) && (fa->dst_port == fb->src_port)
) )
) )
return(0); return(0);
if(fa->src_ip < fb->src_ip ) return(-1); else { if(fa->src_ip > fb->src_ip ) return(1); } if(fa->src_ip < fb->src_ip ) return(-1); else { if(fa->src_ip > fb->src_ip ) return(1); }
@@ -363,24 +378,23 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
ret = ndpi_tfind(&flow, &workflow->ndpi_flows_root[idx], ndpi_workflow_node_cmp); ret = ndpi_tfind(&flow, &workflow->ndpi_flows_root[idx], ndpi_workflow_node_cmp);
/* to avoid two nodes in one binary tree for a flow */ /* to avoid two nodes in one binary tree for a flow */
int is_changed = 0; int is_changed = 0;
if(ret == NULL) if(ret == NULL) {
{ u_int32_t orig_src_ip = flow.src_ip;
u_int32_t orig_src_ip = flow.src_ip; u_int16_t orig_src_port = flow.src_port;
u_int16_t orig_src_port = flow.src_port; u_int32_t orig_dst_ip = flow.dst_ip;
u_int32_t orig_dst_ip = flow.dst_ip; u_int16_t orig_dst_port = flow.dst_port;
u_int16_t orig_dst_port = flow.dst_port;
flow.src_ip = orig_dst_ip; flow.src_ip = orig_dst_ip;
flow.src_port = orig_dst_port; flow.src_port = orig_dst_port;
flow.dst_ip = orig_src_ip; flow.dst_ip = orig_src_ip;
flow.dst_port = orig_src_port; flow.dst_port = orig_src_port;
is_changed = 1; is_changed = 1;
ret = ndpi_tfind(&flow, &workflow->ndpi_flows_root[idx], ndpi_workflow_node_cmp); ret = ndpi_tfind(&flow, &workflow->ndpi_flows_root[idx], ndpi_workflow_node_cmp);
} }
if(ret == NULL) { if(ret == NULL) {
if(workflow->stats.ndpi_flow_count == workflow->prefs.max_ndpi_flows) { if(workflow->stats.ndpi_flow_count == workflow->prefs.max_ndpi_flows) {
@@ -445,26 +459,26 @@ static struct ndpi_flow_info *get_ndpi_flow_info(struct ndpi_workflow * workflow
} else { } else {
struct ndpi_flow_info *flow = *(struct ndpi_flow_info**)ret; struct ndpi_flow_info *flow = *(struct ndpi_flow_info**)ret;
if (is_changed) { if(is_changed) {
if(flow->src_ip == iph->saddr if(flow->src_ip == iph->saddr
&& flow->dst_ip == iph->daddr && flow->dst_ip == iph->daddr
&& flow->src_port == htons(*sport) && flow->src_port == htons(*sport)
&& flow->dst_port == htons(*dport) && flow->dst_port == htons(*dport)
) )
*src = flow->dst_id, *dst = flow->src_id, *src_to_dst_direction = 0, flow->bidirectional = 1; *src = flow->dst_id, *dst = flow->src_id, *src_to_dst_direction = 0, flow->bidirectional = 1;
else else
*src = flow->src_id, *dst = flow->dst_id, *src_to_dst_direction = 1; *src = flow->src_id, *dst = flow->dst_id, *src_to_dst_direction = 1;
} }
else { else {
if(flow->src_ip == iph->saddr if(flow->src_ip == iph->saddr
&& flow->dst_ip == iph->daddr && flow->dst_ip == iph->daddr
&& flow->src_port == htons(*sport) && flow->src_port == htons(*sport)
&& flow->dst_port == htons(*dport) && flow->dst_port == htons(*dport)
) )
*src = flow->src_id, *dst = flow->dst_id, *src_to_dst_direction = 1; *src = flow->src_id, *dst = flow->dst_id, *src_to_dst_direction = 1;
else else
*src = flow->dst_id, *dst = flow->src_id, *src_to_dst_direction = 0, flow->bidirectional = 1; *src = flow->dst_id, *dst = flow->src_id, *src_to_dst_direction = 0, flow->bidirectional = 1;
} }
return flow; return flow;
} }
} }
@@ -502,7 +516,8 @@ static struct ndpi_flow_info *get_ndpi_flow_info6(struct ndpi_workflow * workflo
sizeof(struct ndpi_ipv6hdr), sizeof(struct ndpi_ipv6hdr),
ntohs(iph6->ip6_hdr.ip6_un1_plen), ntohs(iph6->ip6_hdr.ip6_un1_plen),
tcph, udph, sport, dport, tcph, udph, sport, dport,
src, dst, proto, payload, payload_len, src_to_dst_direction)); src, dst, proto, payload,
payload_len, src_to_dst_direction));
} }
/* ****************************************************** */ /* ****************************************************** */
@@ -518,7 +533,9 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
int i, j, n = 0; int i, j, n = 0;
for(i=0, j = 0; j < sizeof(flow->bittorent_hash)-1; i++) { for(i=0, j = 0; j < sizeof(flow->bittorent_hash)-1; i++) {
sprintf(&flow->bittorent_hash[j], "%02x", flow->ndpi_flow->protos.bittorrent.hash[i]); sprintf(&flow->bittorent_hash[j], "%02x",
flow->ndpi_flow->protos.bittorrent.hash[i]);
j += 2, n += flow->ndpi_flow->protos.bittorrent.hash[i]; j += 2, n += flow->ndpi_flow->protos.bittorrent.hash[i];
} }
@@ -544,18 +561,18 @@ void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_fl
else if((flow->detected_protocol.app_protocol == NDPI_PROTOCOL_SSL) else if((flow->detected_protocol.app_protocol == NDPI_PROTOCOL_SSL)
|| (flow->detected_protocol.master_protocol == NDPI_PROTOCOL_SSL)) { || (flow->detected_protocol.master_protocol == NDPI_PROTOCOL_SSL)) {
snprintf(flow->ssh_ssl.client_info, sizeof(flow->ssh_ssl.client_info), "%s", snprintf(flow->ssh_ssl.client_info, sizeof(flow->ssh_ssl.client_info), "%s",
flow->ndpi_flow->protos.ssl.client_certificate); flow->ndpi_flow->protos.stun_ssl.ssl.client_certificate);
snprintf(flow->ssh_ssl.server_info, sizeof(flow->ssh_ssl.server_info), "%s", snprintf(flow->ssh_ssl.server_info, sizeof(flow->ssh_ssl.server_info), "%s",
flow->ndpi_flow->protos.ssl.server_certificate); flow->ndpi_flow->protos.stun_ssl.ssl.server_certificate);
} }
} }
if(flow->detection_completed && !flow->check_extra_packets) { if(flow->detection_completed && !flow->check_extra_packets) {
if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_UNKNOWN) { if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_UNKNOWN) {
if (workflow->__flow_giveup_callback != NULL) if(workflow->__flow_giveup_callback != NULL)
workflow->__flow_giveup_callback(workflow, flow, workflow->__flow_giveup_udata); workflow->__flow_giveup_callback(workflow, flow, workflow->__flow_giveup_udata);
} else { } else {
if (workflow->__flow_detected_callback != NULL) if(workflow->__flow_detected_callback != NULL)
workflow->__flow_detected_callback(workflow, flow, workflow->__flow_detected_udata); workflow->__flow_detected_callback(workflow, flow, workflow->__flow_detected_udata);
} }
@@ -629,25 +646,26 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
} }
if(ndpi_flow->num_extra_packets_checked < ndpi_flow->max_extra_packets_to_check) { if(ndpi_flow->num_extra_packets_checked < ndpi_flow->max_extra_packets_to_check) {
ndpi_process_extra_packet(workflow->ndpi_struct, ndpi_flow, ndpi_process_extra_packet(workflow->ndpi_struct, ndpi_flow,
iph ? (uint8_t *)iph : (uint8_t *)iph6, iph ? (uint8_t *)iph : (uint8_t *)iph6,
ipsize, time, src, dst); ipsize, time, src, dst);
if (ndpi_flow->check_extra_packets == 0) { if(ndpi_flow->check_extra_packets == 0) {
flow->check_extra_packets = 0; flow->check_extra_packets = 0;
process_ndpi_collected_info(workflow, flow); process_ndpi_collected_info(workflow, flow);
} }
} }
} else if (ndpi_flow != NULL) { } else if(ndpi_flow != NULL) {
/* If this wasn't NULL we should do the half free */ /* If this wasn't NULL we should do the half free */
/* TODO: When half_free is deprecated, get rid of this */ /* TODO: When half_free is deprecated, get rid of this */
ndpi_free_flow_info_half(flow); ndpi_free_flow_info_half(flow);
} }
return(flow->detected_protocol); return(flow->detected_protocol);
} }
flow->detected_protocol = ndpi_detection_process_packet(workflow->ndpi_struct, ndpi_flow, flow->detected_protocol =
iph ? (uint8_t *)iph : (uint8_t *)iph6, ndpi_detection_process_packet(workflow->ndpi_struct, ndpi_flow,
ipsize, time, src, dst); iph ? (uint8_t *)iph : (uint8_t *)iph6,
ipsize, time, src, dst);
if((flow->detected_protocol.app_protocol != NDPI_PROTOCOL_UNKNOWN) if((flow->detected_protocol.app_protocol != NDPI_PROTOCOL_UNKNOWN)
|| ((proto == IPPROTO_UDP) && ((flow->src2dst_packets + flow->dst2src_packets) > 8)) || ((proto == IPPROTO_UDP) && ((flow->src2dst_packets + flow->dst2src_packets) > 8))
@@ -655,12 +673,12 @@ static struct ndpi_proto packet_processing(struct ndpi_workflow * workflow,
/* New protocol detected or give up */ /* New protocol detected or give up */
flow->detection_completed = 1; flow->detection_completed = 1;
/* Check if we should keep checking extra packets */ /* Check if we should keep checking extra packets */
if (ndpi_flow->check_extra_packets) if(ndpi_flow->check_extra_packets)
flow->check_extra_packets = 1; flow->check_extra_packets = 1;
if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_UNKNOWN) if(flow->detected_protocol.app_protocol == NDPI_PROTOCOL_UNKNOWN)
flow->detected_protocol = ndpi_detection_giveup(workflow->ndpi_struct, flow->detected_protocol = ndpi_detection_giveup(workflow->ndpi_struct,
flow->ndpi_flow); flow->ndpi_flow);
process_ndpi_collected_info(workflow, flow); process_ndpi_collected_info(workflow, flow);
} }
@@ -735,7 +753,7 @@ struct ndpi_proto ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
/*** check Data Link type ***/ /*** check Data Link type ***/
const int datalink_type = pcap_datalink(workflow->pcap_handle); const int datalink_type = pcap_datalink(workflow->pcap_handle);
datalink_check: datalink_check:
switch(datalink_type) { switch(datalink_type) {
case DLT_NULL: case DLT_NULL:
if(ntohl(*((u_int32_t*)&packet[eth_offset])) == 2) if(ntohl(*((u_int32_t*)&packet[eth_offset])) == 2)
@@ -769,7 +787,7 @@ struct ndpi_proto ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
if(check <= 1500) if(check <= 1500)
pyld_eth_len = check; pyld_eth_len = check;
else if (check >= 1536) else if(check >= 1536)
type = check; type = check;
if(pyld_eth_len != 0) { if(pyld_eth_len != 0) {
@@ -871,7 +889,7 @@ struct ndpi_proto ndpi_workflow_process_packet (struct ndpi_workflow * workflow,
workflow->stats.vlan_count += vlan_packet; workflow->stats.vlan_count += vlan_packet;
iph_check: iph_check:
/* Check and set IP header size and total packet length */ /* Check and set IP header size and total packet length */
iph = (struct ndpi_iphdr *) &packet[ip_offset]; iph = (struct ndpi_iphdr *) &packet[ip_offset];
@@ -1058,4 +1076,3 @@ u_int32_t ethernet_crc32(const void* data, size_t n_bytes) {
__crc32(data, n_bytes, &crc); __crc32(data, n_bytes, &crc);
return crc; return crc;
} }
+4 -4
View File
@@ -1,7 +1,7 @@
/* /*
* ndpi_util.h * ndpi_util.h
* *
* Copyright (C) 2011-16 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -24,7 +24,7 @@
* If you concern about performance or have to integrate nDPI in your * If you concern about performance or have to integrate nDPI in your
* application, you could need to reimplement them yourself. * application, you could need to reimplement them yourself.
* *
* WARNING: this API is unstable! Use it at your own risk! * WARNING: this API is just a demo od nDPI usage: Use it at your own risk!
*/ */
#ifndef __NDPI_UTIL_H__ #ifndef __NDPI_UTIL_H__
#define __NDPI_UTIL_H__ #define __NDPI_UTIL_H__
@@ -75,9 +75,9 @@ typedef struct ndpi_flow_info {
ndpi_protocol detected_protocol; ndpi_protocol detected_protocol;
char info[96]; char info[96];
char host_server_name[192]; char host_server_name[256];
char bittorent_hash[41]; char bittorent_hash[41];
struct { struct {
char client_info[48], server_info[48]; char client_info[48], server_info[48];
} ssh_ssl; } ssh_ssl;
+10 -1
View File
@@ -15,6 +15,7 @@ ndpi_tdestroy
ndpi_exit_detection_module ndpi_exit_detection_module
ndpi_l4_detection_process_packet ndpi_l4_detection_process_packet
ndpi_detection_process_packet ndpi_detection_process_packet
ndpi_process_extra_packet
ndpi_twalk ndpi_twalk
ndpi_tdelete ndpi_tdelete
ndpi_revision ndpi_revision
@@ -63,4 +64,12 @@ ndpi_is_subprotocol_informative
ndpi_set_proto_category ndpi_set_proto_category
ndpi_get_api_version ndpi_get_api_version
ndpi_network_ptree_match ndpi_network_ptree_match
ndpi_check_flow_func ndpi_check_flow_func
ndpi_fill_protocol_category
ndpi_load_hostname_category
ndpi_enable_loaded_categories
ndpi_set_detection_preferences
ndpi_get_proto_defaults
ndpi_get_ndpi_num_supported_protocols
ndpi_get_ndpi_num_custom_protocols
ndpi_get_ndpi_detection_module_size
+60 -64
View File
@@ -35,9 +35,9 @@ extern "C" {
sure that datastructures and in sync across versions sure that datastructures and in sync across versions
*/ */
#define NDPI_API_VERSION 1 #define NDPI_API_VERSION 1
#define SIZEOF_ID_STRUCT (sizeof(struct ndpi_id_struct)) #define SIZEOF_ID_STRUCT ( sizeof(struct ndpi_id_struct) )
#define SIZEOF_FLOW_STRUCT (sizeof(struct ndpi_flow_struct)) #define SIZEOF_FLOW_STRUCT ( sizeof(struct ndpi_flow_struct) )
#define NDPI_DETECTION_ONLY_IPV4 ( 1 << 0 ) #define NDPI_DETECTION_ONLY_IPV4 ( 1 << 0 )
#define NDPI_DETECTION_ONLY_IPV6 ( 1 << 1 ) #define NDPI_DETECTION_ONLY_IPV6 ( 1 << 1 )
@@ -58,7 +58,7 @@ extern "C" {
* else 0 * else 0
* *
*/ */
int check_punycode_string(char * buff , int len); int check_punycode_string(char *buff, int len);
/** /**
@@ -78,7 +78,6 @@ extern "C" {
*/ */
u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void); u_int32_t ndpi_detection_get_sizeof_ndpi_id_struct(void);
/** /**
* nDPI personal allocation and free functions * nDPI personal allocation and free functions
**/ **/
@@ -115,7 +114,6 @@ extern "C" {
*/ */
char* ndpi_strncasestr(const char *s, const char *find, size_t slen); char* ndpi_strncasestr(const char *s, const char *find, size_t slen);
/** /**
* Returns the nDPI protocol id for IP-based protocol detection * Returns the nDPI protocol id for IP-based protocol detection
* *
@@ -125,8 +123,8 @@ extern "C" {
* @return the nDPI protocol ID * @return the nDPI protocol ID
* *
*/ */
u_int16_t ndpi_network_ptree_match(struct ndpi_detection_module_struct *ndpi_struct, struct in_addr *pin); u_int16_t ndpi_network_ptree_match(struct ndpi_detection_module_struct *ndpi_struct,
struct in_addr *pin);
/** /**
* Init single protocol match * Init single protocol match
@@ -135,7 +133,8 @@ extern "C" {
* @par match = the struct passed to match the protocol * @par match = the struct passed to match the protocol
* *
*/ */
void ndpi_init_protocol_match(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol_match *match); void ndpi_init_protocol_match(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol_match *match);
/** /**
* Returns a new initialized detection module * Returns a new initialized detection module
@@ -153,7 +152,6 @@ extern "C" {
*/ */
void ndpi_free_flow(struct ndpi_flow_struct *flow); void ndpi_free_flow(struct ndpi_flow_struct *flow);
/** /**
* Enables cache support. * Enables cache support.
* In nDPI is used for some protocol (i.e. Skype) * In nDPI is used for some protocol (i.e. Skype)
@@ -163,8 +161,8 @@ extern "C" {
* @par port = unsigned int for the port number * @par port = unsigned int for the port number
* *
*/ */
void ndpi_enable_cache(struct ndpi_detection_module_struct *ndpi_mod, char* host, u_int port); void ndpi_enable_cache(struct ndpi_detection_module_struct *ndpi_mod,
char* host, u_int port);
/** /**
* Destroys the detection module * Destroys the detection module
@@ -174,7 +172,6 @@ extern "C" {
*/ */
void ndpi_exit_detection_module(struct ndpi_detection_module_struct *ndpi_struct); void ndpi_exit_detection_module(struct ndpi_detection_module_struct *ndpi_struct);
/** /**
* Sets a single protocol bitmask * Sets a single protocol bitmask
* This function does not increment the index of the callback_buffer * This function does not increment the index of the callback_buffer
@@ -189,16 +186,17 @@ extern "C" {
* @par b_add_detection_bitmask = if set as "true" add the protocol bitmask to the detection bitmask * @par b_add_detection_bitmask = if set as "true" add the protocol bitmask to the detection bitmask
* *
*/ */
void ndpi_set_bitmask_protocol_detection(char *label, struct ndpi_detection_module_struct *ndpi_struct, void ndpi_set_bitmask_protocol_detection(char *label,
struct ndpi_detection_module_struct *ndpi_struct,
const NDPI_PROTOCOL_BITMASK *detection_bitmask, const NDPI_PROTOCOL_BITMASK *detection_bitmask,
const u_int32_t idx, const u_int32_t idx,
u_int16_t ndpi_protocol_id, u_int16_t ndpi_protocol_id,
void (*func) (struct ndpi_detection_module_struct *, struct ndpi_flow_struct *flow), void (*func) (struct ndpi_detection_module_struct *,
struct ndpi_flow_struct *flow),
const NDPI_SELECTION_BITMASK_PROTOCOL_SIZE ndpi_selection_bitmask, const NDPI_SELECTION_BITMASK_PROTOCOL_SIZE ndpi_selection_bitmask,
u_int8_t b_save_bitmask_unknow, u_int8_t b_save_bitmask_unknow,
u_int8_t b_add_detection_bitmask); u_int8_t b_add_detection_bitmask);
/** /**
* Sets the protocol bitmask2 * Sets the protocol bitmask2
* *
@@ -209,7 +207,6 @@ extern "C" {
void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct, void ndpi_set_protocol_detection_bitmask2(struct ndpi_detection_module_struct *ndpi_struct,
const NDPI_PROTOCOL_BITMASK * detection_bitmask); const NDPI_PROTOCOL_BITMASK * detection_bitmask);
/** /**
* Function to be called before we give up with detection for a given flow. * Function to be called before we give up with detection for a given flow.
* This function reduces the NDPI_UNKNOWN_PROTOCOL detection * This function reduces the NDPI_UNKNOWN_PROTOCOL detection
@@ -266,8 +263,6 @@ extern "C" {
const u_int64_t current_tick, const u_int64_t current_tick,
struct ndpi_id_struct *src, struct ndpi_id_struct *src,
struct ndpi_id_struct *dst); struct ndpi_id_struct *dst);
/** /**
* Get the main protocol of the passed flows for the detected module * Get the main protocol of the passed flows for the detected module
* *
@@ -279,8 +274,7 @@ extern "C" {
*/ */
u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t ndpi_get_flow_masterprotocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow); struct ndpi_flow_struct *flow);
/** /**
* API call that is called internally by ndpi_detection_process_packet or by apps * API call that is called internally by ndpi_detection_process_packet or by apps
* that want to avoid calling ndpi_detection_process_packet as they have already * that want to avoid calling ndpi_detection_process_packet as they have already
@@ -312,7 +306,6 @@ extern "C" {
u_int8_t ndpi_detection_get_l4(const u_int8_t *l3, u_int16_t l3_len, const u_int8_t **l4_return, u_int16_t *l4_len_return, u_int8_t ndpi_detection_get_l4(const u_int8_t *l3, u_int16_t l3_len, const u_int8_t **l4_return, u_int16_t *l4_len_return,
u_int8_t *l4_protocol_return, u_int32_t flags); u_int8_t *l4_protocol_return, u_int32_t flags);
/** /**
* Search and return the protocol based on matched ports * Search and return the protocol based on matched ports
* *
@@ -329,8 +322,6 @@ extern "C" {
u_int16_t sport, u_int16_t sport,
u_int32_t dhost, u_int32_t dhost,
u_int16_t dport); u_int16_t dport);
/** /**
* Search and return the protocol guessed that is undetected * Search and return the protocol guessed that is undetected
* *
@@ -349,14 +340,13 @@ extern "C" {
u_int16_t sport, u_int16_t sport,
u_int32_t dhost, u_int32_t dhost,
u_int16_t dport); u_int16_t dport);
/** /**
* Check if the string passed match with a protocol * Check if the string passed match with a protocol
* *
* @par ndpi_struct = the detection module * @par ndpi_struct = the detection module
* @par string_to_match = the string to match * @par string_to_match = the string to match
* @par string_to_match_len = the length of the string * @par string_to_match_len = the length of the string
* @par ret_match = completed returned match information
* @par is_host_match = value of the second field of struct ndpi_automa * @par is_host_match = value of the second field of struct ndpi_automa
* @return the ID of the matched subprotocol * @return the ID of the matched subprotocol
* *
@@ -364,9 +354,8 @@ extern "C" {
int ndpi_match_string_subprotocol(struct ndpi_detection_module_struct *ndpi_struct, int ndpi_match_string_subprotocol(struct ndpi_detection_module_struct *ndpi_struct,
char *string_to_match, char *string_to_match,
u_int string_to_match_len, u_int string_to_match_len,
ndpi_protocol_match_result *ret_match,
u_int8_t is_host_match); u_int8_t is_host_match);
/** /**
* Check if the host passed match with a protocol * Check if the host passed match with a protocol
* *
@@ -374,6 +363,7 @@ extern "C" {
* @par flow = the flow where match the host * @par flow = the flow where match the host
* @par string_to_match = the string to match * @par string_to_match = the string to match
* @par string_to_match_len = the length of the string * @par string_to_match_len = the length of the string
* @par ret_match = completed returned match information
* @par master_protocol_id = value of the ID associated to the master protocol detected * @par master_protocol_id = value of the ID associated to the master protocol detected
* @return the ID of the matched subprotocol * @return the ID of the matched subprotocol
* *
@@ -382,6 +372,7 @@ extern "C" {
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
char *string_to_match, char *string_to_match,
u_int string_to_match_len, u_int string_to_match_len,
ndpi_protocol_match_result *ret_match,
u_int16_t master_protocol_id); u_int16_t master_protocol_id);
@@ -392,6 +383,7 @@ extern "C" {
* @par flow = the flow where match the host * @par flow = the flow where match the host
* @par string_to_match = the string to match * @par string_to_match = the string to match
* @par string_to_match_len = the length of the string * @par string_to_match_len = the length of the string
* @par ret_match = completed returned match information
* @par master_protocol_id = value of the ID associated to the master protocol detected * @par master_protocol_id = value of the ID associated to the master protocol detected
* @return the ID of the matched subprotocol * @return the ID of the matched subprotocol
* *
@@ -400,9 +392,8 @@ extern "C" {
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
char *string_to_match, char *string_to_match,
u_int string_to_match_len, u_int string_to_match_len,
ndpi_protocol_match_result *ret_match,
u_int16_t master_protocol_id); u_int16_t master_protocol_id);
/** /**
* Exclude protocol from search * Exclude protocol from search
* *
@@ -415,8 +406,6 @@ extern "C" {
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
u_int16_t master_protocol_id, u_int16_t master_protocol_id,
const char *_file, const char *_func,int _line); const char *_file, const char *_func,int _line);
/** /**
* Check if the string -bigram_to_match- match with a bigram of -automa- * Check if the string -bigram_to_match- match with a bigram of -automa-
* *
@@ -440,7 +429,8 @@ extern "C" {
* @return the buffer contains the master_protocol and protocol name * @return the buffer contains the master_protocol and protocol name
* *
*/ */
char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol proto, char *buf, u_int buf_len); char* ndpi_protocol2name(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol proto, char *buf, u_int buf_len);
/** /**
* Find out if a given category is custom/user-defined * Find out if a given category is custom/user-defined
@@ -514,7 +504,8 @@ extern "C" {
* @par proto = the struct ndpi_protocol contain the protocols name * @par proto = the struct ndpi_protocol contain the protocols name
* @return the protocol category * @return the protocol category
*/ */
ndpi_protocol_category_t ndpi_get_proto_category(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol proto); ndpi_protocol_category_t ndpi_get_proto_category(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol proto);
/** /**
* Get the protocol name associated to the ID * Get the protocol name associated to the ID
@@ -535,8 +526,8 @@ extern "C" {
* @return the breed ID associated to the protocol * @return the breed ID associated to the protocol
* *
*/ */
ndpi_protocol_breed_t ndpi_get_proto_breed(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t proto); ndpi_protocol_breed_t ndpi_get_proto_breed(struct ndpi_detection_module_struct *ndpi_struct,
u_int16_t proto);
/** /**
* Return the string name of the protocol breed * Return the string name of the protocol breed
@@ -546,8 +537,8 @@ extern "C" {
* @return the string name of the breed ID * @return the string name of the breed ID
* *
*/ */
char* ndpi_get_proto_breed_name(struct ndpi_detection_module_struct *ndpi_struct, ndpi_protocol_breed_t breed_id); char* ndpi_get_proto_breed_name(struct ndpi_detection_module_struct *ndpi_struct,
ndpi_protocol_breed_t breed_id);
/** /**
* Return the ID of the protocol * Return the ID of the protocol
@@ -559,7 +550,6 @@ extern "C" {
*/ */
int ndpi_get_protocol_id(struct ndpi_detection_module_struct *ndpi_mod, char *proto); int ndpi_get_protocol_id(struct ndpi_detection_module_struct *ndpi_mod, char *proto);
/** /**
* Return the ID of the category * Return the ID of the category
* *
@@ -570,7 +560,6 @@ extern "C" {
*/ */
int ndpi_get_category_id(struct ndpi_detection_module_struct *ndpi_mod, char *cat); int ndpi_get_category_id(struct ndpi_detection_module_struct *ndpi_mod, char *cat);
/** /**
* Write the list of the supported protocols * Write the list of the supported protocols
* *
@@ -578,7 +567,6 @@ extern "C" {
*/ */
void ndpi_dump_protocols(struct ndpi_detection_module_struct *mod); void ndpi_dump_protocols(struct ndpi_detection_module_struct *mod);
/** /**
* Read a file and load the protocols * Read a file and load the protocols
* *
@@ -594,8 +582,8 @@ extern "C" {
* -1 else * -1 else
* *
*/ */
int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod, char* path); int ndpi_load_protocols_file(struct ndpi_detection_module_struct *ndpi_mod,
char* path);
/** /**
* Get the total number of the supported protocols * Get the total number of the supported protocols
@@ -606,7 +594,6 @@ extern "C" {
*/ */
u_int ndpi_get_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod); u_int ndpi_get_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod);
/** /**
* Get the nDPI version release * Get the nDPI version release
* *
@@ -615,7 +602,6 @@ extern "C" {
*/ */
char* ndpi_revision(void); char* ndpi_revision(void);
/** /**
* Set the automa for the protocol search * Set the automa for the protocol search
* *
@@ -623,10 +609,10 @@ extern "C" {
* @par automa = the automa to match * @par automa = the automa to match
* *
*/ */
void ndpi_set_automa(struct ndpi_detection_module_struct *ndpi_struct, void* automa); void ndpi_set_automa(struct ndpi_detection_module_struct *ndpi_struct,
void* automa);
/* NDPI_PROTOCOL_HTTP */
#ifdef NDPI_PROTOCOL_HTTP
/** /**
* Retrieve information for HTTP flows * Retrieve information for HTTP flows
* *
@@ -635,8 +621,8 @@ extern "C" {
* @return the HTTP method information about the flow * @return the HTTP method information about the flow
* *
*/ */
ndpi_http_method ndpi_get_http_method(struct ndpi_detection_module_struct *ndpi_mod, struct ndpi_flow_struct *flow); ndpi_http_method ndpi_get_http_method(struct ndpi_detection_module_struct *ndpi_mod,
struct ndpi_flow_struct *flow);
/** /**
* Get the HTTP url * Get the HTTP url
@@ -646,8 +632,8 @@ extern "C" {
* @return the HTTP method information about the flow * @return the HTTP method information about the flow
* *
*/ */
char* ndpi_get_http_url(struct ndpi_detection_module_struct *ndpi_mod, struct ndpi_flow_struct *flow); char* ndpi_get_http_url(struct ndpi_detection_module_struct *ndpi_mod,
struct ndpi_flow_struct *flow);
/** /**
* Get the HTTP content-type * Get the HTTP content-type
@@ -657,11 +643,10 @@ extern "C" {
* @return the HTTP method information about the flow * @return the HTTP method information about the flow
* *
*/ */
char* ndpi_get_http_content_type(struct ndpi_detection_module_struct *ndpi_mod, struct ndpi_flow_struct *flow); char* ndpi_get_http_content_type(struct ndpi_detection_module_struct *ndpi_mod,
#endif struct ndpi_flow_struct *flow);
/* NDPI_PROTOCOL_TOR */
#ifdef NDPI_PROTOCOL_TOR
/** /**
* Check if the flow could be detected as TOR protocol * Check if the flow could be detected as TOR protocol
* *
@@ -674,7 +659,6 @@ extern "C" {
*/ */
int ndpi_is_ssl_tor(struct ndpi_detection_module_struct *ndpi_struct, int ndpi_is_ssl_tor(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, char *certificate); struct ndpi_flow_struct *flow, char *certificate);
#endif
/* Wrappers functions */ /* Wrappers functions */
/** /**
@@ -685,7 +669,6 @@ extern "C" {
*/ */
void* ndpi_init_automa(void); void* ndpi_init_automa(void);
/** /**
* Free Aho-Corasick automata allocated with ndpi_init_automa(); * Free Aho-Corasick automata allocated with ndpi_init_automa();
* *
@@ -694,7 +677,6 @@ extern "C" {
*/ */
void ndpi_free_automa(void *_automa); void ndpi_free_automa(void *_automa);
/** /**
* Add a string to match to an automata * Add a string to match to an automata
* *
@@ -706,7 +688,6 @@ extern "C" {
*/ */
int ndpi_add_string_value_to_automa(void *_automa, char *str, unsigned long num); int ndpi_add_string_value_to_automa(void *_automa, char *str, unsigned long num);
/** /**
* Add a string to match to an automata. Same as ndpi_add_string_value_to_automa() with num set to 1 * Add a string to match to an automata. Same as ndpi_add_string_value_to_automa() with num set to 1
* *
@@ -717,7 +698,6 @@ extern "C" {
*/ */
int ndpi_add_string_to_automa(void *_automa, char *str); int ndpi_add_string_to_automa(void *_automa, char *str);
/** /**
* Finalize the automa (necessary before start searching) * Finalize the automa (necessary before start searching)
* *
@@ -726,7 +706,6 @@ extern "C" {
*/ */
void ndpi_finalize_automa(void *_automa); void ndpi_finalize_automa(void *_automa);
/** /**
* Add a string to match to an automata * Add a string to match to an automata
* *
@@ -737,7 +716,24 @@ extern "C" {
*/ */
int ndpi_match_string(void *_automa, char *string_to_match); int ndpi_match_string(void *_automa, char *string_to_match);
void ndpi_load_ip_category(struct ndpi_detection_module_struct *ndpi_struct,
char *ip_address_and_mask, ndpi_protocol_category_t category);
int ndpi_load_hostname_category(struct ndpi_detection_module_struct *ndpi_struct,
char *name, ndpi_protocol_category_t category);
int ndpi_enable_loaded_categories(struct ndpi_detection_module_struct *ndpi_struct);
void ndpi_fill_protocol_category(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
ndpi_protocol *ret);
int ndpi_set_detection_preferences(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_detection_preference pref,
int value);
ndpi_proto_defaults_t* ndpi_get_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_num_supported_protocols(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_num_custom_protocols(struct ndpi_detection_module_struct *ndpi_mod);
u_int ndpi_get_ndpi_detection_module_size();
void ndpi_set_log_level(struct ndpi_detection_module_struct *ndpi_mod, u_int l);
/** /**
* Add a string to match to an automata * Add a string to match to an automata
* *
@@ -749,13 +745,13 @@ extern "C" {
*/ */
int ndpi_match_string_id(void *_automa, char *string_to_match, unsigned long *id); int ndpi_match_string_id(void *_automa, char *string_to_match, unsigned long *id);
/* Utility functions to set ndpi malloc/free/print wrappers */ /* Utility functions to set ndpi malloc/free/print wrappers */
void set_ndpi_malloc(void* (*__ndpi_malloc)(size_t size)); void set_ndpi_malloc(void* (*__ndpi_malloc)(size_t size));
void set_ndpi_free(void (*__ndpi_free)(void *ptr)); void set_ndpi_free(void (*__ndpi_free)(void *ptr));
void set_ndpi_flow_malloc(void* (*__ndpi_flow_malloc)(size_t size)); void set_ndpi_flow_malloc(void* (*__ndpi_flow_malloc)(size_t size));
void set_ndpi_flow_free(void (*__ndpi_flow_free)(void *ptr)); void set_ndpi_flow_free(void (*__ndpi_flow_free)(void *ptr));
void set_ndpi_debug_function(struct ndpi_detection_module_struct *ndpi_str, ndpi_debug_function_ptr ndpi_debug_printf); void set_ndpi_debug_function(struct ndpi_detection_module_struct *ndpi_str,
ndpi_debug_function_ptr ndpi_debug_printf);
void * ndpi_malloc(size_t size); void * ndpi_malloc(size_t size);
void * ndpi_calloc(unsigned long count, size_t size); void * ndpi_calloc(unsigned long count, size_t size);
void ndpi_free(void *ptr); void ndpi_free(void *ptr);
+5 -5
View File
@@ -231,11 +231,11 @@
# define NDPI_LOG_DBG(...) {} # define NDPI_LOG_DBG(...) {}
# define NDPI_LOG_DBG2(...) {} # define NDPI_LOG_DBG2(...) {}
# else # else
# define NDPI_LOG(proto, mod, log_level, args...) {} # define NDPI_LOG(proto, mod, log_level, args...) { /* printf(args); */ }
# define NDPI_LOG_ERR(mod, args...) {} # define NDPI_LOG_ERR(mod, args...) { printf(args); }
# define NDPI_LOG_INFO(mod, args...) {} # define NDPI_LOG_INFO(mod, args...) { /* printf(args); */ }
# define NDPI_LOG_DBG(mod, args...) {} # define NDPI_LOG_DBG(mod, args...) { /* printf(args); */ }
# define NDPI_LOG_DBG2(mod, args...) {} # define NDPI_LOG_DBG2(mod, args...) { /* printf(args); */ }
# endif # endif
#endif /* NDPI_ENABLE_DEBUG_MESSAGES */ #endif /* NDPI_ENABLE_DEBUG_MESSAGES */
+43 -22
View File
@@ -1,7 +1,7 @@
/* /*
* ndpi_main.h * ndpi_main.h
* *
* Copyright (C) 2011-16 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,7 +24,6 @@
#ifndef __NDPI_MAIN_H__ #ifndef __NDPI_MAIN_H__
#define __NDPI_MAIN_H__ #define __NDPI_MAIN_H__
#include "ndpi_config.h"
#include "ndpi_includes.h" #include "ndpi_includes.h"
#include "ndpi_define.h" #include "ndpi_define.h"
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
@@ -54,35 +53,55 @@ extern "C" {
extern u_int8_t ndpi_ips_match(u_int32_t src, u_int32_t dst, extern u_int8_t ndpi_ips_match(u_int32_t src, u_int32_t dst,
u_int32_t net, u_int32_t num_bits); u_int32_t net, u_int32_t num_bits);
u_int16_t ntohs_ndpi_bytestream_to_number(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read); u_int16_t ntohs_ndpi_bytestream_to_number(const u_int8_t * str,
u_int16_t max_chars_to_read,
u_int32_t ndpi_bytestream_to_number(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read); u_int16_t * bytes_read);
u_int64_t ndpi_bytestream_to_number64(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
u_int32_t ndpi_bytestream_dec_or_hex_to_number(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
u_int64_t ndpi_bytestream_dec_or_hex_to_number64(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
u_int32_t ndpi_bytestream_to_ipv4(const u_int8_t * str, u_int16_t max_chars_to_read, u_int16_t * bytes_read);
u_int32_t ndpi_bytestream_to_number(const u_int8_t * str, u_int16_t max_chars_to_read,
u_int16_t * bytes_read);
u_int64_t ndpi_bytestream_to_number64(const u_int8_t * str, u_int16_t max_chars_to_read,
u_int16_t * bytes_read);
u_int32_t ndpi_bytestream_dec_or_hex_to_number(const u_int8_t * str,
u_int16_t max_chars_to_read,
u_int16_t * bytes_read);
u_int64_t ndpi_bytestream_dec_or_hex_to_number64(const u_int8_t * str,
u_int16_t max_chars_to_read,
u_int16_t * bytes_read);
u_int32_t ndpi_bytestream_to_ipv4(const u_int8_t * str, u_int16_t max_chars_to_read,
u_int16_t * bytes_read);
void ndpi_set_detected_protocol(struct ndpi_detection_module_struct *ndpi_struct, void ndpi_set_detected_protocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
u_int16_t upper_detected_protocol, u_int16_t upper_detected_protocol,
u_int16_t lower_detected_protocol); u_int16_t lower_detected_protocol);
extern void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); extern void ndpi_parse_packet_line_info(struct ndpi_detection_module_struct *ndpi_struct,
extern void ndpi_parse_packet_line_info_any(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); struct ndpi_flow_struct *flow);
extern void ndpi_parse_packet_line_info_any(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow);
extern u_int16_t ndpi_check_for_email_address(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, u_int16_t counter); extern u_int16_t ndpi_check_for_email_address(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, u_int16_t counter);
extern void ndpi_int_change_packet_protocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, extern void ndpi_int_change_packet_protocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
u_int16_t upper_detected_protocol, u_int16_t upper_detected_protocol,
u_int16_t lower_detected_protocol); u_int16_t lower_detected_protocol);
extern void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, extern void ndpi_int_change_protocol(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
u_int16_t upper_detected_protocol, u_int16_t upper_detected_protocol,
u_int16_t lower_detected_protocol); u_int16_t lower_detected_protocol);
extern void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod, ndpi_protocol_breed_t protoBreed, u_int16_t protoId, extern void ndpi_int_change_category(struct ndpi_detection_module_struct *ndpi_struct,
u_int16_t tcp_alias_protoId[2], u_int16_t udp_alias_protoId[2], char *protoName, struct ndpi_flow_struct *flow,
ndpi_protocol_category_t protocol_category);
extern void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod,
ndpi_protocol_breed_t protoBreed, u_int16_t protoId,
u_int16_t tcp_alias_protoId[2],
u_int16_t udp_alias_protoId[2], char *protoName,
ndpi_protocol_category_t protoCategory, ndpi_protocol_category_t protoCategory,
ndpi_port_range *tcpDefPorts, ndpi_port_range *udpDefPorts); ndpi_port_range *tcpDefPorts,
ndpi_port_range *udpDefPorts);
extern void ndpi_int_reset_packet_protocol(struct ndpi_packet_struct *packet); extern void ndpi_int_reset_packet_protocol(struct ndpi_packet_struct *packet);
extern void ndpi_int_reset_protocol(struct ndpi_flow_struct *flow); extern void ndpi_int_reset_protocol(struct ndpi_flow_struct *flow);
@@ -92,8 +111,10 @@ extern "C" {
extern void ndpi_packet_src_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip); extern void ndpi_packet_src_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip);
extern void ndpi_packet_dst_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip); extern void ndpi_packet_dst_ip_get(const struct ndpi_packet_struct *packet, ndpi_ip_addr_t * ip);
extern char *ndpi_get_ip_string(struct ndpi_detection_module_struct *ndpi_struct, const ndpi_ip_addr_t * ip); extern char *ndpi_get_ip_string(struct ndpi_detection_module_struct *ndpi_struct,
extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *ndpi_struct, const struct ndpi_packet_struct *packet); const ndpi_ip_addr_t * ip);
extern char *ndpi_get_packet_src_ip_string(struct ndpi_detection_module_struct *ndpi_struct,
const struct ndpi_packet_struct *packet);
extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id); extern char* ndpi_get_proto_by_id(struct ndpi_detection_module_struct *ndpi_mod, u_int id);
u_int16_t ndpi_get_proto_by_name(struct ndpi_detection_module_struct *ndpi_mod, const char *name); u_int16_t ndpi_get_proto_by_name(struct ndpi_detection_module_struct *ndpi_mod, const char *name);
@@ -104,12 +125,12 @@ extern "C" {
extern u_int8_t ndpi_is_proto(ndpi_protocol p, u_int16_t proto); extern u_int8_t ndpi_is_proto(ndpi_protocol p, u_int16_t proto);
extern u_int16_t ndpi_get_lower_proto(ndpi_protocol p); extern u_int16_t ndpi_get_lower_proto(ndpi_protocol p);
extern int ndpi_get_protocol_id_master_proto(struct ndpi_detection_module_struct *ndpi_struct, u_int16_t protocol_id, extern int ndpi_get_protocol_id_master_proto(struct ndpi_detection_module_struct *ndpi_struct,
u_int16_t protocol_id,
u_int16_t** tcp_master_proto, u_int16_t** tcp_master_proto,
u_int16_t** udp_master_proto); u_int16_t** udp_master_proto);
#ifdef NDPI_PROTOCOL_NETBIOS #/* NDPI_PROTOCOL_NETBIOS */
int ndpi_netbios_name_interpret(char *in, char *out, u_int out_len); int ndpi_netbios_name_interpret(char *in, char *out, u_int out_len);
#endif
#ifdef NDPI_ENABLE_DEBUG_MESSAGES #ifdef NDPI_ENABLE_DEBUG_MESSAGES
void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct, void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct,
+259 -257
View File
@@ -33,263 +33,265 @@
#define NDPI_DETECTION_SUPPORT_IPV6 #define NDPI_DETECTION_SUPPORT_IPV6
#define NDPI_PROTOCOL_SIZE 2 #define NDPI_PROTOCOL_SIZE 2
#define NDPI_PROTOCOL_UNKNOWN 0 typedef enum {
NDPI_PROTOCOL_UNKNOWN = 0,
NDPI_PROTOCOL_FTP_CONTROL = 1, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_MAIL_POP = 2,
NDPI_PROTOCOL_MAIL_SMTP = 3,
NDPI_PROTOCOL_MAIL_IMAP = 4,
NDPI_PROTOCOL_DNS = 5,
NDPI_PROTOCOL_IPP = 6,
NDPI_PROTOCOL_HTTP = 7,
NDPI_PROTOCOL_MDNS = 8,
NDPI_PROTOCOL_NTP = 9,
NDPI_PROTOCOL_NETBIOS = 10,
NDPI_PROTOCOL_NFS = 11,
NDPI_PROTOCOL_SSDP = 12,
NDPI_PROTOCOL_BGP = 13,
NDPI_PROTOCOL_SNMP = 14,
NDPI_PROTOCOL_XDMCP = 15,
NDPI_PROTOCOL_SMB = 16,
NDPI_PROTOCOL_SYSLOG = 17,
NDPI_PROTOCOL_DHCP = 18,
NDPI_PROTOCOL_POSTGRES = 19,
NDPI_PROTOCOL_MYSQL = 20,
NDPI_PROTOCOL_HOTMAIL = 21,
NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK = 22,
NDPI_PROTOCOL_MAIL_POPS = 23,
NDPI_PROTOCOL_APPLEJUICE = 24,
NDPI_PROTOCOL_DIRECTCONNECT = 25,
NDPI_PROTOCOL_NTOP = 26,
NDPI_PROTOCOL_COAP = 27,
NDPI_PROTOCOL_VMWARE = 28,
NDPI_PROTOCOL_MAIL_SMTPS = 29,
NDPI_PROTOCOL_FBZERO = 30,
NDPI_PROTOCOL_UBNTAC2 = 31, /* Ubiquity UBNT AirControl = 2 - Thomas Fjellstrom <thomas+ndpi@fjellstrom.ca> */
NDPI_PROTOCOL_KONTIKI = 32,
NDPI_PROTOCOL_OPENFT = 33,
NDPI_PROTOCOL_FASTTRACK = 34,
NDPI_PROTOCOL_GNUTELLA = 35,
NDPI_PROTOCOL_EDONKEY = 36, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_BITTORRENT = 37,
NDPI_PROTOCOL_SKYPE_CALL_OUT = 38,
NDPI_PROTOCOL_MUSICALLY = 39,
NDPI_PROTOCOL_MEMCACHED = 40, /* Memcached - Darryl Sokoloski <darryl@egloo.ca> */
#define NDPI_PROTOCOL_NO_MASTER_PROTO NDPI_PROTOCOL_UNKNOWN NDPI_PROTOCOL_FREE_41 = 41, /* Free */
NDPI_PROTOCOL_FREE_42 = 42, /* Free */
NDPI_PROTOCOL_FREE_43 = 43, /* Free */
NDPI_PROTOCOL_FREE_44 = 44, /* Free */
NDPI_PROTOCOL_FREE_45 = 45, /* Free */
NDPI_PROTOCOL_FREE_46 = 46, /* Free */
NDPI_PROTOCOL_XBOX = 47,
NDPI_PROTOCOL_QQ = 48,
NDPI_PROTOCOL_SKYPE_CALL_IN = 49,
NDPI_PROTOCOL_RTSP = 50,
NDPI_PROTOCOL_MAIL_IMAPS = 51,
NDPI_PROTOCOL_ICECAST = 52,
NDPI_PROTOCOL_PPLIVE = 53, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_PPSTREAM = 54,
NDPI_PROTOCOL_ZATTOO = 55,
NDPI_PROTOCOL_SHOUTCAST = 56,
NDPI_PROTOCOL_SOPCAST = 57,
NDPI_PROTOCOL_TVANTS = 58,
NDPI_PROTOCOL_TVUPLAYER = 59,
NDPI_PROTOCOL_HTTP_DOWNLOAD = 60,
NDPI_PROTOCOL_QQLIVE = 61,
NDPI_PROTOCOL_THUNDER = 62,
NDPI_PROTOCOL_SOULSEEK = 63,
NDPI_PROTOCOL_SSL_NO_CERT = 64,
NDPI_PROTOCOL_IRC = 65,
NDPI_PROTOCOL_AYIYA = 66,
NDPI_PROTOCOL_UNENCRYPTED_JABBER = 67,
NDPI_PROTOCOL_MSN = 68,
NDPI_PROTOCOL_OSCAR = 69,
NDPI_PROTOCOL_YAHOO = 70,
NDPI_PROTOCOL_BATTLEFIELD = 71,
NDPI_PROTOCOL_GOOGLE_PLUS = 72,
NDPI_PROTOCOL_IP_VRRP = 73,
NDPI_PROTOCOL_STEAM = 74, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_HALFLIFE2 = 75,
NDPI_PROTOCOL_WORLDOFWARCRAFT = 76,
NDPI_PROTOCOL_TELNET = 77,
NDPI_PROTOCOL_STUN = 78,
NDPI_PROTOCOL_IP_IPSEC = 79,
NDPI_PROTOCOL_IP_GRE = 80,
NDPI_PROTOCOL_IP_ICMP = 81,
NDPI_PROTOCOL_IP_IGMP = 82,
NDPI_PROTOCOL_IP_EGP = 83,
NDPI_PROTOCOL_IP_SCTP = 84,
NDPI_PROTOCOL_IP_OSPF = 85,
NDPI_PROTOCOL_IP_IP_IN_IP = 86,
NDPI_PROTOCOL_RTP = 87,
NDPI_PROTOCOL_RDP = 88,
NDPI_PROTOCOL_VNC = 89,
NDPI_PROTOCOL_PCANYWHERE = 90,
NDPI_PROTOCOL_SSL = 91,
NDPI_PROTOCOL_SSH = 92,
NDPI_PROTOCOL_USENET = 93,
NDPI_PROTOCOL_MGCP = 94,
NDPI_PROTOCOL_IAX = 95,
NDPI_PROTOCOL_TFTP = 96,
NDPI_PROTOCOL_AFP = 97,
NDPI_PROTOCOL_STEALTHNET = 98,
NDPI_PROTOCOL_AIMINI = 99,
NDPI_PROTOCOL_SIP = 100,
NDPI_PROTOCOL_TRUPHONE = 101,
NDPI_PROTOCOL_IP_ICMPV6 = 102,
NDPI_PROTOCOL_DHCPV6 = 103,
NDPI_PROTOCOL_ARMAGETRON = 104,
NDPI_PROTOCOL_CROSSFIRE = 105,
NDPI_PROTOCOL_DOFUS = 106,
NDPI_PROTOCOL_FIESTA = 107,
NDPI_PROTOCOL_FLORENSIA = 108,
NDPI_PROTOCOL_GUILDWARS = 109,
NDPI_PROTOCOL_HTTP_ACTIVESYNC = 110,
NDPI_PROTOCOL_KERBEROS = 111,
NDPI_PROTOCOL_LDAP = 112,
NDPI_PROTOCOL_MAPLESTORY = 113,
NDPI_PROTOCOL_MSSQL_TDS = 114,
NDPI_PROTOCOL_PPTP = 115,
NDPI_PROTOCOL_WARCRAFT3 = 116,
NDPI_PROTOCOL_WORLD_OF_KUNG_FU = 117,
NDPI_PROTOCOL_SLACK = 118,
NDPI_PROTOCOL_FACEBOOK = 119,
NDPI_PROTOCOL_TWITTER = 120,
NDPI_PROTOCOL_DROPBOX = 121,
NDPI_PROTOCOL_GMAIL = 122,
NDPI_PROTOCOL_GOOGLE_MAPS = 123,
NDPI_PROTOCOL_YOUTUBE = 124,
NDPI_PROTOCOL_SKYPE = 125,
NDPI_PROTOCOL_GOOGLE = 126,
NDPI_PROTOCOL_DCERPC = 127,
NDPI_PROTOCOL_NETFLOW = 128,
NDPI_PROTOCOL_SFLOW = 129,
NDPI_PROTOCOL_HTTP_CONNECT = 130,
NDPI_PROTOCOL_HTTP_PROXY = 131,
NDPI_PROTOCOL_CITRIX = 132, /* It also includes the old NDPI_PROTOCOL_CITRIX_ONLINE */
NDPI_PROTOCOL_NETFLIX = 133,
NDPI_PROTOCOL_LASTFM = 134,
NDPI_PROTOCOL_WAZE = 135,
NDPI_PROTOCOL_YOUTUBE_UPLOAD = 136, /* Upload files to youtube */
NDPI_PROTOCOL_GENERIC = 137, /* Generic protocol used for category matching */
NDPI_PROTOCOL_CHECKMK = 138,
NDPI_PROTOCOL_AJP = 139, /* Leonn Paiva <leonn.paiva@gmail.com> */
NDPI_PROTOCOL_APPLE = 140,
NDPI_PROTOCOL_WEBEX = 141,
NDPI_PROTOCOL_WHATSAPP = 142,
NDPI_PROTOCOL_APPLE_ICLOUD = 143,
NDPI_PROTOCOL_VIBER = 144,
NDPI_PROTOCOL_APPLE_ITUNES = 145,
NDPI_PROTOCOL_RADIUS = 146,
NDPI_PROTOCOL_WINDOWS_UPDATE = 147,
NDPI_PROTOCOL_TEAMVIEWER = 148, /* xplico.org */
NDPI_PROTOCOL_TUENTI = 149,
NDPI_PROTOCOL_LOTUS_NOTES = 150,
NDPI_PROTOCOL_SAP = 151,
NDPI_PROTOCOL_GTP = 152,
NDPI_PROTOCOL_UPNP = 153,
NDPI_PROTOCOL_LLMNR = 154,
NDPI_PROTOCOL_REMOTE_SCAN = 155,
NDPI_PROTOCOL_SPOTIFY = 156,
NDPI_PROTOCOL_MESSENGER = 157,
NDPI_PROTOCOL_H323 = 158, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_OPENVPN = 159, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_NOE = 160, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_CISCOVPN = 161, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_TEAMSPEAK = 162, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_TOR = 163, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_SKINNY = 164, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_RTCP = 165, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_RSYNC = 166, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_ORACLE = 167, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_CORBA = 168, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_UBUNTUONE = 169, /* Remy Mudingay <mudingay@ill.fr> */
NDPI_PROTOCOL_WHOIS_DAS = 170,
NDPI_PROTOCOL_COLLECTD = 171,
NDPI_PROTOCOL_SOCKS = 172, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_NINTENDO = 173,
NDPI_PROTOCOL_RTMP = 174, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_FTP_DATA = 175, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_WIKIPEDIA = 176, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_ZMQ = 177,
NDPI_PROTOCOL_AMAZON = 178, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_EBAY = 179, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_CNN = 180, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_MEGACO = 181, /* Gianluca Costa <g.costa@xplico.org> */
NDPI_PROTOCOL_REDIS = 182,
NDPI_PROTOCOL_PANDO = 183, /* Tomasz Bujlow <tomasz@skatnet.dk> */
NDPI_PROTOCOL_VHUA = 184,
NDPI_PROTOCOL_TELEGRAM = 185, /* Gianluca Costa <g.costa@xplico.org> */
NDPI_PROTOCOL_VEVO = 186,
NDPI_PROTOCOL_PANDORA = 187,
NDPI_PROTOCOL_QUIC = 188, /* Andrea Buscarinu <andrea.buscarinu@gmail.com> - Michele Campus <michelecampus5@gmail.com> */
NDPI_PROTOCOL_WHATSAPP_VOICE = 189,
NDPI_PROTOCOL_EAQ = 190,
NDPI_PROTOCOL_OOKLA = 191,
NDPI_PROTOCOL_AMQP = 192,
NDPI_PROTOCOL_KAKAOTALK = 193, /* KakaoTalk Chat (no voice call) */
NDPI_PROTOCOL_KAKAOTALK_VOICE = 194, /* KakaoTalk Voice */
NDPI_PROTOCOL_TWITCH = 195, /* Edoardo Dominici <edoaramis@gmail.com> */
NDPI_PROTOCOL_FREE_196 = 196, /* Free */
NDPI_PROTOCOL_WECHAT = 197,
NDPI_PROTOCOL_MPEGTS = 198,
NDPI_PROTOCOL_SNAPCHAT = 199,
NDPI_PROTOCOL_SINA = 200,
NDPI_PROTOCOL_HANGOUT = 201,
NDPI_PROTOCOL_IFLIX = 202, /* www.vizuamatix.com R&D team & M.Mallawaarachchie <manoj_ws@yahoo.com> */
NDPI_PROTOCOL_GITHUB = 203,
NDPI_PROTOCOL_BJNP = 204,
NDPI_PROTOCOL_FREE_205 = 205, /* Free */
NDPI_PROTOCOL_VIDTO = 206,
NDPI_PROTOCOL_SMPP = 207, /* Damir Franusic <df@release14.org> */
NDPI_PROTOCOL_DNSCRYPT = 208,
NDPI_PROTOCOL_TINC = 209, /* William Guglielmo <william@deselmo.com> */
NDPI_PROTOCOL_DEEZER = 210,
NDPI_PROTOCOL_INSTAGRAM = 211, /* Andrea Buscarinu <andrea.buscarinu@gmail.com> */
NDPI_PROTOCOL_MICROSOFT = 212,
NDPI_PROTOCOL_STARCRAFT = 213, /* Matteo Bracci <matteobracci1@gmail.com> */
NDPI_PROTOCOL_TEREDO = 214,
NDPI_PROTOCOL_HOTSPOT_SHIELD = 215,
NDPI_PROTOCOL_HEP = 216, /* sipcapture.org QXIP BV */
NDPI_PROTOCOL_GOOGLE_DRIVE = 217,
NDPI_PROTOCOL_OCS = 218,
NDPI_PROTOCOL_OFFICE_365 = 219,
NDPI_PROTOCOL_CLOUDFLARE = 220,
NDPI_PROTOCOL_MS_ONE_DRIVE = 221,
NDPI_PROTOCOL_MQTT = 222,
NDPI_PROTOCOL_RX = 223,
NDPI_PROTOCOL_APPLESTORE = 224,
NDPI_PROTOCOL_OPENDNS = 225,
NDPI_PROTOCOL_GIT = 226,
NDPI_PROTOCOL_DRDA = 227,
NDPI_PROTOCOL_PLAYSTORE = 228,
NDPI_PROTOCOL_SOMEIP = 229,
NDPI_PROTOCOL_FIX = 230,
NDPI_PROTOCOL_PLAYSTATION = 231,
NDPI_PROTOCOL_PASTEBIN = 232, /* Paulo Angelo <pa@pauloangelo.com> */
NDPI_PROTOCOL_LINKEDIN = 233, /* Paulo Angelo <pa@pauloangelo.com> */
NDPI_PROTOCOL_SOUNDCLOUD = 234,
NDPI_PROTOCOL_CSGO = 235, /* Counter-Strike Global Offensive, Dota = 2 */
NDPI_PROTOCOL_LISP = 236,
NDPI_PROTOCOL_DIAMETER = 237,
NDPI_PROTOCOL_APPLE_PUSH = 238,
NDPI_PROTOCOL_GOOGLE_SERVICES = 239,
NDPI_PROTOCOL_AMAZON_VIDEO = 240,
NDPI_PROTOCOL_GOOGLE_DOCS = 241,
NDPI_PROTOCOL_WHATSAPP_FILES = 242, /* Videos, pictures, voice messages... */
/*
IMPORTANT
before allocating a new identifier please fill up
one of those named NDPI_PROTOCOL_FREE_XXX and not used
(placeholders to avoid protocol renumbering)
*/
/* IMPORTANT:NDPI_LAST_IMPLEMENTED_PROTOCOL MUST BE THE LAST ELEMENT */
NDPI_LAST_IMPLEMENTED_PROTOCOL
} ndpi_protocol_id_t;
#define NDPI_PROTOCOL_UNKNOWN 0 #define NDPI_PROTOCOL_NO_MASTER_PROTO NDPI_PROTOCOL_UNKNOWN
#define NDPI_PROTOCOL_FTP_CONTROL 1 /* Tomasz Bujlow <tomasz@skatnet.dk> */ #define NDPI_MAX_SUPPORTED_PROTOCOLS NDPI_LAST_IMPLEMENTED_PROTOCOL
#define NDPI_PROTOCOL_MAIL_POP 2 #define NDPI_MAX_NUM_CUSTOM_PROTOCOLS (NDPI_NUM_BITS-NDPI_LAST_IMPLEMENTED_PROTOCOL)
#define NDPI_PROTOCOL_MAIL_SMTP 3
#define NDPI_PROTOCOL_MAIL_IMAP 4
#define NDPI_PROTOCOL_DNS 5
#define NDPI_PROTOCOL_IPP 6
#define NDPI_PROTOCOL_HTTP 7
#define NDPI_PROTOCOL_MDNS 8
#define NDPI_PROTOCOL_NTP 9
#define NDPI_PROTOCOL_NETBIOS 10
#define NDPI_PROTOCOL_NFS 11
#define NDPI_PROTOCOL_SSDP 12
#define NDPI_PROTOCOL_BGP 13
#define NDPI_PROTOCOL_SNMP 14
#define NDPI_PROTOCOL_XDMCP 15
#define NDPI_PROTOCOL_SMB 16
#define NDPI_PROTOCOL_SYSLOG 17
#define NDPI_PROTOCOL_DHCP 18
#define NDPI_PROTOCOL_POSTGRES 19
#define NDPI_PROTOCOL_MYSQL 20
#define NDPI_PROTOCOL_HOTMAIL 21
#define NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK 22
#define NDPI_PROTOCOL_MAIL_POPS 23
#define NDPI_PROTOCOL_APPLEJUICE 24
#define NDPI_PROTOCOL_DIRECTCONNECT 25
#define NDPI_PROTOCOL_SOCRATES 26
#define NDPI_PROTOCOL_COAP 27
#define NDPI_PROTOCOL_VMWARE 28
#define NDPI_PROTOCOL_MAIL_SMTPS 29
#define NDPI_PROTOCOL_FILETOPIA 30
#define NDPI_PROTOCOL_UBNTAC2 31 /* Ubiquity UBNT AirControl 2 - Thomas Fjellstrom <thomas+ndpi@fjellstrom.ca> */
#define NDPI_PROTOCOL_KONTIKI 32
#define NDPI_PROTOCOL_OPENFT 33
#define NDPI_PROTOCOL_FASTTRACK 34
#define NDPI_PROTOCOL_GNUTELLA 35
#define NDPI_PROTOCOL_EDONKEY 36 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_BITTORRENT 37
#define NDPI_PROTOCOL_EPP 38
#define NDPI_CONTENT_AVI 39
#define NDPI_CONTENT_FLASH 40
#define NDPI_CONTENT_OGG 41
#define NDPI_CONTENT_MPEG 42
#define NDPI_CONTENT_QUICKTIME 43
#define NDPI_CONTENT_REALMEDIA 44
#define NDPI_CONTENT_WINDOWSMEDIA 45
#define NDPI_CONTENT_MMS 46
#define NDPI_PROTOCOL_XBOX 47
#define NDPI_PROTOCOL_QQ 48
/* Free to use */
#define NDPI_PROTOCOL_FREE_A 49
#define NDPI_PROTOCOL_RTSP 50
#define NDPI_PROTOCOL_MAIL_IMAPS 51
#define NDPI_PROTOCOL_ICECAST 52
#define NDPI_PROTOCOL_PPLIVE 53 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_PPSTREAM 54
#define NDPI_PROTOCOL_ZATTOO 55
#define NDPI_PROTOCOL_SHOUTCAST 56
#define NDPI_PROTOCOL_SOPCAST 57
#define NDPI_PROTOCOL_TVANTS 58
#define NDPI_PROTOCOL_TVUPLAYER 59
#define NDPI_PROTOCOL_HTTP_DOWNLOAD 60
#define NDPI_PROTOCOL_QQLIVE 61
#define NDPI_PROTOCOL_THUNDER 62
#define NDPI_PROTOCOL_SOULSEEK 63
#define NDPI_PROTOCOL_SSL_NO_CERT 64
#define NDPI_PROTOCOL_IRC 65
#define NDPI_PROTOCOL_AYIYA 66
#define NDPI_PROTOCOL_UNENCRYPTED_JABBER 67
#define NDPI_PROTOCOL_MSN 68
#define NDPI_PROTOCOL_OSCAR 69
#define NDPI_PROTOCOL_YAHOO 70
#define NDPI_PROTOCOL_BATTLEFIELD 71
#define NDPI_PROTOCOL_GOOGLE_PLUS 72
#define NDPI_PROTOCOL_IP_VRRP 73
#define NDPI_PROTOCOL_STEAM 74 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_HALFLIFE2 75
#define NDPI_PROTOCOL_WORLDOFWARCRAFT 76
#define NDPI_PROTOCOL_TELNET 77
#define NDPI_PROTOCOL_STUN 78
#define NDPI_PROTOCOL_IP_IPSEC 79
#define NDPI_PROTOCOL_IP_GRE 80
#define NDPI_PROTOCOL_IP_ICMP 81
#define NDPI_PROTOCOL_IP_IGMP 82
#define NDPI_PROTOCOL_IP_EGP 83
#define NDPI_PROTOCOL_IP_SCTP 84
#define NDPI_PROTOCOL_IP_OSPF 85
#define NDPI_PROTOCOL_IP_IP_IN_IP 86
#define NDPI_PROTOCOL_RTP 87
#define NDPI_PROTOCOL_RDP 88
#define NDPI_PROTOCOL_VNC 89
#define NDPI_PROTOCOL_PCANYWHERE 90
#define NDPI_PROTOCOL_SSL 91
#define NDPI_PROTOCOL_SSH 92
#define NDPI_PROTOCOL_USENET 93
#define NDPI_PROTOCOL_MGCP 94
#define NDPI_PROTOCOL_IAX 95
#define NDPI_PROTOCOL_TFTP 96
#define NDPI_PROTOCOL_AFP 97
#define NDPI_PROTOCOL_STEALTHNET 98
#define NDPI_PROTOCOL_AIMINI 99
#define NDPI_PROTOCOL_SIP 100
#define NDPI_PROTOCOL_TRUPHONE 101
#define NDPI_PROTOCOL_IP_ICMPV6 102
#define NDPI_PROTOCOL_DHCPV6 103
#define NDPI_PROTOCOL_ARMAGETRON 104
#define NDPI_PROTOCOL_CROSSFIRE 105
#define NDPI_PROTOCOL_DOFUS 106
#define NDPI_PROTOCOL_FIESTA 107
#define NDPI_PROTOCOL_FLORENSIA 108
#define NDPI_PROTOCOL_GUILDWARS 109
#define NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC 110 /*avoid large declarations in the future*/
#define NDPI_PROTOCOL_KERBEROS 111
#define NDPI_PROTOCOL_LDAP 112
#define NDPI_PROTOCOL_MAPLESTORY 113
#define NDPI_PROTOCOL_MSSQL_TDS 114
#define NDPI_PROTOCOL_PPTP 115
#define NDPI_PROTOCOL_WARCRAFT3 116
#define NDPI_PROTOCOL_WORLD_OF_KUNG_FU 117
#define NDPI_PROTOCOL_SLACK 118
#define NDPI_PROTOCOL_FACEBOOK 119
#define NDPI_PROTOCOL_TWITTER 120
#define NDPI_PROTOCOL_DROPBOX 121
#define NDPI_PROTOCOL_GMAIL 122
#define NDPI_PROTOCOL_GOOGLE_MAPS 123
#define NDPI_PROTOCOL_YOUTUBE 124
#define NDPI_PROTOCOL_SKYPE 125
#define NDPI_PROTOCOL_GOOGLE 126
#define NDPI_PROTOCOL_DCERPC 127
#define NDPI_PROTOCOL_NETFLOW 128
#define NDPI_PROTOCOL_SFLOW 129
#define NDPI_PROTOCOL_HTTP_CONNECT 130
#define NDPI_PROTOCOL_HTTP_PROXY 131
#define NDPI_PROTOCOL_CITRIX 132 /* It includes also the old NDPI_PROTOCOL_CITRIX_ONLINE */
#define NDPI_PROTOCOL_NETFLIX 133
#define NDPI_PROTOCOL_LASTFM 134
#define NDPI_PROTOCOL_WAZE 135
#define NDPI_PROTOCOL_YOUTUBE_UPLOAD 136 /* Upload files to youtube */
#define NDPI_PROTOCOL_ICQ 137
#define NDPI_PROTOCOL_CHECKMK 138
/* Free to use */
#define NDPI_PROTOCOL_FREE_B 139
#define NDPI_PROTOCOL_APPLE 140
#define NDPI_PROTOCOL_WEBEX 141
#define NDPI_PROTOCOL_WHATSAPP 142
#define NDPI_PROTOCOL_APPLE_ICLOUD 143
#define NDPI_PROTOCOL_VIBER 144
#define NDPI_PROTOCOL_APPLE_ITUNES 145
#define NDPI_PROTOCOL_RADIUS 146
#define NDPI_PROTOCOL_WINDOWS_UPDATE 147
#define NDPI_PROTOCOL_TEAMVIEWER 148 /* xplico.org */
#define NDPI_PROTOCOL_TUENTI 149
#define NDPI_PROTOCOL_LOTUS_NOTES 150
#define NDPI_PROTOCOL_SAP 151
#define NDPI_PROTOCOL_GTP 152
#define NDPI_PROTOCOL_UPNP 153
#define NDPI_PROTOCOL_LLMNR 154
#define NDPI_PROTOCOL_REMOTE_SCAN 155
#define NDPI_PROTOCOL_SPOTIFY 156
#define NDPI_CONTENT_WEBM 157
#define NDPI_PROTOCOL_H323 158 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_OPENVPN 159 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_NOE 160 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_CISCOVPN 161 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_TEAMSPEAK 162 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_TOR 163 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_SKINNY 164 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_RTCP 165 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_RSYNC 166 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_ORACLE 167 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_CORBA 168 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_UBUNTUONE 169 /* Remy Mudingay <mudingay@ill.fr> */
#define NDPI_PROTOCOL_WHOIS_DAS 170
#define NDPI_PROTOCOL_COLLECTD 171
#define NDPI_PROTOCOL_SOCKS 172 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_NINTENDO 173
#define NDPI_PROTOCOL_RTMP 174 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_FTP_DATA 175 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_WIKIPEDIA 176 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_ZMQ 177
#define NDPI_PROTOCOL_AMAZON 178 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_EBAY 179 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_CNN 180 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_MEGACO 181 /* Gianluca Costa <g.costa@xplico.org> */
#define NDPI_PROTOCOL_REDIS 182
#define NDPI_PROTOCOL_PANDO 183 /* Tomasz Bujlow <tomasz@skatnet.dk> */
#define NDPI_PROTOCOL_VHUA 184
#define NDPI_PROTOCOL_TELEGRAM 185 /* Gianluca Costa <g.costa@xplico.org> */
#define NDPI_PROTOCOL_VEVO 186
#define NDPI_PROTOCOL_PANDORA 187
#define NDPI_PROTOCOL_QUIC 188 /* Andrea Buscarinu <andrea.buscarinu@gmail.com> - Michele Campus <michelecampus5@gmail.com> */
#define NDPI_PROTOCOL_WHATSAPP_VOICE 189
#define NDPI_PROTOCOL_EAQ 190
#define NDPI_PROTOCOL_OOKLA 191
#define NDPI_PROTOCOL_AMQP 192
#define NDPI_PROTOCOL_KAKAOTALK 193 /* KakaoTalk Chat (no voice call) */
#define NDPI_PROTOCOL_KAKAOTALK_VOICE 194 /* KakaoTalk Voice */
#define NDPI_PROTOCOL_TWITCH 195 /* Edoardo Dominici <edoaramis@gmail.com> */
#define NDPI_PROTOCOL_QUICKPLAY 196 /* Streaming service used by various services such as hooq.tv */
#define NDPI_PROTOCOL_WECHAT 197
#define NDPI_PROTOCOL_MPEGTS 198
#define NDPI_PROTOCOL_SNAPCHAT 199
#define NDPI_PROTOCOL_SINA 200
#define NDPI_PROTOCOL_HANGOUT 201
#define NDPI_PROTOCOL_IFLIX 202 /* www.vizuamatix.com R&D team & M.Mallawaarachchie <manoj_ws@yahoo.com> */
#define NDPI_PROTOCOL_GITHUB 203
#define NDPI_PROTOCOL_BJNP 204
#define NDPI_PROTOCOL_1KXUN 205
#define NDPI_PROTOCOL_IQIYI 206
#define NDPI_PROTOCOL_SMPP 207 /* Damir Franusic <df@release14.org> */
#define NDPI_PROTOCOL_DNSCRYPT 208
#define NDPI_PROTOCOL_TINC 209 /* William Guglielmo <william@deselmo.com> */
#define NDPI_PROTOCOL_DEEZER 210
#define NDPI_PROTOCOL_INSTAGRAM 211 /* Andrea Buscarinu <andrea.buscarinu@gmail.com> */
#define NDPI_PROTOCOL_MICROSOFT 212
#define NDPI_PROTOCOL_STARCRAFT 213 /* Matteo Bracci <matteobracci1@gmail.com> */
#define NDPI_PROTOCOL_TEREDO 214
#define NDPI_PROTOCOL_HOTSPOT_SHIELD 215
#define NDPI_PROTOCOL_HEP 216 /* sipcapture.org QXIP BV */
#define NDPI_PROTOCOL_GOOGLE_DRIVE 217
#define NDPI_PROTOCOL_OCS 218
#define NDPI_PROTOCOL_OFFICE_365 219
#define NDPI_PROTOCOL_CLOUDFLARE 220
#define NDPI_PROTOCOL_MS_ONE_DRIVE 221
#define NDPI_PROTOCOL_MQTT 222
#define NDPI_PROTOCOL_RX 223
#define NDPI_PROTOCOL_APPLESTORE 224
#define NDPI_PROTOCOL_OPENDNS 225
#define NDPI_PROTOCOL_GIT 226
#define NDPI_PROTOCOL_DRDA 227
#define NDPI_PROTOCOL_PLAYSTORE 228
#define NDPI_PROTOCOL_SOMEIP 229
#define NDPI_PROTOCOL_FIX 230
#define NDPI_PROTOCOL_PLAYSTATION 231
#define NDPI_PROTOCOL_PASTEBIN 232 /* Paulo Angelo <pa@pauloangelo.com> */
#define NDPI_PROTOCOL_LINKEDIN 233 /* Paulo Angelo <pa@pauloangelo.com> */
#define NDPI_PROTOCOL_SOUNDCLOUD 234
#define NDPI_PROTOCOL_CSGO 235 /* Counter-Strike Global Offensive, Dota 2 */
#define NDPI_PROTOCOL_LISP 236
#define NDPI_PROTOCOL_DIAMETER 237
#define NDPI_PROTOCOL_APPLE_PUSH 238
#define NDPI_PROTOCOL_GOOGLE_SERVICES 239
#define NDPI_PROTOCOL_AMAZON_VIDEO 240
#define NDPI_PROTOCOL_GOOGLE_DOCS 241
#define NDPI_PROTOCOL_WHATSAPP_FILES 242 /* Videos, pictures, voice messages... */
/* UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE UPDATE */
#define NDPI_LAST_IMPLEMENTED_PROTOCOL NDPI_PROTOCOL_WHATSAPP_FILES
#define NDPI_MAX_SUPPORTED_PROTOCOLS (NDPI_LAST_IMPLEMENTED_PROTOCOL + 1)
#define NDPI_MAX_NUM_CUSTOM_PROTOCOLS (NDPI_NUM_BITS-NDPI_LAST_IMPLEMENTED_PROTOCOL)
#endif #endif
+5 -1
View File
@@ -202,6 +202,8 @@ void ndpi_search_smpp(struct ndpi_detection_module_struct *ndpi_struct, struct n
void ndpi_search_tinc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); void ndpi_search_tinc(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_fix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); void ndpi_search_fix(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_csgo(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow); void ndpi_search_csgo(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_ajp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
void ndpi_search_memcached(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow);
/* --- INIT FUNCTIONS --- */ /* --- INIT FUNCTIONS --- */
void init_diameter_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_diameter_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
@@ -231,7 +233,6 @@ void init_eaq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
void init_edonkey_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_edonkey_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_fasttrack_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_fasttrack_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_fiesta_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_fiesta_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_filetopia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_florensia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_florensia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_ftp_control_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_ftp_control_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_ftp_data_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask); void init_ftp_data_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
@@ -354,4 +355,7 @@ void init_csgo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
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_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_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);
void init_ajp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_fbzero_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
void init_memcached_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
#endif /* __NDPI_PROTOCOLS_H__ */ #endif /* __NDPI_PROTOCOLS_H__ */
+309 -246
View File
@@ -1,7 +1,7 @@
/* /*
* ndpi_typedefs.h * ndpi_typedefs.h
* *
* Copyright (C) 2011-16 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -26,8 +26,8 @@
#include "ndpi_define.h" #include "ndpi_define.h"
#define BT_ANNOUNCE /* Needed to have access to HAVE_* defines */
#define SNAP_EXT #include "ndpi_config.h"
/* NDPI_LOG_LEVEL */ /* NDPI_LOG_LEVEL */
typedef enum { typedef enum {
@@ -61,8 +61,9 @@ typedef struct ndpi_protocol_bitmask_struct {
/* NDPI_DEBUG_FUNCTION_PTR (cast) */ /* NDPI_DEBUG_FUNCTION_PTR (cast) */
typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol, void *module_struct, typedef void (*ndpi_debug_function_ptr) (u_int32_t protocol, void *module_struct,
ndpi_log_level_t log_level, const char *format, ...); ndpi_log_level_t log_level, const char *file,
const char *func, unsigned line,
const char *format, ...);
/* ************************************************************ */ /* ************************************************************ */
/* ******************* NDPI NETWORKS HEADERS ****************** */ /* ******************* NDPI NETWORKS HEADERS ****************** */
@@ -307,8 +308,7 @@ struct ndpi_icmphdr {
/* ******************* ********************* ****************** */ /* ******************* ********************* ****************** */
/* ************************************************************ */ /* ************************************************************ */
#ifdef NDPI_PROTOCOL_BITTORRENT /* NDPI_PROTOCOL_BITTORRENT */
typedef struct spinlock { typedef struct spinlock {
volatile int val; volatile int val;
} spinlock_t; } spinlock_t;
@@ -347,10 +347,8 @@ struct bt_announce { // 192 bytes
u_int8_t name_len, u_int8_t name_len,
name[192 - 4*10 - 2 - 1]; // 149 bytes name[192 - 4*10 - 2 - 1]; // 149 bytes
}; };
#endif
#ifdef NDPI_PROTOCOL_TINC
/* NDPI_PROTOCOL_TINC */
#define TINC_CACHE_MAX_SIZE 10 #define TINC_CACHE_MAX_SIZE 10
PACK_ON struct tinc_cache_entry { PACK_ON struct tinc_cache_entry {
@@ -359,8 +357,6 @@ PACK_ON struct tinc_cache_entry {
u_int16_t dst_port; u_int16_t dst_port;
} PACK_OFF; } PACK_OFF;
#endif
typedef enum { typedef enum {
HTTP_METHOD_UNKNOWN = 0, HTTP_METHOD_UNKNOWN = 0,
HTTP_METHOD_OPTIONS, HTTP_METHOD_OPTIONS,
@@ -381,229 +377,227 @@ struct ndpi_id_struct {
to compare this, use: to compare this, use:
**/ **/
NDPI_PROTOCOL_BITMASK detected_protocol_bitmask; NDPI_PROTOCOL_BITMASK detected_protocol_bitmask;
#ifdef NDPI_PROTOCOL_RTSP /* NDPI_PROTOCOL_RTSP */
ndpi_ip_addr_t rtsp_ip_address; ndpi_ip_addr_t rtsp_ip_address;
#endif
#ifdef NDPI_PROTOCOL_SIP /* NDPI_PROTOCOL_YAHOO */
#ifdef NDPI_PROTOCOL_YAHOO
u_int32_t yahoo_video_lan_timer; u_int32_t yahoo_video_lan_timer;
#endif
#endif
/* NDPI_PROTOCOL_IRC_MAXPORT % 2 must be 0 */ /* NDPI_PROTOCOL_IRC_MAXPORT % 2 must be 0 */
#ifdef NDPI_PROTOCOL_IRC /* NDPI_PROTOCOL_IRC */
#define NDPI_PROTOCOL_IRC_MAXPORT 8 #define NDPI_PROTOCOL_IRC_MAXPORT 8
u_int16_t irc_port[NDPI_PROTOCOL_IRC_MAXPORT]; u_int16_t irc_port[NDPI_PROTOCOL_IRC_MAXPORT];
u_int32_t last_time_port_used[NDPI_PROTOCOL_IRC_MAXPORT]; u_int32_t last_time_port_used[NDPI_PROTOCOL_IRC_MAXPORT];
u_int32_t irc_ts; u_int32_t irc_ts;
#endif
#ifdef NDPI_PROTOCOL_GNUTELLA /* NDPI_PROTOCOL_GNUTELLA */
u_int32_t gnutella_ts; u_int32_t gnutella_ts;
#endif
#ifdef NDPI_PROTOCOL_BATTLEFIELD /* NDPI_PROTOCOL_BATTLEFIELD */
u_int32_t battlefield_ts; u_int32_t battlefield_ts;
#endif
#ifdef NDPI_PROTOCOL_THUNDER /* NDPI_PROTOCOL_THUNDER */
u_int32_t thunder_ts; u_int32_t thunder_ts;
#endif
#ifdef NDPI_PROTOCOL_RTSP /* NDPI_PROTOCOL_RTSP */
u_int32_t rtsp_timer; u_int32_t rtsp_timer;
#endif
#ifdef NDPI_PROTOCOL_OSCAR /* NDPI_PROTOCOL_OSCAR */
u_int32_t oscar_last_safe_access_time; u_int32_t oscar_last_safe_access_time;
#endif
#ifdef NDPI_PROTOCOL_ZATTOO /* NDPI_PROTOCOL_ZATTOO */
u_int32_t zattoo_ts; u_int32_t zattoo_ts;
#endif
#ifdef NDPI_PROTOCOL_UNENCRYPTED_JABBER /* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
u_int32_t jabber_stun_or_ft_ts; u_int32_t jabber_stun_or_ft_ts;
#endif
#ifdef NDPI_PROTOCOL_DIRECTCONNECT /* NDPI_PROTOCOL_DIRECTCONNECT */
u_int32_t directconnect_last_safe_access_time; u_int32_t directconnect_last_safe_access_time;
#endif
#ifdef NDPI_PROTOCOL_SOULSEEK /* NDPI_PROTOCOL_SOULSEEK */
u_int32_t soulseek_last_safe_access_time; u_int32_t soulseek_last_safe_access_time;
#endif
#ifdef NDPI_PROTOCOL_DIRECTCONNECT /* NDPI_PROTOCOL_DIRECTCONNECT */
u_int16_t detected_directconnect_port; u_int16_t detected_directconnect_port;
u_int16_t detected_directconnect_udp_port; u_int16_t detected_directconnect_udp_port;
u_int16_t detected_directconnect_ssl_port; u_int16_t detected_directconnect_ssl_port;
#endif
#ifdef NDPI_PROTOCOL_BITTORRENT /* NDPI_PROTOCOL_BITTORRENT */
#define NDPI_BT_PORTS 8 #define NDPI_BT_PORTS 8
u_int16_t bt_port_t[NDPI_BT_PORTS]; u_int16_t bt_port_t[NDPI_BT_PORTS];
u_int16_t bt_port_u[NDPI_BT_PORTS]; u_int16_t bt_port_u[NDPI_BT_PORTS];
#endif
#ifdef NDPI_PROTOCOL_UNENCRYPTED_JABBER /* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
#define JABBER_MAX_STUN_PORTS 6 #define JABBER_MAX_STUN_PORTS 6
u_int16_t jabber_voice_stun_port[JABBER_MAX_STUN_PORTS]; u_int16_t jabber_voice_stun_port[JABBER_MAX_STUN_PORTS];
u_int16_t jabber_file_transfer_port[2]; u_int16_t jabber_file_transfer_port[2];
#endif
#ifdef NDPI_PROTOCOL_GNUTELLA /* NDPI_PROTOCOL_GNUTELLA */
u_int16_t detected_gnutella_port; u_int16_t detected_gnutella_port;
#endif
#ifdef NDPI_PROTOCOL_GNUTELLA /* NDPI_PROTOCOL_GNUTELLA */
u_int16_t detected_gnutella_udp_port1; u_int16_t detected_gnutella_udp_port1;
u_int16_t detected_gnutella_udp_port2; u_int16_t detected_gnutella_udp_port2;
#endif
#ifdef NDPI_PROTOCOL_SOULSEEK /* NDPI_PROTOCOL_SOULSEEK */
u_int16_t soulseek_listen_port; u_int16_t soulseek_listen_port;
#endif
#ifdef NDPI_PROTOCOL_IRC /* NDPI_PROTOCOL_IRC */
u_int8_t irc_number_of_port; u_int8_t irc_number_of_port;
#endif
#ifdef NDPI_PROTOCOL_OSCAR /* NDPI_PROTOCOL_OSCAR */
u_int8_t oscar_ssl_session_id[33]; u_int8_t oscar_ssl_session_id[33];
#endif
#ifdef NDPI_PROTOCOL_UNENCRYPTED_JABBER /* NDPI_PROTOCOL_UNENCRYPTED_JABBER */
u_int8_t jabber_voice_stun_used_ports; u_int8_t jabber_voice_stun_used_ports;
#endif
#ifdef NDPI_PROTOCOL_SIP /* NDPI_PROTOCOL_SIP */
#ifdef NDPI_PROTOCOL_YAHOO /* NDPI_PROTOCOL_YAHOO */
u_int32_t yahoo_video_lan_dir:1; u_int32_t yahoo_video_lan_dir:1;
#endif
#endif /* NDPI_PROTOCOL_YAHOO */
#ifdef NDPI_PROTOCOL_YAHOO
u_int32_t yahoo_conf_logged_in:1; u_int32_t yahoo_conf_logged_in:1;
u_int32_t yahoo_voice_conf_logged_in:1; u_int32_t yahoo_voice_conf_logged_in:1;
#endif
#ifdef NDPI_PROTOCOL_RTSP /* NDPI_PROTOCOL_RTSP */
u_int32_t rtsp_ts_set:1; u_int32_t rtsp_ts_set:1;
#endif
}; };
/* ************************************************** */ /* ************************************************** */
struct ndpi_flow_tcp_struct { struct ndpi_flow_tcp_struct {
#ifdef NDPI_PROTOCOL_MAIL_SMTP /* NDPI_PROTOCOL_MAIL_SMTP */
u_int16_t smtp_command_bitmask; u_int16_t smtp_command_bitmask;
#endif
#ifdef NDPI_PROTOCOL_MAIL_POP /* NDPI_PROTOCOL_MAIL_POP */
u_int16_t pop_command_bitmask; u_int16_t pop_command_bitmask;
#endif
#ifdef NDPI_PROTOCOL_QQ /* NDPI_PROTOCOL_QQ */
u_int16_t qq_nxt_len; u_int16_t qq_nxt_len;
#endif
#ifdef NDPI_PROTOCOL_TDS /* NDPI_PROTOCOL_WHATSAPP */
u_int8_t wa_matched_so_far;
/* NDPI_PROTOCOL_TDS */
u_int8_t tds_login_version; u_int8_t tds_login_version;
#endif
#ifdef NDPI_PROTOCOL_IRC /* NDPI_PROTOCOL_IRC */
u_int8_t irc_stage; u_int8_t irc_stage;
u_int8_t irc_port; u_int8_t irc_port;
#endif
#ifdef NDPI_PROTOCOL_H323 /* NDPI_PROTOCOL_H323 */
u_int8_t h323_valid_packets; u_int8_t h323_valid_packets;
#endif
#ifdef NDPI_PROTOCOL_GNUTELLA /* NDPI_PROTOCOL_GNUTELLA */
u_int8_t gnutella_msg_id[3]; u_int8_t gnutella_msg_id[3];
#endif
#ifdef NDPI_PROTOCOL_IRC /* NDPI_PROTOCOL_IRC */
u_int32_t irc_3a_counter:3; u_int32_t irc_3a_counter:3;
u_int32_t irc_stage2:5; u_int32_t irc_stage2:5;
u_int32_t irc_direction:2; u_int32_t irc_direction:2;
u_int32_t irc_0x1000_full:1; u_int32_t irc_0x1000_full:1;
#endif
#ifdef NDPI_PROTOCOL_SOULSEEK /* NDPI_PROTOCOL_SOULSEEK */
u_int32_t soulseek_stage:2; u_int32_t soulseek_stage:2;
#endif
#ifdef NDPI_PROTOCOL_FILETOPIA /* NDPI_PROTOCOL_TDS */
u_int32_t filetopia_stage:2;
#endif
#ifdef NDPI_PROTOCOL_TDS
u_int32_t tds_stage:3; u_int32_t tds_stage:3;
#endif
#ifdef NDPI_PROTOCOL_USENET /* NDPI_PROTOCOL_USENET */
u_int32_t usenet_stage:2; u_int32_t usenet_stage:2;
#endif
#ifdef NDPI_PROTOCOL_IMESH /* NDPI_PROTOCOL_IMESH */
u_int32_t imesh_stage:4; u_int32_t imesh_stage:4;
#endif
#ifdef NDPI_PROTOCOL_HTTP /* NDPI_PROTOCOL_HTTP */
u_int32_t http_setup_dir:2; u_int32_t http_setup_dir:2;
u_int32_t http_stage:2; u_int32_t http_stage:2;
u_int32_t http_empty_line_seen:1; u_int32_t http_empty_line_seen:1;
u_int32_t http_wait_for_retransmission:1; u_int32_t http_wait_for_retransmission:1;
#endif
#ifdef NDPI_PROTOCOL_GNUTELLA /* NDPI_PROTOCOL_GNUTELLA */
u_int32_t gnutella_stage:2; // 0 - 2 u_int32_t gnutella_stage:2; // 0 - 2
#endif
#ifdef NDPI_CONTENT_MMS /* NDPI_CONTENT_MMS */
u_int32_t mms_stage:2; u_int32_t mms_stage:2;
#endif
#ifdef NDPI_PROTOCOL_YAHOO /* NDPI_PROTOCOL_YAHOO */
u_int32_t yahoo_sip_comm:1; u_int32_t yahoo_sip_comm:1;
u_int32_t yahoo_http_proxy_stage:2; u_int32_t yahoo_http_proxy_stage:2;
#endif
#ifdef NDPI_PROTOCOL_MSN /* NDPI_PROTOCOL_MSN */
u_int32_t msn_stage:3; u_int32_t msn_stage:3;
u_int32_t msn_ssl_ft:2; u_int32_t msn_ssl_ft:2;
#endif
#ifdef NDPI_PROTOCOL_SSH /* NDPI_PROTOCOL_SSH */
u_int32_t ssh_stage:3; u_int32_t ssh_stage:3;
#endif
#ifdef NDPI_PROTOCOL_VNC /* NDPI_PROTOCOL_VNC */
u_int32_t vnc_stage:2; // 0 - 3 u_int32_t vnc_stage:2; // 0 - 3
#endif
#ifdef NDPI_PROTOCOL_TELNET /* NDPI_PROTOCOL_TELNET */
u_int32_t telnet_stage:2; // 0 - 2 u_int32_t telnet_stage:2; // 0 - 2
#endif
#ifdef NDPI_PROTOCOL_SSL /* NDPI_PROTOCOL_SSL */
u_int8_t ssl_stage:2, ssl_seen_client_cert:1, ssl_seen_server_cert:1; // 0 - 5 u_int8_t ssl_seen_client_cert:1, ssl_seen_server_cert:1, ssl_stage:2; // 0 - 5
#endif
#ifdef NDPI_PROTOCOL_POSTGRES /* NDPI_PROTOCOL_POSTGRES */
u_int32_t postgres_stage:3; u_int32_t postgres_stage:3;
#endif
#ifdef NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK /* NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK */
u_int32_t ddlink_server_direction:1; u_int32_t ddlink_server_direction:1;
#endif
u_int32_t seen_syn:1; u_int32_t seen_syn:1;
u_int32_t seen_syn_ack:1; u_int32_t seen_syn_ack:1;
u_int32_t seen_ack:1; u_int32_t seen_ack:1;
#ifdef NDPI_PROTOCOL_ICECAST
/* NDPI_PROTOCOL_ICECAST */
u_int32_t icecast_stage:1; u_int32_t icecast_stage:1;
#endif
#ifdef NDPI_PROTOCOL_DOFUS /* NDPI_PROTOCOL_DOFUS */
u_int32_t dofus_stage:1; u_int32_t dofus_stage:1;
#endif
#ifdef NDPI_PROTOCOL_FIESTA /* NDPI_PROTOCOL_FIESTA */
u_int32_t fiesta_stage:2; u_int32_t fiesta_stage:2;
#endif
#ifdef NDPI_PROTOCOL_WORLDOFWARCRAFT /* NDPI_PROTOCOL_WORLDOFWARCRAFT */
u_int32_t wow_stage:2; u_int32_t wow_stage:2;
#endif
#ifdef NDPI_PROTOCOL_HTTP_APPLICATION_VEOHTV /* NDPI_PROTOCOL_HTTP_APPLICATION_VEOHTV */
u_int32_t veoh_tv_stage:2; u_int32_t veoh_tv_stage:2;
#endif
#ifdef NDPI_PROTOCOL_SHOUTCAST /* NDPI_PROTOCOL_SHOUTCAST */
u_int32_t shoutcast_stage:2; u_int32_t shoutcast_stage:2;
#endif
#ifdef NDPI_PROTOCOL_RTP /* NDPI_PROTOCOL_RTP */
u_int32_t rtp_special_packets_seen:1; u_int32_t rtp_special_packets_seen:1;
#endif
#ifdef NDPI_PROTOCOL_MAIL_POP /* NDPI_PROTOCOL_MAIL_POP */
u_int32_t mail_pop_stage:2; u_int32_t mail_pop_stage:2;
#endif
#ifdef NDPI_PROTOCOL_MAIL_IMAP /* NDPI_PROTOCOL_MAIL_IMAP */
u_int32_t mail_imap_stage:3, mail_imap_starttls:2; u_int32_t mail_imap_stage:3, mail_imap_starttls:2;
#endif
#ifdef NDPI_PROTOCOL_SKYPE /* NDPI_PROTOCOL_SKYPE */
u_int8_t skype_packet_id; u_int8_t skype_packet_id;
#endif
#ifdef NDPI_PROTOCOL_CITRIX /* NDPI_PROTOCOL_CITRIX */
u_int8_t citrix_packet_id; u_int8_t citrix_packet_id;
#endif
#ifdef NDPI_PROTOCOL_LOTUS_NOTES /* NDPI_PROTOCOL_LOTUS_NOTES */
u_int8_t lotus_notes_packet_id; u_int8_t lotus_notes_packet_id;
#endif
#ifdef NDPI_PROTOCOL_TEAMVIEWER /* NDPI_PROTOCOL_TEAMVIEWER */
u_int8_t teamviewer_stage; u_int8_t teamviewer_stage;
#endif
#ifdef NDPI_PROTOCOL_ZMQ /* NDPI_PROTOCOL_ZMQ */
u_int8_t prev_zmq_pkt_len; u_int8_t prev_zmq_pkt_len;
u_char prev_zmq_pkt[10]; u_char prev_zmq_pkt[10];
#endif
#ifdef NDPI_PROTOCOL_PPSTREAM /* NDPI_PROTOCOL_PPSTREAM */
u_int32_t ppstream_stage:3; u_int32_t ppstream_stage:3;
#endif
/* NDPI_PROTOCOL_MEMCACHED */
u_int8_t memcached_matches;
} }
#ifndef WIN32 #ifndef WIN32
__attribute__ ((__packed__)) __attribute__ ((__packed__))
@@ -613,50 +607,52 @@ struct ndpi_flow_tcp_struct {
/* ************************************************** */ /* ************************************************** */
struct ndpi_flow_udp_struct { struct ndpi_flow_udp_struct {
#ifdef NDPI_PROTOCOL_BATTLEFIELD /* NDPI_PROTOCOL_BATTLEFIELD */
u_int32_t battlefield_msg_id; u_int32_t battlefield_msg_id;
#endif
#ifdef NDPI_PROTOCOL_SNMP /* NDPI_PROTOCOL_SNMP */
u_int32_t snmp_msg_id; u_int32_t snmp_msg_id;
#endif
#ifdef NDPI_PROTOCOL_BATTLEFIELD /* NDPI_PROTOCOL_BATTLEFIELD */
u_int32_t battlefield_stage:3; u_int32_t battlefield_stage:3;
#endif
#ifdef NDPI_PROTOCOL_SNMP /* NDPI_PROTOCOL_SNMP */
u_int32_t snmp_stage:2; u_int32_t snmp_stage:2;
#endif
#ifdef NDPI_PROTOCOL_PPSTREAM /* NDPI_PROTOCOL_PPSTREAM */
u_int32_t ppstream_stage:3; // 0 - 7 u_int32_t ppstream_stage:3; // 0 - 7
#endif
#ifdef NDPI_PROTOCOL_HALFLIFE2 /* NDPI_PROTOCOL_HALFLIFE2 */
u_int32_t halflife2_stage:2; // 0 - 2 u_int32_t halflife2_stage:2; // 0 - 2
#endif
#ifdef NDPI_PROTOCOL_TFTP /* NDPI_PROTOCOL_TFTP */
u_int32_t tftp_stage:1; u_int32_t tftp_stage:1;
#endif
#ifdef NDPI_PROTOCOL_AIMINI /* NDPI_PROTOCOL_AIMINI */
u_int32_t aimini_stage:5; u_int32_t aimini_stage:5;
#endif
#ifdef NDPI_PROTOCOL_XBOX /* NDPI_PROTOCOL_XBOX */
u_int32_t xbox_stage:1; u_int32_t xbox_stage:1;
#endif
#ifdef NDPI_PROTOCOL_WINDOWS_UPDATE /* NDPI_PROTOCOL_WINDOWS_UPDATE */
u_int32_t wsus_stage:1; u_int32_t wsus_stage:1;
#endif
#ifdef NDPI_PROTOCOL_SKYPE /* NDPI_PROTOCOL_SKYPE */
u_int8_t skype_packet_id; u_int8_t skype_packet_id;
#endif
#ifdef NDPI_PROTOCOL_TEAMVIEWER /* NDPI_PROTOCOL_TEAMVIEWER */
u_int8_t teamviewer_stage; u_int8_t teamviewer_stage;
#endif
#ifdef NDPI_PROTOCOL_EAQ /* NDPI_PROTOCOL_EAQ */
u_int8_t eaq_pkt_id; u_int8_t eaq_pkt_id;
u_int32_t eaq_sequence; u_int32_t eaq_sequence;
#endif
#ifdef NDPI_PROTOCOL_RX /* NDPI_PROTOCOL_RX */
u_int32_t rx_conn_epoch; u_int32_t rx_conn_epoch;
u_int32_t rx_conn_id; u_int32_t rx_conn_id;
#endif
/* NDPI_PROTOCOL_MEMCACHED */
u_int8_t memcached_matches;
} }
#ifndef WIN32 #ifndef WIN32
__attribute__ ((__packed__)) __attribute__ ((__packed__))
@@ -686,7 +682,6 @@ struct ndpi_packet_struct {
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE]; u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE];
u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_SIZE]; u_int8_t detected_subprotocol_stack[NDPI_PROTOCOL_SIZE];
#ifndef WIN32 #ifndef WIN32
__attribute__ ((__packed__)) __attribute__ ((__packed__))
#endif #endif
@@ -709,7 +704,8 @@ struct ndpi_packet_struct {
struct ndpi_int_one_line_struct http_x_session_type; struct ndpi_int_one_line_struct http_x_session_type;
struct ndpi_int_one_line_struct server_line; struct ndpi_int_one_line_struct server_line;
struct ndpi_int_one_line_struct http_method; struct ndpi_int_one_line_struct http_method;
struct ndpi_int_one_line_struct http_response; /* the first "word" in this pointer is the response code in the packet (200, etc) */ struct ndpi_int_one_line_struct http_response; /* the first "word" in this pointer is the
response code in the packet (200, etc) */
u_int8_t http_num_headers; /* number of found (valid) header lines in HTTP request or response */ u_int8_t http_num_headers; /* number of found (valid) header lines in HTTP request or response */
u_int16_t l3_packet_len; u_int16_t l3_packet_len;
@@ -744,7 +740,6 @@ struct ndpi_subprotocol_conf_struct {
void (*func) (struct ndpi_detection_module_struct *, char *attr, char *value, int protocol_id); void (*func) (struct ndpi_detection_module_struct *, char *attr, char *value, int protocol_id);
}; };
typedef struct { typedef struct {
u_int16_t port_low, port_high; u_int16_t port_low, port_high;
} ndpi_port_range; } ndpi_port_range;
@@ -783,6 +778,7 @@ typedef enum {
NDPI_PROTOCOL_CATEGORY_STREAMING, /* Streaming protocols */ NDPI_PROTOCOL_CATEGORY_STREAMING, /* Streaming protocols */
NDPI_PROTOCOL_CATEGORY_SYSTEM_OS, /* System/Operating System level applications */ NDPI_PROTOCOL_CATEGORY_SYSTEM_OS, /* System/Operating System level applications */
NDPI_PROTOCOL_CATEGORY_SW_UPDATE, /* Software update */ NDPI_PROTOCOL_CATEGORY_SW_UPDATE, /* Software update */
/* See #define NUM_CUSTOM_CATEGORIES */ /* See #define NUM_CUSTOM_CATEGORIES */
NDPI_PROTOCOL_CATEGORY_CUSTOM_1, /* User custom category 1 */ NDPI_PROTOCOL_CATEGORY_CUSTOM_1, /* User custom category 1 */
NDPI_PROTOCOL_CATEGORY_CUSTOM_2, /* User custom category 2 */ NDPI_PROTOCOL_CATEGORY_CUSTOM_2, /* User custom category 2 */
@@ -790,6 +786,23 @@ typedef enum {
NDPI_PROTOCOL_CATEGORY_CUSTOM_4, /* User custom category 4 */ NDPI_PROTOCOL_CATEGORY_CUSTOM_4, /* User custom category 4 */
NDPI_PROTOCOL_CATEGORY_CUSTOM_5, /* User custom category 5 */ NDPI_PROTOCOL_CATEGORY_CUSTOM_5, /* User custom category 5 */
/* Payload Content */
NDPI_CONTENT_CATEGORY_AVI,
NDPI_CONTENT_CATEGORY_FLASH,
NDPI_CONTENT_CATEGORY_OGG,
NDPI_CONTENT_CATEGORY_MPEG,
NDPI_CONTENT_CATEGORY_QUICKTIME,
NDPI_CONTENT_CATEGORY_REALMEDIA,
NDPI_CONTENT_CATEGORY_WINDOWSMEDIA,
NDPI_CONTENT_CATEGORY_WEBM,
/* Some custom categories */
CUSTOM_CATEGORY_MINING = 99,
CUSTOM_CATEGORY_MALWARE = 100,
CUSTOM_CATEGORY_ADVERTISEMENT = 101,
CUSTOM_CATEGORY_BANNED_SITE = 102,
CUSTOM_CATEGORY_SITE_UNAVAILABLE = 103,
NDPI_PROTOCOL_NUM_CATEGORIES /* NDPI_PROTOCOL_NUM_CATEGORIES /*
NOTE: Keep this as last member NOTE: Keep this as last member
Unused as value but useful to getting the number of elements Unused as value but useful to getting the number of elements
@@ -797,6 +810,14 @@ typedef enum {
*/ */
} ndpi_protocol_category_t; } ndpi_protocol_category_t;
typedef enum {
ndpi_pref_http_dont_dissect_response = 0,
ndpi_pref_dns_dissect_response,
ndpi_pref_direction_detect_disable,
ndpi_pref_disable_metadata_export,
ndpi_pref_enable_category_substring_match,
} ndpi_detection_preference;
/* ntop extensions */ /* ntop extensions */
typedef struct ndpi_proto_defaults { typedef struct ndpi_proto_defaults {
char *protoName; char *protoName;
@@ -819,7 +840,13 @@ typedef struct _ndpi_automa {
} ndpi_automa; } ndpi_automa;
typedef struct ndpi_proto { typedef struct ndpi_proto {
/*
Note
below we do not use ndpi_protocol_id_t as users can define their own
custom protocols and thus the typedef could be too short in size.
*/
u_int16_t master_protocol /* e.g. HTTP */, app_protocol /* e.g. FaceBook */; u_int16_t master_protocol /* e.g. HTTP */, app_protocol /* e.g. FaceBook */;
ndpi_protocol_category_t category;
} ndpi_protocol; } ndpi_protocol;
#define NDPI_PROTOCOL_NULL { NDPI_PROTOCOL_UNKNOWN , NDPI_PROTOCOL_UNKNOWN } #define NDPI_PROTOCOL_NULL { NDPI_PROTOCOL_UNKNOWN , NDPI_PROTOCOL_UNKNOWN }
@@ -827,6 +854,16 @@ typedef struct ndpi_proto {
#define NUM_CUSTOM_CATEGORIES 5 #define NUM_CUSTOM_CATEGORIES 5
#define CUSTOM_CATEGORY_LABEL_LEN 32 #define CUSTOM_CATEGORY_LABEL_LEN 32
#ifdef HAVE_HYPERSCAN
struct hs_list {
char *expression;
unsigned int id;
struct hs_list *next;
};
#endif
#ifdef NDPI_LIB_COMPILATION
struct ndpi_detection_module_struct { struct ndpi_detection_module_struct {
NDPI_PROTOCOL_BITMASK detection_bitmask; NDPI_PROTOCOL_BITMASK detection_bitmask;
NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask; NDPI_PROTOCOL_BITMASK generic_http_packet_bitmask;
@@ -884,6 +921,19 @@ struct ndpi_detection_module_struct {
subprotocol_automa, /* Used for HTTP subprotocol_detection */ subprotocol_automa, /* Used for HTTP subprotocol_detection */
bigrams_automa, impossible_bigrams_automa; /* TOR */ bigrams_automa, impossible_bigrams_automa; /* TOR */
struct {
#ifdef HAVE_HYPERSCAN
struct hs *hostnames;
unsigned int num_to_load;
struct hs_list *to_load;
#else
ndpi_automa hostnames, hostnames_shadow;
#endif
void *hostnames_hash;
void *ipAddresses, *ipAddresses_shadow; /* Patricia */
u_int8_t categories_loaded;
} custom_categories;
/* IP-based protocol detection */ /* IP-based protocol detection */
void *protocols_ptree; void *protocols_ptree;
@@ -914,27 +964,31 @@ struct ndpi_detection_module_struct {
char ip_string[NDPI_IP_STRING_SIZE]; char ip_string[NDPI_IP_STRING_SIZE];
#endif #endif
u_int8_t ip_version_limit; u_int8_t ip_version_limit;
#ifdef NDPI_PROTOCOL_BITTORRENT /* NDPI_PROTOCOL_BITTORRENT */
struct hash_ip4p_table *bt_ht; struct hash_ip4p_table *bt_ht;
#ifdef NDPI_DETECTION_SUPPORT_IPV6 #ifdef NDPI_DETECTION_SUPPORT_IPV6
struct hash_ip4p_table *bt6_ht; struct hash_ip4p_table *bt6_ht;
#endif #endif
#ifdef BT_ANNOUNCE
/* BT_ANNOUNCE */
struct bt_announce *bt_ann; struct bt_announce *bt_ann;
int bt_ann_len; int bt_ann_len;
#endif
#endif /* NDPI_PROTOCOL_TINC */
#ifdef NDPI_PROTOCOL_TINC
struct cache *tinc_cache; struct cache *tinc_cache;
#endif
ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS]; ndpi_proto_defaults_t proto_defaults[NDPI_MAX_SUPPORTED_PROTOCOLS+NDPI_MAX_NUM_CUSTOM_PROTOCOLS];
u_int8_t http_dont_dissect_response:1, dns_dissect_response:1, u_int8_t http_dont_dissect_response:1, dns_dissect_response:1,
direction_detect_disable:1; /* disable internal detection of packet direction */ direction_detect_disable:1, /* disable internal detection of packet direction */
disable_metadata_export:1, /* No metadata is exported */
enable_category_substring_match:1 /* Default is perfect match */
;
void *hyperscan; /* Intel Hyperscan */ void *hyperscan; /* Intel Hyperscan */
}; };
#endif /* NDPI_LIB_COMPILATION */
struct ndpi_flow_struct { struct ndpi_flow_struct {
u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE]; u_int16_t detected_protocol_stack[NDPI_PROTOCOL_SIZE];
@@ -944,7 +998,7 @@ struct ndpi_flow_struct {
u_int16_t protocol_stack_info; u_int16_t protocol_stack_info;
/* init parameter, internal used to set up timestamp,... */ /* init parameter, internal used to set up timestamp,... */
u_int16_t guessed_protocol_id, guessed_host_protocol_id; u_int16_t guessed_protocol_id, guessed_host_protocol_id, guessed_category;
u_int8_t protocol_id_already_guessed:1, host_already_guessed:1, init_finished:1, setup_packet_direction:1, packet_direction:1, check_extra_packets:1; u_int8_t protocol_id_already_guessed:1, host_already_guessed:1, init_finished:1, setup_packet_direction:1, packet_direction:1, check_extra_packets:1;
@@ -968,8 +1022,7 @@ struct ndpi_flow_struct {
} l4; } l4;
/* /*
Pointer to src or dst Pointer to src or dst that identifies the
that identifies the
server of this connection server of this connection
*/ */
struct ndpi_id_struct *server_id; struct ndpi_id_struct *server_id;
@@ -986,8 +1039,8 @@ struct ndpi_flow_struct {
struct { struct {
ndpi_http_method method; ndpi_http_method method;
char *url, *content_type; char *url, *content_type;
u_int8_t num_request_headers, num_response_headers; u_int8_t num_request_headers, num_response_headers;
u_int8_t request_version; /* 0=1.0 and 1=1.1. Create an enum for this? */ u_int8_t request_version; /* 0=1.0 and 1=1.1. Create an enum for this? */
u_char response_status_code[5]; /* 200, 404, etc. */ u_char response_status_code[5]; /* 200, 404, etc. */
} http; } http;
@@ -1004,8 +1057,16 @@ struct ndpi_flow_struct {
} ntp; } ntp;
struct { struct {
char client_certificate[48], server_certificate[48]; struct {
} ssl; char client_certificate[48], server_certificate[48];
} ssl;
struct {
u_int8_t num_udp_pkts, num_processed_pkts, num_binding_requests, is_skype;
} stun;
/* We can have STUN over SSL thus they need to live together */
} stun_ssl;
struct { struct {
char client_signature[48], server_signature[48]; char client_signature[48], server_signature[48];
@@ -1035,105 +1096,101 @@ struct ndpi_flow_struct {
char fingerprint[48]; char fingerprint[48];
char class_ident[48]; char class_ident[48];
} dhcp; } dhcp;
} protos; } protos;
/*** ALL protocol specific 64 bit variables here ***/ /*** ALL protocol specific 64 bit variables here ***/
/* protocols which have marked a connection as this connection cannot be protocol XXX, multiple u_int64_t */ /* protocols which have marked a connection as this connection cannot be protocol XXX, multiple u_int64_t */
NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask; NDPI_PROTOCOL_BITMASK excluded_protocol_bitmask;
u_int8_t num_stun_udp_pkts; ndpi_protocol_category_t category;
#ifdef NDPI_PROTOCOL_REDIS /* NDPI_PROTOCOL_REDIS */
u_int8_t redis_s2d_first_char, redis_d2s_first_char; u_int8_t redis_s2d_first_char, redis_d2s_first_char;
#endif
u_int16_t packet_counter; // can be 0 - 65000 u_int16_t packet_counter; // can be 0 - 65000
u_int16_t packet_direction_counter[2]; u_int16_t packet_direction_counter[2];
u_int16_t byte_counter[2]; u_int16_t byte_counter[2];
#ifdef NDPI_PROTOCOL_BITTORRENT /* NDPI_PROTOCOL_BITTORRENT */
u_int8_t bittorrent_stage; // can be 0 - 255 u_int8_t bittorrent_stage; // can be 0 - 255
#endif
#ifdef NDPI_PROTOCOL_DIRECTCONNECT /* NDPI_PROTOCOL_DIRECTCONNECT */
u_int32_t directconnect_stage:2; // 0 - 1 u_int32_t directconnect_stage:2; // 0 - 1
#endif
#ifdef NDPI_PROTOCOL_SIP /* NDPI_PROTOCOL_YAHOO */
#ifdef NDPI_PROTOCOL_YAHOO
u_int32_t sip_yahoo_voice:1; u_int32_t sip_yahoo_voice:1;
#endif
#endif /* NDPI_PROTOCOL_HTTP */
#ifdef NDPI_PROTOCOL_HTTP
u_int32_t http_detected:1; u_int32_t http_detected:1;
#endif
#ifdef NDPI_PROTOCOL_RTSP /* NDPI_PROTOCOL_RTSP */
u_int32_t rtsprdt_stage:2; u_int32_t rtsprdt_stage:2;
u_int32_t rtsp_control_flow:1; u_int32_t rtsp_control_flow:1;
#endif
#ifdef NDPI_PROTOCOL_YAHOO /* NDPI_PROTOCOL_YAHOO */
u_int32_t yahoo_detection_finished:2; u_int32_t yahoo_detection_finished:2;
#endif
#ifdef NDPI_PROTOCOL_ZATTOO /* NDPI_PROTOCOL_ZATTOO */
u_int32_t zattoo_stage:3; u_int32_t zattoo_stage:3;
#endif
#ifdef NDPI_PROTOCOL_QQ /* NDPI_PROTOCOL_QQ */
u_int32_t qq_stage:3; u_int32_t qq_stage:3;
#endif
#ifdef NDPI_PROTOCOL_THUNDER /* NDPI_PROTOCOL_THUNDER */
u_int32_t thunder_stage:2; // 0 - 3 u_int32_t thunder_stage:2; // 0 - 3
#endif
#ifdef NDPI_PROTOCOL_OSCAR /* NDPI_PROTOCOL_OSCAR */
u_int32_t oscar_ssl_voice_stage:3; u_int32_t oscar_ssl_voice_stage:3;
u_int32_t oscar_video_voice:1; u_int32_t oscar_video_voice:1;
#endif
#ifdef NDPI_PROTOCOL_FLORENSIA /* NDPI_PROTOCOL_FLORENSIA */
u_int32_t florensia_stage:1; u_int32_t florensia_stage:1;
#endif
#ifdef NDPI_PROTOCOL_SOCKS /* NDPI_PROTOCOL_SOCKS */
u_int32_t socks5_stage:2; // 0 - 3 u_int32_t socks5_stage:2; // 0 - 3
u_int32_t socks4_stage:2; // 0 - 3 u_int32_t socks4_stage:2; // 0 - 3
#endif
#ifdef NDPI_PROTOCOL_EDONKEY /* NDPI_PROTOCOL_EDONKEY */
u_int32_t edonkey_stage:2; // 0 - 3 u_int32_t edonkey_stage:2; // 0 - 3
#endif
#ifdef NDPI_PROTOCOL_FTP_CONTROL /* NDPI_PROTOCOL_FTP_CONTROL */
u_int32_t ftp_control_stage:2; u_int32_t ftp_control_stage:2;
#endif
#ifdef NDPI_PROTOCOL_RTMP /* NDPI_PROTOCOL_RTMP */
u_int32_t rtmp_stage:2; u_int32_t rtmp_stage:2;
#endif
#ifdef NDPI_PROTOCOL_PANDO /* NDPI_PROTOCOL_PANDO */
u_int32_t pando_stage:3; u_int32_t pando_stage:3;
#endif
#ifdef NDPI_PROTOCOL_STEAM /* NDPI_PROTOCOL_STEAM */
u_int32_t steam_stage:3; u_int32_t steam_stage:3;
u_int32_t steam_stage1:3; // 0 - 4 u_int32_t steam_stage1:3; // 0 - 4
u_int32_t steam_stage2:2; // 0 - 2 u_int32_t steam_stage2:2; // 0 - 2
u_int32_t steam_stage3:2; // 0 - 2 u_int32_t steam_stage3:2; // 0 - 2
#endif
#ifdef NDPI_PROTOCOL_PPLIVE /* NDPI_PROTOCOL_PPLIVE */
u_int32_t pplive_stage1:3; // 0 - 6 u_int32_t pplive_stage1:3; // 0 - 6
u_int32_t pplive_stage2:2; // 0 - 2 u_int32_t pplive_stage2:2; // 0 - 2
u_int32_t pplive_stage3:2; // 0 - 2 u_int32_t pplive_stage3:2; // 0 - 2
#endif
#ifdef NDPI_PROTOCOL_STARCRAFT /* NDPI_PROTOCOL_STARCRAFT */
u_int32_t starcraft_udp_stage : 3; // 0-7 u_int32_t starcraft_udp_stage : 3; // 0-7
#endif
#ifdef NDPI_PROTOCOL_OPENVPN /* NDPI_PROTOCOL_OPENVPN */
u_int8_t ovpn_session_id[8]; u_int8_t ovpn_session_id[8];
u_int8_t ovpn_counter; u_int8_t ovpn_counter;
#endif
#ifdef NDPI_PROTOCOL_TINC /* NDPI_PROTOCOL_TINC */
u_int8_t tinc_state; u_int8_t tinc_state;
struct tinc_cache_entry tinc_cache_entry; struct tinc_cache_entry tinc_cache_entry;
#endif
#ifdef NDPI_PROTOCOL_CSGO /* NDPI_PROTOCOL_CSGO */
u_int8_t csgo_strid[18],csgo_state,csgo_s2; u_int8_t csgo_strid[18],csgo_state,csgo_s2;
u_int32_t csgo_id2; u_int32_t csgo_id2;
#endif
#if defined(NDPI_PROTOCOL_1KXUN) || defined(NDPI_PROTOCOL_IQIYI) /* NDPI_PROTOCOL_1KXUN || NDPI_PROTOCOL_IQIYI */
u_int16_t kxun_counter, iqiyi_counter; u_int16_t kxun_counter, iqiyi_counter;
#endif
/* internal structures to save functions calls */ /* internal structures to save functions calls */
struct ndpi_packet_struct packet; struct ndpi_packet_struct packet;
struct ndpi_flow_struct *flow; struct ndpi_flow_struct *flow;
@@ -1144,7 +1201,7 @@ struct ndpi_flow_struct {
typedef struct { typedef struct {
char *string_to_match, *string2_to_match, *pattern_to_match, *proto_name; char *string_to_match, *string2_to_match, *pattern_to_match, *proto_name;
int protocol_id; int protocol_id;
ndpi_protocol_category_t proto_category; ndpi_protocol_category_t protocol_category;
ndpi_protocol_breed_t protocol_breed; ndpi_protocol_breed_t protocol_breed;
} ndpi_protocol_match; } ndpi_protocol_match;
@@ -1154,4 +1211,10 @@ typedef struct {
u_int8_t value; u_int8_t value;
} ndpi_network; } ndpi_network;
#endif/* __NDPI_TYPEDEFS_H__ */ typedef struct {
int protocol_id;
ndpi_protocol_category_t protocol_category;
ndpi_protocol_breed_t protocol_breed;
} ndpi_protocol_match_result;
#endif /* __NDPI_TYPEDEFS_H__ */
+8 -4
View File
@@ -5,18 +5,22 @@
# cd src/lib # cd src/lib
# make -f Makefile.simple # make -f Makefile.simple
# #
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -g
RANLIB=ranlib RANLIB = ranlib
OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) ndpi_main.o OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) ndpi_main.o
HEADERS = $(wildcard ../include/*.h) HEADERS = $(wildcard ../include/*.h)
all: libndpi.a
ndpi_main.c: ndpi_content_match.c.inc
libndpi.a: $(OBJECTS) libndpi.a: $(OBJECTS)
ar rc $@ $(OBJECTS) ar rc $@ $(OBJECTS)
$(RANLIB) $@ $(RANLIB) $@
%.o: %.c $(HEADERS) Makefile %.o: %.c $(HEADERS) Makefile
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
clean: clean:
/bin/rm -f libndpi.a $(OBJECTS) /bin/rm -f libndpi.a $(OBJECTS)
-182
View File
@@ -1,182 +0,0 @@
lib_LTLIBRARIES = libndpi.la
CFLAGS += -fPIC -DPIC # --coverage
libndpi_la_CPPFLAGS = -I$(top_srcdir)/src/include/ -I$(top_srcdir)/src/lib/third_party/include/ @HS_INC@
libndpi_la_LDFLAGS = -version-info 1:0:0 -export-symbols $(top_srcdir)/libndpi.sym
libndpi_la_includedir = $(includedir)/libndpi-@VERSION@/libndpi
libndpi_la_include_HEADERS = ../include/ndpi_api.h \
../include/ndpi_define.h \
../include/ndpi_main.h \
../include/ndpi_includes.h \
../include/ndpi_config.h \
../include/ndpi_protocol_ids.h \
../include/ndpi_protocols.h \
../include/ndpi_typedefs.h \
third_party/include/libcache.h
libndpi_la_SOURCES = ndpi_content_match.c.inc \
ndpi_main.c \
protocols/afp.c \
protocols/aimini.c \
protocols/applejuice.c \
protocols/apple_push.c \
protocols/armagetron.c \
protocols/ayiya.c \
protocols/amqp.c \
protocols/battlefield.c \
protocols/bgp.c \
protocols/bittorrent.c \
protocols/bjnp.c \
protocols/checkmk.c \
protocols/ciscovpn.c \
protocols/citrix.c \
protocols/coap.c \
protocols/collectd.c \
protocols/corba.c \
protocols/crossfire.c \
protocols/csgo.c \
protocols/dcerpc.c \
protocols/dhcp.c \
protocols/dhcpv6.c \
protocols/diameter.c \
protocols/directconnect.c \
protocols/directdownloadlink.c \
protocols/dns.c \
protocols/dofus.c \
protocols/drda.c \
protocols/dropbox.c \
protocols/eaq.c \
protocols/edonkey.c \
protocols/fasttrack.c \
protocols/fiesta.c \
protocols/fix.c \
protocols/filetopia.c \
protocols/florensia.c \
protocols/ftp_control.c \
protocols/ftp_data.c \
protocols/git.c \
protocols/gnutella.c \
protocols/gtp.c \
protocols/guildwars.c \
protocols/hangout.c \
protocols/h323.c \
protocols/halflife2_and_mods.c \
protocols/hep.c \
protocols/http_activesync.c \
protocols/http.c \
protocols/iax.c \
protocols/icecast.c \
protocols/ipp.c \
protocols/irc.c \
protocols/jabber.c \
protocols/kakaotalk_voice.c \
protocols/kerberos.c \
protocols/kontiki.c \
protocols/ldap.c \
protocols/lotus_notes.c \
protocols/lisp.c \
protocols/mail_imap.c \
protocols/mail_pop.c \
protocols/mail_smtp.c \
protocols/maplestory.c \
protocols/mdns.c \
protocols/megaco.c \
protocols/mgcp.c \
protocols/mms.c \
protocols/mpegts.c \
protocols/mqtt.c \
protocols/msn.c \
protocols/mssql_tds.c \
protocols/mysql.c \
protocols/netbios.c \
protocols/netflow.c \
protocols/nintendo.c \
protocols/nfs.c \
protocols/noe.c \
protocols/non_tcp_udp.c \
protocols/ntp.c \
protocols/openft.c \
protocols/openvpn.c \
protocols/oracle.c \
protocols/oscar.c \
protocols/pando.c \
protocols/pcanywhere.c \
protocols/postgres.c \
protocols/pplive.c \
protocols/ppstream.c \
protocols/pptp.c \
protocols/qq.c \
protocols/quic.c \
protocols/radius.c \
protocols/rdp.c \
protocols/redis_net.c \
protocols/rsync.c \
protocols/rtcp.c \
protocols/rtmp.c \
protocols/rtp.c \
protocols/rtsp.c \
protocols/rx.c \
protocols/sflow.c \
protocols/shoutcast.c \
protocols/sip.c \
protocols/skinny.c \
protocols/skype.c \
protocols/smb.c \
protocols/snmp.c \
protocols/socks45.c \
protocols/socrates.c \
protocols/sopcast.c \
protocols/soulseek.c \
protocols/spotify.c \
protocols/ssdp.c \
protocols/ssh.c \
protocols/ssl.c \
protocols/starcraft.c \
protocols/stealthnet.c \
protocols/steam.c \
protocols/stun.c \
protocols/syslog.c \
protocols/tcp_udp.c \
protocols/teamspeak.c \
protocols/teamviewer.c \
protocols/telegram.c \
protocols/telnet.c \
protocols/tftp.c \
protocols/thunder.c \
protocols/tor.c \
protocols/teredo.c \
protocols/tvants.c \
protocols/tvuplayer.c \
protocols/ubntac2.c \
protocols/usenet.c \
protocols/viber.c \
protocols/vhua.c \
protocols/vmware.c \
protocols/vnc.c \
protocols/warcraft3.c \
protocols/whoisdas.c \
protocols/world_of_kung_fu.c \
protocols/world_of_warcraft.c \
protocols/xbox.c \
protocols/xdmcp.c \
protocols/yahoo.c \
protocols/zattoo.c \
protocols/zeromq.c \
protocols/smpp.c \
protocols/tinc.c \
protocols/someip.c \
protocols/whatsapp.c \
third_party/include/actypes.h \
third_party/include/ahocorasick.h \
third_party/include/ndpi_patricia.h \
third_party/include/node.h \
third_party/include/sort.h \
third_party/include/libcache.h \
third_party/src/ahocorasick.c \
third_party/src/node.c \
third_party/src/sort.c \
third_party/src/libcache.c
EXTRA_DIST = third_party/src/ndpi_patricia.c
+383 -291
View File
@@ -1,7 +1,7 @@
/* /*
* ndpi_content_match.c * ndpi_content_match.c
* *
* Copyright (C) 2011-2017 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -71,7 +71,6 @@ static ndpi_network host_protocol_list[] = {
{ 0xB92D0600 /* 185.45.6.0/23 */, 23, NDPI_PROTOCOL_TWITTER }, { 0xB92D0600 /* 185.45.6.0/23 */, 23, NDPI_PROTOCOL_TWITTER },
{ 0xBC40E000 /* 188.64.224.0/21 */, 21, NDPI_PROTOCOL_TWITTER }, { 0xBC40E000 /* 188.64.224.0/21 */, 21, NDPI_PROTOCOL_TWITTER },
{ 0xC02C4400 /* 192.44.68.0/23 */, 23, NDPI_PROTOCOL_TWITTER }, { 0xC02C4400 /* 192.44.68.0/23 */, 23, NDPI_PROTOCOL_TWITTER },
{ 0xC030EC00 /* 192.48.236.0/23 */, 23, NDPI_PROTOCOL_TWITTER },
{ 0xC0854C00 /* 192.133.76.0/22 */, 22, NDPI_PROTOCOL_TWITTER }, { 0xC0854C00 /* 192.133.76.0/22 */, 22, NDPI_PROTOCOL_TWITTER },
{ 0xC7109C00 /* 199.16.156.0/22 */, 22, NDPI_PROTOCOL_TWITTER }, { 0xC7109C00 /* 199.16.156.0/22 */, 22, NDPI_PROTOCOL_TWITTER },
{ 0xC73B9400 /* 199.59.148.0/22 */, 22, NDPI_PROTOCOL_TWITTER }, { 0xC73B9400 /* 199.59.148.0/22 */, 22, NDPI_PROTOCOL_TWITTER },
@@ -542,18 +541,31 @@ static ndpi_network host_protocol_list[] = {
{ 0xC0AD4000 /* 192.173.64.0/18 */, 18, NDPI_PROTOCOL_NETFLIX }, { 0xC0AD4000 /* 192.173.64.0/18 */, 18, NDPI_PROTOCOL_NETFLIX },
{ 0xC6266000 /* 198.38.96.0/19 */, 19, NDPI_PROTOCOL_NETFLIX }, { 0xC6266000 /* 198.38.96.0/19 */, 19, NDPI_PROTOCOL_NETFLIX },
{ 0xC62D3000 /* 198.45.48.0/20 */, 20, NDPI_PROTOCOL_NETFLIX }, { 0xC62D3000 /* 198.45.48.0/20 */, 20, NDPI_PROTOCOL_NETFLIX },
{ 0xD04B4C00 /* 208.75.76.0/22 */, 22, NDPI_PROTOCOL_NETFLIX }, { 0xD194D687 /* 209.148.214.135/21 */, 21, NDPI_PROTOCOL_NETFLIX },
/* /*
Cloudflare, Inc. Cloudflare, Inc.
origin AS13335, AS132892, AS203898, AS394536 origin AS13335, AS132892, AS203898, AS394536
*/ */
{ 0x4044C000 /* 64.68.192.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE }, { 0x321ff200 /* 50.31.242.0/23 */, 23, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x6715f400 /* 103.21.244.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x6716c800 /* 103.22.200.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x671f0400 /* 103.31.4.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x68100000 /* 104.16.0.0/12 */, 12, NDPI_PROTOCOL_CLOUDFLARE }, { 0x68100000 /* 104.16.0.0/12 */, 12, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x6CA2C000 /* 108.162.192.0/18 */, 18, NDPI_PROTOCOL_CLOUDFLARE }, { 0x6CA2C000 /* 108.162.192.0/18 */, 18, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x83004800 /* 131.0.72.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8D654400 /* 141.101.68.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE }, { 0x8D654400 /* 141.101.68.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8D654500 /* 141.101.69.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE }, { 0x8D654500 /* 141.101.69.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8d656000 /* 141.101.96.0/21 */, 21, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8d654000 /* 141.101.64.0/20 */, 20, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8d655000 /* 141.101.80.0/21 */, 21, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8d655800 /* 141.101.88.0/19 */, 19, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8d656800 /* 141.101.104.0/21 */, 21, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8d657000 /* 141.101.112.0/21 */, 21, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8d657800 /* 141.101.120.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE },
{ 0x8d657c00 /* 141.101.124.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE },
{ 0xbe5df000 /* 190.93.240.0/20 */, 20, NDPI_PROTOCOL_CLOUDFLARE },
{ 0xA29E0000 /* 162.158.0.0/15 */, 15, NDPI_PROTOCOL_CLOUDFLARE }, { 0xA29E0000 /* 162.158.0.0/15 */, 15, NDPI_PROTOCOL_CLOUDFLARE },
{ 0xA2FB5200 /* 162.251.82.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE }, { 0xA2FB5200 /* 162.251.82.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE },
{ 0xAC400000 /* 172.64.0.0/13 */, 13, NDPI_PROTOCOL_CLOUDFLARE }, { 0xAC400000 /* 172.64.0.0/13 */, 13, NDPI_PROTOCOL_CLOUDFLARE },
@@ -567,6 +579,7 @@ static ndpi_network host_protocol_list[] = {
{ 0xBC726B00 /* 188.114.107.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE }, { 0xBC726B00 /* 188.114.107.0/24 */, 24, NDPI_PROTOCOL_CLOUDFLARE },
{ 0xBC726C00 /* 188.114.108.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE }, { 0xBC726C00 /* 188.114.108.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE },
{ 0xC6298000 /* 198.41.128.0/17 */, 17, NDPI_PROTOCOL_CLOUDFLARE }, { 0xC6298000 /* 198.41.128.0/17 */, 17, NDPI_PROTOCOL_CLOUDFLARE },
{ 0xc5eaf000 /* 197.234.240.0/22 */, 22, NDPI_PROTOCOL_CLOUDFLARE },
{ 0xC71B8000 /* 199.27.128.0/21 */, 21, NDPI_PROTOCOL_CLOUDFLARE }, { 0xC71B8000 /* 199.27.128.0/21 */, 21, NDPI_PROTOCOL_CLOUDFLARE },
/* /*
@@ -595,10 +608,10 @@ static ndpi_network host_protocol_list[] = {
/* Teamviewer 159.122.189.32-63 */ /* Teamviewer 159.122.189.32-63 */
{ 0x9F7ABD30 /* 159.122.189.32 */, 21, NDPI_PROTOCOL_TEAMVIEWER }, { 0x9F7ABD30 /* 159.122.189.32 */, 21, NDPI_PROTOCOL_TEAMVIEWER },
#if 0
/* /*
IFLIX services -by www.vizuamatix.com R&D team IFLIX services -by www.vizuamatix.com R&D team
*/ */
{ 0x344D0000 /* 52.77.0.0 */, 16, NDPI_PROTOCOL_IFLIX }, { 0x344D0000 /* 52.77.0.0 */, 16, NDPI_PROTOCOL_IFLIX },
{ 0x34DC0000 /* 52.220.0.0 */, 16, NDPI_PROTOCOL_IFLIX }, { 0x34DC0000 /* 52.220.0.0 */, 16, NDPI_PROTOCOL_IFLIX },
{ 0x344A0000 /* 52.74.0.0 */, 16, NDPI_PROTOCOL_IFLIX }, { 0x344A0000 /* 52.74.0.0 */, 16, NDPI_PROTOCOL_IFLIX },
@@ -608,6 +621,7 @@ static ndpi_network host_protocol_list[] = {
{ 0x36C09600 /* 54.192.150.0 */, 24, NDPI_PROTOCOL_IFLIX }, { 0x36C09600 /* 54.192.150.0 */, 24, NDPI_PROTOCOL_IFLIX },
{ 0x344AC0F7 /* 52.74.192.247 */, 32, NDPI_PROTOCOL_IFLIX }, { 0x344AC0F7 /* 52.74.192.247 */, 32, NDPI_PROTOCOL_IFLIX },
{ 0x0215E718 /* 2.21.231.24 */, 32, NDPI_PROTOCOL_IFLIX }, { 0x0215E718 /* 2.21.231.24 */, 32, NDPI_PROTOCOL_IFLIX },
#endif
/* /*
Citrix GotoMeeting (AS16815, AS21866) Citrix GotoMeeting (AS16815, AS21866)
@@ -638,12 +652,16 @@ static ndpi_network host_protocol_list[] = {
https://whois.arin.net/rest/nets;q=AWS-VIBER-MEDIA?showDetails=true&showARIN=false&showNonArinTopLevelNet=false&ext=netref2 https://whois.arin.net/rest/nets;q=AWS-VIBER-MEDIA?showDetails=true&showARIN=false&showNonArinTopLevelNet=false&ext=netref2
*/ */
{ 0x0DE61550 /* 13.230.21.80/28 */, 28, NDPI_PROTOCOL_VIBER },
{ 0x0D39B480 /* 13.57.180.128/28 */, 28, NDPI_PROTOCOL_VIBER },
{ 0x012C30400 /* 18.195.4.0/23 */, 23, NDPI_PROTOCOL_VIBER },
{ 0x012C45500 /* 18.196.85.0/25 */, 25, NDPI_PROTOCOL_VIBER },
{ 0x022E8A340 /* 34.232.163.64/28 */, 28, NDPI_PROTOCOL_VIBER },
{ 0x022F67200 /* 34.246.114.0/23 */, 23, NDPI_PROTOCOL_VIBER },
{ 0x3400FC00 /* 52.0.252.0/22 */, 22, NDPI_PROTOCOL_VIBER }, { 0x3400FC00 /* 52.0.252.0/22 */, 22, NDPI_PROTOCOL_VIBER },
{ 0x3640BFF0 /* 54.64.191.240/28 */, 28, NDPI_PROTOCOL_VIBER }, { 0x3640BFF0 /* 54.64.191.240/28 */, 28, NDPI_PROTOCOL_VIBER },
{ 0x36A5FFD0 /* 54.165.255.208/28 */, 28, NDPI_PROTOCOL_VIBER }, { 0x36A5FFD0 /* 54.165.255.208/28 */, 28, NDPI_PROTOCOL_VIBER },
{ 0x36A5FFE0 /* 54.165.255.224/27 */, 27, NDPI_PROTOCOL_VIBER }, { 0x36A5FFE0 /* 54.165.255.224/27 */, 27, NDPI_PROTOCOL_VIBER },
{ 0x36A93FA0 /* 54.169.63.160/27 */, 27, NDPI_PROTOCOL_VIBER },
{ 0x36A93FC0 /* 54.169.63.192/26 */, 26, NDPI_PROTOCOL_VIBER },
{ 0x36DBBFA0 /* 54.219.191.160/28 */, 28, NDPI_PROTOCOL_VIBER }, { 0x36DBBFA0 /* 54.219.191.160/28 */, 28, NDPI_PROTOCOL_VIBER },
{ 0x36E8FB90 /* 54.232.251.144/28 */, 28, NDPI_PROTOCOL_VIBER }, { 0x36E8FB90 /* 54.232.251.144/28 */, 28, NDPI_PROTOCOL_VIBER },
@@ -7907,6 +7925,7 @@ static ndpi_network host_protocol_list[] = {
Valve Corporation (Steam) Valve Corporation (Steam)
origin AS32590 origin AS32590
*/ */
{ 0x2D79B800 /* 45.121.184.0/22 */, 22, NDPI_PROTOCOL_STEAM }, { 0x2D79B800 /* 45.121.184.0/22 */, 22, NDPI_PROTOCOL_STEAM },
{ 0x670A7C00 /* 103.10.124.0/23 */, 23, NDPI_PROTOCOL_STEAM }, { 0x670A7C00 /* 103.10.124.0/23 */, 23, NDPI_PROTOCOL_STEAM },
{ 0x671C3600 /* 103.28.54.0/23 */, 23, NDPI_PROTOCOL_STEAM }, { 0x671C3600 /* 103.28.54.0/23 */, 23, NDPI_PROTOCOL_STEAM },
@@ -7924,10 +7943,18 @@ static ndpi_network host_protocol_list[] = {
{ 0xD040C800 /* 208.64.200.0/24 */, 24, NDPI_PROTOCOL_STEAM }, { 0xD040C800 /* 208.64.200.0/24 */, 24, NDPI_PROTOCOL_STEAM },
{ 0xD040C900 /* 208.64.201.0/22 */, 22, NDPI_PROTOCOL_STEAM }, { 0xD040C900 /* 208.64.201.0/22 */, 22, NDPI_PROTOCOL_STEAM },
{ 0xD04EA400 /* 208.78.164.0/22 */, 22, NDPI_PROTOCOL_STEAM }, { 0xD04EA400 /* 208.78.164.0/22 */, 22, NDPI_PROTOCOL_STEAM },
/*
VidTO
*/
{ 0x51111030 /* 81.17.16.48/32 */, 32, NDPI_PROTOCOL_VIDTO },
{ 0x5fb7329d /* 95.183.50.157/32 */, 32, NDPI_PROTOCOL_VIDTO },
{ 0x577824f2 /* 87.120.36.242/32 */, 32, NDPI_PROTOCOL_VIDTO },
{ 0x0, 0, 0 } { 0x0, 0, 0 }
}; };
/* ****************************************************** */ /* ****************************************************** */
/* /*
@@ -7980,65 +8007,103 @@ static ndpi_network host_protocol_list[] = {
*/ */
/* ****************************************************** */
/*
Each part of a domain name can be no longer than 63 characters. There are no single-digit top-level domains and none contain digits. It doesn't look like ICANN will approve such domains either.
https://www.regular-expressions.info/email.html
(?i) is to make searches case insensitive
(?:) is a non-capturing group used to allow patterns such as .co.uk or .com.cn
The non-capturing group is used in a nested fashion to capture the
.co, and then, optionally, another m.
*/
#define TLD "(?i)(?:\\.co(?:m)?)?\\.[a-z]{2,63}$"
/* ****************************************************** */
ndpi_protocol_match host_match[] = { ndpi_protocol_match host_match[] = {
{ "s3.ll.dash.row.aiv-cdn.net", NULL, "s3\\.ll\\.dash\\.row\\.aiv-cdn\\.net", "AmazonVideo", NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { "s3.ll.dash.row.aiv-cdn.net", NULL, "s3\\.ll\\.dash\\.row\\.aiv-cdn\\.net", "AmazonVideo", NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "d25xi40x97liuc.cloudfront.net", NULL, "d25xi40x97liuc\\.cloudfront\\.net", "AmazonVideo", NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { "s3-dub.cf.dash.row.aiv-cdn.net", NULL, "s3-dub\\.cf\\.dash\\.row\\.aiv-cdn\\.net", "AmazonVideo", NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".aiv-delivery.net", NULL, "\\.aiv-delivery\\.net", "AmazonVideo", NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { "dmqdd6hw24ucf.cloudfront.net", NULL, "dmqdd6hw24ucf\\.cloudfront\\.net", "AmazonVideo", NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "amazon.", NULL, NULL, "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { "d25xi40x97liuc.cloudfront.net", NULL, "d25xi40x97liuc\\.cloudfront\\.net", "AmazonVideo", NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "amazon.com", NULL, "amazon\\.com$", "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".aiv-delivery.net", NULL, "\\.aiv-delivery\\.net", "AmazonVideo", NDPI_PROTOCOL_AMAZON_VIDEO, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "images-amazon.com", NULL, "images-amazon\\.com$", "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "amazon.", NULL, NULL, "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "amazonaws.com", NULL, "amazonaws\\.com$", "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "amazon.com", NULL, "amazon" TLD, "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "amazon-adsystem.com", NULL, "amazon-adsystem\\.com$", "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "images-amazon.com", NULL, "images-amazon" TLD, "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ ".cloudfront.net", NULL, "\\.cloudfront\\.net$", "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "amazonaws.com", NULL, "amazonaws" TLD, "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "amazon-adsystem.com", NULL, "amazon-adsystem" TLD, "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ ".cloudfront.net", NULL, "\\.cloudfront" TLD, "Amazon", NDPI_PROTOCOL_AMAZON, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ ".push.apple.com", NULL, NULL, "ApplePush", NDPI_PROTOCOL_APPLE_PUSH, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_SAFE }, { ".push.apple.com", NULL, "\\.push\\.apple" TLD, "ApplePush", NDPI_PROTOCOL_APPLE_PUSH, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_SAFE },
{ ".apple-dns.net", NULL, NULL, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".apple-dns.net", NULL, "\\.apple-dns" TLD, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".mzstatic.com", NULL, NULL, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".mzstatic.com", NULL, "\\.mzstatic" TLD, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".aaplimg.com", NULL, NULL, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".aaplimg.com", NULL, "\\.aaplimg" TLD, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "iosapps.itunes.apple.com", NULL, NULL, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, /* iOS */ { "aaplimg.com", NULL, "aaplimg" TLD, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "osxapps.itunes.apple.com", NULL, NULL, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, /* MacOS */ { ".apple.com", NULL, "\\.apple" TLD, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "buy.itunes.apple.com", NULL, NULL, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { ".icloud.com", NULL, "\\.icloud\\.com", "AppleiCloud", NDPI_PROTOCOL_APPLE_ICLOUD, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "su.itunes.apple.com", NULL, NULL, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { "iosapps.itunes.apple.com", NULL, "iosapps\\.itunes\\.apple" TLD, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, /* iOS */
{ "se.itunes.apple.com", NULL, NULL, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { "osxapps.itunes.apple.com", NULL, "osxapps\\.itunes\\.apple" TLD, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, /* MacOS */
{ "myapp.itunes.apple.com", NULL, NULL, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { "buy.itunes.apple.com", NULL, "buy\\.itunes\\.apple" TLD, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "swscan.apple.com", NULL, NULL, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { "su.itunes.apple.com", NULL, "su\\.itunes\\.apple" TLD, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "itunes-apple.com", NULL, NULL, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { "se.itunes.apple.com", NULL, "se\\.itunes\\.apple" TLD, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "itunes.apple.com", NULL, NULL, "AppleiTunes", NDPI_PROTOCOL_APPLE_ITUNES, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { "myapp.itunes.apple.com", NULL, "myapp\\.itunes\\.apple" TLD, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "aaplimg.com", NULL, NULL, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { "swscan.apple.com", NULL, "swscan\\.apple" TLD, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ ".apple.com", NULL, NULL, "Apple", NDPI_PROTOCOL_APPLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { "itunes-apple.com", NULL, "itunes-apple" TLD, "AppleStore", NDPI_PROTOCOL_APPLESTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ ".icloud.com", NULL, NULL, "AppleiCloud", NDPI_PROTOCOL_APPLE_ICLOUD, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "itunes.apple.com", NULL, "itunes\\.apple" TLD, "AppleiTunes", NDPI_PROTOCOL_APPLE_ITUNES, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "tlnk.io", NULL, "tlnk" TLD, "AppleiTunes", NDPI_PROTOCOL_APPLE_ITUNES, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".cnn.c", NULL, NULL, "CNN", NDPI_PROTOCOL_CNN, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".cnn.c", NULL, "\\.cnn" TLD, "CNN", NDPI_PROTOCOL_CNN, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".cnn.net", NULL, NULL, "CNN", NDPI_PROTOCOL_CNN, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".cnn.net", NULL, NULL, "CNN", NDPI_PROTOCOL_CNN, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".dropbox.com", NULL, NULL, "DropBox", NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE }, { ".dropbox.com", NULL, "\\.dropbox" TLD, "DropBox", NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ ".dropboxstatic.com", NULL, NULL, "DropBox", NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE }, { ".dropboxstatic.com", NULL, "\\.dropboxstatic" TLD, "DropBox", NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ ".dropbox-dns.com", NULL, NULL, "DropBox", NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE }, { ".dropbox-dns.com", NULL, "\\.dropbox-dns" TLD, "DropBox", NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "log.getdropbox.com", NULL, NULL, "DropBox", NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE }, { "log.getdropbox.com", NULL, "log\\.getdropbox" TLD, "DropBox", NDPI_PROTOCOL_DROPBOX, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ ".ebay.", NULL, NULL, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, /* or FUN */ { ".ebay.", NULL, "\\.ebay" TLD, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, /* or FUN */
{ ".ebay.com", NULL, NULL, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".ebay.com", NULL, NULL, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".ebaystatic.com", NULL, NULL, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".ebaystatic.com", NULL, "\\.ebaystatic" TLD, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".ebaydesc.com", NULL, NULL, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".ebaydesc.com", NULL, "\\.ebaydesc" TLD, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".ebayrtm.com", NULL, NULL, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".ebayrtm.com", NULL, "\\.ebayrtm" TLD, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".ebaystratus.com", NULL, NULL, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".ebaystratus.com", NULL, "\\.ebaystratus" TLD, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".ebayimg.com", NULL, NULL, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".ebayimg.com", NULL, "\\.ebayimg" TLD, "eBay", NDPI_PROTOCOL_EBAY, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "facebook.com", NULL, NULL, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, /* Detected "instagram.c10r.facebook.com". Omitted "*amazonaws.com" and "*facebook.com" CDNs e.g. "ig-telegraph-shv-04-frc3.facebook.com" */
{ "fbstatic-a.akamaihd.net", NULL, NULL, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { ".instagram.", NULL, "\\.instagram" TLD, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".fbcdn.net", NULL, NULL, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { "instagram.", NULL, "instagram" TLD, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "fbcdn-", NULL, NULL, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { ".cdninstagram.com", NULL, "\\.cdninstagram" TLD, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".facebook.net", NULL, NULL, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".speedtest.net", NULL, NULL, "Ookla", NDPI_PROTOCOL_OOKLA, NDPI_PROTOCOL_CATEGORY_NETWORK, NDPI_PROTOCOL_SAFE }, { "igcdn-photos-", NULL, "igcdn-photos-", "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "instagramimages-", NULL, "instagramimages-", "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "instagramstatic-", NULL, "instagramstatic-", "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "docs.googleusercontent.com", NULL, NULL, "GoogleDocs", NDPI_PROTOCOL_GOOGLE_DOCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE }, { "facebook.com", NULL, "facebook" TLD, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "fbstatic-a.akamaihd.net", NULL, "fbstatic-a\\.akamaihd" TLD, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".fbcdn.net", NULL, "\\.fbcdn" TLD, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "fbcdn-", NULL, "fbcdn-", "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".facebook.net", NULL, "\\.facebook" TLD, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".fbsbx.com", NULL, "\\.fbsbx" TLD, "Facebook", NDPI_PROTOCOL_FACEBOOK, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "drive-thirdparty.googleusercontent.com", NULL, NULL, "GoogleDrive", NDPI_PROTOCOL_GOOGLE_DRIVE, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".speedtest.net", NULL, "\\.speedtest" TLD, "Ookla", NDPI_PROTOCOL_OOKLA, NDPI_PROTOCOL_CATEGORY_NETWORK, NDPI_PROTOCOL_SAFE },
{ "drive.google.com", NULL, NULL, "GoogleDrive", NDPI_PROTOCOL_GOOGLE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "android.clients.google.com", NULL, NULL, "PlayStore", NDPI_PROTOCOL_PLAYSTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { "ntop.org", NULL, "ntop\\.org$", "ntop", NDPI_PROTOCOL_NTOP, NDPI_PROTOCOL_CATEGORY_NETWORK, NDPI_PROTOCOL_SAFE },
{ "ggpht.com", NULL, NULL, "PlayStore", NDPI_PROTOCOL_PLAYSTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "docs.googleusercontent.com", NULL, "docs\\.googleusercontent" TLD, "GoogleDocs", NDPI_PROTOCOL_GOOGLE_DOCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE },
{ "docs.googleusercontent.com", NULL, "docs.googleusercontent" TLD, "GoogleDocs", NDPI_PROTOCOL_GOOGLE_DOCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE },
{ "docs.google.com", NULL, "docs.google" TLD, "GoogleDocs", NDPI_PROTOCOL_GOOGLE_DOCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE },
{ "drive-thirdparty.googleusercontent.com", NULL, "drive-thirdparty\\.googleusercontent" TLD, "GoogleDrive", NDPI_PROTOCOL_GOOGLE_DRIVE, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "drive.google.com", NULL, "drive.google" TLD, "GoogleDrive", NDPI_PROTOCOL_GOOGLE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "android.clients.google.com", NULL, "android\\.clients\\.google" TLD, "PlayStore", NDPI_PROTOCOL_PLAYSTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "ggpht.com", NULL, "ggpht" TLD, "PlayStore", NDPI_PROTOCOL_PLAYSTORE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
/* /*
See https://better.fyi/trackers/ See https://better.fyi/trackers/
@@ -8059,270 +8124,298 @@ ndpi_protocol_match host_match[] = {
Gstatic by Google (gstatic.com) Gstatic by Google (gstatic.com)
*/ */
/* Google Advertisements */ /* Google Advertisements */
{ ".googlesyndication.com", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS }, { ".googlesyndication.com", NULL, "\\.googlesyndication" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS },
{ "googleads.", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS }, { "googleads.", NULL, "googleads\\.", "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS },
{ ".doubleclick.net", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS }, { ".doubleclick.net", NULL, "\\.doubleclick" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS },
{ "googleadservices.", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS }, { "googleadservices.", NULL, "googleadservices\\.", "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS },
{ ".2mdn.net", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS }, { ".2mdn.net", NULL, "\\.2mdn" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS },
{ ".dmtry.com", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS }, { ".dmtry.com", NULL, "\\.dmtry" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS },
{ "google-analytics.", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS }, { "google-analytics.", NULL, "google-analytics\\.", "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_TRACKER_ADS },
{ "gtv1.com", NULL, "gtv1" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
/* Google Hangout */
{ "images2-hangout-opensocial.googleusercontent.com", NULL, "images2-hangout-opensocial\\.googleusercontent" TLD, "GoogleHangout", NDPI_PROTOCOL_HANGOUT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
/* Google Services */ /* Google Services */
{ "googleapis.com", NULL, NULL, "GoogleServices", NDPI_PROTOCOL_GOOGLE_SERVICES, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "googleapis.com", NULL, "googleapis" TLD, "GoogleServices", NDPI_PROTOCOL_GOOGLE_SERVICES, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ ".googletagservices.com", NULL, NULL, "GoogleServices", NDPI_PROTOCOL_GOOGLE_SERVICES, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { ".googletagservices.com", NULL, "\\.googletagservices" TLD, "GoogleServices", NDPI_PROTOCOL_GOOGLE_SERVICES, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "mtalk.google.com", NULL, NULL, "GoogleServices", NDPI_PROTOCOL_GOOGLE_SERVICES, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "mtalk.google.com", NULL, "mtalk\\.google" TLD, "GoogleServices", NDPI_PROTOCOL_GOOGLE_SERVICES, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "plus.google.com", NULL, NULL, "GooglePlus", NDPI_PROTOCOL_GOOGLE_PLUS, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { "plus.google.com", NULL, "plus\\.google" TLD, "GooglePlus", NDPI_PROTOCOL_GOOGLE_PLUS, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "plus.url.google.com", NULL, NULL, "GooglePlus", NDPI_PROTOCOL_GOOGLE_PLUS, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { "plus.url.google.com", NULL, "plus\\.url\\.google" TLD, "GooglePlus", NDPI_PROTOCOL_GOOGLE_PLUS, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
/* http://check.googlezip.net/connect [check browser connectivity] */ /* http://check.googlezip.net/connect [check browser connectivity] */
{ ".googlezip.net", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".googlezip.net", NULL, "\\.googlezip" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "docs.googleusercontent.com", NULL, NULL, "GoogleDocs", NDPI_PROTOCOL_GOOGLE_DOCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE }, { "googleusercontent.com", NULL, "googleusercontent" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "docs.google.com", NULL, NULL, "GoogleDocs", NDPI_PROTOCOL_GOOGLE_DOCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE }, { "1e100.net", NULL, "1e100" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "googleusercontent.com", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "maps.google.", NULL, "maps\\.google" TLD, "GoogleMaps", NDPI_PROTOCOL_GOOGLE_MAPS, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "1e100.net", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "maps.gstatic.com", NULL, "maps\\.gstatic" TLD, "GoogleMaps", NDPI_PROTOCOL_GOOGLE_MAPS, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "maps.google.", NULL, NULL, "GoogleMaps", NDPI_PROTOCOL_GOOGLE_MAPS, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".gmail.", NULL, "\\.gmail" TLD, "GMail", NDPI_PROTOCOL_GMAIL, NDPI_PROTOCOL_CATEGORY_MAIL, NDPI_PROTOCOL_ACCEPTABLE },
{ "maps.gstatic.com", NULL, NULL, "GoogleMaps", NDPI_PROTOCOL_GOOGLE_MAPS, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { "mail.google.", NULL, "mail\\.google" TLD, "GMail", NDPI_PROTOCOL_GMAIL, NDPI_PROTOCOL_CATEGORY_MAIL, NDPI_PROTOCOL_ACCEPTABLE },
{ ".gmail.", NULL, NULL, "GMail", NDPI_PROTOCOL_GMAIL, NDPI_PROTOCOL_CATEGORY_MAIL, NDPI_PROTOCOL_ACCEPTABLE }, { "google.", NULL, "google" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "mail.google.", NULL, NULL, "GMail", NDPI_PROTOCOL_GMAIL, NDPI_PROTOCOL_CATEGORY_MAIL, NDPI_PROTOCOL_ACCEPTABLE }, { ".google.", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".gstatic.com", NULL, "\\.gstatic" TLD, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "google.", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { "mail.outlook.com", NULL, "mail\\.outlook" TLD, "Hotmail", NDPI_PROTOCOL_HOTMAIL, NDPI_PROTOCOL_CATEGORY_MAIL, NDPI_PROTOCOL_ACCEPTABLE },
{ ".google.", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".gstatic.com", NULL, NULL, "Google", NDPI_PROTOCOL_GOOGLE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "mail.outlook.com", NULL, NULL, "Hotmail", NDPI_PROTOCOL_HOTMAIL, NDPI_PROTOCOL_CATEGORY_MAIL, NDPI_PROTOCOL_ACCEPTABLE }, { ".last.fm", NULL, "\\.last\\.fm$", "LastFM", NDPI_PROTOCOL_LASTFM, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".last.fm", NULL, NULL, "LastFM", NDPI_PROTOCOL_LASTFM, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { "msn.com", NULL, "msn" TLD, "MSN", NDPI_PROTOCOL_MSN, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, /* News site */
{ "msn.com", NULL, NULL, "MSN", NDPI_PROTOCOL_MSN, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, /* News site */ { "netflix.com", NULL, "netflix" TLD, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "nflxext.com", NULL, "nflxext" TLD, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "nflximg.com", NULL, "nflximg" TLD, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "nflximg.net", NULL, "nflximg" TLD, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "nflxvideo.net", NULL, "nflxvideo" TLD, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "nflxso.net", NULL, "nflxso" TLD, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "netflix.com", NULL, NULL, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".skype.", NULL, "\\.skype\\.", "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "nflxext.com", NULL, NULL, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".skypeassets.", NULL, "\\.skypeassets\\.", "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "nflximg.com", NULL, NULL, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".skypedata.", NULL, "\\.skypedata\\.", "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "nflximg.net", NULL, NULL, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".skypeecs-", NULL, "\\.skypeecs-", "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "nflxvideo.net", NULL, NULL, "NetFlix", NDPI_PROTOCOL_NETFLIX, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".skypeforbusiness.", NULL, "\\.skypeforbusiness\\.", "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".lync.com", NULL, "\\.lync" TLD, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "e7768.b.akamaiedge.net", NULL, "e7768\\.b\\.akamaiedge" TLD, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "e4593.dspg.akamaiedge.net", NULL, "e4593\\.dspg\\.akamaiedge" TLD,"Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "e4593.g.akamaiedge.net", NULL, "e4593\\.g\\.akamaiedge" TLD, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".skype.", NULL, NULL, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE }, { ".tuenti.com", NULL, "\\.tuenti" TLD, "Tuenti", NDPI_PROTOCOL_TUENTI, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".skypeassets.", NULL, NULL, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".skypedata.", NULL, NULL, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".skypeecs-", NULL, NULL, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".skypeforbusiness.", NULL, NULL, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".lync.com", NULL, NULL, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "e7768.b.akamaiedge.net", NULL, NULL, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "e4593.dspg.akamaiedge.net", NULL, NULL,"Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "e4593.g.akamaiedge.net", NULL, NULL, "Skype", NDPI_PROTOCOL_SKYPE, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".tuenti.com", NULL, NULL, "Tuenti", NDPI_PROTOCOL_TUENTI, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE }, { ".twttr.com", NULL, "\\.twttr" TLD, "Twitter", NDPI_PROTOCOL_TWITTER, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "twitter.", NULL, "twitter" TLD, "Twitter", NDPI_PROTOCOL_TWITTER, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "twimg.com", NULL, "twimg" TLD, "Twitter", NDPI_PROTOCOL_TWITTER, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".twttr.com", NULL, NULL, "Twitter", NDPI_PROTOCOL_TWITTER, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { ".viber.com", NULL, "\\.viber" TLD, "Viber", NDPI_PROTOCOL_VIBER, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
{ "twitter.", NULL, NULL, "Twitter", NDPI_PROTOCOL_TWITTER, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { ".cdn.viber.com", NULL, NULL, "Viber", NDPI_PROTOCOL_VIBER, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
{ "twimg.com", NULL, NULL, "Twitter", NDPI_PROTOCOL_TWITTER, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { ".viber.it", NULL, NULL, "Viber", NDPI_PROTOCOL_VIBER, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
{ ".viber.com", NULL, NULL, "Viber", NDPI_PROTOCOL_VIBER, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE }, { "wikipedia.", NULL, "wikipedia" TLD, "Wikipedia", NDPI_PROTOCOL_WIKIPEDIA, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".cdn.viber.com", NULL, NULL, "Viber", NDPI_PROTOCOL_VIBER, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE }, { "wikimedia.", NULL, "wikimedia" TLD, "Wikipedia", NDPI_PROTOCOL_WIKIPEDIA, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "mediawiki.", NULL, "mediawiki" TLD, "Wikipedia", NDPI_PROTOCOL_WIKIPEDIA, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "wikimediafoundation.", NULL, "wikimediafoundation" TLD, "Wikipedia", NDPI_PROTOCOL_WIKIPEDIA, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "wikipedia.", NULL, NULL, "Wikipedia", NDPI_PROTOCOL_WIKIPEDIA, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { "mmg-fna.whatsapp.net", NULL, "mmg-fna\\.whatsapp" TLD, "WhatsAppFiles", NDPI_PROTOCOL_WHATSAPP_FILES, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_ACCEPTABLE },
{ "wikimedia.", NULL, NULL, "Wikipedia", NDPI_PROTOCOL_WIKIPEDIA, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { ".whatsapp.", NULL, "\\.whatsapp" TLD, "WhatsApp", NDPI_PROTOCOL_WHATSAPP, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
{ "mediawiki.", NULL, NULL, "Wikipedia", NDPI_PROTOCOL_WIKIPEDIA, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "wikimediafoundation.", NULL, NULL, "Wikipedia", NDPI_PROTOCOL_WIKIPEDIA, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "mmg-fna.whatsapp.net", NULL, NULL, "WhatsAppFiles", NDPI_PROTOCOL_WHATSAPP_FILES, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_ACCEPTABLE }, { ".yahoo.", NULL, "\\.yahoo" TLD, "Yahoo", NDPI_PROTOCOL_YAHOO, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".whatsapp.", NULL, NULL, "WhatsApp", NDPI_PROTOCOL_WHATSAPP, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE }, { ".yimg.com", NULL, "\\.yimg" TLD, "Yahoo", NDPI_PROTOCOL_YAHOO, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "yahooapis.", NULL, "yahooapis" TLD, "Yahoo", NDPI_PROTOCOL_YAHOO, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ ".yahoo.", NULL, NULL, "Yahoo", NDPI_PROTOCOL_YAHOO, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { "upload.youtube.com", NULL, "upload\\.youtube" TLD, "YouTubeUpload", NDPI_PROTOCOL_YOUTUBE_UPLOAD, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".yimg.com", NULL, NULL, "Yahoo", NDPI_PROTOCOL_YAHOO, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { "upload.video.google.com", NULL, "upload\\.video\\.google" TLD, "YouTubeUpload", NDPI_PROTOCOL_YOUTUBE_UPLOAD, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "yahooapis.", NULL, NULL, "Yahoo", NDPI_PROTOCOL_YAHOO, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "youtubei.googleapis.com", NULL, "youtubei\\.googleapis" TLD, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "youtube.", NULL, "youtube" TLD, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "youtu.be.", NULL, "youtu\\.be" TLD, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "yt3.ggpht.com", NULL, "yt3\\.ggpht" TLD, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".googlevideo.com", NULL, "\\.googlevideo" TLD, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".ytimg.com", NULL, "\\.ytimg" TLD, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "youtube-nocookie.", NULL, "youtube-nocookie" TLD, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "ggpht.com", NULL, "ggpht" TLD, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "upload.youtube.com", NULL, NULL, "YouTubeUpload", NDPI_PROTOCOL_YOUTUBE_UPLOAD, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { ".vevo.com", NULL, "\\.vevo" TLD, "Vevo", NDPI_PROTOCOL_VEVO, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "upload.video.google.com", NULL, NULL, "YouTubeUpload", NDPI_PROTOCOL_YOUTUBE_UPLOAD, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "youtube.", NULL, NULL, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "youtu.be.", NULL, NULL, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "yt3.ggpht.com", NULL, NULL, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".googlevideo.com", NULL, NULL, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".ytimg.com", NULL, NULL, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "youtube-nocookie.", NULL, NULL, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "ggpht.com", NULL, NULL, "YouTube", NDPI_PROTOCOL_YOUTUBE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".vevo.com", NULL, NULL, "Vevo", NDPI_PROTOCOL_VEVO, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { ".spotify.", NULL, "\\.spotify" TLD, "Spotify", NDPI_PROTOCOL_SPOTIFY, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "audio-fa.scdn.co", NULL, "audio-fa\\.scdn" TLD, "Spotify", NDPI_PROTOCOL_SPOTIFY, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".spotify.", NULL, NULL, "Spotify", NDPI_PROTOCOL_SPOTIFY, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "edge-mqtt.facebook.com", NULL, "edge-mqtt\\.facebook" TLD, "Messenger", NDPI_PROTOCOL_MESSENGER, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ "audio-fa.scdn.co", NULL, NULL, "Spotify", NDPI_PROTOCOL_SPOTIFY, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".pandora.com", NULL, "\\.pandora" TLD, "Pandora", NDPI_PROTOCOL_PANDORA, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".pandora.com", NULL, NULL, "Pandora", NDPI_PROTOCOL_PANDORA, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".torproject.org", NULL, "\\.torproject\\.org$", "Tor", NDPI_PROTOCOL_TOR, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS },
{ ".torproject.org", NULL, NULL, "Tor", NDPI_PROTOCOL_TOR, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS }, { ".kakao.com", NULL, "\\.kakao" TLD, "KakaoTalk", NDPI_PROTOCOL_KAKAOTALK, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ ".kakao.com", NULL, NULL, "KakaoTalk", NDPI_PROTOCOL_KAKAOTALK, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE }, { "ttvnw.net", NULL, "ttvnw" TLD, "Twitch", NDPI_PROTOCOL_TWITCH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "static-cdn.jtvnw.net", NULL, "static-cdn\\.jtvnw" TLD, "Twitch", NDPI_PROTOCOL_TWITCH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "www-cdn.jtvnw.net", NULL, "www-cdn\\.jtvnw" TLD, "Twitch", NDPI_PROTOCOL_TWITCH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "ttvnw.net", NULL, NULL, "Twitch", NDPI_PROTOCOL_TWITCH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { ".qq.com", NULL, "\\.qq" TLD, "QQ", NDPI_PROTOCOL_QQ, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ "static-cdn.jtvnw.net", NULL, NULL, "Twitch", NDPI_PROTOCOL_TWITCH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { ".gtimg.com", NULL, "\\.gtimg" TLD, "QQ", NDPI_PROTOCOL_QQ, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ "www-cdn.jtvnw.net", NULL, NULL, "Twitch", NDPI_PROTOCOL_TWITCH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "quickplay.com", NULL, NULL, "QuickPlay", NDPI_PROTOCOL_QUICKPLAY, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".weibo.com", NULL, "\\.weibo" TLD, "Sina(Weibo)", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".weibo.cn", NULL, NULL, "Sina(Weibo)", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".qq.com", NULL, NULL, "QQ", NDPI_PROTOCOL_QQ, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { ".sinaimg.cn", NULL, "\\.sinaimg" TLD, "Sina", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".gtimg.com", NULL, NULL, "QQ", NDPI_PROTOCOL_QQ, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { ".sinajs.cn", NULL, "\\.sinajs" TLD, "Sina", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".sina.cn", NULL, "\\.sina" TLD, "Sina", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".weibo.com", NULL, NULL, "Sina(Weibo)", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { ".sina.com.cn", NULL, "\\.sina\\.com\\.cn$", "Sina", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".sinaimg.cn", NULL, NULL, "Sina", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".sinajs.cn", NULL, NULL, "Sina", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".sina.cn", NULL, NULL, "Sina", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".sina.com.cn", NULL, NULL, "Sina", NDPI_PROTOCOL_SINA, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
/* https://support.cipafilter.com/index.php?/Knowledgebase/Article/View/117/0/snapchat---how-to-block */ /* https://support.cipafilter.com/index.php?/Knowledgebase/Article/View/117/0/snapchat---how-to-block */
{ "feelinsonice.appspot.com", NULL, "\\.appspot\\.com$", "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { "feelinsonice.appspot.com", NULL, "\\.appspot" TLD, "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ "feelinsonice-hrd.appspot.com", NULL, NULL, "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { "feelinsonice-hrd.appspot.com", NULL, "feelinsonice-hrd\\.appspot" TLD, "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ "feelinsonice.com", NULL, "\\.feelsonice\\.com$", "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { "feelinsonice.com", NULL, "\\.feelsonice" TLD, "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".snapchat.", NULL, "\\.snapchat\\.com$", "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { ".snapchat.", NULL, "\\.snapchat" TLD, "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".snapads.", NULL, "\\.snapads\\.com$", "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { ".snapads.", NULL, "\\.snapads" TLD, "Snapchat", NDPI_PROTOCOL_SNAPCHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
/* Detected "instagram.c10r.facebook.com". Omitted "*amazonaws.com" and "*facebook.com" CDNs e.g. "ig-telegraph-shv-04-frc3.facebook.com" */ { ".waze.com", NULL, "\\.waze" TLD, "Waze", NDPI_PROTOCOL_WAZE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ ".cdninstagram.com", NULL, NULL, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "instagram.", NULL, NULL, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".instagram.", NULL, NULL, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "igcdn-photos-", NULL, NULL, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "instagramimages-", NULL, NULL, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "instagramstatic-", NULL, NULL, "Instagram", NDPI_PROTOCOL_INSTAGRAM, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".waze.com", NULL, NULL, "Waze", NDPI_PROTOCOL_WAZE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { ".deezer.com", NULL, "\\.deezer" TLD, "Deezer", NDPI_PROTOCOL_DEEZER, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".deezer.com", NULL, NULL, "Deezer", NDPI_PROTOCOL_DEEZER, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".microsoft.com", NULL, "\\.microsoft" TLD, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "i-msdn.sec.s-msft.com", NULL, "i-msdn.sec\\.s-msft" TLD, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_SYSTEM_OS, NDPI_PROTOCOL_ACCEPTABLE },
{ "i2-msdn.sec.s-msft.com", NULL, "i2-msdn\\.sec\\.s-msft" TLD, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_SYSTEM_OS, NDPI_PROTOCOL_ACCEPTABLE },
{ ".webtrends.com", NULL, "\\.webtrends" TLD, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ ".msecnd.net", NULL, "\\.msecnd" TLD, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "bing.com", NULL, "bing" TLD, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".visualstudio.com", NULL, "\\.visualstudio" TLD, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_SAFE },
{ "login.live.com", NULL, "login\\.live" TLD, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".microsoft.com", NULL, NULL, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE }, { "bn1301.storage.live.com", NULL, "bn1301\\.storage\\.live" TLD, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE,NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "i-msdn.sec.s-msft.com", NULL, NULL, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_SYSTEM_OS, NDPI_PROTOCOL_ACCEPTABLE }, { "*.gateway.messenger.live.com", NULL, "\\*\\.gateway\\.messenger\\.live" TLD, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "i2-msdn.sec.s-msft.com", NULL, NULL, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_SYSTEM_OS, NDPI_PROTOCOL_ACCEPTABLE }, { "skyapi.live.net", NULL, "skyapi\\.live" TLD, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ ".webtrends.com", NULL, NULL, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "d.docs.live.net", NULL, "d\\.docs\\.live" TLD, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ ".msecnd.net", NULL, NULL, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "onedrive.live.com", NULL, "onedrive\\.live" TLD, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "bing.com", NULL, NULL, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ ".visualstudio.com", NULL, NULL, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_SAFE },
{ "login.live.com", NULL, NULL, "Microsoft", NDPI_PROTOCOL_MICROSOFT, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_SAFE },
{ "bn1301.storage.live.com", NULL, NULL, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE,NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE }, { "update.microsoft.com", NULL, "update\\.microsoft" TLD, "WindowsUpdate", NDPI_PROTOCOL_WINDOWS_UPDATE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "*.gateway.messenger.live.com", NULL, NULL, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE }, { ".windowsupdate.com", NULL, "\\.windowsupdate" TLD, "WindowsUpdate", NDPI_PROTOCOL_WINDOWS_UPDATE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "skyapi.live.net", NULL, NULL, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "d.docs.live.net", NULL, NULL, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "onedrive.live.com", NULL, NULL, "MS_OneDrive", NDPI_PROTOCOL_MS_ONE_DRIVE, NDPI_PROTOCOL_CATEGORY_CLOUD, NDPI_PROTOCOL_ACCEPTABLE },
{ "update.microsoft.com", NULL, NULL, "WindowsUpdate", NDPI_PROTOCOL_WINDOWS_UPDATE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE }, { "worldofwarcraft.com", NULL, "worldofwarcraft" TLD, "WorldOfWarcraft", NDPI_PROTOCOL_WORLDOFWARCRAFT, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".windowsupdate.com", NULL, NULL, "WindowsUpdate", NDPI_PROTOCOL_WINDOWS_UPDATE, NDPI_PROTOCOL_CATEGORY_SW_UPDATE, NDPI_PROTOCOL_SAFE },
{ "worldofwarcraft.com", NULL, NULL, "WorldOfWarcraft", NDPI_PROTOCOL_WORLDOFWARCRAFT, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN }, { ".anchorfree.", NULL, "\\.anchorfree" TLD, "HotspotShield", NDPI_PROTOCOL_HOTSPOT_SHIELD, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS },
{ "hotspotshield.com", NULL, "hotspotshield" TLD, "HotspotShield", NDPI_PROTOCOL_HOTSPOT_SHIELD, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS },
{ ".northghost.com", NULL, "\\.northghost" TLD, "HotspotShield", NDPI_PROTOCOL_HOTSPOT_SHIELD, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS },
{ ".anchorfree.", NULL, NULL, "HotspotShield", NDPI_PROTOCOL_HOTSPOT_SHIELD, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS }, { ".webex.com", NULL, "\\.webex" TLD, "Webex", NDPI_PROTOCOL_WEBEX, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE },
{ "hotspotshield.com", NULL, NULL, "HotspotShield", NDPI_PROTOCOL_HOTSPOT_SHIELD, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS },
{ ".northghost.com", NULL, NULL, "HotspotShield", NDPI_PROTOCOL_HOTSPOT_SHIELD, NDPI_PROTOCOL_CATEGORY_VPN, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS },
{ ".webex.com", NULL, NULL, "Webex", NDPI_PROTOCOL_WEBEX, NDPI_PROTOCOL_CATEGORY_VOIP, NDPI_PROTOCOL_ACCEPTABLE }, { ".ocsdomain.com", NULL, "\\.ocsdomain" TLD, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "ocs.fr", NULL, "ocs" TLD, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".ocs.fr", NULL, NULL, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".labgency.ws", NULL, ".labgency" TLD, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".ocsdomain.com", NULL, NULL, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { ".iflix.com", NULL, "\\.iflix" TLD, "IFLIX", NDPI_PROTOCOL_IFLIX, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "ocs.fr", NULL, NULL, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { ".app.iflixcorp.com", NULL, "\\.app\\.iflixcorp" TLD, "IFLIX", NDPI_PROTOCOL_IFLIX, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".ocs.fr", NULL, NULL, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { ".images.iflixassets.com", NULL, "\\.images\\.iflixassets" TLD, "IFLIX", NDPI_PROTOCOL_IFLIX, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".labgency.ws", NULL, NULL, "OCS", NDPI_PROTOCOL_OCS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".iflix.com", NULL, NULL, "IFLIX", NDPI_PROTOCOL_IFLIX, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "crl.microsoft.com", NULL, "crl\\.microsoft" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".app.iflixcorp.com", NULL, NULL, "IFLIX", NDPI_PROTOCOL_IFLIX, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "evsecure-ocsp.verisign.com", NULL, "evsecure-ocsp\\.verisign" TLD,"Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".images.iflixassets.com", NULL, NULL, "IFLIX", NDPI_PROTOCOL_IFLIX, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "evsecure-aia.verisign.com", NULL, "evsecure-aia\\.verisign" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "evsecure-crl.verisign.com", NULL, "evsecure-crl\\.verisign" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "crl.microsoft.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".omniroot.com", NULL, "\\.omniroot" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "evsecure-ocsp.verisign.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".microsoftonline.com", NULL, "\\.microsoftonline" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "evsecure-aia.verisign.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".office365.com", NULL, "\\.office365" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "evsecure-crl.verisign.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".office.com", NULL, "\\.office" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".omniroot.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "office.net", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".microsoftonline.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".msocsp.com", NULL, "\\.msocsp" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".office365.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".msocdn.com", NULL, "\\.msocdn" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".office.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "officeapps.live.com", NULL, "officeapps\\.live" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".msocsp.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "outlook.live.com", NULL, "outlook\\.live" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".msocdn.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "office.live.com", NULL, "office\\.live" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "officeapps.live.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".onenote.", NULL, "\\.onenote" TLD, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "outlook.live.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "office.live.com", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".onenote.", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "office.net", NULL, NULL, "Office365", NDPI_PROTOCOL_OFFICE_365, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
/* http://www.urlquery.net/report.php?id=1453233646161 */ /* http://www.urlquery.net/report.php?id=1453233646161 */
{ "lifedom.top", NULL, NULL, "Cloudflare", NDPI_PROTOCOL_CLOUDFLARE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "lifedom.top", NULL, "lifedom" TLD, "Cloudflare", NDPI_PROTOCOL_CLOUDFLARE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "coby.ns.cloudflare.com", NULL, NULL, "Cloudflare", NDPI_PROTOCOL_CLOUDFLARE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "coby.ns.cloudflare.com", NULL, "coby\\.ns\\.cloudflare" TLD, "Cloudflare", NDPI_PROTOCOL_CLOUDFLARE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "amanda.ns.cloudflare.com", NULL, NULL, "Cloudflare", NDPI_PROTOCOL_CLOUDFLARE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "amanda.ns.cloudflare.com", NULL, "amanda\\.ns\\.cloudflare" TLD, "Cloudflare", NDPI_PROTOCOL_CLOUDFLARE, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ "d295hzzivaok4k.cloudfront.net", NULL, NULL,"OpenDNS", NDPI_PROTOCOL_OPENDNS, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE }, { "d295hzzivaok4k.cloudfront.net", NULL, "d295hzzivaok4k\\.cloudfront" TLD,"OpenDNS", NDPI_PROTOCOL_OPENDNS, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_ACCEPTABLE },
{ ".opendns.com", NULL, NULL, "OpenDNS", NDPI_PROTOCOL_OPENDNS, NDPI_PROTOCOL_CATEGORY_NETWORK, NDPI_PROTOCOL_ACCEPTABLE }, { ".opendns.com", NULL, "\\.opendns" TLD, "OpenDNS", NDPI_PROTOCOL_OPENDNS, NDPI_PROTOCOL_CATEGORY_NETWORK, NDPI_PROTOCOL_ACCEPTABLE },
/* https://get.slack.help/hc/en-us/articles/205138367-Troubleshooting-Slack-connection-issues */ /* https://get.slack.help/hc/en-us/articles/205138367-Troubleshooting-Slack-connection-issues */
{ "slack.com", NULL, NULL, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "slack.com", NULL, "slack" TLD, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".slack-msgs.com", NULL, NULL, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".slack-msgs.com", NULL, "\\.slack-msgs" TLD, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "slack-files.com", NULL, NULL, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "slack-files.com", NULL, "slack-files" TLD, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "slack-imgs.com", NULL, NULL, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "slack-imgs.com", NULL, "slack-imgs" TLD, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".slack-edge.com", NULL, NULL, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".slack-edge.com", NULL, "\\.slack-edge" TLD, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".slack-core.com", NULL, NULL, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { ".slack-core.com", NULL, "\\.slack-core" TLD, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "slack-redir.net", NULL, NULL, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "slack-redir.net", NULL, "slack-redir" TLD, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
/* Detected "slack-assets2.s3-us-west-2.amazonaws.com.". Omitted "*amazonaws.com" CDN, but no generic pattern to use on first part */ /* Detected "slack-assets2.s3-us-west-2.amazonaws.com.". Omitted "*amazonaws.com" CDN, but no generic pattern to use on first part */
{ "slack-assets2.s3-", NULL, NULL, "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "slack-assets2.s3-", NULL, "slack-assets2\\.s3-", "Slack", NDPI_PROTOCOL_SLACK, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "github.com", NULL, NULL, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "zhiliaoapp.com", NULL, "zhiliaoapp" TLD, "Musical.ly", NDPI_PROTOCOL_MUSICALLY, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".github.com", NULL, NULL, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "muscdn.com", NULL, "muscdn" TLD, "Musical.ly", NDPI_PROTOCOL_MUSICALLY, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "github.io", NULL, NULL, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "livelycdn.com", NULL, "livelycdn" TLD, "Musical.ly", NDPI_PROTOCOL_MUSICALLY, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".github.io", NULL, NULL, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "direct.ly", NULL, "direct\\.ly$", "Musical.ly", NDPI_PROTOCOL_MUSICALLY, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "githubusercontent.com", NULL, NULL, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".githubusercontent.com", NULL, NULL, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE }, { "github.com", NULL, "github" TLD, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".github.com", NULL, "\\.github" TLD, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "github.io", NULL, NULL, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".github.io", NULL, NULL, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ "githubusercontent.com", NULL, "githubusercontent" TLD, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".githubusercontent.com", NULL, "\\.githubusercontent" TLD, "Github", NDPI_PROTOCOL_GITHUB, NDPI_PROTOCOL_CATEGORY_COLLABORATIVE, NDPI_PROTOCOL_ACCEPTABLE },
{ ".iqiyi.com", NULL, NULL, "iQIYI", NDPI_PROTOCOL_IQIYI, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".steampowered.com", NULL, "\\.steampowered" TLD, "Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".qiyi.com", NULL, NULL, "iQIYI", NDPI_PROTOCOL_IQIYI, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { "steamcommunity.com", NULL, "steamcommunity" TLD, "Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".71.am", NULL, NULL, "iQIYI", NDPI_PROTOCOL_IQIYI, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".steamcontent.com", NULL, "\\.steamcontent" TLD, "Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".qiyipic.com", NULL, NULL, "iQIYI", NDPI_PROTOCOL_IQIYI, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".steamstatic.com", NULL, "\\.steamstatic" TLD, "Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ "steamcommunity-a.akamaihd.net", NULL, "steamcommunity-a\\.akamaihd" TLD,"Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".ppstream.com", NULL, NULL, "PPStream", NDPI_PROTOCOL_PPSTREAM, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".wechat.com", NULL, "\\.wechat\\.com", "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".pps.tv", NULL, NULL, "PPStream", NDPI_PROTOCOL_PPSTREAM, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".wechat.org", NULL, "\\.wechat\\.org", "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".wechatapp.com", NULL, "\\.wechatapp" TLD, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".we.chat", NULL, "\\.we\\.chat", "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".wx.", NULL, "\\.wx\\.", "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".weixin.", NULL, "\\.weixin\\.", "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".mmsns.qpic.cn", NULL, "\\.mmsns\\.qpic" TLD, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".1kxun.", NULL, NULL, "1kxun", NDPI_PROTOCOL_1KXUN, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { "dnscrypt.org", NULL, "dnscrypt\\.org$", "DNScrypt", NDPI_PROTOCOL_DNSCRYPT, NDPI_PROTOCOL_CATEGORY_NETWORK, NDPI_PROTOCOL_ACCEPTABLE },
{ "tcad.wedolook.com", NULL, NULL, "1kxun", NDPI_PROTOCOL_1KXUN, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".steampowered.com", NULL, NULL, "Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN }, { "torrent.", NULL, "torrent" TLD, "BitTorrent", NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_UNSAFE },
{ "steamcommunity.com", NULL, NULL, "Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN }, { "torrents.", NULL, "torrents" TLD, "BitTorrent", NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_UNSAFE },
{ ".steamcontent.com", NULL, NULL, "Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN }, { "torrentz.", NULL, "torrentz" TLD, "BitTorrent", NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_UNSAFE },
{ ".steamstatic.com", NULL, NULL, "Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ "steamcommunity-a.akamaihd.net", NULL, NULL,"Steam", NDPI_PROTOCOL_STEAM, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".wechat.com", NULL, NULL, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { ".nintendo.net", NULL, "\\.nintendo" TLD, "Nintendo", NDPI_PROTOCOL_NINTENDO, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".wechat.org", NULL, NULL, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN }, { ".nintendo.com", NULL, NULL, "Nintendo", NDPI_PROTOCOL_NINTENDO, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".wechatapp.com", NULL, NULL, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".we.chat", NULL, NULL, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".wx.", NULL, NULL, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".weixin.", NULL, NULL, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ ".mmsns.qpic.cn", NULL, NULL, "WeChat", NDPI_PROTOCOL_WECHAT, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_FUN },
{ "dnscrypt.org", NULL, NULL, "DNScrypt", NDPI_PROTOCOL_DNSCRYPT, NDPI_PROTOCOL_CATEGORY_NETWORK, NDPI_PROTOCOL_ACCEPTABLE }, { ".playstation.net", NULL, "\\.playstation" TLD, "Playstation", NDPI_PROTOCOL_PLAYSTATION, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".playstation.com", NULL, NULL, "Playstation", NDPI_PROTOCOL_PLAYSTATION, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".sonyentertainmentnetwork.com", NULL, "\\.sonyentertainmentnetwork" TLD,"Playstation", NDPI_PROTOCOL_PLAYSTATION, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ "torrent.", NULL, NULL, "BitTorrent", NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_UNSAFE }, { ".linkedin.com", NULL, "\\.linkedin" TLD, "LinkedIn", NDPI_PROTOCOL_LINKEDIN, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "torrents.", NULL, NULL, "BitTorrent", NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_UNSAFE }, { ".licdn.com", NULL, "\\.licdn" TLD, "LinkedIn", NDPI_PROTOCOL_LINKEDIN, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ "torrentz.", NULL, NULL, "BitTorrent", NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_UNSAFE },
{ ".nintendo.net", NULL, NULL, "Nintendo", NDPI_PROTOCOL_NINTENDO, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN }, { ".sndcdn.com", NULL, "\\.sndcdn" TLD, "SoundCloud", NDPI_PROTOCOL_SOUNDCLOUD, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".nintendo.com", NULL, NULL, "Nintendo", NDPI_PROTOCOL_NINTENDO, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN }, { ".soundcloud.com", NULL, "\\.soundcloud" TLD, "SoundCloud", NDPI_PROTOCOL_SOUNDCLOUD, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".playstation.net", NULL, NULL, "Playstation", NDPI_PROTOCOL_PLAYSTATION, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN }, { "getrockerbox.com", NULL, "getrockerbox" TLD, "SoundCloud", NDPI_PROTOCOL_SOUNDCLOUD, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".playstation.com", NULL, NULL, "Playstation", NDPI_PROTOCOL_PLAYSTATION, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".sonyentertainmentnetwork.com", NULL, NULL,"Playstation", NDPI_PROTOCOL_PLAYSTATION, NDPI_PROTOCOL_CATEGORY_GAME, NDPI_PROTOCOL_FUN },
{ ".pastebin.com", NULL, NULL, "Pastebin", NDPI_PROTOCOL_PASTEBIN, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS }, { "web.telegram.org", NULL, "web\\.telegram" TLD, "Telegram", NDPI_PROTOCOL_TELEGRAM, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
{ "tdesktop.com", NULL, "tdesktop" TLD, "Telegram", NDPI_PROTOCOL_TELEGRAM, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
{ "tupdate.com", NULL, "tupdate" TLD, "Telegram", NDPI_PROTOCOL_TELEGRAM, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
{ ".linkedin.com", NULL, NULL, "LinkedIn", NDPI_PROTOCOL_LINKEDIN, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN }, { ".pastebin.com", NULL, "\\.pastebin" TLD, "Pastebin", NDPI_PROTOCOL_PASTEBIN, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_POTENTIALLY_DANGEROUS },
{ ".licdn.com", NULL, NULL, "LinkedIn", NDPI_PROTOCOL_LINKEDIN, NDPI_PROTOCOL_CATEGORY_SOCIAL_NETWORK, NDPI_PROTOCOL_FUN },
{ ".sndcdn.com", NULL, NULL, "SoundCloud", NDPI_PROTOCOL_SOUNDCLOUD, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".ppstream.com", NULL, "\\.ppstream" TLD, "PPStream", NDPI_PROTOCOL_PPSTREAM, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".soundcloud.com", NULL, NULL, "SoundCloud", NDPI_PROTOCOL_SOUNDCLOUD, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN }, { ".pps.tv", NULL, "\\.pps\\.tv$", "PPStream", NDPI_PROTOCOL_PPSTREAM, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "getrockerbox.com", NULL, NULL, "SoundCloud", NDPI_PROTOCOL_SOUNDCLOUD, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "web.telegram.org", NULL, NULL, "Telegram", NDPI_PROTOCOL_TELEGRAM, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE }, /*
{ "tdesktop.com", NULL, NULL, "Telegram", NDPI_PROTOCOL_TELEGRAM, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE }, VidTO streaming service
{ "tupdate.com", NULL, NULL, "Telegram", NDPI_PROTOCOL_TELEGRAM, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE }, NOTE: this is a possible candidate for NDPI_PROTOCOL_GENERIC
*/
{ ".vidto.me", NULL, "\\.vidto" TLD, "VidTO", NDPI_PROTOCOL_PPSTREAM, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".vidto.se", NULL, NULL, "VidTO", NDPI_PROTOCOL_PPSTREAM, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".icq.", NULL, NULL, "ICQ", NDPI_PROTOCOL_ICQ, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE }, /*
{ "icq.", NULL, NULL, "ICQ", NDPI_PROTOCOL_ICQ, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE }, Not so popular services without a protocl dissector (and thus not worth a protocolId) that are handled/detected by categpory rather
than by protocol id. They are bound to a generic protocol (NDPI_PROTOCOL_GENERIC) and placed onto the right category
*/
{ "quickplay.com", NULL, "quickplay" TLD, "QuickPlay", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".iqiyi.com", NULL, "\\.iqiyi" TLD, "iQIYI", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".qiyi.com", NULL, "\\.qiyi" TLD, "iQIYI", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".71.am", NULL, "\\.71" TLD, "iQIYI", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".qiyipic.com", NULL, "\\.qiyipic" TLD, "iQIYI", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".1kxun.", NULL, "\\.1kxun\\.", "1kxun", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "tcad.wedolook.com", NULL, "tcad\\.wedolook" TLD, "1kxun", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ "baidu.com", NULL, "baidu" TLD, "baidu", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_WEB, NDPI_PROTOCOL_FUN },
{ "icq.", NULL, "icq" TLD, "ICQ", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
{ ".icq.", NULL, NULL, "ICQ", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_CHAT, NDPI_PROTOCOL_ACCEPTABLE },
/* RapidVideo streaming */
{ ".rapidvideo.com", NULL, "\\.rapidvideo" TLD, "RapidVideo", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
{ ".playercdn.net", NULL, "\\.playercdn" TLD, "RapidVideo", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_STREAMING, NDPI_PROTOCOL_FUN },
/* showmax.com video streaming */
{ "showmax.com", NULL, "showmax" TLD, "Showmax", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "showmax.akamaized.net", NULL, "showmax\\.akamaized" TLD, "Showmax", NDPI_PROTOCOL_GENERIC, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ NULL, NULL, NULL, 0 } { NULL, NULL, NULL, 0 }
}; };
@@ -8332,44 +8425,43 @@ ndpi_protocol_match host_match[] = {
Mime-type content match match Mime-type content match match
*/ */
ndpi_protocol_match content_match[] = { ndpi_protocol_match content_match[] = {
{ "audio/mpeg", NULL, NULL, NULL, NDPI_CONTENT_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "audio/mpeg", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "audio/x-mpeg", NULL, NULL, NULL, NDPI_CONTENT_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "audio/x-mpeg", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "audio/mpeg3", NULL, NULL, NULL, NDPI_CONTENT_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "audio/mpeg3", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "audio/mp4a", NULL, NULL, NULL, NDPI_CONTENT_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "audio/mp4a", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/mpeg", NULL, NULL, NULL, NDPI_CONTENT_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/mpeg", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/nsv", NULL, NULL, NULL, NDPI_CONTENT_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/nsv", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "misc/ultravox", NULL, NULL, NULL, NDPI_CONTENT_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "misc/ultravox", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "audio/ogg", NULL, NULL, NULL, NDPI_CONTENT_OGG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "audio/ogg", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_OGG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/ogg", NULL, NULL, NULL, NDPI_CONTENT_OGG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/ogg", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_OGG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/ogg", NULL, NULL, NULL, NDPI_CONTENT_OGG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "application/ogg", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_OGG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ ".adobe.", NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { ".adobe.", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/flv", NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/flv", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/x-flv", NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/x-flv", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/x-fcs", NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "application/x-fcs", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/x-shockwave-flash",NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE }, { "application/x-shockwave-flash",NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE },
{ "video/flash", NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/flash", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/flv", NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "application/flv", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "flv-application/octet-stream", NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "flv-application/octet-stream", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/futuresplash", NULL, NULL, NULL, NDPI_CONTENT_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "application/futuresplash", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_FLASH, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/quicktime", NULL, NULL, NULL, NDPI_CONTENT_QUICKTIME, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/quicktime", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_QUICKTIME, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/mp4", NULL, NULL, NULL, NDPI_CONTENT_QUICKTIME, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/mp4", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_QUICKTIME, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/x-m4v", NULL, NULL, NULL, NDPI_CONTENT_QUICKTIME, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/x-m4v", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_QUICKTIME, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "audio/x-pn-realaudio", NULL, NULL, NULL, NDPI_CONTENT_REALMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "audio/x-pn-realaudio", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_REALMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/vnd.rn-realmedia", NULL, NULL, NULL, NDPI_CONTENT_REALMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "application/vnd.rn-realmedia", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_REALMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/x-ms-", NULL, NULL, NULL, NDPI_CONTENT_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/x-ms-", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "asf", NULL, NULL, NULL, NDPI_CONTENT_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "asf", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "asx", NULL, NULL, NULL, NDPI_CONTENT_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "asx", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/x-msvideo", NULL, NULL, NULL, NDPI_CONTENT_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/x-msvideo", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "audio/x-wav", NULL, NULL, NULL, NDPI_CONTENT_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "audio/x-wav", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/vnd.ms.wms-hdr.asfv1", NULL, NULL, NULL, NDPI_CONTENT_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "application/vnd.ms.wms-hdr.asfv1", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "NSPlayer/", NULL, NULL, NULL, NDPI_CONTENT_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "NSPlayer/", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/x-mms-framed", NULL, NULL, NULL, NDPI_CONTENT_MMS, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "Xbox Live Client/", NULL, NULL, NULL, NDPI_PROTOCOL_XBOX, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "Xbox Live Client/", NULL, NULL, NULL, NDPI_PROTOCOL_XBOX, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "Windows-Update-Agent", NULL, NULL, NULL, NDPI_PROTOCOL_WINDOWS_UPDATE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE }, { "Windows-Update-Agent", NULL, NULL, NULL, NDPI_PROTOCOL_WINDOWS_UPDATE, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_ACCEPTABLE },
{ "audio/webm", NULL, NULL, NULL, NDPI_CONTENT_WEBM, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "audio/webm", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WEBM, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "video/webm", NULL, NULL, NULL, NDPI_CONTENT_WEBM, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "video/webm", NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_WEBM, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/x-rtsp-tunnelled", NULL, NULL, NULL, NDPI_PROTOCOL_RTSP, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "application/x-rtsp-tunnelled", NULL, NULL, NULL, NDPI_PROTOCOL_RTSP, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/vnd.apple.mpegurl",NULL, NULL, NULL, NDPI_CONTENT_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN }, { "application/vnd.apple.mpegurl",NULL, NULL, NULL, NDPI_CONTENT_CATEGORY_MPEG, NDPI_PROTOCOL_CATEGORY_MEDIA, NDPI_PROTOCOL_FUN },
{ "application/x-tar", NULL, NULL, NULL, NDPI_PROTOCOL_HTTP_DOWNLOAD, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_ACCEPTABLE }, { "application/x-tar", NULL, NULL, NULL, NDPI_PROTOCOL_HTTP_DOWNLOAD, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_ACCEPTABLE },
{ "application/octet-stream", NULL, NULL, NULL, NDPI_PROTOCOL_HTTP_DOWNLOAD, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_ACCEPTABLE }, { "application/octet-stream", NULL, NULL, NULL, NDPI_PROTOCOL_HTTP_DOWNLOAD, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_ACCEPTABLE },
{ "application/mac-binary", NULL, NULL, NULL, NDPI_PROTOCOL_HTTP_DOWNLOAD, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_ACCEPTABLE }, { "application/mac-binary", NULL, NULL, NULL, NDPI_PROTOCOL_HTTP_DOWNLOAD, NDPI_PROTOCOL_CATEGORY_DOWNLOAD_FT, NDPI_PROTOCOL_ACCEPTABLE },
+904 -268
View File
File diff suppressed because it is too large Load Diff
+2 -6
View File
@@ -1,8 +1,8 @@
/* /*
* afp.c * afp.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-11 by ipoque GmbH
* Copyright (C) 2011-16 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_AFP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AFP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AFP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -100,5 +98,3 @@ void init_afp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* aimini.c * aimini.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_AIMINI
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AIMINI #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AIMINI
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -293,5 +291,3 @@ void init_aimini_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
*id += 1; *id += 1;
} }
#endif
+149
View File
@@ -0,0 +1,149 @@
/*
* ajp.c
*
* Copyright (C) 2018 by Leonn Paiva <leonn.paiva@gmail.com>
*
* This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH
*
* nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nDPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ndpi_protocol_ids.h"
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AJP
#include "ndpi_api.h"
enum ajp_direction {
AJP_SERVER_TO_CONTAINER = 0x1234,
AJP_CONTAINER_TO_SERVER = 0x4142
};
enum ajp_packet_type {
AJP_UNKNOWN = 0,
/* packet types */
AJP_FORWARD_REQUEST = 2,
AJP_SEND_BODY_CHUNK = 3,
AJP_SEND_HEADERS = 4,
AJP_END_RESPONSE = 5,
AJP_GET_BODY_CHUNK = 6,
AJP_SHUTDOWN = 7,
AJP_PING = 8,
AJP_CPONG = 9,
AJP_CPING = 10,
AJP_BODY = 11
};
struct ajp_header {
uint16_t magic;
uint16_t len;
uint8_t code;
};
static void set_ajp_detected(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow) {
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
ndpi_search_tcp_or_udp(ndpi_struct, flow);
/* If no custom protocol has been detected */
/* if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) */
ndpi_int_reset_protocol(flow);
ndpi_set_detected_protocol(ndpi_struct, flow, flow->guessed_host_protocol_id, NDPI_PROTOCOL_AJP);
}
}
/*************************************************************************************************/
static void ndpi_check_ajp(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow)
{
struct ajp_header ajp_hdr;
struct ndpi_packet_struct *packet = &flow->packet;
if (packet->payload_packet_len < 5 /* ajp_header size*/) {
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return;
}
ajp_hdr = *((struct ajp_header *) (packet->payload));
ajp_hdr.magic = ntohs(ajp_hdr.magic);
ajp_hdr.len = ntohs(ajp_hdr.len);
if (ajp_hdr.len > 0 && ajp_hdr.magic == AJP_SERVER_TO_CONTAINER) {
if (ajp_hdr.code == AJP_FORWARD_REQUEST || ajp_hdr.code == AJP_SHUTDOWN
|| ajp_hdr.code == AJP_PING || ajp_hdr.code == AJP_CPING) {
set_ajp_detected(ndpi_struct, flow);
} else {
NDPI_LOG_DBG(ndpi_struct, "Invalid AJP request type");
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
}
} else if (ajp_hdr.len > 0 && ajp_hdr.magic == AJP_CONTAINER_TO_SERVER) {
if (ajp_hdr.code == AJP_SEND_BODY_CHUNK || ajp_hdr.code == AJP_SEND_HEADERS
|| ajp_hdr.code == AJP_END_RESPONSE || ajp_hdr.code == AJP_GET_BODY_CHUNK
|| ajp_hdr.code == AJP_CPONG) {
set_ajp_detected(ndpi_struct, flow);
} else {
NDPI_LOG_DBG(ndpi_struct, "Invalid AJP response type");
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
}
} else {
NDPI_LOG_DBG(ndpi_struct,"Invalid AJP packet\n");
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
}
}
void ndpi_search_ajp(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow)
{
struct ndpi_packet_struct *packet = &flow->packet;
// Break after 20 packets.
if(flow->packet_counter > 20) {
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return;
}
if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN) {
return;
}
NDPI_LOG_DBG(ndpi_struct, "search AJP\n");
ndpi_check_ajp(ndpi_struct, flow);
return;
}
/* ********************************* */
void init_ajp_dissector(struct ndpi_detection_module_struct *ndpi_struct,
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("AJP", ndpi_struct, detection_bitmask,
*id, NDPI_PROTOCOL_AJP, ndpi_search_ajp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}
+1 -4
View File
@@ -1,7 +1,7 @@
/* /*
* amqp.c * amqp.c
* *
* Copyright (C) 2011-17 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -20,8 +20,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_AMQP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AMQP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AMQP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -87,4 +85,3 @@ void init_amqp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
} }
#endif
-5
View File
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_APPLE_PUSH
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_APPLE_PUSH #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_APPLE_PUSH
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -76,6 +74,3 @@ void init_apple_push_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* applejuice.c * applejuice.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_APPLEJUICE
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_APPLEJUICE #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_APPLEJUICE
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -67,5 +65,3 @@ void init_applejuice_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+1 -6
View File
@@ -2,7 +2,7 @@
* armagetron.c * armagetron.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_ARMAGETRON
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ARMAGETRON #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ARMAGETRON
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -109,6 +107,3 @@ void init_armagetron_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+1 -1
View File
@@ -2,7 +2,7 @@
* flash.c * flash.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
+1 -1
View File
@@ -2,7 +2,7 @@
* ftp.c * ftp.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
+1 -1
View File
@@ -2,7 +2,7 @@
* manolito.c * manolito.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
+1 -1
View File
@@ -2,7 +2,7 @@
* popo.c * popo.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
+1 -1
View File
@@ -2,7 +2,7 @@
* secondlife.c * secondlife.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* ayiya.c * ayiya.c
* *
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -28,8 +28,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_AYIYA
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AYIYA #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AYIYA
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -85,5 +83,3 @@ void init_ayiya_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_in
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* battlefield.c * battlefield.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_BATTLEFIELD
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BATTLEFIELD #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BATTLEFIELD
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -126,5 +124,3 @@ void init_battlefield_dissector(struct ndpi_detection_module_struct *ndpi_struct
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* bgp.c * bgp.c
* *
* Copyright (C) 2016 - ntop.org * Copyright (C) 2016-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_BGP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BGP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BGP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -67,5 +65,3 @@ void init_bgp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
+5 -6
View File
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_BITTORRENT
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BITTORRENT #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BITTORRENT
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -57,7 +55,8 @@ static u_int8_t is_utp_pkt(const u_int8_t *payload, u_int payload_len) {
return(1); return(1);
} }
static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow, static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow,
int bt_offset, int check_hash, int bt_offset, int check_hash,
const u_int8_t save_detection, const u_int8_t encrypted_connection) const u_int8_t save_detection, const u_int8_t encrypted_connection)
{ {
@@ -73,7 +72,9 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc
} else } else
bt_hash = (const char*)&flow->packet.payload[28]; bt_hash = (const char*)&flow->packet.payload[28];
if(bt_hash) memcpy(flow->protos.bittorrent.hash, bt_hash, 20); if(!ndpi_struct->disable_metadata_export) {
if(bt_hash) memcpy(flow->protos.bittorrent.hash, bt_hash, 20);
}
} }
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN); ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN);
@@ -500,5 +501,3 @@ void init_bittorrent_dissector(struct ndpi_detection_module_struct *ndpi_struct,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+3 -9
View File
@@ -1,16 +1,14 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_BJNP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BJNP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BJNP
#include "ndpi_api.h" #include "ndpi_api.h"
static void ndpi_int_bjnp_add_connection(struct ndpi_detection_module_struct *ndpi_struct, static void ndpi_int_bjnp_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
u_int8_t due_to_correlation) u_int8_t due_to_correlation) {
{ ndpi_set_detected_protocol(ndpi_struct, flow,
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BJNP, NDPI_PROTOCOL_UNKNOWN); NDPI_PROTOCOL_BJNP, NDPI_PROTOCOL_UNKNOWN);
} }
@@ -61,7 +59,3 @@ void init_bjnp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+3 -1
View File
@@ -1,7 +1,7 @@
/* /*
* btlib.c * btlib.c
* *
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* Contributed by Vitaly Lavrov <vel21ripn@gmail.com> * Contributed by Vitaly Lavrov <vel21ripn@gmail.com>
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
@@ -22,6 +22,8 @@
* *
*/ */
#include "ndpi_api.h"
#ifndef NDPI_NO_STD_INC #ifndef NDPI_NO_STD_INC
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
+1 -6
View File
@@ -1,7 +1,7 @@
/* /*
* checkmk.c * checkmk.c
* *
* Copyright (C) 2011-17 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
*/ */
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_CHECKMK
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CHECKMK #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CHECKMK
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -82,6 +80,3 @@ void init_checkmk_dissector(struct ndpi_detection_module_struct *ndpi_struct,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
-4
View File
@@ -6,8 +6,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_CISCOVPN
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CISCOVPN #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CISCOVPN
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -84,5 +82,3 @@ void init_ciscovpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* citrix.c * citrix.c
* *
* Copyright (C) 2012-15 - ntop.org * Copyright (C) 2012-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_CITRIX
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CITRIX #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CITRIX
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -95,5 +93,3 @@ void init_citrix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
-4
View File
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_COAP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_COAP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_COAP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -163,5 +161,3 @@ void init_coap_dissector (struct ndpi_detection_module_struct *ndpi_struct,
*id +=1; *id +=1;
} }
#endif // NDPI_PROTOCOL_COAP
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* collectd.c * collectd.c
* *
* Copyright (C) 2014 - ntop.org * Copyright (C) 2014-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -21,8 +21,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_COLLECTD
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_COLLECTD #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_COLLECTD
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -54,5 +52,3 @@ void ndpi_search_collectd(struct ndpi_detection_module_struct *ndpi_struct, stru
NDPI_EXCLUDE_PROTO(ndpi_struct, flow); NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
} }
} }
#endif
-3
View File
@@ -20,8 +20,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_CORBA
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CORBA #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CORBA
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -60,4 +58,3 @@ void init_corba_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_in
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* crossfire.c * crossfire.c
* *
* Copyright (C) 2012-15 - ntop.org * Copyright (C) 2012-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_CROSSFIRE
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CROSSFIRE #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CROSSFIRE
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -88,5 +86,3 @@ void init_crossfire_dissector(struct ndpi_detection_module_struct *ndpi_struct,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
-4
View File
@@ -22,8 +22,6 @@
*/ */
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_CSGO
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CSGO #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CSGO
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -122,5 +120,3 @@ void init_csgo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
} }
#endif
+1 -4
View File
@@ -1,7 +1,7 @@
/* /*
* dcerpc.c * dcerpc.c
* *
* Copyright (C) 2011-13 by ntop.org * Copyright (C) 2011-18 by ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DCERPC
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DCERPC #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DCERPC
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -69,4 +67,3 @@ void init_dcerpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
*id += 1; *id += 1;
} }
#endif
+30 -28
View File
@@ -1,7 +1,7 @@
/* /*
* dhcp.c * dhcp.c
* *
* Copyright (C) 2016 - ntop.org * Copyright (C) 2016-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -20,8 +20,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DHCP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DHCP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DHCP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -102,34 +100,40 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
if(msg_type <= 8) foundValidMsgType = 1; if(msg_type <= 8) foundValidMsgType = 1;
} else if(id == 55 /* Parameter Request List / Fingerprint */) { } else if(id == 55 /* Parameter Request List / Fingerprint */) {
u_int idx, offset = 0; if(!ndpi_struct->disable_metadata_export) {
u_int idx, offset = 0;
for(idx = 0; idx < len && offset < sizeof(flow->protos.dhcp.fingerprint) - 2; idx++) {
snprintf((char*)&flow->protos.dhcp.fingerprint[offset], for(idx = 0; idx < len && offset < sizeof(flow->protos.dhcp.fingerprint) - 2; idx++) {
sizeof(flow->protos.dhcp.fingerprint) - offset, snprintf((char*)&flow->protos.dhcp.fingerprint[offset],
"%02X", dhcp->options[i+2+idx] & 0xFF); sizeof(flow->protos.dhcp.fingerprint) - offset,
offset += 2; "%02X", dhcp->options[i+2+idx] & 0xFF);
offset += 2;
}
flow->protos.dhcp.fingerprint[sizeof(flow->protos.dhcp.fingerprint) - 1] = '\0';
} }
flow->protos.dhcp.fingerprint[sizeof(flow->protos.dhcp.fingerprint) - 1] = '\0';
} else if(id == 60 /* Class Identifier */) { } else if(id == 60 /* Class Identifier */) {
char *name = (char*)&dhcp->options[i+2]; if(!ndpi_struct->disable_metadata_export) {
int j = 0; char *name = (char*)&dhcp->options[i+2];
int j = 0;
j = ndpi_min(len, sizeof(flow->protos.dhcp.class_ident)-1);
strncpy((char*)flow->protos.dhcp.class_ident, name, j); j = ndpi_min(len, sizeof(flow->protos.dhcp.class_ident)-1);
flow->protos.dhcp.class_ident[j] = '\0'; strncpy((char*)flow->protos.dhcp.class_ident, name, j);
flow->protos.dhcp.class_ident[j] = '\0';
}
} else if(id == 12 /* Host Name */) { } else if(id == 12 /* Host Name */) {
char *name = (char*)&dhcp->options[i+2]; if(!ndpi_struct->disable_metadata_export) {
int j = 0; char *name = (char*)&dhcp->options[i+2];
int j = 0;
#ifdef DHCP_DEBUG #ifdef DHCP_DEBUG
NDPI_LOG_DBG2(ndpi_struct, "[DHCP] '%.*s'\n",name,len); NDPI_LOG_DBG2(ndpi_struct, "[DHCP] '%.*s'\n",name,len);
// while(j < len) { printf( "%c", name[j]); j++; }; printf("\n"); // while(j < len) { printf( "%c", name[j]); j++; }; printf("\n");
#endif #endif
j = ndpi_min(len, sizeof(flow->host_server_name)-1); j = ndpi_min(len, sizeof(flow->host_server_name)-1);
strncpy((char*)flow->host_server_name, name, j); strncpy((char*)flow->host_server_name, name, j);
flow->host_server_name[j] = '\0'; flow->host_server_name[j] = '\0';
}
} }
i += len + 2; i += len + 2;
@@ -160,5 +164,3 @@ void init_dhcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* dhcpv6.c * dhcpv6.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DHCPV6
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DHCPV6 #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DHCPV6
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -68,5 +66,3 @@ void init_dhcpv6_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+12 -15
View File
@@ -1,8 +1,7 @@
/* /*
* aimini.c * diameter.c
* *
* Copyright (C) 2018 - ntop.org * Copyright (C) 2018 - ntop.org
* Written by Michele Campus - <campus@ntop.org>
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -19,22 +18,22 @@
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with nDPI. If not, see <http://www.gnu.org/licenses/>. * along with nDPI. If not, see <http://www.gnu.org/licenses/>.
* *
* Based on code of:
* Michele Campus - <campus@ntop.org>
*/ */
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DIAMETER
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DIAMETER #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DIAMETER
#include "ndpi_api.h" #include "ndpi_api.h"
// Header Flags possibile values // Header Flags possibile values
#define REQUEST 0X80 #define DIAMETER_REQUEST 0X80
#define PROXYABLE 0X40 #define DIAMETER_PROXYABLE 0X40
#define ERROR 0X20 #define DIAMETER_ERROR 0X20
#define RETRASM 0X10 #define DIAMETER_RETRASM 0X10
typedef enum { typedef enum {
AC = 271, AC = 271,
@@ -73,10 +72,10 @@ int is_diameter(struct ndpi_packet_struct *packet, int size_payload)
// check if the packet is diameter // check if the packet is diameter
if(diameter->version == 0x01 && if(diameter->version == 0x01 &&
(diameter->flags == REQUEST || (diameter->flags == DIAMETER_REQUEST ||
diameter->flags == PROXYABLE || diameter->flags == DIAMETER_PROXYABLE ||
diameter->flags == ERROR || diameter->flags == DIAMETER_ERROR ||
diameter->flags == RETRASM)) { diameter->flags == DIAMETER_RETRASM)) {
u_int16_t com_code = diameter->com_code[2] + (diameter->com_code[1] << 8) + (diameter->com_code[0] << 8); u_int16_t com_code = diameter->com_code[2] + (diameter->com_code[1] << 8) + (diameter->com_code[0] << 8);
@@ -128,5 +127,3 @@ void init_diameter_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
*id += 1; *id += 1;
} }
#endif /* NDPI_PROTOCOL_DIAMETER */
+2 -7
View File
@@ -2,7 +2,7 @@
* directconnect.c * directconnect.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DIRECTCONNECT
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DIRECTCONNECT #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DIRECTCONNECT
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -80,8 +78,7 @@ static void ndpi_int_directconnect_add_connection(struct ndpi_detection_module_s
const u_int8_t connection_type) const u_int8_t connection_type)
{ {
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
struct ndpi_id_struct *src = flow->src; struct ndpi_id_struct *src = flow->src;
struct ndpi_id_struct *dst = flow->dst; struct ndpi_id_struct *dst = flow->dst;
@@ -446,5 +443,3 @@ void init_directconnect_dissector(struct ndpi_detection_module_struct *ndpi_stru
*id += 1; *id += 1;
} }
#endif
+2 -4
View File
@@ -2,7 +2,7 @@
* directdownloadlink.c * directdownloadlink.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-14svn - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DIRECT_DOWNLOAD_LINK
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -731,4 +729,4 @@ void init_directdownloadlink_dissector(struct ndpi_detection_module_struct *ndpi
*id += 1; *id += 1;
} }
#endif
+7 -7
View File
@@ -1,7 +1,7 @@
/* /*
* dns.c * dns.c
* *
* Copyright (C) 2012-16 - ntop.org * Copyright (C) 2012-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DNS
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DNS #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DNS
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -209,12 +207,16 @@ void ndpi_search_dns(struct ndpi_detection_module_struct *ndpi_struct, struct nd
flow->protos.dns.num_queries = (u_int8_t)dns_header.num_queries, flow->protos.dns.num_queries = (u_int8_t)dns_header.num_queries,
flow->protos.dns.num_answers = (u_int8_t) (dns_header.num_answers + dns_header.authority_rrs + dns_header.additional_rrs); flow->protos.dns.num_answers = (u_int8_t) (dns_header.num_answers + dns_header.authority_rrs + dns_header.additional_rrs);
if(j > 0) if(j > 0) {
ndpi_protocol_match_result ret_match;
ndpi_match_host_subprotocol(ndpi_struct, flow, ndpi_match_host_subprotocol(ndpi_struct, flow,
(char *)flow->host_server_name, (char *)flow->host_server_name,
strlen((const char*)flow->host_server_name), strlen((const char*)flow->host_server_name),
&ret_match,
NDPI_PROTOCOL_DNS); NDPI_PROTOCOL_DNS);
}
#ifdef DNS_DEBUG #ifdef DNS_DEBUG
NDPI_LOG_DBG2(ndpi_struct, "[num_queries=%d][num_answers=%d][reply_code=%u][rsp_type=%u][host_server_name=%s]\n", NDPI_LOG_DBG2(ndpi_struct, "[num_queries=%d][num_answers=%d][reply_code=%u][rsp_type=%u][host_server_name=%s]\n",
flow->protos.dns.num_queries, flow->protos.dns.num_answers, flow->protos.dns.num_queries, flow->protos.dns.num_answers,
@@ -247,5 +249,3 @@ void init_dns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
+2 -4
View File
@@ -2,7 +2,7 @@
* dofus.c * dofus.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DOFUS
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DOFUS #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DOFUS
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -151,4 +149,4 @@ void init_dofus_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_in
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* drda.c * drda.c
* *
* Copyright (C) 2012-16 - ntop.org * Copyright (C) 2012-18 - ntop.org
* *
* This module is free software: you can redistribute it and/or modify * This module is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -19,8 +19,6 @@
*/ */
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DRDA
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DRDA #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DRDA
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -103,5 +101,3 @@ void init_drda_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
} }
#endif /* NDPI_PROTOCOL_DRDA */
+1 -7
View File
@@ -1,7 +1,7 @@
/* /*
* dropbox.c * dropbox.c
* *
* Copyright (C) 2012-16 by ntop.org * Copyright (C) 2012-18 by ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_DROPBOX
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DROPBOX #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DROPBOX
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -91,7 +89,3 @@ void init_dropbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* eaq.c * eaq.c
* *
* Copyright (C) 2015 - ntop.org * Copyright (C) 2015-18 - ntop.org
* *
* This module is free software: you can redistribute it and/or modify * This module is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -27,8 +27,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_EAQ
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_EAQ #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_EAQ
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -88,5 +86,3 @@ void init_eaq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
-3
View File
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_EDONKEY
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_EDONKEY #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_EDONKEY
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -225,4 +223,3 @@ void init_edonkey_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* fasttrack.c * fasttrack.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_FASTTRACK
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FASTTRACK #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FASTTRACK
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -94,5 +92,3 @@ void init_fasttrack_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+131
View File
@@ -0,0 +1,131 @@
/*
* fbzero.c
*
* Copyright (C) 2018 - ntop.org
*
* nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nDPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ndpi_protocol_ids.h"
/* https://code.facebook.com/posts/608854979307125/building-zero-protocol-for-fast-secure-mobile-connections/ */
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FBZERO
#include "ndpi_api.h"
PACK_ON
struct fbzero_tag {
char tag[4];
u_int32_t tag_offset_len;
} PACK_OFF;
PACK_ON
struct fbzero_header {
u_int8_t flags;
char version[3];
u_int8_t unknown;
u_int32_t len;
char tag[4];
u_int16_t tag_number, _pad;
} PACK_OFF;
/* **************************************************************************** */
void ndpi_search_fbzero(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow) {
struct ndpi_packet_struct *packet = &flow->packet;
NDPI_LOG_DBG(ndpi_struct, "search FacebookZero\n");
if(packet->payload_packet_len > sizeof(struct fbzero_header)) {
struct fbzero_header *h = (struct fbzero_header*)packet->payload;
struct fbzero_tag *t;
u_int offset = sizeof(struct fbzero_header), i, data_offset, tag_number, data_prev_offset = 0;
if((h->flags & 0x01) == 0)
goto fbzero_not_found;
if((h->version[0] != 'Q')
|| (h->version[1] != 'T')
|| (h->version[2] != 'V'))
goto fbzero_not_found;
if(h->unknown != 0x30)
goto fbzero_not_found;
t = (struct fbzero_tag*)&packet->payload[offset];
tag_number = h->tag_number;
data_offset = offset + tag_number*sizeof(struct fbzero_tag);
if(strncmp(h->tag, "CHLO", 4))
goto fbzero_not_found;
for(i=0; i<h->tag_number; i++) {
#ifdef DEBUG
printf("[FBZERO] %u) %c%c%c%c\n", i, t->tag[0], t->tag[1], t->tag[2], t->tag[3]);
#endif
offset += sizeof(struct fbzero_tag);
if((t->tag[0] == 'S') && (t->tag[1] == 'N')
&& (t->tag[2] == 'I') && (t->tag[3] == '\0')) {
char *value = (char*)&packet->payload[data_offset + data_prev_offset];
u_int tag_len = t->tag_offset_len-data_prev_offset, max_len;
ndpi_protocol_match_result ret_match;
max_len = ndpi_min(tag_len, sizeof(flow->host_server_name)-1);
strncpy((char*)flow->host_server_name, value, max_len);
flow->host_server_name[max_len] = '\0';
#ifdef DEBUG
printf("[FBZERO] SNI [@%u][len: %u][%s]\n", tag_len,
t->tag_offset_len-data_prev_offset, flow->host_server_name);
#endif
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FBZERO, NDPI_PROTOCOL_UNKNOWN);
ndpi_match_host_subprotocol(ndpi_struct, flow, (char *)flow->host_server_name,
strlen((const char *)flow->host_server_name),
&ret_match,
NDPI_PROTOCOL_FBZERO);
return;
}
data_prev_offset = t->tag_offset_len;
t = (struct fbzero_tag*)&packet->payload[offset];
}
return;
}
fbzero_not_found:
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
}
/* **************************************************************************** */
void init_fbzero_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id,
NDPI_PROTOCOL_BITMASK *detection_bitmask) {
ndpi_set_bitmask_protocol_detection("FacebookZero", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_FBZERO,
ndpi_search_fbzero,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}
+1 -4
View File
@@ -2,7 +2,7 @@
* fiesta.c * fiesta.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_FIESTA
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FIESTA #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FIESTA
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -105,4 +103,3 @@ void init_fiesta_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
*id += 1; *id += 1;
} }
#endif
-98
View File
@@ -1,98 +0,0 @@
/*
* filetopia.c
*
* Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org
*
* This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH
*
* nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nDPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_FILETOPIA
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FILETOPIA
#include "ndpi_api.h"
static void ndpi_int_filetopia_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_FILETOPIA, NDPI_PROTOCOL_UNKNOWN);
}
void ndpi_search_filetopia_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
struct ndpi_packet_struct *packet = &flow->packet;
NDPI_LOG_DBG(ndpi_struct, "search Filetopia\n");
if (flow->l4.tcp.filetopia_stage == 0) {
if (packet->payload_packet_len >= 50 && packet->payload_packet_len <= 70
&& packet->payload[0] == 0x03 && packet->payload[1] == 0x9a
&& packet->payload[3] == 0x22 && packet->payload[packet->payload_packet_len - 1] == 0x2b) {
NDPI_LOG_DBG2(ndpi_struct, "Filetopia stage 1 detected\n");
flow->l4.tcp.filetopia_stage = 1;
return;
}
} else if (flow->l4.tcp.filetopia_stage == 1) {
if (packet->payload_packet_len >= 100 && packet->payload[0] == 0x03
&& packet->payload[1] == 0x9a && (packet->payload[3] == 0x22 || packet->payload[3] == 0x23)) {
int i;
for (i = 0; i < 10; i++) { // check 10 bytes for valid ASCII printable characters
if (!(packet->payload[5 + i] >= 0x20 && packet->payload[5 + i] <= 0x7e)) {
goto end_filetopia_nothing_found;
}
}
NDPI_LOG_DBG2(ndpi_struct, "Filetopia stage 2 detected\n");
flow->l4.tcp.filetopia_stage = 2;
return;
}
} else if (flow->l4.tcp.filetopia_stage == 2) {
if (packet->payload_packet_len >= 4 && packet->payload_packet_len <= 100
&& packet->payload[0] == 0x03 && packet->payload[1] == 0x9a
&& (packet->payload[3] == 0x22 || packet->payload[3] == 0x23)) {
NDPI_LOG_INFO(ndpi_struct, "found Filetopia\n");
ndpi_int_filetopia_add_connection(ndpi_struct, flow);
return;
}
}
end_filetopia_nothing_found:
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
}
void init_filetopia_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("Filetopia", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_FILETOPIA,
ndpi_search_filetopia_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}
#endif
+1 -6
View File
@@ -1,7 +1,7 @@
/* /*
* fix.c * fix.c
* *
* Copyright (C) 2017 - ntop.org * Copyright (C) 2017-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_FIX
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FIX #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FIX
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -75,6 +73,3 @@ void init_fix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* florensia.c * florensia.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_FLORENSIA
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FLORENSIA #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FLORENSIA
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -129,5 +127,3 @@ void init_florensia_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* ftp_control.c * ftp_control.c
* *
* Copyright (C) 2016 - ntop.org * Copyright (C) 2016-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_FTP_CONTROL
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FTP_CONTROL #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FTP_CONTROL
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -1014,5 +1012,3 @@ void init_ftp_control_dissector(struct ndpi_detection_module_struct *ndpi_struct
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* ftp_data.c * ftp_data.c
* *
* Copyright (C) 2016 - ntop.org * Copyright (C) 2016-18 - ntop.org
* *
* The signature is based on the Libprotoident library. * The signature is based on the Libprotoident library.
* *
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_FTP_DATA
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FTP_DATA #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_FTP_DATA
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -258,5 +256,3 @@ void init_ftp_data_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
*id += 1; *id += 1;
} }
#endif
+1 -6
View File
@@ -1,7 +1,7 @@
/* /*
* git.c * git.c
* *
* Copyright (C) 2012-16 - ntop.org * Copyright (C) 2012-18 - ntop.org
* *
* This module is free software: you can redistribute it and/or modify * This module is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -20,8 +20,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_GIT
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GIT #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GIT
#include <stdlib.h> #include <stdlib.h>
@@ -73,7 +71,6 @@ void ndpi_search_git(struct ndpi_detection_module_struct *ndpi_struct,
/* ***************************************************************** */ /* ***************************************************************** */
void init_git_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, void init_git_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id,
NDPI_PROTOCOL_BITMASK *detection_bitmask) NDPI_PROTOCOL_BITMASK *detection_bitmask)
{ {
@@ -86,5 +83,3 @@ void init_git_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif /* NDPI_PROTOCOL_GIT */
+1 -5
View File
@@ -2,7 +2,7 @@
* gnutella.c * gnutella.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_GNUTELLA
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GNUTELLA #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GNUTELLA
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -371,5 +369,3 @@ void init_gnutella_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* gtp.c * gtp.c
* *
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -20,8 +20,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_GTP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GTP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GTP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -89,5 +87,3 @@ void init_gtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* guildwars.c * guildwars.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_GUILDWARS
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GUILDWARS #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_GUILDWARS
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -78,5 +76,3 @@ void init_guildwars_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+1 -6
View File
@@ -1,16 +1,13 @@
/* /*
* h323.c * h323.c
* *
* Copyright (C) 2015 ntop.org * Copyright (C) 2015-18 ntop.org
* Copyright (C) 2013 Remy Mudingay <mudingay@ill.fr> * Copyright (C) 2013 Remy Mudingay <mudingay@ill.fr>
* *
*/ */
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_H323
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_H323 #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_H323
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -115,5 +112,3 @@ void init_h323_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* halflife2_and_mods.c * halflife2_and_mods.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_HALFLIFE2
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HALFLIFE2 #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HALFLIFE2
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -77,5 +75,3 @@ void init_halflife2_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+1 -4
View File
@@ -1,7 +1,7 @@
/* /*
* hangout.c * hangout.c
* *
* Copyright (C) 2012-16 - ntop.org * Copyright (C) 2012-18 - ntop.org
* *
* This module is free software: you can redistribute it and/or modify * This module is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -20,8 +20,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_HANGOUT
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HANGOUT #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HANGOUT
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -109,4 +107,3 @@ void init_hangout_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_
*id += 1; *id += 1;
} }
#endif /* NDPI_PROTOCOL_HANGOUT */
+11 -14
View File
@@ -2,7 +2,7 @@
* hep.c * hep.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* Copyright (C) 2011-15 - QXIP BV * Copyright (C) 2011-15 - QXIP BV
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
@@ -26,8 +26,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_HEP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HEP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HEP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -45,16 +43,17 @@ void ndpi_search_hep(struct ndpi_detection_module_struct *ndpi_struct, struct nd
const u_int8_t *packet_payload = packet->payload; const u_int8_t *packet_payload = packet->payload;
u_int32_t payload_len = packet->payload_packet_len; u_int32_t payload_len = packet->payload_packet_len;
NDPI_LOG_DBG(ndpi_struct, "searching HEP\n"); NDPI_LOG_DBG(ndpi_struct, "searching HEP\n");
if (payload_len > 10) {
if (memcmp(packet_payload, "HEP3", 4) == 0) {
NDPI_LOG_INFO(ndpi_struct, "found HEP3\n");
ndpi_int_hep_add_connection(ndpi_struct, flow);
return;
}
}
NDPI_EXCLUDE_PROTO(ndpi_struct, flow); if(payload_len > 10) {
if(memcmp(packet_payload, "HEP3", 4) == 0) {
NDPI_LOG_INFO(ndpi_struct, "found HEP3\n");
ndpi_int_hep_add_connection(ndpi_struct, flow);
return;
}
}
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
} }
@@ -69,5 +68,3 @@ void init_hep_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
+97 -94
View File
@@ -1,7 +1,7 @@
/* /*
* http.c * http.c
* *
* Copyright (C) 2011-17 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_HTTP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HTTP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HTTP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -34,7 +32,7 @@
static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *ndpi_struct, static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, struct ndpi_flow_struct *flow,
u_int32_t protocol) { u_int16_t category) {
if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) { if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) {
/* This is HTTP and it is not a sub protocol (e.g. skype or dropbox) */ /* This is HTTP and it is not a sub protocol (e.g. skype or dropbox) */
@@ -42,18 +40,18 @@ static void ndpi_int_http_add_connection(struct ndpi_detection_module_struct *nd
ndpi_search_tcp_or_udp(ndpi_struct, flow); ndpi_search_tcp_or_udp(ndpi_struct, flow);
/* If no custom protocol has been detected */ /* If no custom protocol has been detected */
/* if(flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) */
if(protocol == NDPI_PROTOCOL_HTTP) { if(flow->guessed_host_protocol_id != NDPI_PROTOCOL_UNKNOWN) {
ndpi_int_reset_protocol(flow); ndpi_int_reset_protocol(flow);
ndpi_set_detected_protocol(ndpi_struct, flow, flow->guessed_host_protocol_id, protocol); ndpi_set_detected_protocol(ndpi_struct, flow, flow->guessed_host_protocol_id, NDPI_PROTOCOL_HTTP);
} else } else
ndpi_set_detected_protocol(ndpi_struct, flow, protocol, NDPI_PROTOCOL_HTTP); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP, NDPI_PROTOCOL_UNKNOWN);
flow->http_detected = 1; flow->http_detected = 1, flow->guessed_category = category;
} }
} }
#ifdef NDPI_CONTENT_FLASH #ifdef NDPI_CONTENT_CATEGORY_FLASH
static void flash_check_http_payload(struct ndpi_detection_module_struct static void flash_check_http_payload(struct ndpi_detection_module_struct
*ndpi_struct, struct ndpi_flow_struct *flow) *ndpi_struct, struct ndpi_flow_struct *flow)
{ {
@@ -69,12 +67,12 @@ static void flash_check_http_payload(struct ndpi_detection_module_struct
&& pos[5] == 0x00 && pos[6] == 0x00 && pos[7] == 0x00 && pos[8] == 0x09) { && pos[5] == 0x00 && pos[6] == 0x00 && pos[7] == 0x00 && pos[8] == 0x09) {
NDPI_LOG_INFO(ndpi_struct, "found Flash content in HTTP\n"); NDPI_LOG_INFO(ndpi_struct, "found Flash content in HTTP\n");
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_CONTENT_FLASH); ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_CONTENT_CATEGORY_FLASH);
} }
} }
#endif #endif
#ifdef NDPI_CONTENT_AVI #ifdef NDPI_CONTENT_CATEGORY_AVI
static void avi_check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) static void avi_check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{ {
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
@@ -96,7 +94,7 @@ static void avi_check_http_payload(struct ndpi_detection_module_struct *ndpi_str
if(packet->payload_packet_len > 20 && memcmp(packet->payload, "RIFF", 4) == 0 if(packet->payload_packet_len > 20 && memcmp(packet->payload, "RIFF", 4) == 0
&& memcmp(packet->payload + 8, "AVI LIST", 8) == 0) { && memcmp(packet->payload + 8, "AVI LIST", 8) == 0) {
NDPI_LOG_INFO(ndpi_struct, "found Avi content in HTTP\n"); NDPI_LOG_INFO(ndpi_struct, "found Avi content in HTTP\n");
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_CONTENT_AVI); ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_CONTENT_CATEGORY_AVI);
} }
flow->l4.tcp.http_empty_line_seen = 0; flow->l4.tcp.http_empty_line_seen = 0;
return; return;
@@ -115,13 +113,12 @@ static void avi_check_http_payload(struct ndpi_detection_module_struct *ndpi_str
if((p + 16) <= packet->payload_packet_len && memcmp(&packet->payload[p], "RIFF", 4) == 0 if((p + 16) <= packet->payload_packet_len && memcmp(&packet->payload[p], "RIFF", 4) == 0
&& memcmp(&packet->payload[p + 8], "AVI LIST", 8) == 0) { && memcmp(&packet->payload[p + 8], "AVI LIST", 8) == 0) {
NDPI_LOG_INFO(ndpi_struct, "found Avi content in HTTP\n"); NDPI_LOG_INFO(ndpi_struct, "found Avi content in HTTP\n");
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_CONTENT_AVI); ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_CONTENT_CATEGORY_AVI);
} }
} }
} }
#endif #endif
#ifdef NDPI_PROTOCOL_TEAMVIEWER
static void teamviewer_check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) static void teamviewer_check_http_payload(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{ {
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
@@ -140,10 +137,7 @@ static void teamviewer_check_http_payload(struct ndpi_detection_module_struct *n
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_TEAMVIEWER); ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_TEAMVIEWER);
} }
} }
#endif
#ifdef NDPI_PROTOCOL_RTSP
static void rtsp_parse_packet_acceptline(struct ndpi_detection_module_struct static void rtsp_parse_packet_acceptline(struct ndpi_detection_module_struct
*ndpi_struct, struct ndpi_flow_struct *flow) *ndpi_struct, struct ndpi_flow_struct *flow)
{ {
@@ -154,9 +148,9 @@ static void rtsp_parse_packet_acceptline(struct ndpi_detection_module_struct
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_RTSP); ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_RTSP);
} }
} }
#endif
static void setHttpUserAgent(struct ndpi_flow_struct *flow, char *ua) { static void setHttpUserAgent(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow, char *ua) {
if ( !strcmp(ua, "Windows NT 5.0")) ua = "Windows 2000"; if ( !strcmp(ua, "Windows NT 5.0")) ua = "Windows 2000";
else if(!strcmp(ua, "Windows NT 5.1")) ua = "Windows XP"; else if(!strcmp(ua, "Windows NT 5.1")) ua = "Windows XP";
else if(!strcmp(ua, "Windows NT 5.2")) ua = "Windows Server 2003"; else if(!strcmp(ua, "Windows NT 5.2")) ua = "Windows Server 2003";
@@ -170,13 +164,16 @@ static void setHttpUserAgent(struct ndpi_flow_struct *flow, char *ua) {
* https://github.com/ua-parser/uap-core/blob/master/regexes.yaml */ * https://github.com/ua-parser/uap-core/blob/master/regexes.yaml */
//printf("==> %s\n", ua); //printf("==> %s\n", ua);
snprintf((char*)flow->protos.http.detected_os, sizeof(flow->protos.http.detected_os), "%s", ua); if(!ndpi_struct->disable_metadata_export) {
snprintf((char*)flow->protos.http.detected_os, sizeof(flow->protos.http.detected_os), "%s", ua);
}
} }
static void parseHttpSubprotocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) { static void parseHttpSubprotocol(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
if((flow->l4.tcp.http_stage == 0) || (flow->http.url && flow->http_detected)) { if((flow->l4.tcp.http_stage == 0) || (flow->http.url && flow->http_detected)) {
char *double_col = strchr((char*)flow->host_server_name, ':'); char *double_col = strchr((char*)flow->host_server_name, ':');
ndpi_protocol_match_result ret_match;
if(double_col) double_col[0] = '\0'; if(double_col) double_col[0] = '\0';
/** /**
@@ -186,6 +183,7 @@ static void parseHttpSubprotocol(struct ndpi_detection_module_struct *ndpi_struc
*/ */
ndpi_match_host_subprotocol(ndpi_struct, flow, (char *)flow->host_server_name, ndpi_match_host_subprotocol(ndpi_struct, flow, (char *)flow->host_server_name,
strlen((const char *)flow->host_server_name), strlen((const char *)flow->host_server_name),
&ret_match,
NDPI_PROTOCOL_HTTP); NDPI_PROTOCOL_HTTP);
} }
} }
@@ -330,7 +328,7 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
} }
if(token) if(token)
setHttpUserAgent(flow, token); setHttpUserAgent(ndpi_struct, flow, token);
} }
} }
} }
@@ -353,21 +351,31 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
packet->host_line.len, packet->host_line.ptr); packet->host_line.len, packet->host_line.ptr);
/* call ndpi_match_host_subprotocol to see if there is a match with known-host HTTP subprotocol */ /* call ndpi_match_host_subprotocol to see if there is a match with known-host HTTP subprotocol */
if((ndpi_struct->http_dont_dissect_response) || flow->http_detected) if((ndpi_struct->http_dont_dissect_response) || flow->http_detected) {
ndpi_protocol_match_result ret_match;
ndpi_match_host_subprotocol(ndpi_struct, flow, ndpi_match_host_subprotocol(ndpi_struct, flow,
(char*)packet->host_line.ptr, (char*)packet->host_line.ptr,
packet->host_line.len, packet->host_line.len,
&ret_match,
NDPI_PROTOCOL_HTTP); NDPI_PROTOCOL_HTTP);
}
/* Copy result for nDPI apps */ /* Copy result for nDPI apps */
len = ndpi_min(packet->host_line.len, sizeof(flow->host_server_name)-1); if(!ndpi_struct->disable_metadata_export) {
strncpy((char*)flow->host_server_name, (char*)packet->host_line.ptr, len); len = ndpi_min(packet->host_line.len, sizeof(flow->host_server_name)-1);
flow->host_server_name[len] = '\0', flow->server_id = flow->dst; strncpy((char*)flow->host_server_name, (char*)packet->host_line.ptr, len);
flow->host_server_name[len] = '\0';
}
flow->server_id = flow->dst;
if(packet->forwarded_line.ptr) { if(packet->forwarded_line.ptr) {
len = ndpi_min(packet->forwarded_line.len, sizeof(flow->protos.http.nat_ip)-1); len = ndpi_min(packet->forwarded_line.len, sizeof(flow->protos.http.nat_ip)-1);
strncpy((char*)flow->protos.http.nat_ip, (char*)packet->forwarded_line.ptr, len); if(!ndpi_struct->disable_metadata_export) {
flow->protos.http.nat_ip[len] = '\0'; strncpy((char*)flow->protos.http.nat_ip, (char*)packet->forwarded_line.ptr, len);
flow->protos.http.nat_ip[len] = '\0';
}
} }
if(ndpi_struct->http_dont_dissect_response) if(ndpi_struct->http_dont_dissect_response)
@@ -393,12 +401,16 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
if((flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN) if((flow->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN)
&& ((ndpi_struct->http_dont_dissect_response) || flow->http_detected) && ((ndpi_struct->http_dont_dissect_response) || flow->http_detected)
&& (packet->http_origin.len > 0)) && (packet->http_origin.len > 0)) {
ndpi_protocol_match_result ret_match;
ndpi_match_host_subprotocol(ndpi_struct, flow, ndpi_match_host_subprotocol(ndpi_struct, flow,
(char *)packet->http_origin.ptr, (char *)packet->http_origin.ptr,
packet->http_origin.len, packet->http_origin.len,
&ret_match,
NDPI_PROTOCOL_HTTP); NDPI_PROTOCOL_HTTP);
}
if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN) { if(flow->detected_protocol_stack[0] != NDPI_PROTOCOL_UNKNOWN) {
if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_HTTP) { if(packet->detected_protocol_stack[0] != NDPI_PROTOCOL_HTTP) {
NDPI_LOG_INFO(ndpi_struct, "found HTTP/%s\n", NDPI_LOG_INFO(ndpi_struct, "found HTTP/%s\n",
@@ -419,34 +431,32 @@ static void check_content_type_and_change_protocol(struct ndpi_detection_module_
if(packet->accept_line.ptr != NULL) { if(packet->accept_line.ptr != NULL) {
NDPI_LOG_DBG2(ndpi_struct, "Accept line found %.*s\n", NDPI_LOG_DBG2(ndpi_struct, "Accept line found %.*s\n",
packet->accept_line.len, packet->accept_line.ptr); packet->accept_line.len, packet->accept_line.ptr);
#ifdef NDPI_PROTOCOL_RTSP if(NDPI_COMPARE_PROTOCOL_TO_BITMASK(ndpi_struct->detection_bitmask,
if(NDPI_COMPARE_PROTOCOL_TO_BITMASK(ndpi_struct->detection_bitmask, NDPI_PROTOCOL_RTSP) != 0) { NDPI_PROTOCOL_RTSP) != 0) {
rtsp_parse_packet_acceptline(ndpi_struct, flow); rtsp_parse_packet_acceptline(ndpi_struct, flow);
} }
#endif
} }
/* search for line startin with "Icy-MetaData" */ /* search for line startin with "Icy-MetaData" */
#ifdef NDPI_CONTENT_MPEG for (a = 0; a < packet->parsed_lines; a++) {
for (a = 0; a < packet->parsed_lines; a++) {
if(packet->line[a].len > 11 && memcmp(packet->line[a].ptr, "Icy-MetaData", 12) == 0) { if(packet->line[a].len > 11 && memcmp(packet->line[a].ptr, "Icy-MetaData", 12) == 0) {
NDPI_LOG_INFO(ndpi_struct, "found MPEG: Icy-MetaData\n"); NDPI_LOG_INFO(ndpi_struct, "found MPEG: Icy-MetaData\n");
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_CONTENT_MPEG); ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_CONTENT_CATEGORY_MPEG);
return; return;
} }
} }
#ifdef NDPI_CONTENT_AVI
#endif
#endif
if(packet->content_line.ptr != NULL && packet->content_line.len != 0) { if(packet->content_line.ptr != NULL && packet->content_line.len != 0) {
NDPI_LOG_DBG2(ndpi_struct, "Content Type line found %.*s\n", NDPI_LOG_DBG2(ndpi_struct, "Content Type line found %.*s\n",
packet->content_line.len, packet->content_line.ptr); packet->content_line.len, packet->content_line.ptr);
if((ndpi_struct->http_dont_dissect_response) || flow->http_detected) if((ndpi_struct->http_dont_dissect_response) || flow->http_detected) {
ndpi_protocol_match_result ret_match;
ndpi_match_content_subprotocol(ndpi_struct, flow, ndpi_match_content_subprotocol(ndpi_struct, flow,
(char*)packet->content_line.ptr, packet->content_line.len, (char*)packet->content_line.ptr, packet->content_line.len,
NDPI_PROTOCOL_HTTP); &ret_match, NDPI_PROTOCOL_HTTP);
}
} }
} }
@@ -454,18 +464,16 @@ static void check_http_payload(struct ndpi_detection_module_struct *ndpi_struct,
{ {
NDPI_LOG_DBG2(ndpi_struct, "called check_http_payload\n"); NDPI_LOG_DBG2(ndpi_struct, "called check_http_payload\n");
#ifdef NDPI_CONTENT_FLASH #ifdef NDPI_CONTENT_CATEGORY_FLASH
if(NDPI_COMPARE_PROTOCOL_TO_BITMASK(ndpi_struct->detection_bitmask, NDPI_CONTENT_FLASH) != 0) if(NDPI_COMPARE_PROTOCOL_TO_BITMASK(ndpi_struct->detection_bitmask, NDPI_CONTENT_CATEGORY_FLASH) != 0)
flash_check_http_payload(ndpi_struct, flow); flash_check_http_payload(ndpi_struct, flow);
#endif #endif
#ifdef NDPI_CONTENT_AVI #ifdef NDPI_CONTENT_CATEGORY_AVI
if(NDPI_COMPARE_PROTOCOL_TO_BITMASK(ndpi_struct->detection_bitmask, NDPI_CONTENT_AVI) != 0) if(NDPI_COMPARE_PROTOCOL_TO_BITMASK(ndpi_struct->detection_bitmask, NDPI_CONTENT_CATEGORY_AVI) != 0)
avi_check_http_payload(ndpi_struct, flow); avi_check_http_payload(ndpi_struct, flow);
#endif #endif
#ifdef NDPI_PROTOCOL_TEAMVIEWER
teamviewer_check_http_payload(ndpi_struct, flow);
#endif
teamviewer_check_http_payload(ndpi_struct, flow);
} }
/** /**
@@ -523,27 +531,26 @@ static u_int16_t http_request_url_offset(struct ndpi_detection_module_struct *nd
static void http_bitmask_exclude_other(struct ndpi_flow_struct *flow) static void http_bitmask_exclude_other(struct ndpi_flow_struct *flow)
{ {
#ifdef NDPI_CONTENT_MPEG #ifdef NDPI_CONTENT_CATEGORY_MPEG
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_MPEG); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_CATEGORY_MPEG);
#endif #endif
#ifdef NDPI_CONTENT_QUICKTIME #ifdef NDPI_CONTENT_CATEGORY_QUICKTIME
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_QUICKTIME); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_CATEGORY_QUICKTIME);
#endif #endif
#ifdef NDPI_CONTENT_WINDOWSMEDIA #ifdef NDPI_CONTENT_CATEGORY_WINDOWSMEDIA
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_WINDOWSMEDIA); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA);
#endif #endif
#ifdef NDPI_CONTENT_REALMEDIA #ifdef NDPI_CONTENT_CATEGORY_REALMEDIA
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_REALMEDIA); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_CATEGORY_REALMEDIA);
#endif #endif
#ifdef NDPI_CONTENT_AVI #ifdef NDPI_CONTENT_CATEGORY_AVI
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_AVI); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_CATEGORY_AVI);
#endif #endif
#ifdef NDPI_CONTENT_OGG #ifdef NDPI_CONTENT_CATEGORY_OGG
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_OGG); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_CONTENT_CATEGORY_OGG);
#endif #endif
#ifdef NDPI_PROTOCOL_XBOX
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_XBOX); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_XBOX);
#endif
} }
/*************************************************************************************************/ /*************************************************************************************************/
@@ -663,7 +670,7 @@ static void ndpi_check_http_tcp(struct ndpi_detection_module_struct *ndpi_struct
/* Check for additional field introduced by Steam */ /* Check for additional field introduced by Steam */
int x = 1; int x = 1;
if((memcmp(packet->line[x].ptr, "x-steam-sid", 11)) == 0) { if(packet->line[x].len >= 11 && (memcmp(packet->line[x].ptr, "x-steam-sid", 11)) == 0) {
NDPI_LOG_INFO(ndpi_struct, "found STEAM\n"); NDPI_LOG_INFO(ndpi_struct, "found STEAM\n");
ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_STEAM); ndpi_int_http_add_connection(ndpi_struct, flow, NDPI_PROTOCOL_STEAM);
check_content_type_and_change_protocol(ndpi_struct, flow); check_content_type_and_change_protocol(ndpi_struct, flow);
@@ -943,9 +950,9 @@ void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#ifdef NDPI_CONTENT_MPEG #ifdef NDPI_CONTENT_CATEGORY_MPEG
ndpi_set_bitmask_protocol_detection("MPEG", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("MPEG", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_MPEG, NDPI_CONTENT_CATEGORY_MPEG,
ndpi_search_http_tcp, ndpi_search_http_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
@@ -953,52 +960,52 @@ void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
#endif #endif
#ifdef NDPI_CONTENT_FLASH #ifdef NDPI_CONTENT_CATEGORY_FLASH
ndpi_set_bitmask_protocol_detection("Flash", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("Flash", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_FLASH, NDPI_CONTENT_CATEGORY_FLASH,
ndpi_search_http_tcp, ndpi_search_http_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#endif #endif
#ifdef NDPI_CONTENT_QUICKTIME #ifdef NDPI_CONTENT_CATEGORY_QUICKTIME
ndpi_set_bitmask_protocol_detection("QuickTime", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("QuickTime", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_QUICKTIME, NDPI_CONTENT_CATEGORY_QUICKTIME,
ndpi_search_http_tcp, ndpi_search_http_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#endif #endif
#ifdef NDPI_CONTENT_REALMEDIA #ifdef NDPI_CONTENT_CATEGORY_REALMEDIA
ndpi_set_bitmask_protocol_detection("RealMedia", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("RealMedia", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_REALMEDIA, NDPI_CONTENT_CATEGORY_REALMEDIA,
ndpi_search_http_tcp, ndpi_search_http_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#endif #endif
#ifdef NDPI_CONTENT_WINDOWSMEDIA #ifdef NDPI_CONTENT_CATEGORY_WINDOWSMEDIA
ndpi_set_bitmask_protocol_detection("WindowsMedia", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("WindowsMedia", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_WINDOWSMEDIA, NDPI_CONTENT_CATEGORY_WINDOWSMEDIA,
ndpi_search_http_tcp, ndpi_search_http_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#endif #endif
#ifdef NDPI_CONTENT_MMS #ifdef NDPI_CONTENT_CATEGORY_MMS
ndpi_set_bitmask_protocol_detection("MMS", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("MMS", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_MMS, NDPI_CONTENT_CATEGORY_MMS,
ndpi_search_http_tcp, ndpi_search_http_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#endif #endif
#ifdef NDPI_PROTOCOL_XBOX
ndpi_set_bitmask_protocol_detection("Xbox", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("Xbox", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_XBOX, NDPI_PROTOCOL_XBOX,
ndpi_search_http_tcp, ndpi_search_http_tcp,
@@ -1006,8 +1013,7 @@ void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#endif
#ifdef NDPI_PROTOCOL_QQ
ndpi_set_bitmask_protocol_detection("QQ", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("QQ", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_QQ, NDPI_PROTOCOL_QQ,
ndpi_search_http_tcp, ndpi_search_http_tcp,
@@ -1015,19 +1021,19 @@ void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#endif
#ifdef NDPI_CONTENT_AVI #ifdef NDPI_CONTENT_CATEGORY_AVI
ndpi_set_bitmask_protocol_detection("AVI", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("AVI", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_AVI, NDPI_CONTENT_CATEGORY_AVI,
ndpi_search_http_tcp, ndpi_search_http_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK); ADD_TO_DETECTION_BITMASK);
*id += 1; *id += 1;
#endif #endif
#ifdef NDPI_CONTENT_OGG #ifdef NDPI_CONTENT_CATEGORY_OGG
ndpi_set_bitmask_protocol_detection("OggVorbis", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("OggVorbis", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_OGG, NDPI_CONTENT_CATEGORY_OGG,
ndpi_search_http_tcp, ndpi_search_http_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN, NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
@@ -1044,11 +1050,11 @@ void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_PROTOCOL_QQ); NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_PROTOCOL_QQ);
#ifdef NDPI_CONTENT_FLASH #ifdef NDPI_CONTENT_CATEGORY_FLASH
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_CONTENT_FLASH); NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_CONTENT_CATEGORY_FLASH);
#endif #endif
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_CONTENT_MMS); NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_CONTENT_CATEGORY_MMS);
NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_PROTOCOL_XBOX); NDPI_DEL_PROTOCOL_FROM_BITMASK(ndpi_struct->callback_buffer[a].excluded_protocol_bitmask, NDPI_PROTOCOL_XBOX);
@@ -1060,7 +1066,4 @@ void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
a++; a++;
#endif #endif
} }
#endif
+18 -22
View File
@@ -2,7 +2,7 @@
* http_activesync.c * http_activesync.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -26,42 +26,39 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HTTP_ACTIVESYNC
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC
#include "ndpi_api.h" #include "ndpi_api.h"
static void ndpi_int_activesync_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) static void ndpi_int_activesync_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{ {
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC, NDPI_PROTOCOL_HTTP); ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP_ACTIVESYNC, NDPI_PROTOCOL_HTTP);
} }
void ndpi_search_activesync(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) void ndpi_search_activesync(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{ {
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
NDPI_LOG_DBG(ndpi_struct, "search activesync\n"); NDPI_LOG_DBG(ndpi_struct, "search activesync\n");
if (packet->tcp != NULL) { if (packet->tcp != NULL) {
if (packet->payload_packet_len > 150 if (packet->payload_packet_len > 150
&& ((memcmp(packet->payload, "OPTIONS /Microsoft-Server-ActiveSync?", 37) == 0) && ((memcmp(packet->payload, "OPTIONS /Microsoft-Server-ActiveSync?", 37) == 0)
|| (memcmp(packet->payload, "POST /Microsoft-Server-ActiveSync?", 34) == 0))) { || (memcmp(packet->payload, "POST /Microsoft-Server-ActiveSync?", 34) == 0))) {
ndpi_int_activesync_add_connection(ndpi_struct, flow); ndpi_int_activesync_add_connection(ndpi_struct, flow);
NDPI_LOG_INFO(ndpi_struct, "found ActiveSync \n"); NDPI_LOG_INFO(ndpi_struct, "found ActiveSync \n");
return; return;
} }
} }
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
} }
void init_http_activesync_dissector(struct ndpi_detection_module_struct *ndpi_struct,
void init_http_activesync_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{ {
ndpi_set_bitmask_protocol_detection("HTTP_Application_ActiveSync", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("HTTP_Application_ActiveSync", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_HTTP_APPLICATION_ACTIVESYNC, NDPI_PROTOCOL_HTTP_ACTIVESYNC,
ndpi_search_activesync, ndpi_search_activesync,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
SAVE_DETECTION_BITMASK_AS_UNKNOWN, SAVE_DETECTION_BITMASK_AS_UNKNOWN,
@@ -70,4 +67,3 @@ void init_http_activesync_dissector(struct ndpi_detection_module_struct *ndpi_st
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* iax.c * iax.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_IAX
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IAX #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IAX
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -107,5 +105,3 @@ void init_iax_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
+13 -15
View File
@@ -2,7 +2,7 @@
* icecast.c * icecast.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_ICECAST
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ICECAST #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_ICECAST
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -42,13 +40,13 @@ void ndpi_search_icecast_tcp(struct ndpi_detection_module_struct *ndpi_struct, s
NDPI_LOG_DBG(ndpi_struct, "search icecast\n"); NDPI_LOG_DBG(ndpi_struct, "search icecast\n");
if ((packet->payload_packet_len < 500 && if((packet->payload_packet_len < 500 &&
packet->payload_packet_len >= 7 && memcmp(packet->payload, "SOURCE ", 7) == 0) packet->payload_packet_len >= 7 && memcmp(packet->payload, "SOURCE ", 7) == 0)
|| flow->l4.tcp.icecast_stage) { || flow->l4.tcp.icecast_stage) {
ndpi_parse_packet_line_info_any(ndpi_struct, flow); ndpi_parse_packet_line_info_any(ndpi_struct, flow);
NDPI_LOG_DBG2(ndpi_struct, "Icecast lines=%d\n", packet->parsed_lines); NDPI_LOG_DBG2(ndpi_struct, "Icecast lines=%d\n", packet->parsed_lines);
for (i = 0; i < packet->parsed_lines; i++) { for (i = 0; i < packet->parsed_lines; i++) {
if (packet->line[i].ptr != NULL && packet->line[i].len > 4 if(packet->line[i].ptr != NULL && packet->line[i].len > 4
&& memcmp(packet->line[i].ptr, "ice-", 4) == 0) { && memcmp(packet->line[i].ptr, "ice-", 4) == 0) {
NDPI_LOG_INFO(ndpi_struct, "found Icecast\n"); NDPI_LOG_INFO(ndpi_struct, "found Icecast\n");
ndpi_int_icecast_add_connection(ndpi_struct, flow); ndpi_int_icecast_add_connection(ndpi_struct, flow);
@@ -56,28 +54,30 @@ void ndpi_search_icecast_tcp(struct ndpi_detection_module_struct *ndpi_struct, s
} }
} }
if (packet->parsed_lines < 1 && !flow->l4.tcp.icecast_stage) { if(packet->parsed_lines < 1 && !flow->l4.tcp.icecast_stage) {
flow->l4.tcp.icecast_stage = 1; flow->l4.tcp.icecast_stage = 1;
return; return;
} }
} }
#ifdef NDPI_PROTOCOL_HTTP
if (NDPI_FLOW_PROTOCOL_EXCLUDED(ndpi_struct, flow, NDPI_PROTOCOL_HTTP)) { if(NDPI_FLOW_PROTOCOL_EXCLUDED(ndpi_struct, flow, NDPI_PROTOCOL_HTTP)) {
goto icecast_exclude; goto icecast_exclude;
} }
#endif
if (packet->packet_direction == flow->setup_packet_direction && flow->packet_counter < 10) { if((packet->packet_direction == flow->setup_packet_direction)
&& (flow->packet_counter < 10)) {
return; return;
} }
if (packet->packet_direction != flow->setup_packet_direction) { if(packet->packet_direction != flow->setup_packet_direction) {
/* server answer, now test Server for Icecast */ /* server answer, now test Server for Icecast */
ndpi_parse_packet_line_info(ndpi_struct, flow); ndpi_parse_packet_line_info(ndpi_struct, flow);
if (packet->server_line.ptr != NULL && packet->server_line.len > NDPI_STATICSTRING_LEN("Icecast") && if((packet->server_line.ptr != NULL)
memcmp(packet->server_line.ptr, "Icecast", NDPI_STATICSTRING_LEN("Icecast")) == 0) { && (packet->server_line.len > NDPI_STATICSTRING_LEN("Icecast"))
&& memcmp(packet->server_line.ptr, "Icecast",
NDPI_STATICSTRING_LEN("Icecast")) == 0) {
/* TODO maybe store the previous protocol type as subtype? /* TODO maybe store the previous protocol type as subtype?
* e.g. ogg or mpeg * e.g. ogg or mpeg
*/ */
@@ -103,5 +103,3 @@ void init_icecast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* ipp.c * ipp.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_IPP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IPP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IPP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -123,5 +121,3 @@ void init_ipp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
+3 -6
View File
@@ -2,7 +2,7 @@
* irc.c * irc.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_IRC
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IRC #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_IRC
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -778,8 +776,8 @@ void ndpi_search_irc_tcp(struct ndpi_detection_module_struct *ndpi_struct, struc
} }
} }
void init_irc_dissector(struct ndpi_detection_module_struct *ndpi_struct,
void init_irc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{ {
ndpi_set_bitmask_protocol_detection("IRC", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("IRC", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_IRC, NDPI_PROTOCOL_IRC,
@@ -791,4 +789,3 @@ void init_irc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif
+4 -9
View File
@@ -2,7 +2,7 @@
* jabber.c * jabber.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_UNENCRYPTED_JABBER
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_UNENCRYPTED_JABBER #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_UNENCRYPTED_JABBER
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -36,10 +34,8 @@ struct jabber_string {
}; };
static struct jabber_string jabber_strings[] = { static struct jabber_string jabber_strings[] = {
#ifdef NDPI_PROTOCOL_TRUPHONE
{ "='im.truphone.com'", NDPI_PROTOCOL_TRUPHONE }, { "='im.truphone.com'", NDPI_PROTOCOL_TRUPHONE },
{ "=\"im.truphone.com\"", NDPI_PROTOCOL_TRUPHONE }, { "=\"im.truphone.com\"", NDPI_PROTOCOL_TRUPHONE },
#endif
{ NULL, 0 } { NULL, 0 }
}; };
@@ -289,9 +285,8 @@ void ndpi_search_jabber_tcp(struct ndpi_detection_module_struct *ndpi_struct, st
NDPI_EXCLUDE_PROTO(ndpi_struct, flow); NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
#ifdef NDPI_PROTOCOL_TRUPHONE ndpi_exclude_protocol(ndpi_struct, flow, NDPI_PROTOCOL_TRUPHONE,
ndpi_exclude_protocol(ndpi_struct, flow, NDPI_PROTOCOL_TRUPHONE,__FILE__,__FUNCTION__,__LINE__); __FILE__,__FUNCTION__,__LINE__);
#endif
} }
@@ -306,4 +301,4 @@ void init_jabber_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
*id += 1; *id += 1;
} }
#endif
+3 -5
View File
@@ -1,7 +1,7 @@
/* /*
* kakaotalk_voice.c * kakaotalk_voice.c
* *
* Copyright (C) 2015 - ntop.org * Copyright (C) 2015-18 - ntop.org
* *
* This module is free software: you can redistribute it and/or modify * This module is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -26,8 +26,6 @@
*/ */
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_KAKAOTALK_VOICE
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KAKAOTALK_VOICE #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KAKAOTALK_VOICE
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -66,7 +64,8 @@ void ndpi_search_kakaotalk_voice(struct ndpi_detection_module_struct *ndpi_struc
} }
void init_kakaotalk_voice_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) void init_kakaotalk_voice_dissector(struct ndpi_detection_module_struct *ndpi_struct,
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{ {
ndpi_set_bitmask_protocol_detection("KakaoTalk_Voice", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("KakaoTalk_Voice", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_KAKAOTALK_VOICE, NDPI_PROTOCOL_KAKAOTALK_VOICE,
@@ -77,4 +76,3 @@ void init_kakaotalk_voice_dissector(struct ndpi_detection_module_struct *ndpi_st
*id += 1; *id += 1;
} }
#endif
+1 -4
View File
@@ -2,7 +2,7 @@
* kerberos.c * kerberos.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_KERBEROS
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KERBEROS #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KERBEROS
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -80,4 +78,3 @@ void init_kerberos_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
*id += 1; *id += 1;
} }
#endif
+3 -5
View File
@@ -2,7 +2,7 @@
* kontiki.c * kontiki.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_KONTIKI
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KONTIKI #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_KONTIKI
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -66,7 +64,8 @@ void ndpi_search_kontiki(struct ndpi_detection_module_struct *ndpi_struct, struc
} }
void init_kontiki_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) void init_kontiki_dissector(struct ndpi_detection_module_struct *ndpi_struct,
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{ {
ndpi_set_bitmask_protocol_detection("Kontiki", ndpi_struct, detection_bitmask, *id, ndpi_set_bitmask_protocol_detection("Kontiki", ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_KONTIKI, NDPI_PROTOCOL_KONTIKI,
@@ -78,4 +77,3 @@ void init_kontiki_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_
*id += 1; *id += 1;
} }
#endif
+1 -4
View File
@@ -2,7 +2,7 @@
* ldap.c * ldap.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_LDAP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LDAP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LDAP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -104,4 +102,3 @@ void init_ldap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
} }
#endif
-3
View File
@@ -1,7 +1,5 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_LISP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LISP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LISP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -68,4 +66,3 @@ void init_lisp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -1,7 +1,7 @@
/* /*
* lotus_notes.c * lotus_notes.c
* *
* Copyright (C) 2012-15 - ntop.org * Copyright (C) 2012-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -20,13 +20,10 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_LOTUS_NOTES
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LOTUS_NOTES #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_LOTUS_NOTES
#include "ndpi_api.h" #include "ndpi_api.h"
/* ************************************ */ /* ************************************ */
static void ndpi_check_lotus_notes(struct ndpi_detection_module_struct *ndpi_struct, static void ndpi_check_lotus_notes(struct ndpi_detection_module_struct *ndpi_struct,
@@ -84,4 +81,3 @@ void init_lotus_notes_dissector(struct ndpi_detection_module_struct *ndpi_struct
*id += 1; *id += 1;
} }
#endif
+1 -7
View File
@@ -1,7 +1,7 @@
/* /*
* mail_imap.c * mail_imap.c
* *
* Copyright (C) 2016 - ntop.org * Copyright (C) 2016-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MAIL_IMAP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_IMAP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_IMAP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -48,12 +46,10 @@ void ndpi_search_mail_imap_tcp(struct ndpi_detection_module_struct *ndpi_struct,
NDPI_LOG_DBG(ndpi_struct, "search IMAP_IMAP\n"); NDPI_LOG_DBG(ndpi_struct, "search IMAP_IMAP\n");
if (flow->l4.tcp.mail_imap_starttls == 2) { if (flow->l4.tcp.mail_imap_starttls == 2) {
#ifdef NDPI_PROTOCOL_SSL
NDPI_LOG_DBG2(ndpi_struct, "starttls detected\n"); NDPI_LOG_DBG2(ndpi_struct, "starttls detected\n");
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MAIL_IMAP); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MAIL_IMAP);
NDPI_DEL_PROTOCOL_FROM_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_SSL); NDPI_DEL_PROTOCOL_FROM_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_SSL);
return; return;
#endif
} }
if (packet->payload_packet_len >= 4 && ntohs(get_u_int16_t(packet->payload, packet->payload_packet_len - 2)) == 0x0d0a) { if (packet->payload_packet_len >= 4 && ntohs(get_u_int16_t(packet->payload, packet->payload_packet_len - 2)) == 0x0d0a) {
@@ -320,5 +316,3 @@ void init_mail_imap_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* mail_pop.c * mail_pop.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MAIL_POP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_POP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_POP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -212,5 +210,3 @@ void init_mail_pop_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
*id += 1; *id += 1;
} }
#endif
+1 -4
View File
@@ -2,7 +2,7 @@
* mail_smtp.c * mail_smtp.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -25,8 +25,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MAIL_SMTP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_SMTP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAIL_SMTP
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -189,4 +187,3 @@ void init_mail_smtp_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+1 -5
View File
@@ -2,7 +2,7 @@
* maplestory.c * maplestory.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,8 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MAPLESTORY
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAPLESTORY #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MAPLESTORY
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -94,5 +92,3 @@ void init_maplestory_dissector(struct ndpi_detection_module_struct *ndpi_struct,
*id += 1; *id += 1;
} }
#endif
+7 -8
View File
@@ -1,7 +1,7 @@
/* /*
* mdns.c * mdns.c
* *
* Copyright (C) 2016-17 - ntop.org * Copyright (C) 2016-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -22,8 +22,6 @@
*/ */
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MDNS
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MDNS #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MDNS
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -86,10 +84,12 @@ static int ndpi_int_check_mdns_payload(struct ndpi_detection_module_struct
/* printf("==> [%d] %s\n", j, answer); */ /* printf("==> [%d] %s\n", j, answer); */
len = ndpi_min(sizeof(flow->protos.mdns.answer)-1, j); if(!ndpi_struct->disable_metadata_export) {
strncpy(flow->protos.mdns.answer, (const char *)answer, len); len = ndpi_min(sizeof(flow->protos.mdns.answer)-1, j);
flow->protos.mdns.answer[len] = '\0'; strncpy(flow->protos.mdns.answer, (const char *)answer, len);
flow->protos.mdns.answer[len] = '\0';
}
NDPI_LOG_INFO(ndpi_struct, "found MDNS with answer query\n"); NDPI_LOG_INFO(ndpi_struct, "found MDNS with answer query\n");
return 1; return 1;
} }
@@ -157,4 +157,3 @@ void init_mdns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
} }
#endif
+3 -5
View File
@@ -2,7 +2,7 @@
* megaco.c * megaco.c
* *
* Copyright (C) 2014 by Gianluca Costa http://www.capanalysis.net * Copyright (C) 2014 by Gianluca Costa http://www.capanalysis.net
* Copyright (C) 2012-15 - ntop.org * Copyright (C) 2012-18 - ntop.org
* *
* This module is free software: you can redistribute it and/or modify * This module is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -20,14 +20,13 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MEGACO
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MEGACO #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MEGACO
#include "ndpi_api.h" #include "ndpi_api.h"
void ndpi_search_megaco(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) void ndpi_search_megaco(struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow)
{ {
struct ndpi_packet_struct *packet = &flow->packet; struct ndpi_packet_struct *packet = &flow->packet;
@@ -61,4 +60,3 @@ void init_megaco_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
*id += 1; *id += 1;
} }
#endif
+189
View File
@@ -0,0 +1,189 @@
/*
* memcached.c
*
* Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-18 - ntop.org
* Copyright (C) 2018 - eGloo Incorporated
*
* This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH
*
* nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nDPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ndpi_protocol_ids.h"
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MEMCACHED
#include "ndpi_api.h"
#define MCDC_SET "set "
#define MCDC_SET_LEN (sizeof(MCDC_SET) - 1)
#define MCDC_ADD "add "
#define MCDC_ADD_LEN (sizeof(MCDC_ADD) - 1)
#define MCDC_REPLACE "replace "
#define MCDC_REPLACE_LEN (sizeof(MCDC_REPLACE) - 1)
#define MCDC_APPEND "append "
#define MCDC_APPEND_LEN (sizeof(MCDC_APPEND) - 1)
#define MCDC_PREPEND "prepend "
#define MCDC_PREPEND_LEN (sizeof(MCDC_PREPEND) - 1)
#define MCDC_CAS "cas "
#define MCDC_CAS_LEN (sizeof(MCDC_CAS) - 1)
#define MCDC_GET "get "
#define MCDC_GET_LEN (sizeof(MCDC_GET) - 1)
#define MCDC_GETS "gets "
#define MCDC_GETS_LEN (sizeof(MCDC_GETS) - 1)
#define MCDC_DELETE "delete "
#define MCDC_DELETE_LEN (sizeof(MCDC_DELETE) - 1)
#define MCDC_INCR "incr "
#define MCDC_INCR_LEN (sizeof(MCDC_INCR) - 1)
#define MCDC_DECR "decr "
#define MCDC_DECR_LEN (sizeof(MCDC_DECR) - 1)
#define MCDC_TOUCH "touch "
#define MCDC_TOUCH_LEN (sizeof(MCDC_TOUCH) - 1)
#define MCDC_GAT "gat "
#define MCDC_GAT_LEN (sizeof(MCDC_GAT) - 1)
#define MCDC_GATS "gats "
#define MCDC_GATS_LEN (sizeof(MCDC_GATS) - 1)
#define MCDC_STATS "stats"
#define MCDC_STATS_LEN (sizeof(MCDC_STATS) - 1)
#define MCDR_ERROR "ERROR\r\n"
#define MCDR_ERROR_LEN (sizeof(MCDR_ERROR) - 1)
#define MCDR_CLIENT_ERROR "CLIENT_ERROR "
#define MCDR_CLIENT_ERROR_LEN (sizeof(MCDR_CLIENT_ERROR) - 1)
#define MCDR_SERVER_ERROR "SERVER_ERROR "
#define MCDR_SERVER_ERROR_LEN (sizeof(MCDR_SERVER_ERROR) - 1)
#define MCDR_STORED "STORED\r\n"
#define MCDR_STORED_LEN (sizeof(MCDR_STORED) - 1)
#define MCDR_NOT_STORED "NOT_STORED\r\n"
#define MCDR_NOT_STORED_LEN (sizeof(MCDR_NOT_STORED) - 1)
#define MCDR_EXISTS "EXISTS\r\n"
#define MCDR_EXISTS_LEN (sizeof(MCDR_EXISTS) - 1)
#define MCDR_NOT_FOUND "NOT_FOUND\r\n"
#define MCDR_NOT_FOUND_LEN (sizeof(MCDR_NOT_FOUND) - 1)
#define MCDR_END "END\r\n"
#define MCDR_END_LEN (sizeof(MCDR_END) - 1)
#define MCDR_DELETED "DELETED\r\n"
#define MCDR_DELETED_LEN (sizeof(MCDR_DELETED) - 1)
#define MCDR_TOUCHED "TOUCHED\r\n"
#define MCDR_TOUCHED_LEN (sizeof(MCDR_TOUCHED) - 1)
#define MCDR_STAT "STAT "
#define MCDR_STAT_LEN (sizeof(MCDR_STAT) - 1)
#define MEMCACHED_UDP_HDR_LEN 8
#define MEMCACHED_MIN_LEN MCDR_END_LEN
#define MEMCACHED_MIN_UDP_LEN (MEMCACHED_MIN_LEN + MEMCACHED_UDP_HDR_LEN)
#define MEMCACHED_MIN_MATCH 2 /* Minimum number of command/responses required */
#define MEMCACHED_MATCH(cr) memcmp(offset, cr, cr ## _LEN)
static void ndpi_int_memcached_add_connection(struct ndpi_detection_module_struct
*ndpi_struct, struct ndpi_flow_struct *flow)
{
NDPI_LOG_INFO(ndpi_struct, "found memcached\n");
ndpi_set_detected_protocol(ndpi_struct, flow,
NDPI_PROTOCOL_MEMCACHED, NDPI_PROTOCOL_UNKNOWN);
}
void ndpi_search_memcached(
struct ndpi_detection_module_struct *ndpi_struct,
struct ndpi_flow_struct *flow)
{
struct ndpi_packet_struct *packet = &flow->packet;
const u_int8_t *offset = packet->payload;
u_int8_t *matches;
NDPI_LOG_DBG(ndpi_struct, "search memcached\n");
if (packet->tcp != NULL) {
if (packet->payload_packet_len < MEMCACHED_MIN_LEN) {
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return;
}
matches = &flow->l4.tcp.memcached_matches;
}
else if (packet->udp != NULL) {
if (packet->payload_packet_len < MEMCACHED_MIN_UDP_LEN) {
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return;
}
if ((offset[4] == 0x00 && offset[5] == 0x00) ||
offset[6] != 0x00 || offset[7] != 0x00) {
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return;
}
offset += MEMCACHED_UDP_HDR_LEN;
matches = &flow->l4.udp.memcached_matches;
}
else {
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
return;
}
/* grep MCD memcached.c |\
* egrep -v '(LEN|MATCH)' |\
* sed -e 's/^#define //g' |\
* awk '{ printf "else if (! MEMCACHED_MATCH(%s)) *matches += 1;\n",$1 }' */
if (! MEMCACHED_MATCH(MCDC_SET)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_ADD)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_REPLACE)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_APPEND)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_PREPEND)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_CAS)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_GET)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_GETS)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_DELETE)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_INCR)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_DECR)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_TOUCH)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_GAT)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_GATS)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDC_STATS)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_ERROR)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_CLIENT_ERROR)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_SERVER_ERROR)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_STORED)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_NOT_STORED)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_EXISTS)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_NOT_FOUND)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_END)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_DELETED)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_TOUCHED)) *matches += 1;
else if (! MEMCACHED_MATCH(MCDR_STAT)) *matches += 1;
if (*matches >= MEMCACHED_MIN_MATCH)
ndpi_int_memcached_add_connection(ndpi_struct, flow);
}
void init_memcached_dissector(
struct ndpi_detection_module_struct *ndpi_struct,
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("MEMCACHED",
ndpi_struct, detection_bitmask, *id,
NDPI_PROTOCOL_MEMCACHED,
ndpi_search_memcached,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD,
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}
+1 -6
View File
@@ -1,7 +1,7 @@
/* /*
* mgcp.c * mgcp.c
* *
* Copyright (C) 2017 - ntop.org * Copyright (C) 2017-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -23,14 +23,10 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MGCP
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MGCP #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MGCP
#include "ndpi_api.h" #include "ndpi_api.h"
static void ndpi_int_mgcp_add_connection(struct ndpi_detection_module_struct static void ndpi_int_mgcp_add_connection(struct ndpi_detection_module_struct
*ndpi_struct, struct ndpi_flow_struct *flow) *ndpi_struct, struct ndpi_flow_struct *flow)
{ {
@@ -93,4 +89,3 @@ void init_mgpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int
*id += 1; *id += 1;
} }
#endif
-95
View File
@@ -1,95 +0,0 @@
/*
* mms.c
*
* Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org
*
* This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH
*
* nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* nDPI is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with nDPI. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ndpi_protocol_ids.h"
#ifdef NDPI_CONTENT_MMS
#define NDPI_CURRENT_PROTO NDPI_CONTENT_MMS
#include "ndpi_api.h"
static void ndpi_int_mms_add_connection(struct ndpi_detection_module_struct
*ndpi_struct, struct ndpi_flow_struct *flow)
{
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_CONTENT_MMS, NDPI_PROTOCOL_UNKNOWN);
}
void ndpi_search_mms_tcp(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
{
struct ndpi_packet_struct *packet = &flow->packet;
NDPI_LOG_DBG(ndpi_struct, "search MMS\n");
/* search MSMMS packets */
if (packet->payload_packet_len >= 20) {
if (flow->l4.tcp.mms_stage == 0 && packet->payload[4] == 0xce
&& packet->payload[5] == 0xfa && packet->payload[6] == 0x0b
&& packet->payload[7] == 0xb0 && packet->payload[12] == 0x4d
&& packet->payload[13] == 0x4d && packet->payload[14] == 0x53 && packet->payload[15] == 0x20) {
NDPI_LOG_INFO(ndpi_struct, "found MMS: MSMMS Request \n");
flow->l4.tcp.mms_stage = 1 + packet->packet_direction;
return;
}
if (flow->l4.tcp.mms_stage == 2 - packet->packet_direction
&& packet->payload[4] == 0xce && packet->payload[5] == 0xfa
&& packet->payload[6] == 0x0b && packet->payload[7] == 0xb0
&& packet->payload[12] == 0x4d && packet->payload[13] == 0x4d
&& packet->payload[14] == 0x53 && packet->payload[15] == 0x20) {
NDPI_LOG_INFO(ndpi_struct, "found MMS: MSMMS Response \n");
ndpi_int_mms_add_connection(ndpi_struct, flow);
return;
}
}
#ifdef NDPI_PROTOCOL_HTTP
if (NDPI_COMPARE_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_HTTP) != 0) {
#endif /* NDPI_PROTOCOL_HTTP */
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
#ifdef NDPI_PROTOCOL_HTTP
} else {
NDPI_LOG_DBG(ndpi_struct, "MMS avoid early exclude from http\n");
}
#endif /* NDPI_PROTOCOL_HTTP */
}
void init_mms_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{
ndpi_set_bitmask_protocol_detection("MMS", ndpi_struct, detection_bitmask, *id,
NDPI_CONTENT_MMS,
ndpi_search_mms_tcp,
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD,
NO_SAVE_DETECTION_BITMASK_AS_UNKNOWN,
ADD_TO_DETECTION_BITMASK);
*id += 1;
}
#endif
+1 -4
View File
@@ -2,7 +2,7 @@
* mpegts.c (MPEG Transport Stream) * mpegts.c (MPEG Transport Stream)
* https://en.wikipedia.org/wiki/MPEG_transport_stream * https://en.wikipedia.org/wiki/MPEG_transport_stream
* *
* Copyright (C) 2015 - ntop.org * Copyright (C) 2015-18 - ntop.org
* *
* nDPI is free software: you can redistribute it and/or modify * nDPI is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by * it under the terms of the GNU Lesser General Public License as published by
@@ -21,8 +21,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MPEGTS
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MPEGTS #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MPEGTS
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -65,4 +63,3 @@ void init_mpegts_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
*id += 1; *id += 1;
} }
#endif
+1 -4
View File
@@ -23,8 +23,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MQTT
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MQTT #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MQTT
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -232,7 +230,7 @@ void ndpi_search_mqtt (struct ndpi_detection_module_struct *ndpi_struct,
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MQTT); NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_MQTT);
return; return;
} else { } else {
NDPI_LOG_INFO(ndpi_struct, "found Mqtt UNSUBSCRIBE\n",pt); NDPI_LOG_INFO(ndpi_struct, "found Mqtt UNSUBSCRIBE\n");
ndpi_int_mqtt_add_connection(ndpi_struct,flow); ndpi_int_mqtt_add_connection(ndpi_struct,flow);
return; return;
} }
@@ -255,5 +253,4 @@ void init_mqtt_dissector (struct ndpi_detection_module_struct *ndpi_struct,
*id +=1; *id +=1;
} }
#endif // NDPI_PROTOCOL_MQTT
+26 -42
View File
@@ -2,7 +2,7 @@
* msn.c * msn.c
* *
* Copyright (C) 2009-2011 by ipoque GmbH * Copyright (C) 2009-2011 by ipoque GmbH
* Copyright (C) 2011-15 - ntop.org * Copyright (C) 2011-18 - ntop.org
* *
* This file is part of nDPI, an open source deep packet inspection * This file is part of nDPI, an open source deep packet inspection
* library based on the OpenDPI and PACE technology by ipoque GmbH * library based on the OpenDPI and PACE technology by ipoque GmbH
@@ -24,9 +24,6 @@
#include "ndpi_protocol_ids.h" #include "ndpi_protocol_ids.h"
#ifdef NDPI_PROTOCOL_MSN
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MSN #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_MSN
#include "ndpi_api.h" #include "ndpi_api.h"
@@ -65,7 +62,6 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
u_int16_t plen; u_int16_t plen;
u_int16_t status = 0; u_int16_t status = 0;
#ifdef NDPI_PROTOCOL_SSL
if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_SSL) { if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_SSL) {
NDPI_LOG_DBG2(ndpi_struct, "msn ssl ft test\n"); NDPI_LOG_DBG2(ndpi_struct, "msn ssl ft test\n");
@@ -73,28 +69,32 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
if(flow->packet_counter < 10) { if(flow->packet_counter < 10) {
if(flow->packet_counter == 7 && packet->payload_packet_len > 300) { if(flow->packet_counter == 7 && packet->payload_packet_len > 300) {
if(memcmp(packet->payload + 24, "MSNSLP", 6) == 0 if(memcmp(packet->payload + 24, "MSNSLP", 6) == 0
|| (get_u_int32_t(packet->payload, 0) == htonl(0x30000000) && get_u_int32_t(packet->payload, 4) == 0x00000000)) { || (get_u_int32_t(packet->payload, 0) == htonl(0x30000000)
&& get_u_int32_t(packet->payload, 4) == 0x00000000)) {
NDPI_LOG_INFO(ndpi_struct, "found MSN File Transfer, ifdef ssl\n"); NDPI_LOG_INFO(ndpi_struct, "found MSN File Transfer, ifdef ssl\n");
ndpi_int_msn_add_connection(ndpi_struct, flow); ndpi_int_msn_add_connection(ndpi_struct, flow);
return; return;
} }
} }
if(flow->packet_counter >= 5 && flow->packet_counter <= 10 && (get_u_int32_t(packet->payload, 0) == htonl(0x18000000)
&& get_u_int32_t(packet->payload, 4) == 0x00000000)) { if(flow->packet_counter >= 5 && flow->packet_counter <= 10
&& (get_u_int32_t(packet->payload, 0) == htonl(0x18000000)
&& get_u_int32_t(packet->payload, 4) == 0x00000000)) {
flow->l4.tcp.msn_ssl_ft++; flow->l4.tcp.msn_ssl_ft++;
NDPI_LOG_DBG2(ndpi_struct, NDPI_LOG_DBG2(ndpi_struct,
"increased msn ft ssl stage to: %u at packet nr: %u\n", flow->l4.tcp.msn_ssl_ft, "increased msn ft ssl stage to: %u at packet nr: %u\n",
flow->l4.tcp.msn_ssl_ft,
flow->packet_counter); flow->packet_counter);
if (flow->l4.tcp.msn_ssl_ft == 2) { if (flow->l4.tcp.msn_ssl_ft == 2) {
NDPI_LOG_INFO(ndpi_struct, NDPI_LOG_INFO(ndpi_struct,
"found MSN File Transfer, ifdef ssl 2.\n"); "found MSN File Transfer, ifdef ssl 2.\n");
ndpi_int_msn_add_connection(ndpi_struct, flow); ndpi_int_msn_add_connection(ndpi_struct, flow);
} }
return; return;
} }
} }
} }
#endif
/* we detect the initial connection only ! */ /* we detect the initial connection only ! */
/* match: "VER " ..... "CVR" x 0x0d 0x0a /* match: "VER " ..... "CVR" x 0x0d 0x0a
@@ -103,15 +103,17 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
*/ */
/* now we have a look at the first packet only. */ /* now we have a look at the first packet only. */
if(flow->packet_counter == 1 if(flow->packet_counter == 1
#ifdef NDPI_PROTOCOL_SSL || ((packet->detected_protocol_stack[0] == NDPI_PROTOCOL_SSL)
|| ((packet->detected_protocol_stack[0] == NDPI_PROTOCOL_SSL) && flow->packet_counter <= 3) && flow->packet_counter <= 3)
#endif
) { ) {
/* this part is working asymmetrically */ /* this part is working asymmetrically */
if(packet->payload_packet_len > 32 && (packet->payload[0] == 0x02 || packet->payload[0] == 0x00) if(packet->payload_packet_len > 32
&& (ntohl(get_u_int32_t(packet->payload, 8)) == 0x2112a442 || ntohl(get_u_int32_t(packet->payload, 4)) == 0x2112a442) && (packet->payload[0] == 0x02 || packet->payload[0] == 0x00)
&& ((ntohl(get_u_int32_t(packet->payload, 24)) == 0x000f0004 && ntohl(get_u_int32_t(packet->payload, 28)) == 0x72c64bc6) && (ntohl(get_u_int32_t(packet->payload, 8)) == 0x2112a442
|| ntohl(get_u_int32_t(packet->payload, 4)) == 0x2112a442)
&& ((ntohl(get_u_int32_t(packet->payload, 24)) == 0x000f0004
&& ntohl(get_u_int32_t(packet->payload, 28)) == 0x72c64bc6)
|| (ntohl(get_u_int32_t(packet->payload, 20)) == 0x000f0004 || (ntohl(get_u_int32_t(packet->payload, 20)) == 0x000f0004
&& ntohl(get_u_int32_t(packet->payload, 24)) == 0x72c64bc6))) { && ntohl(get_u_int32_t(packet->payload, 24)) == 0x72c64bc6))) {
NDPI_LOG_INFO(ndpi_struct, NDPI_LOG_INFO(ndpi_struct,
@@ -145,10 +147,9 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
} }
} }
} }
if( if(
#ifdef NDPI_PROTOCOL_HTTP
packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP || packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP ||
#endif
ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "GET ") || ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "GET ") ||
ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "POST ")) { ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "POST ")) {
ndpi_parse_packet_line_info(ndpi_struct, flow); ndpi_parse_packet_line_info(ndpi_struct, flow);
@@ -160,18 +161,12 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
return; return;
} }
} }
/* #ifdef NDPI_PROTOCOL_HTTP */
/* /\* we have to examine two http packets *\/ */
/* if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP) { */
/* } */
/* #endif */
/* not seen this pattern in any trace */ /* not seen this pattern in any trace */
/* now test for http login, at least 100 a bytes packet */ /* now test for http login, at least 100 a bytes packet */
if(packet->payload_packet_len > 100) { if(packet->payload_packet_len > 100) {
if( if(
#ifdef NDPI_PROTOCOL_HTTP
packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP || packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP ||
#endif
memcmp(packet->payload, "POST http://", 12) == 0) { memcmp(packet->payload, "POST http://", 12) == 0) {
/* scan packet if not already done... */ /* scan packet if not already done... */
ndpi_parse_packet_line_info(ndpi_struct, flow); ndpi_parse_packet_line_info(ndpi_struct, flow);
@@ -193,9 +188,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
/* for this case the asymmetric detection is asym (1) */ /* for this case the asymmetric detection is asym (1) */
if(packet->payload_packet_len > 400) { if(packet->payload_packet_len > 400) {
if(( if((
#ifdef NDPI_PROTOCOL_HTTP
packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP || packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP ||
#endif
(memcmp(packet->payload, "POST ", 5) == 0))) { (memcmp(packet->payload, "POST ", 5) == 0))) {
u_int16_t c; u_int16_t c;
if(memcmp(&packet->payload[5], "http://", 7) == 0) { if(memcmp(&packet->payload[5], "http://", 7) == 0) {
@@ -259,9 +252,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
&& packet->payload_packet_len > 100) { && packet->payload_packet_len > 100) {
/* not necessary to check the length, because this has been done : >400. */ /* not necessary to check the length, because this has been done : >400. */
if( if(
#ifdef NDPI_PROTOCOL_HTTP
packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP || packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP ||
#endif
ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "HTTP/1.0 200 OK") || ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "HTTP/1.0 200 OK") ||
ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "HTTP/1.1 200 OK") ndpi_match_strprefix(packet->payload, packet->payload_packet_len, "HTTP/1.1 200 OK")
) { ) {
@@ -342,9 +333,7 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
packet->payload_packet_len > 100) { packet->payload_packet_len > 100) {
/* not necessary to check the length, because this has been done : >400. */ /* not necessary to check the length, because this has been done : >400. */
if( if(
#ifdef NDPI_PROTOCOL_HTTP
packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP || packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP ||
#endif
(memcmp(packet->payload, "HTTP/1.0 200 OK", 15) == 0) || (memcmp(packet->payload, "HTTP/1.0 200 OK", 15) == 0) ||
(memcmp(packet->payload, "HTTP/1.1 200 OK", 15) == 0)) { (memcmp(packet->payload, "HTTP/1.1 200 OK", 15) == 0)) {
@@ -442,15 +431,16 @@ static void ndpi_search_msn_tcp(struct ndpi_detection_module_struct *ndpi_struct
} }
NDPI_LOG_DBG(ndpi_struct, "msn 7\n"); NDPI_LOG_DBG(ndpi_struct, "msn 7\n");
if (flow->packet_counter <= MAX_PACKETS_FOR_MSN) { if (flow->packet_counter <= MAX_PACKETS_FOR_MSN) {
if (memcmp(&packet->payload[0], "MSG ", 4) == 0 if (packet->payload_packet_len >=4 && (memcmp(&packet->payload[0], "MSG ", 4) == 0
|| memcmp(&packet->payload[0], "PNG", 3) == 0 || memcmp(&packet->payload[0], "PNG", 3) == 0
|| memcmp(&packet->payload[0], "QNG ", 4) == 0 || memcmp(&packet->payload[0], "QNG ", 4) == 0
|| memcmp(&packet->payload[0], "OUT", 3) == 0 || memcmp(&packet->payload[0], "OUT", 3) == 0
|| memcmp(&packet->payload[0], "RNG ", 4) == 0 || memcmp(&packet->payload[0], "RNG ", 4) == 0
|| memcmp(&packet->payload[0], "NLN ", 4) == 0 || memcmp(&packet->payload[0], "NLN ", 4) == 0
|| memcmp(&packet->payload[0], "UBX ", 4) == 0 || memcmp(&packet->payload[0], "UBX ", 4) == 0
|| memcmp(&packet->payload[0], "XFR ", 4) == 0) { || memcmp(&packet->payload[0], "XFR ", 4) == 0)
){
ndpi_int_msn_add_connection(ndpi_struct, flow); ndpi_int_msn_add_connection(ndpi_struct, flow);
NDPI_LOG_INFO(ndpi_struct, "found MSN\n"); NDPI_LOG_INFO(ndpi_struct, "found MSN\n");
@@ -506,15 +496,9 @@ void ndpi_search_msn(struct ndpi_detection_module_struct *ndpi_struct, struct nd
/* the detection can switch out the http or the ssl detection. In this case we need not check those protocols */ /* the detection can switch out the http or the ssl detection. In this case we need not check those protocols */
// need to do the ceck when protocol == http too (POST /gateway ...) // need to do the ceck when protocol == http too (POST /gateway ...)
if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN if(packet->detected_protocol_stack[0] == NDPI_PROTOCOL_UNKNOWN
#ifdef NDPI_PROTOCOL_HTTP
|| packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP || packet->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP
#endif
#ifdef NDPI_PROTOCOL_SSL
|| packet->detected_protocol_stack[0] == NDPI_PROTOCOL_SSL || packet->detected_protocol_stack[0] == NDPI_PROTOCOL_SSL
#endif
#ifdef NDPI_PROTOCOL_STUN
|| packet->detected_protocol_stack[0] == NDPI_PROTOCOL_STUN || packet->detected_protocol_stack[0] == NDPI_PROTOCOL_STUN
#endif
) )
ndpi_search_msn_tcp(ndpi_struct, flow); ndpi_search_msn_tcp(ndpi_struct, flow);
} else if (packet->udp != NULL) { } else if (packet->udp != NULL) {
@@ -524,7 +508,8 @@ void ndpi_search_msn(struct ndpi_detection_module_struct *ndpi_struct, struct nd
} }
void init_msn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) void init_msn_dissector(struct ndpi_detection_module_struct *ndpi_struct,
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
{ {
NDPI_BITMASK_RESET(ndpi_struct->callback_buffer[*id].excluded_protocol_bitmask); NDPI_BITMASK_RESET(ndpi_struct->callback_buffer[*id].excluded_protocol_bitmask);
@@ -539,4 +524,3 @@ void init_msn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
*id += 1; *id += 1;
} }
#endif

Some files were not shown because too many files have changed in this diff Show More