69 Commits

Author SHA1 Message Date
Toni Uhlig
93bff603d0 py-flow-info: Support for --ipwhois, --new and --detection.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-04-30 22:39:11 +02:00
Toni Uhlig
174bd89d8e Added JA3 blacklist downloader/checker from abuse.ch
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-04-17 16:45:03 +02:00
Toni Uhlig
a119a72d13 Added python example to check JA3 hashes against known hashes via JA3er.com
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-04-16 13:30:24 +02:00
Toni Uhlig
f713ec702b Added nDPId semantic validation test.
* fixed inconsistent processing of remaining flows during nDPId shutdown phase
 * fixed multiple `detected' flow events
   (instead only `detection-update' flow events can occur after a `detected' flow event)
 * fixed nDPIsrvd.py invalid message buffer handling
 * improved run_tests.sh so only valid pcap capture files are getting processed
   (and some more cosmetics + logging)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-04-14 22:04:42 +02:00
Toni Uhlig
514c427917 Fixed nDPIsrvd.h flow end bug (flow end callback could never be called and caused some memory troubles).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-04-11 12:34:38 +02:00
Toni Uhlig
131cf5385b Added IPv6 support for -I / -E.
* added another Python search path and try-catch ModuleNotFoundError again
 * run_tests.sh checks for OpenBSD netcat (required for -q)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-04-11 00:16:52 +02:00
Toni Uhlig
4e583cd4de Added JSON schema validation to run_tests.sh
* Python3 scripts are now compatible with versions <3.6
 * improved and prettified run_tests.sh

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-04-09 14:12:48 +02:00
Toni Uhlig
0a7ad7a76a nDPId-test: added JSON distribution + JSON parsing (Multithreaded design re-using most of nDPId/nDPIsrvd core)
* improved Makefile.old install targets
 * splitted nDPIsrvd_parse into nDPIsrvd_parse_line and nDPIsrvd_parse_all for the sake of readability
 * minor Python script improvments (check for nDPIsrvd.py on multiple locations, may be superseeded by setuptools in the future)
 * some paths needs to be absolute (chdir() during daemonize) and therefor additional checks introduced
 * test run script checks and fails if certain files are are missing (PCAP file <=> result output file)
 * removed not very useful "internal format error" JSON serialization if a BUG for same exists
 * fixed invalid l4 type statistics counters for nDPIsrvd-collectd

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-04-09 00:18:35 +02:00
Toni Uhlig
ef4a22ffac Updated README.md
* added examples/README.md and schema/README.md

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-03-24 14:44:27 +01:00
Toni Uhlig
c68c1750ba Switched to CMake build system.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-03-17 17:41:19 +01:00
Toni Uhlig
1c3ef69faa nDPIsrvd collectd-exec overhaul.
* Install targets updated.
 * Removed nDPIsrvd.h token validation function (done automatically by token_get).

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-03-15 14:39:43 +01:00
Toni Uhlig
9a06b97473 Fixed collectd-exec issues.
* Added collectd example config and types.db

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-03-12 17:30:04 +01:00
Toni Uhlig
772b67b767 Added basic collectd-exec example.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-03-10 18:32:09 +01:00
Toni Uhlig
4699263d65 Fixed possible NULL pointer deref in dependencies/nDPIsrvd.h and examples/c-captured/c-captured.c
* `make install` C examples
 * examples/py-flow-info/flow-info.py supports filtering
 * added breed to examples/py-flow-info/flow-info.py

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-28 11:27:22 +01:00
Toni Uhlig
06ff353099 Added JA3 / SSL SHA1 fingerprint blacklists.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-27 17:47:49 +01:00
Toni Uhlig
e0310d7e1d Finalized examples/c-captured to dump packet bytes to PCAP for further analysis.
* Fixed memory holes in nDPId structs.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-24 18:43:26 +01:00
Toni Uhlig
0b5b177c14 Extended nDPIsrvd.h with address parsing.
* nDPId supports looading of custom nDPI protocol/category files
 * extended JSON schemas according to nDPI / nDPId JSON serializing
 * removed memory holes in nDPId
 * extended examples/c-captured

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-23 14:46:47 +01:00
Toni Uhlig
0a6d44dc60 C-Api uses similiar flow key hash calculation as Python-Api.
* Make use of flow id / alias / source which is required for future use cases where multiple nDPId instances (same / different machines) feed one nDPIsrvd.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-19 18:39:14 +01:00
Toni Uhlig
a1805eb891 Added JSON schema files and a Python schema validator.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-17 14:00:10 +01:00
Toni Uhlig
893f437051 Aligned nDPIsrvd.py to nDPIsrvd.h for consistency.
* Simplified Python interface as well.
 * c-captured and flow-undetected-to-pcap.py produce similiar results
 * Removed overloaded nDPIsrvd.py event structures.
 * flow-info.py prints (with a color-hash) additional information e.g. alias/source and midstream

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-16 20:43:00 +01:00
Toni Uhlig
7218990e58 Removed superfluous nDPI (header) dependency for examples/c-captured. Use header definitions from libc instead.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-06 16:01:54 +01:00
Toni Uhlig
69b4e662c7 nDPIsrvd C API overhaul and massive simplification.
* nDPIsrvd.h does flow mgmt out of the box
 * dissect received JSON strings via callback
 * added new JSON key/values for packet-flows (usecTimestamp/L3/L4 info)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-02-06 15:41:30 +01:00
Toni Uhlig
257cce1dcc Fixed braindead failure - Increase of NETWORK_BUFFER_MAX_SIZE > 9999 means to also increase NETWORK_BUFFER_LENGTH_DIGITS to 5.
* Fixed ARM32 xcompile warnings; Other GCC versions, other uint64_t's..
 * Replaced ridiculous nDPIsrvd_JSON_BYTES with NETWORK_BUFFER_LENGTH_DIGITS.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-01-27 18:05:13 +01:00
Toni Uhlig
9564b0ce2c Increased JSON buffer size to 12288 (libnDPI serializes more and more information).
* Making Compare&Fetch mandatory.
 * Added some more Compare&Fetch to prevent TSAN complaining about data races.
   Fixed possible but more ore less harmless data races during shutdown process.
 * Shrink SIGNAL handler to a minimum. SYSV Signal handling and MT-safety is awkward.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-01-27 17:19:29 +01:00
Toni Uhlig
102b61175c All colors are beautiful for py-flow-info.
* instance alias is now mandatory (will be required for future use-cases)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-01-26 19:07:16 +01:00
Toni Uhlig
25c23e3d23 Finished (mostly) C guessed/undetected flow dumper.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-01-26 18:31:24 +01:00
Toni Uhlig
3a1afb9434 Added simple python json out example used for comparing JSON output.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2021-01-20 16:10:16 +01:00
Toni Uhlig
613e60ca2a Declared nDPI id and flow structs in nDPId flow info struct.
Two reasons:
 * reduce heap memory allocations
 * nDPId flow info struct may be inflated in the future (more bytes to compress)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-12-30 13:28:32 +01:00
Toni Uhlig
32b192df3b Removed all LUA leftover as preparation for UTHASH.
* Added UNIX socket support for nDPIsrvd.h (and c-captured)

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-12-01 13:31:07 +01:00
Toni Uhlig
f8692c6be1 Let travis use pcap files from nDPI to produce some JSON output. (disabled, needs further testing..)
* Added pcap diff script
 * Added \n to JSON string end (useful for debugging and readability)
 * Use first host/server name character for hash calculation as well
 * Removed error'ing EPOLLHUP handling in nDPIsrvd (connection closing will be detected via read())

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-12-01 10:22:47 +01:00
Toni Uhlig
ba179cc724 Increased serialization buffer size as required for recent nDPI builds.
* added .gitignore to prevent SCM check-ins of unwanted files
 * fixed invalid include path for python examples

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-11-18 18:12:38 +01:00
Toni Uhlig
54dd72676d Provide functionality do deal with tokens from JSMN.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-11-17 19:29:10 +01:00
Toni Uhlig
a03e0c8ba8 Fixed inconsistent callback function call if a token parsed.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-11-13 19:55:54 +01:00
Toni Uhlig
7853c79cd6 Renamed misleading "contrib" subfolder to "dependencies".
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-11-13 14:26:51 +01:00
Toni Uhlig
7362da8c5f Finished unfinished nDPIsrvd.h helper functionality.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-11-13 14:09:19 +01:00
Toni Uhlig
ca28fd9a03 Make sure that DAEMON_EVENT_SHUTDOWN gets transmitted before close() (hacky, but works).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-11-08 15:14:08 +01:00
Toni Uhlig
8cbac2ac88 cosmetics, exception verbosity
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-10-17 12:42:26 +02:00
Toni Uhlig
ec9dc251d2 py-flow-info: Print BasicEvents.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-10-12 20:02:20 +02:00
Toni Uhlig
9ea078b05e Improved python event validation with focus on readability.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-30 20:35:28 +02:00
Toni Uhlig
2f7a052f43 Centralized some python code parts to make future modifications easier.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-29 18:37:24 +02:00
Toni Uhlig
04bbbcd055 Improved event parsing for Python scripts.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-26 15:15:15 +02:00
Toni Uhlig
8c61f88362 Added event validation functions and fixed Python scripts.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-26 11:19:21 +02:00
Toni Uhlig
84712686a7 Centralized EventName validation and moved code parts.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-26 00:49:34 +02:00
Toni Uhlig
adce2272dc Removed DISABLE_JSMN define for c-json-stdout (built-in per default).
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-26 00:49:34 +02:00
Toni Uhlig
a3ed1af871 Removed examples/c-json-stdout/jsmn as it's new location will be contrib/jsmn, soon.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-26 00:39:51 +02:00
Toni Uhlig
6c0ac8b045 Added new flow event: FLOW_EVENT_DETECTION_UPDATE
* This event will be triggered when nDPI detection has some new information for us (hopefully).
 * Detection change is based on hashing with 32-bit murmur3 certain members of the ndpi flow struct.

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-25 20:43:23 +02:00
Toni Uhlig
370ca7c00d Process extra packets with nDPI, still not perfect but results in a more accurate detection.
* set default user used for setuid()
 * added 2 TODOs

Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-24 23:41:12 +02:00
Toni Uhlig
ec101fbc0f go-dashboard: Print unmarshalled JSON string in a textbox.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-03 20:34:57 +02:00
Toni Uhlig
001f84af3b go-dashboard: Added event structs and JSON unmarshal semantic.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-02 18:57:58 +02:00
Toni Uhlig
0a03293d16 go-dashboard: go mod/vendor support + termdash text user interface
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
2020-09-01 23:46:07 +02:00