Updated README.md (#1562)

* make check great again (not so much)
 * make doc/doc-view
 * CI updates

Signed-off-by: lns <matzeton@googlemail.com>
This commit is contained in:
Toni
2022-05-30 19:48:05 +02:00
committed by GitHub
parent ca115774c9
commit 00ee364a7e
11 changed files with 93 additions and 42 deletions
+9 -18
View File
@@ -30,9 +30,7 @@ jobs:
run: make all run: make all
- name: Test - name: Test
run: | run: |
./tests/do.sh make check VERBOSE=1
./tests/do-unit.sh
./tests/do-dga.sh
- name: Generate Coverage Report - name: Generate Coverage Report
run: | run: |
mkdir -vp coverage_report/ndpi_coverage_report mkdir -vp coverage_report/ndpi_coverage_report
@@ -66,9 +64,9 @@ jobs:
sudo make install sudo make install
- name: Generate Python bindings - name: Generate Python bindings
run: | run: |
cd python
pip install --upgrade pip pip install --upgrade pip
pip install -r requirements.txt pip install -r python/requirements.txt
cd python
python setup.py install python setup.py install
cd .. cd ..
- name: Test Python Bindings - name: Test Python Bindings
@@ -96,11 +94,9 @@ jobs:
./autogen.sh --with-only-libndpi ./autogen.sh --with-only-libndpi
- name: Generate Documentation - name: Generate Documentation
run: | run: |
cd doc
pip install --upgrade pip pip install --upgrade pip
pip install -r requirements.txt pip install -r doc/requirements.txt
make html make doc
cd ..
mkdir -vp doc/_build/ndpi-documentation-upload/ndpi-documentation mkdir -vp doc/_build/ndpi-documentation-upload/ndpi-documentation
mv -v doc/_build/html doc/_build/ndpi-documentation-upload/ndpi-documentation/html mv -v doc/_build/html doc/_build/ndpi-documentation-upload/ndpi-documentation/html
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
@@ -288,9 +284,7 @@ jobs:
- name: Installing MacOS prerequisites - name: Installing MacOS prerequisites
if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64') if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64')
run: | run: |
brew install autoconf automake libtool pkg-config gettext json-c brew install coreutils wdiff colordiff autoconf automake libtool pkg-config gettext json-c rrdtool
brew install coreutils wdiff colordiff
brew install rrdtool
- name: Install MacOS Prerequisites (libgcrypt) - name: Install MacOS Prerequisites (libgcrypt)
if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.gcrypt, '--with-local-libgcrypt') if: startsWith(matrix.os, 'macOS') && startsWith(matrix.arch, 'x86_64') && startsWith(matrix.gcrypt, '--with-local-libgcrypt')
run: | run: |
@@ -396,8 +390,7 @@ jobs:
make all && make all &&
make -C example ndpiSimpleIntegration && make -C example ndpiSimpleIntegration &&
make -C rrdtool && make -C rrdtool &&
./tests/do.sh && make check VERBOSE=1
./tests/do-unit.sh
" "
- name: Display qemu specified architecture (armhf - little endian) - name: Display qemu specified architecture (armhf - little endian)
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'armhf') if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 'armhf')
@@ -421,8 +414,7 @@ jobs:
make all && make all &&
make -C example ndpiSimpleIntegration && make -C example ndpiSimpleIntegration &&
make -C rrdtool && make -C rrdtool &&
./tests/do.sh && make check VERBOSE=1
./tests/do-unit.sh
" "
- name: Display qemu specified architecture (s390x - big endian) - name: Display qemu specified architecture (s390x - big endian)
if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 's390x') if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.arch, 's390x')
@@ -446,6 +438,5 @@ jobs:
make all && make all &&
make -C example ndpiSimpleIntegration && make -C example ndpiSimpleIntegration &&
make -C rrdtool && make -C rrdtool &&
./tests/do.sh && make check VERBOSE=1
./tests/do-unit.sh
" "
+7
View File
@@ -21,5 +21,12 @@ EXTRA_DIST = README.md README.nDPI README.fuzzer.md CHANGELOG.md CONTRIBUTING.md
sonar-project.properties .github .ci-ignore .lgtm/cpp-queries/packet-payload-integer-arithmetic.ql lgtm.yml sonar-project.properties .github .ci-ignore .lgtm/cpp-queries/packet-payload-integer-arithmetic.ql lgtm.yml
.PHONY: doc doc-view
doc:
make -C doc html
doc-view:
python3 -m http.server --bind 127.0.0.1 --directory doc/_build/html 8080
changelog: changelog:
git log --since={`curl -s https://github.com/ntop/ndpi/releases | grep datetime | head -n1 | egrep -o "[0-9]+\-[0-9]+\-[0-9]+"`} --name-only --pretty=format:" - %s" | grep "^ " > CHANGELOG.latest git log --since={`curl -s https://github.com/ntop/ndpi/releases | grep datetime | head -n1 | egrep -o "[0-9]+\-[0-9]+\-[0-9]+"`} --name-only --pretty=format:" - %s" | grep "^ " > CHANGELOG.latest
+49 -20
View File
@@ -12,44 +12,70 @@ nDPI® is an open source LGPLv3 library for deep-packet inspection. Based on Ope
### How To Compile nDPI ### How To Compile nDPI
In order to compile this library do In order to compile this project do
- ./autogen.sh - ./autogen.sh
- ./configure - make
To compile the library w/o any tools or tests:
- ./autogen.sh --with-only-libndpi
- make - make
To run tests do additionally: To run tests do additionally:
- cd tests; ./do.sh - ./tests/do.sh # Generate and check for diff's in PCAP files
- ./tests/do-unit.sh # Run unit tests
- ./tests/do-dga.sh # Run DGA detection test
Please note that the pre-requisites for compilation include: or run all with: `make check`
- GNU tools (autogen, automake, autoconf, libtool)
- GNU C compiler (gcc) Please note that the (minimal) pre-requisites for compilation include:
- GNU tools (autoconf automake libtool pkg-config gettext flex bison)
- GNU C compiler (gcc) or Clang
On Debian/Ubuntu systems do: On Debian/Ubuntu systems do:
- sudo apt-get install build-essential git bison flex libpcap-dev libtool libtool-bin autoconf pkg-config automake autogen libjson-c-dev libnuma-dev libgcrypt20-dev libpcre2-dev - sudo apt-get install build-essential git gettext flex bison libtool autoconf automake pkg-config libpcap-dev libjson-c-dev libnuma-dev libpcre2-dev libmaxminddb-dev librrd-dev
FreeBSD On Arch Linux:
- sudo pkg install gcc git autoconf automake libtool devel/pkgconf json-c gmake - sudo pacman -S gcc git gettext flex bison libtool autoconf automake pkg-config libpcap json-c numactl pcre2 libmaxminddb rrdtool
Remember to use gmake and not make on FreeBSD On FreeBSD:
- sudo pkg install gcc git gettext flex bison libtool autoconf automake devel/pkgconf gmake libpcap json-c pcre2 libmaxminddb rrdtool
Remember to use `gmake` and not `make` on FreeBSD
On MacOS:
- brew install coreutils gcc git gettext flex bison libtool autoconf automake pkg-config libpcap json-c pcre2 libmaxminddb rrdtool
On Windows (assuming [MSYS2](https://www.msys2.org/) already installed):
- msys2 -c "pacman --noconfirm -S --needed --overwrite '\*' git mingw-w64-x86\_64-toolchain automake1.16 automake-wrapper autoconf libtool make mingw-w64-x86\_64-json-c mingw-w64-x86\_64-crt-git mingw-w64-x86\_64-pcre mingw-w64-x86\_64-libpcap"
### How To Build The Documentation
- pip install --upgrade pip
- pip install -r doc/requirements.txt
- make doc
Use the builtin python3 webserver to view documentation:
- make doc-view
### How To Add A New Protocol Dissector ### How To Add A New Protocol Dissector
The entire procedure of adding new protocols in detail: The entire procedure of adding new protocols in detail:
1. Add new protocol together with its unique ID to: src/include/ndpi_protocol_ids.h 1. Add new protocol together with its unique ID to: `src/include/ndpi_protocol_ids.h`
2. Create a new protocol in: src/lib/protocols/ 2. Create a new protocol in: `src/lib/protocols/`
3. Variables to be kept for the duration of the entire flow (as state variables) need to be placed in: src/include/ndpi_typedefs.h in ndpi_flow_tcp_struct (for TCP only), ndpi_flow_udp_struct (for UDP only), or ndpi_flow_struct (for both). 3. Variables to be kept for the duration of the entire flow (as state variables) need to be placed in: `src/include/ndpi_typedefs.h` in `ndpi_flow_tcp_struct` (for TCP only), `ndpi_flow_udp_struct` (for UDP only), or `ndpi_flow_struct` (for both).
4. Add a new entry for the search function for the new protocol in: src/include/ndpi_protocols.h 4. Add a new entry for the search function for the new protocol in: `src/include/ndpi_protocols.h`
5. Choose (do not change anything) a selection bitmask from: src/include/ndpi_define.h 5. Choose (do not change anything) a selection bitmask from: `src/include/ndpi_define.h`
6. Add a new entry in ndpi_set_protocol_detection_bitmask2 in: src/lib/ndpi_main.c 6. Set protocol default ports in `ndpi_init_protocol_defaults` in: `src/lib/ndpi_main.c`
7. Set protocol default ports in ndpi_init_protocol_defaults in: src/lib/ndpi_main.c 7. `./autogen.sh`
8. ./autogen.sh 8. `make`
9. make 9. `make check`
10. make check
### How to use nDPI to Block Selected Traffic ### How to use nDPI to Block Selected Traffic
You can use nDPI to selectively block selected Internet traffic by embedding it onto an application (remember that nDPI is just a library). Both [ntopng](https://github.com/ntop/ntopng) and [nProbe cento](http://www.ntop.org/products/netflow/nprobe-cento/) can do this. You can use nDPI to selectively block selected Internet traffic by embedding it onto an application (remember that nDPI is just a library). Both [ntopng](https://github.com/ntop/ntopng) and [nProbe cento](http://www.ntop.org/products/netflow/nprobe-cento/) can do this.
### nDPI Paper Citation ### nDPI Paper Citation
@@ -57,9 +83,12 @@ You can use nDPI to selectively block selected Internet traffic by embedding it
- Deri, Luca, et al. [nDPI: Open-source high-speed deep packet inspection](http://luca.ntop.org/nDPI.pdf) 2014 International Wireless Communications and Mobile Computing Conference (IWCMC). IEEE, 2014. - Deri, Luca, et al. [nDPI: Open-source high-speed deep packet inspection](http://luca.ntop.org/nDPI.pdf) 2014 International Wireless Communications and Mobile Computing Conference (IWCMC). IEEE, 2014.
### nDPI-Related Projects ### nDPI-Related Projects
- [nfstream](https://github.com/aouinizied/nfstream) - [nfstream](https://github.com/aouinizied/nfstream)
- [nDPId](https://github.com/utoni/nDPId)
### DISCLAIMER ### DISCLAIMER
While we do our best to detect network protocols, we cannot guarantee that our software is error free and 100% accurate in protocol detection. Please make sure that you respect the privacy of users and you have proper authorization to listen, capture and inspect network traffic. While we do our best to detect network protocols, we cannot guarantee that our software is error free and 100% accurate in protocol detection. Please make sure that you respect the privacy of users and you have proper authorization to listen, capture and inspect network traffic.
nDPI is a registered trademark in the US and EU. nDPI is a registered trademark in the US and EU.
+5 -1
View File
@@ -102,7 +102,10 @@ if ! test "${with_only_libndpi+set}" = set; then :
JSONC_LIBS="${pkg_cv_JSONC_LIBS}" JSONC_LIBS="${pkg_cv_JSONC_LIBS}"
JSONC_CFLAGS="${pkg_cv_JSONC_CFLAGS}" JSONC_CFLAGS="${pkg_cv_JSONC_CFLAGS}"
], [AC_MSG_WARN([JSON-C not available. Disabled unit test.])]) ], [AC_MSG_WARN([JSON-C not available. Disabled unit test.])])
AC_CHECK_LIB([json-c], [json_object_put], [EXTRA_TARGETS="$EXTRA_TARGETS tests/unit"], [ AC_CHECK_LIB([json-c], [json_object_put], [
EXTRA_TARGETS="$EXTRA_TARGETS tests/unit"
build_unittests=yes
],[
AC_MSG_WARN([JSON-C not available. Disabled unit test.]) AC_MSG_WARN([JSON-C not available. Disabled unit test.])
JSONC_LIBS="" JSONC_LIBS=""
JSONC_CFLAGS="" JSONC_CFLAGS=""
@@ -114,6 +117,7 @@ if ! test "${with_only_libndpi+set}" = set; then :
EXTRA_TARGETS="" EXTRA_TARGETS=""
]) ])
fi fi
AM_CONDITIONAL([BUILD_UNITTESTS], [test "x$build_unittests" = "xyes"])
HANDLE_TLS_SIGS="//" HANDLE_TLS_SIGS="//"
AS_IF([test "x${enable_tls_sigs}" = "xyes"],[ AS_IF([test "x${enable_tls_sigs}" = "xyes"],[
+3
View File
@@ -74,6 +74,9 @@ dpdk:
$(MAKE) -f Makefile.dpdk $(MAKE) -f Makefile.dpdk
check: check:
true # nothing to do here
cppcheck:
cppcheck --template='{file}:{line}:{severity}:{message}' --quiet --enable=all --force -I$(SRCHOME)/include *.c cppcheck --template='{file}:{line}:{severity}:{message}' --quiet --enable=all --force -I$(SRCHOME)/include *.c
clean: clean:
+3
View File
@@ -23,3 +23,6 @@ distdir:
install: install:
@echo -n "" @echo -n ""
check:
true # nothing to do here
+3
View File
@@ -26,3 +26,6 @@ distdir:
install: install:
@echo -n "" @echo -n ""
check:
true # nothing to do here
+3
View File
@@ -85,6 +85,9 @@ distdir:
distclean: clean distclean: clean
/bin/rm -f Makefile /bin/rm -f Makefile
check:
true # nothing to do here
cppcheck: cppcheck:
cppcheck --template='{file}:{line}:{severity}:{message}' --quiet --enable=all --force -I ../include *.c protocols/*.c cppcheck --template='{file}:{line}:{severity}:{message}' --quiet --enable=all --force -I ../include *.c protocols/*.c
+5 -1
View File
@@ -1,4 +1,8 @@
TESTS = do.sh TESTS = do.sh do-dga.sh
if BUILD_UNITTESTS
TESTS += do-unit.sh
endif
EXTRA_DIST = pcap result performance \ EXTRA_DIST = pcap result performance \
unit/unit.c unit/Makefile.in \ unit/unit.c unit/Makefile.in \
+3 -1
View File
@@ -36,6 +36,8 @@ install:
distdir: distdir:
distclean: clean distclean: clean
/bin/rm -f Makefile /bin/rm -f Makefile
check:
true # nothing to do here, done by invoking tests/do-dga.sh
+3 -1
View File
@@ -60,6 +60,8 @@ install:
distdir: distdir:
distclean: clean distclean: clean
/bin/rm -f Makefile /bin/rm -f Makefile
check:
true # nothing to do here, done by invoking tests/do-unit.sh