Commit graph

516 commits

Author SHA1 Message Date
Vitaly Lavrov
f84512cd2a Merge commit '6d2476c31b' into flow_info-4 2026-11-20 12:56:46 +03:00
Vitaly Lavrov
ad0f93c339 Merge commit 'b6bddaf79b' into flow_info-4 2026-11-20 12:44:45 +03:00
Vitaly Lavrov
a0b3a6fbee Merge commit '6b38c1c258' into flow_info-4 2026-11-20 12:42:41 +03:00
Vitaly Lavrov
4d3cb23dc8 Merge commit 'b17e3ae776' into flow_info-4 2026-11-20 12:36:39 +03:00
Vitaly Lavrov
20fb399023 Merge commit 'cdad1fce08' into flow_info-4 2026-11-20 12:31:37 +03:00
Luca Deri
5d9724ca04 HTTP subprotocols are not set only in case HTTP returns a positive response.
This is to avoid that probing attempts create invalid protocol detection
2026-11-12 12:47:04 +01:00
Alfredo Cardigliano
b5db1c7850 Fix Linux Cooked Capture v2 parsing 2026-11-10 09:39:10 +01:00
Ivan Nardi
b6bddaf79b
Kerberos: add helpers to describe and serialize the metadata (#3317)
- ndpi_kerberos_msg_type2str(), ndpi_kerberos_name_type2str(),
  ndpi_kerberos_error2str() (RFC 4120, RFC 4556, RFC 6113 error codes),
  ndpi_kerberos_s4u2str()
- ndpi_kerberos_reply_ok(): the KDC issued the ticket (AS-REP/TGS-REP)
- ndpi_kerberos_reply_error(): name of the error of a KRB-ERROR reply
- ndpi_kerberos_client_name(): "user@realm", or "host$@realm" for a
  machine; an enterprise name ending with the realm is used as it is,
  otherwise its '@' are escaped ("user\@upn.suffix@realm")
- ndpi_kerberos2json(): used by ndpi_dpi2json() (same output)

ndpiReader uses them, and prints the name of the error code.
2026-11-05 19:46:37 +01:00
Ivan Nardi
21184d1a50 Kerberos: keep UTF-8 names and report truncated names
Names and realm were copied byte by byte: any non-ASCII byte was replaced
by '?' (e.g. "josé" became "jos??") and a name longer than the buffer was
silently truncated, i.e. exported as a different, wrong, name.

Now:
- valid UTF-8 is kept as is (only ASCII is lowercased); control characters
  and invalid bytes are still replaced by '?'
- a multi-byte character is never split
- the new flags hostname_truncated, domain_truncated and
  username_truncated report a truncated name
- the buffers are larger (hostname 64, domain 64, username 96), to fit long
  enterprise names and realms (still within the protos union)
2026-11-05 13:28:09 +01:00
Ivan Nardi
30aae910ed Kerberos: export S4U (S4U2Self and S4U2Proxy) requests
With S4U (MS-SFU) a service requests a ticket on behalf of a user: the
client name of the reply is the user, but the client of the flow is the
service. Without knowing it, the users of the metadata bind the user to
the host of the service.

Export it in the new field "s4u", set for the first TGS-REQ with:
- PA-FOR-USER (129) or PA-S4U-X509-USER (130): S4U2Self
- the cname-in-addl-tkt KDC option: S4U2Proxy (constrained delegation);
  additional tickets without this option are user-to-user
2026-11-05 13:28:09 +01:00
Ivan Nardi
5e46f85b98 Kerberos: don't export service principals as usernames; export the name type
With a client name of two components, only "host/x" and "ldap/x" were
handled (the second component is the machine): for any other service
principal (e.g. "nfs/server.corp.local" or "HTTP/web.corp.local", used by
logins with a keytab) the service was exported as the username ("nfs",
"http"). Now neither the username nor the hostname are set.

Export also the name type of the client name (e.g. 1 principal, 2/3
service, 6 X.500, 10 enterprise, -128 MS principal), so that the users of
the metadata can tell what kind of name it is.
2026-11-05 13:28:09 +01:00
Ivan Nardi
0d0d926fad
ndpiReader: remove the info of a risk cleared after the detection (#3306)
ndpiReader clears the unidirectional traffic risk when a packet comes
back after the detection (as nDPI asks the applications to do), but the
info of the risk, copied as a string when the detection was completed,
was still printed.

The flow now keeps a copy of the infos of its risks, by risk, instead of
the string: clearing a risk removes also its info, and the text is built
when required.
2026-11-02 09:14:32 +01:00
Luca Deri
f3a562f0d0 SMB detects file name and returs it in metadata
Renamed ends_with with ndpi_ends_with
2026-10-27 17:24:04 +01:00
Ivan Nardi
b20123478c
Kerberos: rework dissector and export request/response metadata (#3276)
Replace the per-message heuristics with a single ASN.1 walk covering
AS-REQ, AS-REP, TGS-REQ, TGS-REP and KRB-ERROR, over both TCP and UDP.
AS-REP was never parsed and nothing was extracted from KRB-ERROR.

New metadata: request type, response type and (for KRB-ERROR) the error
code. They are printed by ndpiReader and exported via JSON as
"request_type", "response_type", "response_ok" (true for AS-REP and
TGS-REP) and "error_code". Only the first request and the first reply
of a flow are exported.

Client name and realm keep the existing conventions, so they are not
the literal Wireshark `kerberos.CNameString/kerberos.realm` values:
- the trailing '$' of machine accounts is stripped on purpose: a cname
  ending with '$' (e.g. "jersey-shore-2c$") is exported in "hostname"
  without the '$'; any other cname is exported in "username" unchanged
- names and realm are lowercased

The generic BER helpers (asn1_ber_decode_header/tlv/single_tlv/int) are
in ndpi_utils.c, next to asn1_ber_decode_length().

Close #3275
Close #2117
2026-10-13 18:52:53 +02:00
Luca Deri
5915c399c0 Improved nDPI TCP fingeprint specification 2026-10-11 12:52:14 +02:00
Vitaly Lavrov
094c9014a4 Merge commit 'eb8024ea92' into flow_info-4 2026-10-07 10:18:05 +03:00
Vitaly Lavrov
7d5fc92248 Merge commit 'a6e250b724' into flow_info-4 2026-10-07 10:03:49 +03:00
Luca Deri
de3915b9fc Renamed JA5 to nDPI TLS fingerprint 2026-10-06 23:42:20 +02:00
Vitaly Lavrov
633df5a1f5 Merge commit 'feab46858f' into flow_info-4 2026-10-05 14:16:35 +03:00
Vitaly Lavrov
ecfab97ceb Merge commit 'a105d9328a' into flow_info-4 2026-10-02 15:37:40 +03:00
Vitaly Lavrov
5fa42a1942 Merge commit 'dedf61e9cc' into flow_info-4 2026-10-02 15:32:03 +03:00
Luca Deri
f9daaf170d
Dynamic host_server_name and add JA5 implementation(#3257) 2026-09-14 10:34:33 +02:00
Luca Deri
61337dad12
Reworked code to split flow definition in core and metadata 2026-09-05 15:48:02 +02:00
Raja Muhammad Awais
720dbe3481
ndpiReader: exclude TCP retransmissions from goodput (#3234)
Close: #1853

Co-authored-by: RajaMuhammadAwais <1.19938988e+08+RajaMuhammadAwais@users.noreply.github.com>
2026-08-28 18:14:28 +02:00
Luca
a105d9328a Fix for monitoring mode 2026-08-24 16:32:13 +02:00
Ivan Nardi
1f2606902c
License: non-commercial vs commercial applications (#3220)
* WIP

* Fix compilation of fuzzing

* Fix fuzzing compilation

* Cleaned up old quic contributed code (#3222)

Recode commits 713cdd0, 26df140

* QUIC: refactoring

* WIP

* WIP

* Revert "QUIC: refactoring"

This reverts commit 50afd07f28.

* QUIC: refactoring original Wireshark code (#3224)

* Added ability to specify in protocol definition, when a (partial) protocol
can change. This can be queries using a new APi call
named ndpi_can_partial_proto_classification_change()

* TLS: minor changes and remove same stale comments

* Fix out-of-bounds read of TLS certificate dates (#3225)

notBefore and notAfter are u_int32_t, but ndpi_tls2json() passed their
address to ndpi_gmtime_r() as a time_t *. Wherever time_t is 8 bytes this
reads 4 bytes past the field, picking up the adjacent member, so the value
handed to gmtime_r() is notBefore | (notAfter << 32) on little-endian.

gmtime_r() then fails on that out-of-range value and returns NULL, leaving
before/after NULL, so the "notbefore" and "notafter" fields are silently
dropped from the JSON output. On architectures that require aligned access
the 8-byte load traps instead of merely being wrong.

Convert to a real time_t instead of casting the address. The temporaries
are named not_before/not_after because notBefore/notAfter are already
char[32] buffers in the same function.

* WIP

* fuzz: fix compilation

---------

Co-authored-by: Luca Deri <lucaderi@users.noreply.github.com>
Co-authored-by: Luca Deri <deri@ntop.org>
Co-authored-by: shalseth <33956011+shalseth@users.noreply.github.com>
2026-08-22 17:57:28 +02:00
Vitaly Lavrov
c79d883936 Merge branch 'github.dev' into flow_info-4
Some checks failed
CIFuzz / Fuzzing (address) (push) Has been cancelled
CIFuzz / Fuzzing (memory) (push) Has been cancelled
CIFuzz / Fuzzing (undefined) (push) Has been cancelled
2026-07-07 12:14:31 +03:00
Ivan Nardi
79178b88c8
CI: compilation checks on more BSD flavors and add support for ubuntu 26.04 (#3188) 2026-06-22 17:20:16 +02:00
Vitaly Lavrov
e5d3178c64 Merge commit '68c7159a72' into flow_info-4 2026-05-07 10:17:25 +03:00
Vitaly Lavrov
47f7d09550 Merge commit 'c4c18440cc' into flow_info-4 2026-05-06 14:58:30 +03:00
Luca Deri
ae586c875c Extended IPSEC dissection and added metadata extraction 2026-04-09 15:08:48 +02:00
Luca Deri
c4c18440cc
Implemented nDPI server fingerprint (#3139) 2026-03-24 00:09:11 +01:00
Vitaly Lavrov
7c61d68bd9 Merge commit '6258bda34d' into flow_info-4
Fix after merge
2026-03-20 14:45:11 +03:00
Vitaly Lavrov
60bf93c7bc Merge commit 'e3801f4d14' into flow_info-4 2026-03-20 11:52:21 +03:00
Vitaly Lavrov
4928347756 Merge commit '15bac7a892' into flow_info-4 2026-03-20 11:06:51 +03:00
Ivan Nardi
8a3aa62f5f
USDT probes: add two new probes for detecting IP fragments (#3134) 2026-03-14 21:46:09 +01:00
Ivan Nardi
31c3610ea7 ndpiReader: better memory statistics: malloc vs realloc 2026-03-04 18:27:58 +01:00
Ivan Nardi
299a588f51
ndpiReader: fix a masan error (#3118) 2026-02-17 10:29:48 +01:00
Vitaly Lavrov
0c1ed8d9eb Merge commit '5c4b307e6a' into flow_info-4 2026-02-09 10:52:24 +03:00
Vitaly Lavrov
81d22f46d5 Merge commit '922187a5a2' into flow_info-4 2026-02-06 12:44:37 +03:00
Vitaly Lavrov
07b76c4d26 Merge commit '1ffc582e76' into flow_info-4 2026-02-06 12:32:00 +03:00
Ivan Nardi
40ff9c4aa8 ndpiReader: fix the TLS blocks info collecting 2026-01-25 20:05:44 +01:00
Luca Deri
5e93917718 Further separator changes 2026-01-24 10:08:41 +01:00
Luca Deri
901e317422
Added --cfg "tls,max_num_blocks_to_analyze,X" for dynamically setting TLS blocks number (#3073)
* Added --cfg "tls,max_num_blocks_to_analyze,X" where if X > 0 TLS blocks are analyzed

Example --cfg "tls,max_num_blocks_to_analyze,8"

* TLS blocks now include a time-delta (msec) with respect to the previous TLS block.
The format is @<msec delta>. Example:

 "tls_blocks": [
         "22:1=232@191",
         "22:2=-122@5,20=-1@5,21=-23@5,21=-905@5,21=-281@5",
         "21=-53@0",
         "20=1@3,21=53@3",
         "21=-218@119,21=-218@119",
 ]
2026-01-08 23:36:13 +01:00
Luca Deri
37ca034697 (C) update 2026-01-01 10:31:40 +01:00
Luca Deri
e49fa91627 Added tls_blocks serialization in JSON/csv
Use --cfg "tls,blocks_analysis,1" with ndpiReader
2025-12-26 21:06:19 +01:00
Luca Deri
159c05f032
Added ability to export SSH key exchanges (disabled by default).
It's possible to enable it using "--cfg=ssh,metadata.ssh_data,1" in ndpiReader. When enabled
the negotiated SSH key exchange method is returned.
2025-12-20 20:19:17 +01:00
Vitaly Lavrov
4aee91fd7a Merge commit 'd76007054c' into flow_info-4 2025-12-09 12:47:45 +03:00
Vitaly Lavrov
acdd82f4c4 Merge commit 'e22a434709' into flow_info-4 2025-12-08 15:05:45 +03:00
Vitaly Lavrov
d33e63fbba Merge commit 'bb10ecc380' into flow_info-4 2025-12-08 13:13:41 +03:00