Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a50169a7b3 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
mversion: 3.1.{build}
|
||||
version: 3.1.{build}
|
||||
branches:
|
||||
only:
|
||||
- dev
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
name: Build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
jobs:
|
||||
sonarcloud:
|
||||
name: SonarCloud
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
@@ -1,23 +0,0 @@
|
||||
name: CIFuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'ndpi'
|
||||
dry-run: false
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'ndpi'
|
||||
fuzz-seconds: 600
|
||||
dry-run: false
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
||||
@@ -1,83 +0,0 @@
|
||||
/**
|
||||
* @name Suspicious packet->payload based integer arithmetic
|
||||
* @description An arithmetic operation influenced array access is suspicious
|
||||
* if it uses an integer value that is likely to be network-controlled, and
|
||||
* may require a closer manual audit.
|
||||
* @kind problem
|
||||
* @problem.severity warning
|
||||
* @id cpp/packet-payload-integer-arithmetic
|
||||
* @tags audit security
|
||||
*/
|
||||
|
||||
import cpp
|
||||
|
||||
import semmle.code.cpp.dataflow.TaintTracking
|
||||
import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis
|
||||
|
||||
/** A source of an integer value that is likely to come from the network.
|
||||
* This is produced by an invocation of a macro of the form `ntoh*` or `get_u_int*_t`,
|
||||
* called with `packet->payload` as an argument.
|
||||
*/
|
||||
|
||||
class NetworkMacro extends Macro {
|
||||
NetworkMacro() { this.getName().regexpMatch("^ntoh(ll|l|s)") }
|
||||
}
|
||||
|
||||
class NetworkIntegerSource extends Expr {
|
||||
NetworkIntegerSource() {
|
||||
exists(MacroInvocation mi |
|
||||
this = mi.getExpr() and
|
||||
mi.getUnexpandedArgument(0).regexpMatch(".*packet->payload.*") |
|
||||
// catch all get_u_int*_t(x)
|
||||
mi.getMacroName().regexpMatch("^get_u_int(64|32|16|8)_t") and
|
||||
// dedup ntoh*(get_u_int*_t(x)) since we'll catch those in the next case
|
||||
not mi.getOutermostMacroAccess().getMacro() instanceof NetworkMacro
|
||||
or
|
||||
// catch all ntoh*(x) ... this will also catch the nested cases
|
||||
mi.getMacro() instanceof NetworkMacro
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
class ArithmeticOperation extends Operation {
|
||||
ArithmeticOperation() {
|
||||
this instanceof UnaryArithmeticOperation or this instanceof BinaryArithmeticOperation
|
||||
}
|
||||
}
|
||||
|
||||
class NetworkToArrayAccess extends TaintTracking::Configuration {
|
||||
NetworkToArrayAccess() { this = "NetworkToArrayAccess" }
|
||||
|
||||
override predicate isSource(DataFlow::Node source) {
|
||||
source.asExpr() instanceof NetworkIntegerSource
|
||||
}
|
||||
|
||||
override predicate isSink(DataFlow::Node sink) {
|
||||
exists(ArrayExpr ae | sink.asExpr() = ae.getArrayOffset())
|
||||
}
|
||||
}
|
||||
|
||||
class NetworkToArithmetic extends TaintTracking::Configuration {
|
||||
NetworkToArithmetic() { this = "NetworkToArithmetic" }
|
||||
|
||||
override predicate isSource(DataFlow::Node source) {
|
||||
source.asExpr() instanceof NetworkIntegerSource
|
||||
}
|
||||
|
||||
override predicate isSink(DataFlow::Node sink) {
|
||||
exists (Assignment assign |
|
||||
sink.asExpr() = assign.getRValue().(ArithmeticOperation) or
|
||||
sink.asExpr() = assign.(AssignArithmeticOperation)
|
||||
) or
|
||||
exists(LocalVariable var |
|
||||
sink.asExpr() = var.getInitializer().getExpr().(ArithmeticOperation)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// find audit candidates based on suspicious network integer use
|
||||
from NetworkIntegerSource source, Expr sink1, Expr sink2, NetworkToArithmetic config1, NetworkToArrayAccess config2
|
||||
where config1.hasFlow(DataFlow::exprNode(source), DataFlow::exprNode(sink1))
|
||||
// or this if you want integer arithmeric _OR_ array accesses
|
||||
and config2.hasFlow(DataFlow::exprNode(source), DataFlow::exprNode(sink2))
|
||||
select source, "Suspicious use of network integer arithmetic."
|
||||
+14
-62
@@ -6,33 +6,12 @@ matrix:
|
||||
compiler: clang
|
||||
|
||||
- os: linux
|
||||
env: BUILD_DPKG_PACKAGE=y
|
||||
compiler: gcc
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- fakeroot
|
||||
- debhelper
|
||||
- dpkg-dev
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
|
||||
- os: linux
|
||||
env: DISABLE_GCRYPT=y
|
||||
compiler: gcc
|
||||
dist: bionic
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- fakeroot
|
||||
- debhelper
|
||||
- dpkg-dev
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
|
||||
- os: linux
|
||||
@@ -42,8 +21,6 @@ matrix:
|
||||
apt:
|
||||
packages:
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
|
||||
- os: linux
|
||||
@@ -54,8 +31,6 @@ matrix:
|
||||
apt:
|
||||
packages:
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
|
||||
- os: linux
|
||||
@@ -66,8 +41,6 @@ matrix:
|
||||
apt:
|
||||
packages:
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
|
||||
# Targets below have been disabled as we have no way
|
||||
@@ -80,7 +53,6 @@ matrix:
|
||||
# apt:
|
||||
# packages:
|
||||
# - libpcap-dev
|
||||
# - libjson-c-dev
|
||||
# - autogen
|
||||
#
|
||||
# - os: linux
|
||||
@@ -91,7 +63,6 @@ matrix:
|
||||
# apt:
|
||||
# packages:
|
||||
# - libpcap-dev
|
||||
# - libjson-c-dev
|
||||
# - autogen
|
||||
|
||||
- os: linux
|
||||
@@ -103,11 +74,9 @@ matrix:
|
||||
packages:
|
||||
- g++-8
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-8"
|
||||
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
||||
|
||||
- os: linux
|
||||
compiler: gcc-9
|
||||
@@ -118,11 +87,9 @@ matrix:
|
||||
packages:
|
||||
- g++-9
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-9"
|
||||
- MATRIX_EVAL="CC=gcc-9 && CXX=g++-9"
|
||||
|
||||
- os: linux
|
||||
compiler: clang-8
|
||||
@@ -134,11 +101,9 @@ matrix:
|
||||
packages:
|
||||
- clang-8
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-8"
|
||||
- MATRIX_EVAL="CC=clang-8 && CXX=clang++-8"
|
||||
|
||||
- os: linux
|
||||
compiler: clang-7
|
||||
@@ -150,14 +115,12 @@ matrix:
|
||||
packages:
|
||||
- clang-7
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
env:
|
||||
- MATRIX_EVAL="CC=clang-7"
|
||||
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
||||
|
||||
- name: fuzza
|
||||
env: CXXFLAGS="-g3 -O0 -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" CFLAGS="-g3 -O0 -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" LDFLAGS="-g3 -O0 -fsanitize=address" QA_FUZZ=asan CC=clang-7 && CXX=clang++-7 ASAN_SYMBOLIZER_PATH=/usr/local/clang-7.0.0/bin/llvm-symbolizer
|
||||
env: CXXFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" CFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=address -fsanitize=fuzzer-no-link" LDFLAGS="-g -fsanitize=address" QA_FUZZ=asan CC=clang-7 && CXX=clang++-7 ASAN_SYMBOLIZER_PATH=/usr/local/clang-7.0.0/bin/llvm-symbolizer
|
||||
os: linux
|
||||
compiler: clang-7
|
||||
addons:
|
||||
@@ -168,23 +131,22 @@ matrix:
|
||||
packages:
|
||||
- clang-7
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
- name: fuzzm
|
||||
env: CXXFLAGS="-g3 -O0 -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" CFLAGS="-g3 -O0 -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" LDFLAGS="-g3 -O0 -fsanitize=memory" QA_FUZZ=msan CC=clang && CXX=clang++
|
||||
env: CXXFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" CFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=memory -fsanitize=fuzzer-no-link" LDFLAGS="-g -fsanitize=memory" QA_FUZZ=msan CC=clang-7 && CXX=clang++-7 MSAN_SYMBOLIZER_PATH=/usr/local/clang-7.0.0/bin/llvm-symbolizer
|
||||
os: linux
|
||||
compiler: clang
|
||||
dist: bionic
|
||||
compiler: clang-7
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-trusty-7
|
||||
packages:
|
||||
- clang-7
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
- name: fuzzu
|
||||
env: CXXFLAGS="-g3 -Og -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fsanitize=fuzzer-no-link -fno-sanitize=alignment" CFLAGS="-g3 -Og -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fno-sanitize-recover=undefined,integer -fsanitize=fuzzer-no-link -fno-sanitize=alignment" LDFLAGS="-g3 -Og -fsanitize=undefined -fno-sanitize=alignment" QA_FUZZ=ubsan CC=clang-7 && CXX=clang++-7
|
||||
env: CXXFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fsanitize=fuzzer-no-link" CFLAGS="-g -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=undefined -fno-sanitize-recover=undefined,integer -fsanitize=fuzzer-no-link" LDFLAGS="-g -fsanitize=undefined" QA_FUZZ=ubsan CC=clang-7 && CXX=clang++-7
|
||||
os: linux
|
||||
compiler: clang-7
|
||||
addons:
|
||||
@@ -195,12 +157,10 @@ matrix:
|
||||
packages:
|
||||
- clang-7
|
||||
- libpcap-dev
|
||||
- libgcrypt20-dev
|
||||
- libjson-c-dev
|
||||
- autogen
|
||||
|
||||
|
||||
before_install:
|
||||
before_install:
|
||||
- eval "${MATRIX_EVAL}"
|
||||
|
||||
before_script:
|
||||
@@ -208,20 +168,12 @@ before_script:
|
||||
# - lcov --directory . --zerocounters
|
||||
|
||||
script:
|
||||
- if [ -n "$QA_FUZZ" ]; then ./configure --enable-fuzztargets ; else
|
||||
./configure ; fi
|
||||
- if [ -n "$BUILD_DPKG_PACKAGE" ]; then cd ./packages/ubuntu ;
|
||||
./configure && dpkg-buildpackage -b -us -uc ; cd ../.. ; fi
|
||||
- if [ -n "$DISABLE_GCRYPT" ]; then ./configure --disable-gcrypt ; fi
|
||||
- if [ -n "$QA_FUZZ" ]; then ./configure --enable-fuzztargets ; else ./configure ; fi
|
||||
- make
|
||||
- make -C example ndpiSimpleIntegration
|
||||
- make dist
|
||||
|
||||
#after_script:
|
||||
- cd tests
|
||||
- ./do.sh
|
||||
- ./do-unit.sh
|
||||
- ./do-dga.sh
|
||||
|
||||
#after_success:
|
||||
#- cd ${TRAVIS_BUILD_DIR}
|
||||
|
||||
+3
-189
@@ -1,191 +1,5 @@
|
||||
# CHANGELOG
|
||||
|
||||
#### nDPI 4.0 (July 2021)
|
||||
|
||||
## New Features
|
||||
- Add API for computing RSI (Relative Strenght Index)
|
||||
- Add GeoIP support
|
||||
- Add fragments management
|
||||
- Add API for jitter calculation
|
||||
- Add single exponential smoothing API
|
||||
- Add timeseries forecasting support implementing Holt-Winters with confidence interval
|
||||
- Add support for MAC to radi tree and expose the full API to applications
|
||||
- Add JA3+, with ALPN and elliptic curve
|
||||
- Add double exponential smoothing implementation
|
||||
- Extended API for managing flow risks
|
||||
- Add flow risk score
|
||||
- New flow risks:
|
||||
- Desktop or File Sharing Session
|
||||
- HTTP suspicious content (useful for tracking trickbot)
|
||||
- Malicious JA3
|
||||
- Malicious SHA1
|
||||
- Risky domain
|
||||
- Risky AS
|
||||
- TLS Certificate Validity Too Long
|
||||
- TLS Suspicious Extension
|
||||
|
||||
## New Supported Protocols and Services
|
||||
- New protocols:
|
||||
- AmongUs
|
||||
- AVAST SecureDNS
|
||||
- CPHA (CheckPoint High Availability Protocol)
|
||||
- DisneyPlus
|
||||
- DTLS
|
||||
- Genshin Impact
|
||||
- HP Virtual Machine Group Management (hpvirtgrp)
|
||||
- Mongodb
|
||||
- Pinterest
|
||||
- Reddit
|
||||
- Snapchat VoIP calls
|
||||
- Tumblr
|
||||
- Virtual Asssitant (Alexa, Siri)
|
||||
- Z39.50
|
||||
- Add protocols to HTTP as subprotocols
|
||||
- Add detection of TLS browser type
|
||||
- Add connectionless DCE/RPC detection
|
||||
|
||||
## Improvements
|
||||
- 2.5x speed bump. Example ndpiReader with a long mixed pcap
|
||||
v3.4 - nDPI throughput: 1.29 M pps / 3.35 Gb/sec
|
||||
v4.0 - nDPI throughput: 3.35 M pps / 8.68 Gb/sec
|
||||
- Improve detection/dissection of:
|
||||
- AnyDesk
|
||||
- DNS
|
||||
- Hulu
|
||||
- DCE/RPC (avoid false positives)
|
||||
- dnscrypt
|
||||
- Facebook (add new networks)
|
||||
- Fortigate
|
||||
- FTP Control
|
||||
- HTTP
|
||||
- Fix user-agent parsing
|
||||
- Fix logs when NDPI_ENABLE_DEBUG_MESSAGES is defined
|
||||
- IEC104
|
||||
- IEC60870
|
||||
- IRC
|
||||
- Netbios
|
||||
- Netflix
|
||||
- Ookla speedtest (detection over IPv6)
|
||||
- openspeedtest.com
|
||||
- Outlook / MicrosoftMail
|
||||
- QUIC
|
||||
- update to draft-33
|
||||
- improve handling of SNI
|
||||
- support for fragmented Client Hello
|
||||
- support for DNS-over-QUIC
|
||||
- RTSP
|
||||
- RTSP via HTTP
|
||||
- SNMP (reimplemented)
|
||||
- Skype
|
||||
- SSH
|
||||
- Steam (Steam Datagram Relay - SDR)
|
||||
- STUN (avoid false positives, improved Skype detection)
|
||||
- TeamViewer (add new hosts)
|
||||
- TOR (update hosts)
|
||||
- TLS
|
||||
- Certificate Subject matching
|
||||
- Check for common ALPNs
|
||||
- Reworked fingerprint calculation
|
||||
- Fix extraction for TLS signature algorithms
|
||||
- Fix ClientHello parsing
|
||||
- UPnP
|
||||
- wireguard
|
||||
- Improve DGA detection
|
||||
- Improve JA3
|
||||
- Improve Mining detection
|
||||
- Improve string matching algorithm
|
||||
- Improve ndpi_pref_enable_tls_block_dissection
|
||||
- Optimize speed and memory size
|
||||
- Update ahocorasick library
|
||||
- Improve subprotocols detection
|
||||
|
||||
## Fixes
|
||||
- Fix partial application matching
|
||||
- Fix multiple segfault and leaks
|
||||
- Fix uninitialized memory use
|
||||
- Fix release of patterns allocated in ndpi_add_string_to_automa
|
||||
- Fix return value of ndpi_match_string_subprotocol
|
||||
- Fix setting of flow risks on 32 bit machines
|
||||
- Fix TLS certificate threshold
|
||||
- Fix a memory error in TLS JA3 code
|
||||
- Fix false positives in Z39.50
|
||||
- Fix off-by-one memory error for TLS-JA3
|
||||
- Fix bug in ndpi_lru_find_cache
|
||||
- Fix invalid xbox and playstation port guesses
|
||||
- Fix CAPWAP tunnel decoding
|
||||
- Fix parsing of DLT_PPP datalink type
|
||||
- Fix dissection of QUIC initial packets coalesced with 0-RTT one
|
||||
- Fix parsing of GTP headers
|
||||
- Add bitmap boundary checks
|
||||
|
||||
## Misc
|
||||
- Update download category name
|
||||
- Update category labels
|
||||
- Renamed Skype in Skype_Teams (the protocol is now shared across these apps)
|
||||
- Add IEC analysis wireshark plugin
|
||||
- Flow risk visualization in Wireshark
|
||||
- ndpiReader
|
||||
- add statistics about nDPI performance
|
||||
- fix memory leak
|
||||
- fix collecting of risks statistics
|
||||
- Move installed libraries from /usr/local to /usr
|
||||
- Improve NDPI_API_VERSION generation
|
||||
- Update ndpi_ptree_match_addr prototype
|
||||
|
||||
#### nDPI 3.4 (October 2020)
|
||||
|
||||
## New Features
|
||||
* Completely reworked and extended QUIC dissector
|
||||
* Added flow risk concept to move nDPI towards result interpretation
|
||||
* Added ndpi_dpi2json() API call
|
||||
* Added DGA risk for names that look like a DGA
|
||||
* Added HyperLogLog cardinality estimator API calls
|
||||
* Added ndpi_bin_XXX API calls to handle bin handling
|
||||
* Fully fuzzy tested code that has greatly improved reliability and robustness
|
||||
|
||||
## New Supported Protocols and Services
|
||||
* QUIC
|
||||
* SMBv1
|
||||
* WebSocket
|
||||
* TLS: added ESNI support
|
||||
* SOAP
|
||||
* DNScrypt
|
||||
|
||||
## Improvements
|
||||
* Python CFFI bindings
|
||||
* Various TLS extensions and fixes including extendede metadata support
|
||||
* Added various pcap files for testing corner cases in protocols
|
||||
* Various improvements in JSON/Binary data serialization
|
||||
* CiscoVPN
|
||||
* H323
|
||||
* MDNS
|
||||
* MySQL 8
|
||||
* IEC 60870-5-104
|
||||
* DoH/DoT dissection improvements
|
||||
* Office365 renamed to Microsoft365
|
||||
* Major protocol dissection improvement in particular with unknwon traffic
|
||||
* Improvement in Telegram v6 protocol support
|
||||
* HTTP improvements to detect file download/upload and binary files
|
||||
* BitTorrent and WhatsApp dissection improvement
|
||||
* Spotify
|
||||
* Added detection of malformed packets
|
||||
* Fuzzy testing support has been greatly improved
|
||||
* SSH code cleanup
|
||||
|
||||
## Fixes
|
||||
* Fixed various memory leaks and race conditions in protocol decoding
|
||||
* NATS, CAPWAP dissector
|
||||
* Removed HyperScan support that greatly simplified the code
|
||||
* ARM platform fixes on memory alignment
|
||||
* Wireshark extcap support
|
||||
* DPDK support
|
||||
* OpenWRT, OpenBSD support
|
||||
* MINGW compiler support
|
||||
|
||||
## MISC
|
||||
* Created demo app for nDPI newcomers
|
||||
* Removed obsolete pplive and pando protocols
|
||||
|
||||
#### nDPI 3.2 (February 2020)
|
||||
|
||||
## New Features
|
||||
@@ -233,7 +47,7 @@
|
||||
* Improved Python bindings
|
||||
* Improved Ethereum support
|
||||
* Improved categories detection with streaming and HTTP
|
||||
* Support for IP-based detection to compute the application protocol
|
||||
* Support for IP-based detection to compute the application protocol
|
||||
* Renamed protocol 104 to IEC60870 (more meaningful)
|
||||
* Added failed authentication support with FTP
|
||||
* Renamed DNSoverHTTPS to handle bot DoH and DoT
|
||||
@@ -245,7 +59,7 @@
|
||||
* Modified API signatures for ndpi_ssl_version2str / ndpi_detection_giveup
|
||||
* Removed ndpi_pref_http_dont_dissect_response / ndpi_pref_dns_dont_dissect_response (replaced by ndpi_extra_dissection_possible)
|
||||
|
||||
## Fixes
|
||||
## Fixes
|
||||
* Fixed memory invalid access in SMTP and leaks in TLS
|
||||
* Fixed a few memory leaks
|
||||
* Fixrd invalid memory access in a few protocol dissectors (HTTP, memcached, Citrix, STUN, DNS, Amazon Video, TLS, Viber)
|
||||
@@ -414,7 +228,7 @@
|
||||
## Other
|
||||
|
||||
* Deb and RPM packages: ndpi with shared libraries and binaries, ndpi-dev with headers and static libraries
|
||||
* Protocols now have an optional subprotocol: Spotify cannot have subprotocols, DNS can (DNS.Spotify)
|
||||
* Protocols now have an optional subprotocol: Spotify cannot have subprotocols, DNS can (DNS.Spotify)
|
||||
* New API functions:
|
||||
* ndpi_fill_ip_protocol_category to handle ICMP flows category
|
||||
* ndpi_flowv4_flow_hash and ndpi_flowv6_flow_hash to support the Community ID Flow Hashing (https://github.com/corelight/community-id-spec)
|
||||
|
||||
+2
-5
@@ -1,5 +1,5 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = src/lib @EXTRA_TARGETS@
|
||||
SUBDIRS = src/lib example tests
|
||||
|
||||
if BUILD_FUZZTARGETS
|
||||
SUBDIRS += fuzz
|
||||
@@ -8,7 +8,4 @@ endif
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libndpi.pc
|
||||
|
||||
EXTRA_DIST = README.md CHANGELOG.md CONTRIBUTING.md README.protocols autogen.sh configure.seed wireshark python windows utils packages doc/nDPI_QuickStartGuide.pages doc/nDPI_QuickStartGuide.pdf example/MacOS example/Win32
|
||||
|
||||
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
|
||||
EXTRA_DIST = autogen.sh
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
## What is nDPI ?
|
||||
|
||||
nDPI® is an open source LGPLv3 library for deep-packet inspection. Based on OpenDPI it includes ntop extensions. We have tried to push them into the OpenDPI source tree but nobody answered emails so we have decided to create our own source tree
|
||||
nDPI is an open source LGPLv3 library for deep-packet inspection. Based on OpenDPI it includes ntop extensions. We have tried to push them into the OpenDPI source tree but nobody answered emails so we have decided to create our own source tree
|
||||
|
||||
### How To Compile nDPI
|
||||
|
||||
@@ -26,14 +26,6 @@ Please note that the pre-requisites for compilation include:
|
||||
- GNU tools (autogen, automake, autoconf, libtool)
|
||||
- GNU C compiler (gcc)
|
||||
|
||||
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
|
||||
|
||||
FreeBSD
|
||||
- sudo pkg install gcc git autoconf automake libtool devel/pkgconf json-c gmake
|
||||
|
||||
Remember to use gmake and not make on FreeBSD
|
||||
|
||||
### How To Add A New Protocol Dissector
|
||||
|
||||
The entire procedure of adding new protocols in detail:
|
||||
@@ -50,19 +42,21 @@ The entire procedure of adding new protocols in detail:
|
||||
10. make check
|
||||
|
||||
### 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.
|
||||
|
||||
### nDPI Paper Citation
|
||||
|
||||
- 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
|
||||
- [nfstream](https://github.com/aouinizied/nfstream)
|
||||
|
||||
### 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.
|
||||
|
||||
nDPI is a registered trademark in the US and EU.
|
||||
### Creating A Source File Tar Ball
|
||||
|
||||
If you want to distribute a source tar file of nDPI do:
|
||||
|
||||
- make dist
|
||||
|
||||
To ensure that a tar file includes all necessary files and to run tests on distribution do:
|
||||
|
||||
- make distcheck
|
||||
|
||||
[ntopng_logo]: https://camo.githubusercontent.com/0f789abcef232035c05e0d2e82afa3cc3be46485/687474703a2f2f7777772e6e746f702e6f72672f77702d636f6e74656e742f75706c6f6164732f323031312f30382f6e746f706e672d69636f6e2d313530783135302e706e67
|
||||
|
||||
|
||||
+4
-5
@@ -5,18 +5,17 @@ Prerequisites
|
||||
- GNU autotools/libtool
|
||||
- libpcap or PF_RING (optional but recommended)
|
||||
- apt-get install libjson-c-dev (for JSON support)
|
||||
- libgcrypt20-dev (for QUIC support)
|
||||
|
||||
On Ubuntu/Debian
|
||||
- apt-get install build-essential
|
||||
- apt-get install git autoconf automake autogen libpcap-dev libtool libgcrypt20-dev
|
||||
- apt-get install git autoconf automake autogen libpcap-dev libtool
|
||||
|
||||
On Fedora/CentOS
|
||||
- yum groupinstall "Development tools"
|
||||
- yum install git autoconf automake autogen libpcap-devel libtool libgcrypt-devel
|
||||
- yum install git autoconf automake autogen libpcap-devel libtool
|
||||
|
||||
On MacOSX (using http://brew.sh)
|
||||
brew install autoconf automake libtool git libgcrypt
|
||||
brew install autoconf automake libtool git
|
||||
|
||||
On FreeBSD
|
||||
- pkg install autoconf automake libtool gmake git libgcrypt
|
||||
- pkg install autoconf automake libtool gmake git
|
||||
|
||||
+3
-18
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
NDPI_MAJOR="4"
|
||||
NDPI_MINOR="0"
|
||||
NDPI_MAJOR="3"
|
||||
NDPI_MINOR="2"
|
||||
NDPI_PATCH="0"
|
||||
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"
|
||||
|
||||
@@ -12,17 +12,10 @@ AUTOMAKE=$(command -v automake)
|
||||
LIBTOOL=$(command -v libtool)
|
||||
LIBTOOLIZE=$(command -v libtoolize)
|
||||
AUTORECONF=$(command -v autoreconf)
|
||||
PKG_CONFIG=$(command -v pkg-config)
|
||||
FUZZY=
|
||||
|
||||
if test -z $AUTOCONF; then
|
||||
echo "autoconf is missing: please install it and try again"
|
||||
exit
|
||||
else
|
||||
V=`autoconf --version | head -1 | cut -d ' ' -f 4`
|
||||
if [ "$V" = '2.63' ]; then
|
||||
FUZZY="dnl> "
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z $AUTOMAKE; then
|
||||
@@ -40,24 +33,16 @@ if test -z $AUTORECONF; then
|
||||
exit
|
||||
fi
|
||||
|
||||
if test -z $PKG_CONFIG; then
|
||||
echo "pkg-config is missing: please install it (apt-get install pkg-config) and try again"
|
||||
exit
|
||||
fi
|
||||
|
||||
cat configure.seed | sed \
|
||||
-e "s/@NDPI_MAJOR@/$NDPI_MAJOR/g" \
|
||||
-e "s/@NDPI_MINOR@/$NDPI_MINOR/g" \
|
||||
-e "s/@NDPI_PATCH@/$NDPI_PATCH/g" \
|
||||
-e "s/@NDPI_VERSION_SHORT@/$NDPI_VERSION_SHORT/g" \
|
||||
-e "s/@FUZZY@/$FUZZY/g" \
|
||||
> configure.ac
|
||||
|
||||
autoreconf -ivf
|
||||
cat configure | sed "s/#define PACKAGE/#define NDPI_PACKAGE/g" | sed "s/#define VERSION/#define NDPI_VERSION/g" > configure.tmp
|
||||
cat configure.tmp > configure
|
||||
|
||||
echo "./configure $@"
|
||||
chmod +x configure
|
||||
./configure $@
|
||||
|
||||
./configure "$*"
|
||||
|
||||
+74
-140
@@ -1,50 +1,24 @@
|
||||
AC_INIT([libndpi], [@NDPI_VERSION_SHORT@])
|
||||
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
AC_PREFIX_DEFAULT(/usr)
|
||||
AC_ARG_WITH(llvm_sanitizer, [ --with-llvm-sanitizer Build with support for the LLVM address sanitizer])
|
||||
|
||||
EXTRA_TARGETS="example tests tests/unit tests/dga"
|
||||
AC_ARG_WITH(only-libndpi, AS_HELP_STRING([--with-only-libndpi], [Build only libndpi (no examples, tests etc)]))
|
||||
AS_IF([test "${with_only_libndpi+set}" = set],[
|
||||
EXTRA_TARGETS=""
|
||||
])
|
||||
|
||||
GNU_PREFIX=""
|
||||
|
||||
AC_ARG_WITH(mipsel, AS_HELP_STRING([--with-mipsel], [Build only libndpi (no examples, tests etc) for mipsel]))
|
||||
AS_IF([test "${with_mipsel+set}" = set],[
|
||||
EXTRA_TARGETS=""
|
||||
GNU_PREFIX="mipsel-linux-gnu-"
|
||||
])
|
||||
|
||||
AC_ARG_WITH(sanitizer, AS_HELP_STRING([--with-sanitizer], [Build with support for address, undefined and leak sanitizer]))
|
||||
AC_ARG_ENABLE(fuzztargets, AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
|
||||
AS_IF([test "x$enable_fuzztargets" = "xyes"], [BUILD_FUZZTARGETS=1], [BUILD_FUZZTARGETS=0])
|
||||
AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
|
||||
|
||||
AS_IF([test "${with_sanitizer+set}" = set],[
|
||||
CFLAGS="${CFLAGS} -g3 -O0 -Wno-unused-value -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak -fno-omit-frame-pointer"
|
||||
LDFLAGS="${LDFLAGS} -fsanitize=address -fsanitize=undefined -fno-sanitize=alignment -fsanitize=leak"
|
||||
AS_IF([test "${with_llvm_sanitizer+set}" = set],[
|
||||
CFLAGS="${CFLAGS} -g -O2 -Wno-unused-value -fsanitize=address -fno-omit-frame-pointer"
|
||||
LDFLAGS="${LDFLAGS} -fsanitize=address"
|
||||
CC=clang
|
||||
CXX=clang++
|
||||
])
|
||||
|
||||
LT_INIT
|
||||
|
||||
SYSTEM=`uname -s`
|
||||
if test $SYSTEM = "Darwin"; then
|
||||
dnl> AC_PROG_CC(clang gcc)
|
||||
AM_PROG_CC_C_O(clang gcc)
|
||||
AC_PROG_CXX(clang++ g++)
|
||||
AC_PROG_CC_STDC(clang gcc)
|
||||
else
|
||||
dnl> AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CC_STDC
|
||||
fi
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CC_STDC
|
||||
AC_LANG_WERROR
|
||||
AX_PTHREAD
|
||||
|
||||
@@ -57,59 +31,39 @@ AC_DEFINE_UNQUOTED(NDPI_MAJOR_RELEASE, "${NDPI_MAJOR}", [nDPI major release])
|
||||
AC_DEFINE_UNQUOTED(NDPI_MINOR_RELEASE, "${NDPI_MINOR}", [nDPI minor release])
|
||||
AC_DEFINE_UNQUOTED(NDPI_PATCH_LEVEL, "${NDPI_PATCH}", [nDPI patch level])
|
||||
|
||||
# .git as directory in a cloned repo
|
||||
# .git as file in submodule based integration
|
||||
if test -d ".git" || test -f ".git" ; then :
|
||||
if test -d ".git"; then :
|
||||
GIT_TAG=`git log -1 --format=%h`
|
||||
GIT_DATE=`git log -1 --format=%cd`
|
||||
#
|
||||
# On CentOS 6 `git rev-list HEAD --count` does not work
|
||||
#
|
||||
#
|
||||
#
|
||||
GIT_NUM=`git log --pretty=oneline | wc -l | tr -d '[[:space:]]'`
|
||||
GIT_RELEASE="${PACKAGE_VERSION}-${GIT_NUM}-${GIT_TAG}"
|
||||
|
||||
A=`git log src/include/ndpi_typedefs.h|wc -l`
|
||||
B=`git log src/include/ndpi_protocol_ids.h|wc -l`
|
||||
C=`git log src/include/ndpi_api.h.in|wc -l`
|
||||
NDPI_API_VERSION=$((A+B+C))
|
||||
else
|
||||
GIT_RELEASE="${PACKAGE_VERSION}"
|
||||
GIT_DATE=`date -u -r CHANGELOG.md`
|
||||
if test -z "$SOURCE_DATE_EPOCH" ; then :
|
||||
SOURCE_DATE_EPOCH=`date +%s`
|
||||
fi
|
||||
NDPI_API_VERSION=`echo $SOURCE_DATE_EPOCH | cut -c7-10`
|
||||
fi
|
||||
|
||||
NDPI_API_VERSION=`echo $NDPI_API_VERSION | sed 's/^0*//'`
|
||||
|
||||
AC_DEFINE_UNQUOTED(NDPI_GIT_RELEASE, "${GIT_RELEASE}", [GIT Release])
|
||||
AC_DEFINE_UNQUOTED(NDPI_GIT_DATE, "${GIT_DATE}", [Last GIT change])
|
||||
|
||||
if ! test "${with_mipsel+set}" = set && ! test "${with_only_libndpi+set}" = set; then :
|
||||
dnl> used by json-c for unit tests
|
||||
PKG_CHECK_MODULES([JSONC], [json-c], [JSONC_LIBS=`pkg-config --libs json-c` JSONC_CFLAGS=`pkg-config --cflags json-c`])
|
||||
fi
|
||||
|
||||
LIBS="$LIBS $JSONC_LIBS"
|
||||
CFLAGS="$CFLAGS $JSONC_CFLAGS"
|
||||
|
||||
AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h unistd.h json.h])
|
||||
AC_CHECK_HEADERS([netinet/in.h stdint.h stdlib.h string.h unistd.h])
|
||||
|
||||
ADDITIONAL_LIBS=
|
||||
PCAP_HOME=$HOME/PF_RING/userland
|
||||
|
||||
DPDK_TARGET=
|
||||
AC_MSG_CHECKING([DPDK (used by ndpiReader)])
|
||||
if test -d $HOME/DPDK; then :
|
||||
AC_MSG_RESULT(yes)
|
||||
echo "Enabling DPDK support in ndpiReader"
|
||||
DPDK_TARGET=dpdk
|
||||
else
|
||||
AC_MSG_RESULT([no (missing $HOME/DPDK)])
|
||||
echo "DPDK support disabled (missing $HOME/DPDK)"
|
||||
fi
|
||||
|
||||
if ! test -d $PCAP_HOME; then :
|
||||
if test -d $PCAP_HOME; then :
|
||||
echo -n ""
|
||||
else
|
||||
PCAP_HOME=`pwd`/../../PF_RING/userland
|
||||
fi
|
||||
SHORT_MACHINE=`uname -m | cut -b1-3`
|
||||
@@ -120,6 +74,10 @@ else
|
||||
fi
|
||||
|
||||
MACHINE=`uname -m`
|
||||
SYSTEM=`uname -s`
|
||||
if test $SYSTEM = "Darwin"; then
|
||||
CC=clang
|
||||
fi
|
||||
|
||||
CUSTOM_NDPI=
|
||||
|
||||
@@ -128,15 +86,30 @@ if test -d ../nDPI-custom; then :
|
||||
AC_MSG_RESULT([Compiling with custom nDPI protocols])
|
||||
fi
|
||||
|
||||
if test -d ../ndpi-pro; then :
|
||||
with_maxminddb=1
|
||||
fi
|
||||
AC_ARG_WITH(hyperscan, [ --with-hyperscan Enable nDPI build with Intel Hyperscan])
|
||||
|
||||
AS_IF([test "${with_hyperscan+set}" = set],[
|
||||
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
|
||||
|
||||
AS_IF([test "x$ac_cv_lib_hs_hs_compile_multi" = xyes],[
|
||||
AC_CHECK_LIB([m], [pow])
|
||||
AC_CHECK_LIB([stdc++], [main])
|
||||
PKG_CHECK_MODULES([HS],[libhs])
|
||||
LDFLAGS="$LDFLAGS $HS_LIBS"
|
||||
AC_MSG_RESULT([compiling with Intel Hyperscan])
|
||||
],[
|
||||
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
|
||||
])
|
||||
])
|
||||
|
||||
case "$host" in
|
||||
*-*-mingw32*|*-*-msys)
|
||||
CFLAGS="${CFLAGS} -DOS_WIN32"
|
||||
LDFLAGS="${LDFLAGS} -lws2_32 -lucrtbase"
|
||||
BUILD_MINGW=1
|
||||
;;
|
||||
*)
|
||||
if test -f $PCAP_HOME/libpcap/libpcap.a; then :
|
||||
@@ -164,87 +137,57 @@ AC_ARG_ENABLE([debug-messages],
|
||||
AS_HELP_STRING([--enable-debug-messages], [Define NDPI_ENABLE_DEBUG_MESSAGES=1]), [
|
||||
AC_DEFINE(NDPI_ENABLE_DEBUG_MESSAGES, 1, [Enable ndpi_debug_messages]) ])
|
||||
|
||||
@FUZZY@ AS_IF([test "x$enable_fuzztargets" = "xyes"], [
|
||||
@FUZZY@ AC_PROG_CXX
|
||||
@FUZZY@ AC_LANG_PUSH(C++)
|
||||
@FUZZY@ tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
@FUZZY@ AX_CHECK_COMPILE_FLAG([-fsanitize=fuzzer],,
|
||||
@FUZZY@ [AC_MSG_ERROR([--enable-fuzztargets requires -fsanitize=fuzzer which is only supported by LLVM])],
|
||||
@FUZZY@ [-Werror])
|
||||
@FUZZY@ AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [
|
||||
@FUZZY@ LIB_FUZZING_ENGINE=-fsanitize=fuzzer
|
||||
@FUZZY@ AC_SUBST(LIB_FUZZING_ENGINE)
|
||||
@FUZZY@ ])
|
||||
@FUZZY@ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE"
|
||||
@FUZZY@ AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE])
|
||||
@FUZZY@ AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
@FUZZY@ #include <sys/types.h>
|
||||
@FUZZY@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size);
|
||||
@FUZZY@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) {
|
||||
@FUZZY@ (void)Data;
|
||||
@FUZZY@ (void)Size;
|
||||
@FUZZY@ return 0;
|
||||
@FUZZY@ }
|
||||
@FUZZY@ ]])],
|
||||
@FUZZY@ [ AC_MSG_RESULT(yes)
|
||||
@FUZZY@ has_sanitizefuzzer=yes],
|
||||
@FUZZY@ [ AC_MSG_RESULT(no) ]
|
||||
@FUZZY@ )
|
||||
@FUZZY@ _AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
|
||||
@FUZZY@ AC_LANG_POP()
|
||||
@FUZZY@ ])
|
||||
AC_ARG_ENABLE(fuzztargets,
|
||||
AS_HELP_STRING([--enable-fuzztargets], [Enable fuzz targets]),[enable_fuzztargets=$enableval],[enable_fuzztargets=no])
|
||||
AM_CONDITIONAL([BUILD_FUZZTARGETS], [test "x$enable_fuzztargets" = "xyes"])
|
||||
AS_IF([test "x$enable_fuzztargets" = "xyes"], [
|
||||
AC_PROG_CXX
|
||||
AC_LANG_PUSH(C++)
|
||||
tmp_saved_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
AS_IF([test "x$LIB_FUZZING_ENGINE" = "x"], [
|
||||
LIB_FUZZING_ENGINE=-fsanitize=fuzzer
|
||||
AC_SUBST(LIB_FUZZING_ENGINE)
|
||||
])
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $LIB_FUZZING_ENGINE"
|
||||
AC_MSG_CHECKING([whether $CXX accepts $LIB_FUZZING_ENGINE])
|
||||
AC_LINK_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <sys/types.h>
|
||||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size);
|
||||
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *Data, size_t Size) {
|
||||
(void)Data;
|
||||
(void)Size;
|
||||
return 0;
|
||||
}
|
||||
]])],
|
||||
[ AC_MSG_RESULT(yes)
|
||||
has_sanitizefuzzer=yes],
|
||||
[ AC_MSG_RESULT(no) ]
|
||||
)
|
||||
_AC_LANG_PREFIX[]FLAGS=$tmp_saved_flags
|
||||
AC_LANG_POP()
|
||||
])
|
||||
AM_CONDITIONAL([HAS_FUZZLDFLAGS], [test "x$has_sanitizefuzzer" = "xyes"])
|
||||
|
||||
AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))
|
||||
|
||||
dnl> GCRYPT
|
||||
GCRYPT_ENABLED=1
|
||||
AC_ARG_ENABLE([gcrypt],
|
||||
[AS_HELP_STRING([--disable-gcrypt], [Avoid compiling with libgcrypt/libgpg-error, even if they are present. QUIC sub-classification may be missing])],
|
||||
[GCRYPT_ENABLED=0],
|
||||
[AC_CHECK_LIB(gcrypt, gcry_cipher_checktag)])
|
||||
AS_IF([test "x$enable_gcrypt" = "xyes"], [
|
||||
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes; then :
|
||||
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lgcrypt"
|
||||
else
|
||||
$as_unset ac_cv_lib_gcrypt_gcry_cipher_checktag
|
||||
AC_CHECK_LIB(gpg-error, gpg_strerror_r)
|
||||
AC_CHECK_LIB(gcrypt, gcry_cipher_checktag)
|
||||
if test "x$ac_cv_lib_gcrypt_gcry_cipher_checktag" = xyes -a "x$ac_cv_lib_gpg_error_gpg_strerror_r" = xyes; then :
|
||||
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lgcrypt -lgpg-error"
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
dnl> PCRE
|
||||
AC_ARG_WITH(pcre, [ --with-pcre Enable nDPI build with libpcre])
|
||||
if test "${with_pcre+set}" = set; then :
|
||||
AC_CHECK_LIB(pcre, pcre_compile, AC_DEFINE_UNQUOTED(HAVE_PCRE, 1, [libpcre(-dev) is present]))
|
||||
if test "x$ac_cv_lib_pcre_pcre_compile" = xyes; then :
|
||||
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lpcre"
|
||||
ADDITIONAL_LIBS=-lpcre
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl> GeoIP
|
||||
AC_ARG_WITH(maxminddb, [ --with-maxminddb Enable nDPI build with libmaxminddb])
|
||||
if test "${with_maxminddb+set}" = set; then :
|
||||
AC_CHECK_LIB([maxminddb], [MMDB_lookup_sockaddr])
|
||||
AC_HAVE_HEADERS(maxminddb.h)
|
||||
if test ".${ac_cv_lib_maxminddb_MMDB_lookup_sockaddr}" = ".yes" && test ".${ac_cv_header_maxminddb_h}" = ".yes"; then
|
||||
ADDITIONAL_LIBS="${ADDITIONAL_LIBS} -lmaxminddb"
|
||||
AC_DEFINE_UNQUOTED(HAVE_MAXMINDDB, 1, [MaxMind DB support])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile example/Makefile example/Makefile.dpdk tests/Makefile tests/unit/Makefile tests/dga/Makefile libndpi.pc src/include/ndpi_define.h src/lib/Makefile python/Makefile fuzz/Makefile src/include/ndpi_api.h])
|
||||
AC_CONFIG_FILES([tests/do.sh], [chmod +x tests/do.sh])
|
||||
AC_CONFIG_FILES([tests/do_valgrind.sh], [chmod +x tests/do_valgrind.sh])
|
||||
AC_CONFIG_FILES([Makefile example/Makefile example/Makefile.dpdk tests/Makefile libndpi.pc src/include/ndpi_define.h src/lib/Makefile python/Makefile fuzz/Makefile])
|
||||
AC_CONFIG_HEADERS(src/include/ndpi_config.h)
|
||||
AC_SUBST(GIT_RELEASE)
|
||||
AC_SUBST(NDPI_MAJOR)
|
||||
AC_SUBST(NDPI_MINOR)
|
||||
AC_SUBST(NDPI_PATCH)
|
||||
AC_SUBST(NDPI_VERSION_SHORT)
|
||||
AC_SUBST(SVN_DATE)
|
||||
AC_SUBST(JSON_C_LIB)
|
||||
AC_SUBST(PCAP_INC)
|
||||
AC_SUBST(PCAP_LIB)
|
||||
AC_SUBST(ADDITIONAL_LIBS)
|
||||
@@ -252,13 +195,4 @@ AC_SUBST(DL_LIB)
|
||||
AC_SUBST(DPDK_TARGET)
|
||||
AC_SUBST(HAVE_PTHREAD_SETAFFINITY_NP)
|
||||
AC_SUBST(CUSTOM_NDPI)
|
||||
AC_SUBST(NDPI_API_VERSION)
|
||||
AC_SUBST(EXTRA_TARGETS)
|
||||
AC_SUBST(BUILD_MINGW)
|
||||
AC_SUBST(BUILD_FUZZTARGETS)
|
||||
AC_SUBST(JSONC_CFLAGS)
|
||||
AC_SUBST(JSONC_LIBS)
|
||||
AC_SUBST(GCRYPT_ENABLED)
|
||||
AC_SUBST(GNU_PREFIX)
|
||||
AC_SUBST(FRAG_MAN_ENABLED)
|
||||
AC_OUTPUT
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -21,7 +21,7 @@ SRCS-y := reader_util.c intrusion_detection.c ndpiReader.c
|
||||
|
||||
CFLAGS += -g
|
||||
CFLAGS += -Wno-strict-prototypes -Wno-missing-prototypes -Wno-missing-declarations -Wno-unused-parameter -I $(PWD)/../src/include @CFLAGS@ -DUSE_DPDK
|
||||
LDLIBS = $(LIBNDPI) @PCAP_LIB@ @LIBS@ -lpthread -lm @LDFLAGS@
|
||||
LDLIBS = $(LIBNDPI) @PCAP_LIB@ -lpthread @LDFLAGS@
|
||||
|
||||
include $(RTE_SDK)/mk/rte.extapp.mk
|
||||
|
||||
|
||||
+6
-22
@@ -1,39 +1,29 @@
|
||||
CC=@CC@
|
||||
CXX=@CXX@
|
||||
BUILD_MINGW=@BUILD_MINGW@
|
||||
SRCHOME=../src
|
||||
CFLAGS=-g -fPIC -DPIC -I$(SRCHOME)/include @PCAP_INC@ @CFLAGS@
|
||||
CFLAGS=-g -fPIC -DPIC -I$(SRCHOME)/include @CFLAGS@
|
||||
LIBNDPI=$(SRCHOME)/lib/libndpi.a
|
||||
LDFLAGS=$(LIBNDPI) @PCAP_LIB@ @LIBS@ @ADDITIONAL_LIBS@ -lpthread -lm @LDFLAGS@
|
||||
LDFLAGS=$(LIBNDPI) @PCAP_LIB@ @ADDITIONAL_LIBS@ -lpthread -lm @LDFLAGS@
|
||||
HEADERS=intrusion_detection.h reader_util.h $(SRCHOME)/include/ndpi_api.h \
|
||||
$(SRCHOME)/include/ndpi_typedefs.h $(SRCHOME)/include/ndpi_protocol_ids.h
|
||||
OBJS=ndpiReader.o reader_util.o intrusion_detection.o
|
||||
PREFIX?=@prefix@
|
||||
|
||||
ifneq ($(BUILD_MINGW),)
|
||||
all:
|
||||
@echo 'Examples disabled due to mingw build.'
|
||||
|
||||
else
|
||||
|
||||
all: ndpiReader @DPDK_TARGET@
|
||||
|
||||
EXECUTABLE_SOURCES := ndpiReader.c ndpiSimpleIntegration.c
|
||||
EXECUTABLE_SOURCES := ndpiReader.c
|
||||
COMMON_SOURCES := $(filter-out $(EXECUTABLE_SOURCES),$(wildcard *.c ))
|
||||
|
||||
libndpiReader.a: $(COMMON_SOURCES:%.c=%.o) $(LIBNDPI)
|
||||
ar rsv libndpiReader.a $(COMMON_SOURCES:%.c=%.o)
|
||||
|
||||
ndpiReader: libndpiReader.a $(LIBNDPI) ndpiReader.o
|
||||
$(CC) $(CFLAGS) ndpiReader.o libndpiReader.a -o $@ $(LDFLAGS)
|
||||
|
||||
ndpiSimpleIntegration: ndpiSimpleIntegration.o
|
||||
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS)
|
||||
ndpiReader: libndpiReader.a $(LIBNDPI) $(EXECUTABLE_SOURCES:%.c=%.o)
|
||||
$(CXX) $(CFLAGS) $(EXECUTABLE_SOURCES:%.c=%.o) libndpiReader.a -o $@ $(LDFLAGS)
|
||||
|
||||
%.o: %.c $(HEADERS) Makefile
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
install: ndpiReader
|
||||
install:
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin/
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/share/ndpi
|
||||
cp ndpiReader $(DESTDIR)$(PREFIX)/bin/
|
||||
@@ -54,12 +44,6 @@ clean:
|
||||
/bin/rm -f _install _postbuild _postinstall _preinstall
|
||||
/bin/rm -rf build
|
||||
|
||||
distdir:
|
||||
cp categories.txt mining_hosts.txt protos.txt README.DPDK '$(distdir)/'
|
||||
find . -maxdepth 1 -type f -name '*.c' -o -name '*.h' -o -name '*.py' | xargs -I'{}' cp '{}' '$(distdir)/{}'
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile.dpdk
|
||||
/bin/rm -f Makefile
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* intrusion_detection.c
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-19 - 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
|
||||
@@ -53,6 +53,7 @@ double get_flow_score(ndpi_norm_value* scores, int n_metrics){
|
||||
/* ********************************** */
|
||||
|
||||
double Ddos_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* pktlen_c_to_s_avg */
|
||||
@@ -104,6 +105,7 @@ double Ddos_score(struct ndpi_flow_info* flow){
|
||||
}
|
||||
|
||||
double Dos_goldeneye_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* pktlen_s_to_c_max */
|
||||
@@ -154,7 +156,7 @@ double Dos_goldeneye_score(struct ndpi_flow_info* flow){
|
||||
}
|
||||
|
||||
double Dos_hulk_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen_ms/1000.0, l = (double)flow->last_seen_ms/1000.0;
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* duration */
|
||||
@@ -206,6 +208,7 @@ double Dos_hulk_score(struct ndpi_flow_info* flow){
|
||||
}
|
||||
|
||||
double Dos_slow_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* pktlen_s_to_c_max */
|
||||
@@ -257,6 +260,7 @@ double Dos_slow_score(struct ndpi_flow_info* flow){
|
||||
}
|
||||
|
||||
double Ftp_patator_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* iat_flow_min */
|
||||
@@ -308,7 +312,7 @@ double Ftp_patator_score(struct ndpi_flow_info* flow){
|
||||
}
|
||||
|
||||
double Hearthbleed_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen_ms/1000.0, l = (double)flow->last_seen_ms/1000.0;
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* iat_flow_max */
|
||||
@@ -360,6 +364,7 @@ double Hearthbleed_score(struct ndpi_flow_info* flow){
|
||||
}
|
||||
|
||||
double Infiltration_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* pktlen_c_to_s_max */
|
||||
@@ -411,6 +416,7 @@ double Infiltration_score(struct ndpi_flow_info* flow){
|
||||
}
|
||||
|
||||
double Ssh_patator_score(struct ndpi_flow_info* flow){
|
||||
double f = (double)flow->first_seen/1000.0, l = (double)flow->last_seen/1000.0;
|
||||
int n_metrics = 6;
|
||||
ndpi_norm_value* scores = malloc(n_metrics * sizeof(ndpi_norm_value));
|
||||
/* fin */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* intrusion_detection.h
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-19 - 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
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
################################################################
|
||||
# abuse.ch Suricata JA3 Fingerprint Blacklist (CSV) #
|
||||
# For Suricata 4.1.0 or newer #
|
||||
# Last updated: 2020-04-09 06:48:14 UTC #
|
||||
# #
|
||||
# Terms Of Use: https://sslbl.abuse.ch/blacklist/ #
|
||||
# For questions please contact sslbl [at] abuse.ch #
|
||||
################################################################
|
||||
#
|
||||
# ja3_md5,Firstseen,Lastseen,Listingreason
|
||||
b386946a5a44d1ddcc843bc75336dfce,2017-07-14 18:08:15,2019-07-27 20:42:54,Dridex
|
||||
8991a387e4cc841740f25d6f5139f92d,2017-07-14 19:02:03,2019-07-28 00:34:38,Adware
|
||||
cb98a24ee4b9134448ffb5714fd870ac,2017-07-14 19:48:28,2019-05-22 03:22:38,Dridex
|
||||
1aa7bf8b97e540ca5edd75f7b8384bfa,2017-07-14 20:23:38,2019-07-28 01:38:22,TrickBot
|
||||
3d89c0dfb1fa44911b8fa7523ef8dedb,2017-07-15 04:23:45,2021-02-01 18:23:25,Adware
|
||||
bc6c386f480ee97b9d9e52d472b772d8,2017-07-15 10:57:38,2021-02-21 13:13:30,Adware
|
||||
8f52d1ce303fb4a6515836aec3cc16b1,2017-07-15 19:05:11,2019-07-27 20:00:57,TrickBot
|
||||
d6f04b5a910115f4b50ecec09d40a1df,2017-07-15 19:42:24,2018-10-14 08:12:51,Dridex
|
||||
35c0a31c481927f022a3b530255ac080,2017-07-15 19:43:19,2021-02-06 03:21:55,Tofsee
|
||||
d551fafc4f40f1dec2bb45980bfa9492,2017-07-15 19:59:29,2020-11-16 13:06:20,Adware
|
||||
e330bca99c8a5256ae126a55c4c725c5,2017-07-15 19:59:29,2021-01-13 00:29:37,Adware
|
||||
b8f81673c0e1d29908346f3bab892b9b,2017-07-16 01:32:03,2018-12-17 06:08:03,Adware
|
||||
83e04bc58d402f9633983cbf22724b02,2017-07-16 01:32:03,2021-01-14 14:23:42,Adware
|
||||
70722097d1fe1d78d8c2164640ab6df4,2017-07-16 02:39:08,2021-02-22 04:56:57,Tofsee
|
||||
9c2589e1c0e9f533a022c6205f9719e1,2017-07-16 08:37:17,2021-02-19 08:46:32,Adware
|
||||
849b04bdbd1d2b983f6e8a457e0632a8,2017-07-16 08:37:17,2021-02-19 08:46:32,Adware
|
||||
16efcf0e00504ddfedde13bfea997952,2017-07-16 19:45:45,2020-12-23 15:10:32,Adware
|
||||
4d7a28d6f2263ed61de88ca66eb011e3,2017-07-16 21:20:29,2020-12-08 18:10:55,Tofsee
|
||||
550dce18de1bb143e69d6dd9413b8355,2017-07-16 22:17:20,2018-12-21 07:04:50,Adware
|
||||
c50f6a8b9173676b47ba6085bd0c6cee,2017-07-16 22:38:41,2019-05-21 09:42:17,TrickBot
|
||||
20dd18bdd3209ea718989030a6f93364,2017-07-18 10:22:58,2019-04-28 09:23:31,Adware
|
||||
8498fe4268764dbf926a38283e9d3d8f,2017-07-18 10:22:58,2020-12-31 02:06:27,Adware
|
||||
590a232d04d56409fab72e752a8a2634,2017-07-18 18:53:24,2020-10-11 20:48:33,Tofsee
|
||||
51a7ad14509fd614c7bb3a50c4982b8c,2017-07-19 07:28:19,2019-07-14 11:58:32,JBifrost
|
||||
96eba628dcb2b47607192ba74a3b55ba,2017-07-19 18:53:48,2021-01-04 12:45:08,Tofsee
|
||||
df5c30e670dba99f9270ed36060cf054,2017-07-20 17:44:07,2018-04-11 15:57:59,Tofsee
|
||||
098f55e27d8c4b0a590102cbdb3a5f3a,2017-07-21 09:52:01,2019-04-08 01:09:54,Adware
|
||||
46efd49abcca8ea9baa932da68fdb529,2017-07-22 14:07:36,2021-02-20 20:45:32,Adware
|
||||
29085f03f8e8a03f0b399c5c7cf0b0b8,2017-07-22 14:07:36,2021-02-21 20:56:01,Adware
|
||||
d7150af4514b868defb854db0f62a441,2017-07-23 09:39:24,2018-07-24 01:04:58,Tofsee
|
||||
03e186a7f83285e93341de478334006e,2017-07-24 18:17:14,2021-02-13 23:55:58,Tofsee
|
||||
3cda52da4ade09f1f781ad2e82dcfa20,2017-07-30 18:41:36,2019-05-21 17:34:18,Quakbot
|
||||
b13d01846ad7a14a70bf030a16775c78,2017-08-08 07:12:49,2021-02-21 01:32:12,Adware
|
||||
1543a7c46633acf71e8401baccbd0568,2017-08-08 21:32:28,2020-11-10 05:30:17,Tofsee
|
||||
1d095e68489d3c535297cd8dffb06cb9,2017-08-12 19:56:28,2020-10-28 11:06:23,Tofsee
|
||||
93d056782d649deb51cda44ecb714bb0,2017-08-28 12:20:47,2019-04-15 23:47:27,Adware
|
||||
698e36219f3979420fa2581b21dac7ec,2017-08-28 12:20:47,2020-12-31 02:06:31,Adware
|
||||
1712287800ac91b34cadd5884ce85568,2017-08-28 16:01:59,2021-01-23 09:36:32,TorrentLocker
|
||||
5e573c9c9f8ba720ef9b18e9fce2e2f7,2017-08-30 13:44:56,2021-02-17 17:11:34,Adware
|
||||
f6fd83a21f9f3c5f9ff7b5c63bbc179d,2017-10-20 08:03:21,2018-11-06 06:42:12,Adware
|
||||
92579701f145605e9edc0b01a901c6d5,2017-10-23 00:10:48,2021-02-18 22:56:49,Adware
|
||||
a61299f9b501adcf680b9275d79d4ac6,2017-11-04 18:03:59,2020-04-21 17:08:24,Tofsee
|
||||
b2b61db7b9490a60d270ccb20b462826,2017-11-14 20:12:03,2021-02-18 22:56:49,Adware
|
||||
7dcce5b76c8b17472d024758970a406b,2017-11-22 12:42:46,2020-12-22 15:15:49,Tofsee
|
||||
534ce2dbc413c68e908363b5df0ae5e0,2017-12-22 09:36:21,2019-07-27 15:22:33,TrickBot
|
||||
fb00055a1196aeea8d1bc609885ba953,2018-01-01 22:49:25,2019-04-09 06:58:58,TrickBot
|
||||
a50a861119aceb0ccc74902e8fddb618,2018-01-02 08:16:23,2018-07-05 02:33:08,Tofsee
|
||||
e7643725fcff971e3051fe0e47fc2c71,2018-01-31 08:06:13,2020-03-25 16:19:48,Tofsee
|
||||
7c410ce832e848a3321432c9a82e972b,2018-01-31 20:04:25,2021-02-21 22:51:31,Tofsee
|
||||
da949afd9bd6df820730f8f171584a71,2018-02-03 05:19:37,2021-02-21 05:20:43,Tofsee
|
||||
906004246f3ba5e755b043c057254a29,2018-03-11 08:25:38,2018-04-14 00:59:16,Tofsee
|
||||
fd80fa9c6120cdeea8520510f3c644ac,2018-03-11 09:34:30,2021-02-21 22:16:39,Tofsee
|
||||
b90bdbe961a648f0427db21aaa6ccb59,2018-03-11 10:37:43,2020-05-29 23:39:01,Tofsee
|
||||
1fe4c7a3544eb27afec2adfb3a3dbf60,2018-03-11 19:23:08,2021-02-20 11:19:52,Tofsee
|
||||
c201b92f8b483fa388be174d6689f534,2018-03-12 13:43:52,2021-01-28 06:17:06,Gozi
|
||||
9f62c4f26b90d3d757bea609e82f2eaf,2018-03-13 06:23:41,2020-12-18 16:07:31,Tofsee
|
||||
1be3ecebe5aa9d3654e6e703d81f6928,2018-03-13 11:50:02,2021-02-14 23:03:13,Ransomware.Troldesh
|
||||
e3b2ab1f9a56f2fb4c9248f2f41631fa,2018-03-15 01:06:34,2021-02-22 10:36:48,Tofsee
|
||||
dff8a0aa1c904aaea76c5bf624e88333,2018-03-18 09:41:15,2020-10-27 09:50:24,Tofsee
|
||||
17fd49722f8d11f3d76dce84f8e099a7,2018-03-19 23:02:27,2020-12-09 11:32:21,Tofsee
|
||||
911479ac8a0813ed1241b3686ccdade9,2018-03-19 23:24:59,2020-03-30 04:09:18,Tofsee
|
||||
c5deb9465d47232dd48772f9c4d14679,2018-03-22 15:42:48,2021-02-17 07:39:32,Tofsee
|
||||
f22bdd57e3a52de86cda40da2d84e83b,2018-03-27 13:40:19,2019-01-20 14:31:39,Tofsee
|
||||
d18a4da84af59e1108862a39bae7c9d4,2018-04-03 00:40:51,2021-02-06 01:53:12,Tofsee
|
||||
2d8794cb7b52b777bee2695e79c15760,2018-04-04 06:56:37,2021-02-10 08:22:31,Ransomware
|
||||
40adfd923eb82b89d8836ba37a19bca1,2018-04-15 15:49:08,2021-02-21 22:22:56,CoinMiner
|
||||
1aee0238942d453d679fc1e37a303387,2018-05-13 01:59:49,2021-02-10 13:19:24,Tofsee
|
||||
2092e1fffb45d7e4a19a57f9bc5e203a,2018-05-16 21:59:36,2018-09-05 01:58:33,Adware
|
||||
bffa4501966196d3d6e90cee1f88fc89,2018-06-07 15:08:04,2020-03-16 00:03:44,Tofsee
|
||||
807fca46d9d0cf63adf4e5e80e414bbe,2018-06-07 16:51:03,2021-02-20 03:15:38,Tofsee
|
||||
fb58831f892190644fe44e25bc830b45,2018-06-08 12:07:59,2019-05-31 21:02:37,Adware
|
||||
0cc1e84568e471aa1d62ad4158ade6b5,2018-06-24 10:50:47,2021-02-10 21:48:57,Tofsee
|
||||
d2935c58fe676744fecc8614ee5356c7,2018-08-14 21:48:41,2021-02-21 21:44:55,Adwind
|
||||
8916410db85077a5460817142dcbc8de,2018-08-21 12:32:28,2021-02-21 20:02:19,TrickBot
|
||||
c5235d3a8b9934b7fbbd204d50bc058d,2018-08-23 17:36:08,2019-10-13 05:11:09,Gootkit
|
||||
57f3642b4e37e28f5cbe3020c9331b4c,2018-08-28 15:54:53,2021-02-22 11:09:43,Gozi
|
||||
e62a5f4d538cbf169c2af71bec2399b4,2018-08-30 15:45:40,2021-02-21 20:36:55,TrickBot
|
||||
51c64c77e60f3980eea90869b68c58a8,2018-08-30 21:04:57,2021-02-21 22:09:16,Dridex
|
||||
7691297bcb20a41233fd0a0baa0a3628,2018-09-17 02:50:05,2021-02-21 17:05:57,Adware
|
||||
7dd50e112cd23734a310b90f6f44a7cd,2018-09-17 17:54:58,2021-02-22 11:14:04,Quakbot
|
||||
52c7396a501e4fecbdfa99c5408334ac,2018-09-18 00:29:04,2019-12-03 17:24:02,Tofsee
|
||||
f735bbc6b69723b9df7b0e7ef27872af,2018-10-02 18:04:16,2021-02-19 06:55:39,TrickBot
|
||||
49ed2ef3f1321e5f044f1e71b0e6fdd5,2018-10-02 18:04:17,2021-02-19 06:55:39,TrickBot
|
||||
d76ee64fb7273733cbe455ac81c292e6,2018-11-16 13:26:39,2018-11-18 19:19:36,Tofsee
|
||||
8f6c918dcb585ebbea05e2cc94530e3d,2018-11-16 13:26:41,2020-05-06 15:45:21,Tofsee
|
||||
34f14a69ad7009ca5863379218af17f3,2018-11-17 05:17:22,2021-01-28 08:19:18,Tofsee
|
||||
c2b4710c6888a5d47befe865c8e6fb19,2018-11-29 20:46:04,2020-12-16 15:08:09,Tofsee
|
||||
decfb48a53789ebe081b88aabb58ee34,2018-12-21 09:06:16,2021-02-16 12:28:53,Adwind
|
||||
08a8a4e85b25ac42e1490bc85cfdb5ce,2019-01-30 02:48:34,2020-10-27 09:50:19,Tofsee
|
||||
c0220cd64849a629397a9cb68f78a0ea,2019-03-24 00:12:32,2021-02-13 05:13:33,Tofsee
|
||||
7a29c223fb122ec64d10f0a159e07996,2019-06-09 22:55:29,2020-10-27 09:50:26,Tofsee
|
||||
44dab16d680ef93487bc16ad23b3ffb1,2019-06-09 22:55:29,2020-10-27 09:50:25,Tofsee
|
||||
70a04365be5bbd4653698bebeb43ce68,2019-07-02 06:26:56,2020-05-30 04:19:00,Tofsee
|
||||
d81d654effb94714a4086734fa0adad9,2019-07-16 23:29:02,2020-10-27 09:50:21,Tofsee
|
||||
25d74b7b4b779eb1efd4b31d26d651c6,2019-08-03 20:15:33,2020-07-14 21:43:25,Tofsee
|
||||
fc2299d5b2964cd242c5a2c8c531a5f0,2019-08-09 23:56:32,2021-02-22 08:49:18,Tofsee
|
||||
32926ca3e59f0413d0b98725454594f5,2019-09-12 06:56:10,2020-10-27 21:49:31,Tofsee
|
||||
ffefafdb86336d057eda5fdf02b3d5ce,2019-10-26 07:31:49,2020-07-25 00:14:09,Tofsee
|
||||
# END (98) entries
|
||||
|
+305
-1457
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+9
-37
@@ -10,47 +10,19 @@ tcp:3000@ntop
|
||||
# Format:
|
||||
# host:"<value>",host:"<value>",.....@<subproto>
|
||||
|
||||
host:"disneyplus.com",host:"cdn.registerdisney.go.com",host:"disney-portal.my.onetrust.com",host:"disneyplus.bn5x.net",host:"disney-plus.net"@DisneyPlus
|
||||
host:"googlesyndication.com"@Google
|
||||
host:"venere.com"@Venere
|
||||
host:"kataweb.it",host:"repubblica.it"@Repubblica
|
||||
host:"ntop"@ntop
|
||||
host:"atv-ext.amazon.com",host:"*.api.amazon.com",host:"*.api.amazonvideo.com"@AmazonVideo
|
||||
host:"*.amazonaws.com"@AmazonVideo
|
||||
host:"*.netflix.com"@Netflix
|
||||
host:"*.lvlt.dash.us.aiv-cdn.net.c.footprint.net"@AmazonVideo
|
||||
host:"api-global.netflix.com"@Netflix
|
||||
# IP based Subprotocols
|
||||
# Format:
|
||||
# ip:<value>,ip:<value>,.....@<subproto>
|
||||
|
||||
#
|
||||
# NOTES
|
||||
# 1) the port of a custom protocol is optional but if
|
||||
# specified it must match the port.
|
||||
# 2) you can specify up to 1 port per IP address
|
||||
# 3) if you specify a custom ip:<IP>:<PORT> rule,
|
||||
# even if the <PORT> doesn't match the <IP>
|
||||
# (if best match during the search) will
|
||||
# have priority as best match. Example if
|
||||
# you specify a <Google IP>:<port 9999> and
|
||||
# in your traffic have match for such IP but
|
||||
# with a port other than 9999, the IP address
|
||||
# begin a best match will hve preference over
|
||||
# <Google IP> so this protocol will not be
|
||||
# detected as <L7 proto>.Google but only
|
||||
# as <L7 proto>
|
||||
#
|
||||
|
||||
ip:213.75.170.11/32:443@CustomProtocol
|
||||
ip:8.248.73.247:443@AmazonPrime
|
||||
ip:213.75.170.11@CustomProtocol
|
||||
ip:8.248.73.247@AmazonPrime
|
||||
ip:54.80.47.130@AmazonPrime
|
||||
|
||||
#
|
||||
# Risk Exceptions
|
||||
#
|
||||
# ip_risk_mask: used to mask flow risks for IP addresses
|
||||
# host_risk_mask: used to mask exceptions for domain names and hosts
|
||||
#
|
||||
# Syntax: <name>=<64 bit mask to be put in AND with the risk
|
||||
#
|
||||
# For IPs, the flow risk is put in AND (source IP mask OR destination IP mask)
|
||||
# For Flows with a hostname (e.g. TLS) the risk is also put in AND with the host_risk_mask
|
||||
#ip_risk_mask:192.168.1.0/24=0
|
||||
#ip_risk_mask:10.196.157.228=0
|
||||
host_risk_mask:".local"=0
|
||||
host_risk_mask:".msftconnecttest.com"=0
|
||||
|
||||
|
||||
+263
-529
File diff suppressed because it is too large
Load Diff
+36
-74
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_util.h
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-19 - 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
|
||||
@@ -29,9 +29,8 @@
|
||||
#ifndef __NDPI_UTIL_H__
|
||||
#define __NDPI_UTIL_H__
|
||||
|
||||
#include "../src/lib/third_party/include/uthash.h"
|
||||
#include "uthash.h"
|
||||
#include <pcap.h>
|
||||
#include "ndpi_includes.h"
|
||||
#include "ndpi_classify.h"
|
||||
#include "ndpi_typedefs.h"
|
||||
|
||||
@@ -51,14 +50,8 @@
|
||||
#define PREFETCH_OFFSET 3
|
||||
|
||||
extern int dpdk_port_init(int port, struct rte_mempool *mbuf_pool);
|
||||
extern int dpdk_port_deinit(int port);
|
||||
#endif
|
||||
|
||||
#define PLEN_MAX 1504
|
||||
#define PLEN_BIN_LEN 32
|
||||
#define PLEN_NUM_BINS 48 /* 47*32 = 1504 */
|
||||
#define MAX_NUM_BIN_PKTS 256
|
||||
|
||||
/* ETTA Spec defiintions for feature readiness */
|
||||
#define ETTA_MIN_PACKETS 10
|
||||
#define ETTA_MIN_OCTETS 4000
|
||||
@@ -94,38 +87,38 @@ extern int dpdk_port_deinit(int port);
|
||||
|
||||
// inner hash table (ja3 -> security state)
|
||||
typedef struct ndpi_ja3_info {
|
||||
char * ja3;
|
||||
ndpi_cipher_weakness unsafe_cipher;
|
||||
UT_hash_handle hh;
|
||||
char * ja3;
|
||||
ndpi_cipher_weakness unsafe_cipher;
|
||||
UT_hash_handle hh;
|
||||
} ndpi_ja3_info;
|
||||
|
||||
// external hash table (host ip -> <ip string, hash table ja3c, hash table ja3s>)
|
||||
// used to aggregate ja3 fingerprints by hosts
|
||||
typedef struct ndpi_host_ja3_fingerprints {
|
||||
u_int32_t ip;
|
||||
char *ip_string;
|
||||
char *dns_name;
|
||||
ndpi_ja3_info *host_client_info_hasht;
|
||||
ndpi_ja3_info *host_server_info_hasht;
|
||||
u_int32_t ip;
|
||||
char *ip_string;
|
||||
char *dns_name;
|
||||
ndpi_ja3_info *host_client_info_hasht;
|
||||
ndpi_ja3_info *host_server_info_hasht;
|
||||
|
||||
UT_hash_handle hh;
|
||||
UT_hash_handle hh;
|
||||
} ndpi_host_ja3_fingerprints;
|
||||
|
||||
|
||||
//inner hash table
|
||||
typedef struct ndpi_ip_dns{
|
||||
u_int32_t ip;
|
||||
char *ip_string;
|
||||
char *dns_name; //server name if any;
|
||||
UT_hash_handle hh;
|
||||
u_int32_t ip;
|
||||
char *ip_string;
|
||||
char *dns_name; //server name if any;
|
||||
UT_hash_handle hh;
|
||||
} ndpi_ip_dns;
|
||||
|
||||
//hash table ja3 -> <host, ip, security>, used to aggregate host by ja3 fingerprints
|
||||
typedef struct ndpi_ja3_fingerprints_host{
|
||||
char *ja3; //key
|
||||
ndpi_cipher_weakness unsafe_cipher;
|
||||
ndpi_ip_dns *ipToDNS_ht;
|
||||
UT_hash_handle hh;
|
||||
char *ja3; //key
|
||||
ndpi_cipher_weakness unsafe_cipher;
|
||||
ndpi_ip_dns *ipToDNS_ht;
|
||||
UT_hash_handle hh;
|
||||
} ndpi_ja3_fingerprints_host;
|
||||
|
||||
struct flow_metrics {
|
||||
@@ -134,13 +127,13 @@ struct flow_metrics {
|
||||
|
||||
struct ndpi_entropy {
|
||||
// Entropy fields
|
||||
pkt_timeval src2dst_last_pkt_time, dst2src_last_pkt_time, flow_last_pkt_time;
|
||||
struct timeval src2dst_last_pkt_time, dst2src_last_pkt_time, flow_last_pkt_time;
|
||||
u_int16_t src2dst_pkt_len[MAX_NUM_PKTS]; /*!< array of packet appdata lengths */
|
||||
pkt_timeval src2dst_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
|
||||
struct timeval src2dst_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
|
||||
u_int16_t dst2src_pkt_len[MAX_NUM_PKTS]; /*!< array of packet appdata lengths */
|
||||
pkt_timeval dst2src_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
|
||||
pkt_timeval src2dst_start; /*!< first packet arrival time */
|
||||
pkt_timeval dst2src_start; /*!< first packet arrival time */
|
||||
struct timeval dst2src_pkt_time[MAX_NUM_PKTS]; /*!< array of arrival times */
|
||||
struct timeval src2dst_start; /*!< first packet arrival time */
|
||||
struct timeval dst2src_start; /*!< first packet arrival time */
|
||||
u_int32_t src2dst_opackets; /*!< non-zero packet counts */
|
||||
u_int32_t dst2src_opackets; /*!< non-zero packet counts */
|
||||
u_int16_t src2dst_pkt_count; /*!< packet counts */
|
||||
@@ -181,7 +174,7 @@ typedef struct ndpi_flow_info {
|
||||
u_int32_t fin_count, src2dst_fin_count, dst2src_fin_count;
|
||||
u_int32_t rst_count, src2dst_rst_count, dst2src_rst_count;
|
||||
u_int32_t c_to_s_init_win, s_to_c_init_win;
|
||||
u_int64_t first_seen_ms, last_seen_ms;
|
||||
u_int64_t first_seen, last_seen;
|
||||
u_int64_t src2dst_bytes, dst2src_bytes;
|
||||
u_int64_t src2dst_goodput_bytes, dst2src_goodput_bytes;
|
||||
u_int32_t src2dst_packets, dst2src_packets;
|
||||
@@ -195,36 +188,28 @@ typedef struct ndpi_flow_info {
|
||||
struct ndpi_analyze_struct *iat_c_to_s, *iat_s_to_c, *iat_flow,
|
||||
*pktlen_c_to_s, *pktlen_s_to_c;
|
||||
|
||||
char info[255];
|
||||
char info[160];
|
||||
char flow_extra_info[16];
|
||||
char host_server_name[240];
|
||||
char bittorent_hash[41];
|
||||
char dhcp_fingerprint[48];
|
||||
ndpi_risk risk;
|
||||
|
||||
|
||||
struct {
|
||||
u_int16_t ssl_version;
|
||||
char client_requested_server_name[256], server_info[64],
|
||||
char client_requested_server_name[64], server_info[64],
|
||||
client_hassh[33], server_hassh[33], *server_names,
|
||||
*tls_alpn, *tls_supported_versions,
|
||||
*tls_issuerDN, *tls_subjectDN,
|
||||
server_organization[64],
|
||||
ja3_client[33], ja3_server[33],
|
||||
sha1_cert_fingerprint[20];
|
||||
u_int8_t sha1_cert_fingerprint_set;
|
||||
struct tls_heuristics browser_heuristics;
|
||||
|
||||
struct {
|
||||
u_int16_t cipher_suite;
|
||||
char *esni;
|
||||
} encrypted_sni;
|
||||
|
||||
time_t notBefore, notAfter;
|
||||
u_int16_t server_cipher;
|
||||
ndpi_cipher_weakness client_unsafe_cipher, server_unsafe_cipher;
|
||||
} ssh_tls;
|
||||
|
||||
struct {
|
||||
char url[256], request_content_type[64], content_type[64], user_agent[128];
|
||||
char url[256], content_type[64], user_agent[128];
|
||||
u_int response_status_code;
|
||||
} http;
|
||||
|
||||
@@ -236,13 +221,6 @@ typedef struct ndpi_flow_info {
|
||||
|
||||
struct ndpi_entropy entropy;
|
||||
struct ndpi_entropy last_entropy;
|
||||
|
||||
/* Payload lenght bins */
|
||||
#ifdef DIRECTION_BINS
|
||||
struct ndpi_bin payload_len_bin_src2dst, payload_len_bin_dst2src;
|
||||
#else
|
||||
struct ndpi_bin payload_len_bin;
|
||||
#endif
|
||||
} ndpi_flow_info_t;
|
||||
|
||||
|
||||
@@ -256,12 +234,10 @@ typedef struct ndpi_stats {
|
||||
u_int64_t protocol_counter_bytes[NDPI_MAX_SUPPORTED_PROTOCOLS + NDPI_MAX_NUM_CUSTOM_PROTOCOLS + 1];
|
||||
u_int32_t protocol_flows[NDPI_MAX_SUPPORTED_PROTOCOLS + NDPI_MAX_NUM_CUSTOM_PROTOCOLS + 1];
|
||||
u_int32_t ndpi_flow_count;
|
||||
u_int32_t flow_count[3];
|
||||
u_int64_t tcp_count, udp_count;
|
||||
u_int64_t mpls_count, pppoe_count, vlan_count, fragmented_count;
|
||||
u_int64_t packet_len[6];
|
||||
u_int16_t max_packet_len;
|
||||
u_int64_t dpi_packet_count[3];
|
||||
} ndpi_stats_t;
|
||||
|
||||
|
||||
@@ -269,7 +245,6 @@ typedef struct ndpi_stats {
|
||||
typedef struct ndpi_workflow_prefs {
|
||||
u_int8_t decode_tunnels;
|
||||
u_int8_t quiet_mode;
|
||||
u_int8_t ignore_vlanid;
|
||||
u_int32_t num_roots;
|
||||
u_int32_t max_ndpi_flows;
|
||||
} ndpi_workflow_prefs_t;
|
||||
@@ -299,14 +274,14 @@ typedef struct ndpi_workflow {
|
||||
void **ndpi_flows_root;
|
||||
struct ndpi_detection_module_struct *ndpi_struct;
|
||||
u_int32_t num_allocated_flows;
|
||||
} ndpi_workflow_t;
|
||||
} ndpi_workflow_t;
|
||||
|
||||
|
||||
/* TODO: remove wrappers parameters and use ndpi global, when their initialization will be fixed... */
|
||||
struct ndpi_workflow * ndpi_workflow_init(const struct ndpi_workflow_prefs * prefs, pcap_t * pcap_handle);
|
||||
|
||||
|
||||
/* workflow main free function */
|
||||
/* workflow main free function */
|
||||
void ndpi_workflow_free(struct ndpi_workflow * workflow);
|
||||
|
||||
|
||||
@@ -320,11 +295,8 @@ void ndpi_free_flow_info_half(struct ndpi_flow_info *flow);
|
||||
/* Process a packet and update the workflow */
|
||||
struct ndpi_proto ndpi_workflow_process_packet(struct ndpi_workflow * workflow,
|
||||
const struct pcap_pkthdr *header,
|
||||
const u_char *packet,
|
||||
ndpi_risk *flow_risk,
|
||||
FILE * csv_fp);
|
||||
const u_char *packet);
|
||||
|
||||
int ndpi_is_datalink_supported(int datalink_type);
|
||||
|
||||
/* flow callbacks for complete detected flow
|
||||
(ndpi_flow_info will be freed right after) */
|
||||
@@ -340,25 +312,15 @@ static inline void ndpi_workflow_set_flow_giveup_callback(struct ndpi_workflow *
|
||||
workflow->__flow_giveup_udata = udata;
|
||||
}
|
||||
|
||||
/* compare two nodes in workflow */
|
||||
/* compare two nodes in workflow */
|
||||
int ndpi_workflow_node_cmp(const void *a, const void *b);
|
||||
void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_flow_info *flow, FILE * csv_fp);
|
||||
void process_ndpi_collected_info(struct ndpi_workflow * workflow, struct ndpi_flow_info *flow);
|
||||
u_int32_t ethernet_crc32(const void* data, size_t n_bytes);
|
||||
void ndpi_flow_info_free_data(struct ndpi_flow_info *flow);
|
||||
void ndpi_flow_info_freer(void *node);
|
||||
void ndpi_free_flow_data_analysis(struct ndpi_flow_info *flow);
|
||||
const char* print_cipher_id(u_int32_t cipher);
|
||||
float ndpi_flow_get_byte_count_entropy(const uint32_t byte_count[256], unsigned int num_bytes);
|
||||
|
||||
extern int nDPI_LogLevel;
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
#define LOG(log_level, args...) \
|
||||
{ \
|
||||
if(log_level <= nDPI_LogLevel) \
|
||||
printf(args); \
|
||||
}
|
||||
#else
|
||||
#define LOG(...) {}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# https://www.spamhaus.org/statistics/tlds/
|
||||
.fail
|
||||
.viajes
|
||||
.exposed
|
||||
.london
|
||||
.work
|
||||
.gq
|
||||
.ml
|
||||
.surk
|
||||
.tk
|
||||
.xyz
|
||||
File diff suppressed because it is too large
Load Diff
+10
-20
@@ -1,12 +1,11 @@
|
||||
bin_PROGRAMS = fuzz_process_packet fuzz_ndpi_reader fuzz_ndpi_reader_with_main
|
||||
bin_PROGRAMS = fuzz_process_packet fuzz_ndpi_reader
|
||||
|
||||
fuzz_process_packet_SOURCES = fuzz_process_packet.c
|
||||
fuzz_process_packet_CFLAGS =
|
||||
fuzz_process_packet_LDADD = ../src/lib/libndpi.a
|
||||
fuzz_process_packet_LDFLAGS = $(ADDITIONAL_LIBS) $(LIBS)
|
||||
fuzz_process_packet_LDFLAGS = ../src/lib/libndpi.a $(ADDITIONAL_LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
fuzz_process_packet_CFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
fuzz_process_packet_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
fuzz_process_packet_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
else
|
||||
fuzz_process_packet_SOURCES += onefile.c
|
||||
endif
|
||||
# force usage of CXX for linker
|
||||
fuzz_process_packet_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
@@ -15,28 +14,19 @@ fuzz_process_packet_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
|
||||
fuzz_ndpi_reader_SOURCES = fuzz_ndpi_reader.c
|
||||
fuzz_ndpi_reader_CFLAGS = -I../example/
|
||||
fuzz_ndpi_reader_LDADD = ../example/libndpiReader.a ../src/lib/libndpi.a
|
||||
fuzz_ndpi_reader_LDFLAGS = $(PCAP_LIB) $(ADDITIONAL_LIBS) $(LIBS)
|
||||
fuzz_ndpi_reader_LDFLAGS = ../example/libndpiReader.a ../src/lib/libndpi.a $(PCAP_LIB) $(ADDITIONAL_LIBS)
|
||||
if HAS_FUZZLDFLAGS
|
||||
fuzz_ndpi_reader_CFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
fuzz_ndpi_reader_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
fuzz_ndpi_reader_LDFLAGS += $(LIB_FUZZING_ENGINE)
|
||||
else
|
||||
fuzz_ndpi_reader_SOURCES += onefile.c
|
||||
endif
|
||||
# force usage of CXX for linker
|
||||
fuzz_ndpi_reader_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_ndpi_reader_LDFLAGS) $(LDFLAGS) -o $@
|
||||
|
||||
fuzz_ndpi_reader_with_main_SOURCES = fuzz_ndpi_reader.c
|
||||
fuzz_ndpi_reader_with_main_CFLAGS = -I../example/ -DBUILD_MAIN
|
||||
fuzz_ndpi_reader_with_main_LDADD = ../src/lib/libndpi.a
|
||||
fuzz_ndpi_reader_with_main_LDFLAGS = ../example/libndpiReader.a $(PCAP_LIB) $(ADDITIONAL_LIBS) $(LIBS)
|
||||
# force usage of CXX for linker
|
||||
fuzz_ndpi_reader_with_main_LINK=$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CXX) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(fuzz_ndpi_reader_with_main_LDFLAGS) $(LDFLAGS) -o $@
|
||||
EXTRA_fuzz_ndpi_reader_DEPENDENCIES = fuzz_ndpi_reader_seed_corpus.zip
|
||||
|
||||
# required for Google oss-fuzz
|
||||
# see https://github.com/google/oss-fuzz/tree/master/projects/ndpi
|
||||
testpcaps := $(wildcard ../tests/pcap/*.pcap)
|
||||
|
||||
fuzz_ndpi_reader_seed_corpus.zip: $(testpcaps)
|
||||
|
||||
+10
-94
@@ -21,13 +21,13 @@ int bufferToFile(const char * name, const uint8_t *Data, size_t Size) {
|
||||
FILE * fd;
|
||||
if (remove(name) != 0) {
|
||||
if (errno != ENOENT) {
|
||||
perror("remove failed");
|
||||
printf("failed remove, errno=%d\n", errno);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fd = fopen(name, "wb");
|
||||
if (fd == NULL) {
|
||||
perror("open failed");
|
||||
printf("failed open, errno=%d\n", errno);
|
||||
return -2;
|
||||
}
|
||||
if (fwrite (Data, 1, Size, fd) != Size) {
|
||||
@@ -45,7 +45,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
int r;
|
||||
char errbuf[PCAP_ERRBUF_SIZE];
|
||||
NDPI_PROTOCOL_BITMASK all;
|
||||
char * pcap_path = tempnam("/tmp", "fuzz-ndpi-reader");
|
||||
|
||||
if (prefs == NULL) {
|
||||
prefs = calloc(sizeof(struct ndpi_workflow_prefs), 1);
|
||||
@@ -58,20 +57,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
prefs->max_ndpi_flows = 1024;
|
||||
prefs->quiet_mode = 0;
|
||||
}
|
||||
bufferToFile(pcap_path, Data, Size);
|
||||
bufferToFile("/tmp/fuzz.pcap", Data, Size);
|
||||
|
||||
pkts = pcap_open_offline(pcap_path, errbuf);
|
||||
pkts = pcap_open_offline("/tmp/fuzz.pcap", errbuf);
|
||||
if (pkts == NULL) {
|
||||
remove(pcap_path);
|
||||
free(pcap_path);
|
||||
return 0;
|
||||
}
|
||||
if (ndpi_is_datalink_supported(pcap_datalink(pkts)) == 0)
|
||||
{
|
||||
/* Do not fail if the datalink type is not supported (may happen often during fuzzing). */
|
||||
pcap_close(pkts);
|
||||
remove(pcap_path);
|
||||
free(pcap_path);
|
||||
return 0;
|
||||
}
|
||||
struct ndpi_workflow * workflow = ndpi_workflow_init(prefs, pkts);
|
||||
@@ -84,92 +73,19 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||
sizeof(workflow->stats.protocol_counter_bytes));
|
||||
memset(workflow->stats.protocol_flows, 0,
|
||||
sizeof(workflow->stats.protocol_flows));
|
||||
ndpi_finalize_initialization(workflow->ndpi_struct);
|
||||
ndpi_finalize_initalization(workflow->ndpi_struct);
|
||||
|
||||
header = NULL;
|
||||
r = pcap_next_ex(pkts, &header, &pkt);
|
||||
while (r > 0) {
|
||||
if(header->caplen >= 42 /* ARP+ size */) {
|
||||
/* allocate an exact size buffer to check overflows */
|
||||
uint8_t *packet_checked = malloc(header->caplen);
|
||||
|
||||
if(packet_checked) {
|
||||
ndpi_risk flow_risk;
|
||||
|
||||
memcpy(packet_checked, pkt, header->caplen);
|
||||
ndpi_workflow_process_packet(workflow, header, packet_checked, &flow_risk, NULL);
|
||||
free(packet_checked);
|
||||
}
|
||||
}
|
||||
|
||||
/* allocate an exact size buffer to check overflows */
|
||||
uint8_t *packet_checked = malloc(header->caplen);
|
||||
memcpy(packet_checked, pkt, header->caplen);
|
||||
ndpi_workflow_process_packet(workflow, header, packet_checked);
|
||||
free(packet_checked);
|
||||
r = pcap_next_ex(pkts, &header, &pkt);
|
||||
}
|
||||
ndpi_workflow_free(workflow);
|
||||
pcap_close(pkts);
|
||||
|
||||
remove(pcap_path);
|
||||
free(pcap_path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef BUILD_MAIN
|
||||
int main(int argc, char ** argv)
|
||||
{
|
||||
FILE * pcap_file;
|
||||
long pcap_file_size;
|
||||
uint8_t * pcap_buffer;
|
||||
int test_retval;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "usage: %s: [pcap-file]\n",
|
||||
(argc > 0 ? argv[0] : "fuzz_ndpi_reader_with_main"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
pcap_file = fopen(argv[1], "r");
|
||||
if (pcap_file == NULL) {
|
||||
perror("fopen failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fseek(pcap_file, 0, SEEK_END) != 0) {
|
||||
perror("fseek(SEEK_END) failed");
|
||||
fclose(pcap_file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pcap_file_size = ftell(pcap_file);
|
||||
if (pcap_file_size < 0) {
|
||||
perror("ftell failed");
|
||||
fclose(pcap_file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fseek(pcap_file, 0, SEEK_SET) != 0) {
|
||||
perror("fseek(0, SEEK_SET) failed");
|
||||
fclose(pcap_file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
pcap_buffer = malloc(pcap_file_size);
|
||||
if (pcap_buffer == NULL) {
|
||||
perror("malloc failed");
|
||||
fclose(pcap_file);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fread(pcap_buffer, sizeof(*pcap_buffer), pcap_file_size, pcap_file) != pcap_file_size) {
|
||||
perror("fread failed");
|
||||
fclose(pcap_file);
|
||||
free(pcap_buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
test_retval = LLVMFuzzerTestOneInput(pcap_buffer, pcap_file_size);
|
||||
fclose(pcap_file);
|
||||
free(pcap_buffer);
|
||||
|
||||
return test_retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -6,5 +6,5 @@ includedir=@includedir@
|
||||
Name: libndpi
|
||||
Description: deep packet inspection library
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -lndpi @ADDITIONAL_LIBS@
|
||||
Libs: -L${libdir} -lndpi
|
||||
Cflags: -I${includedir}/ndpi
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
# ===========================================================================
|
||||
# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||
# ===========================================================================
|
||||
#
|
||||
# SYNOPSIS
|
||||
#
|
||||
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
|
||||
#
|
||||
# DESCRIPTION
|
||||
#
|
||||
# Check whether the given FLAG works with the current language's compiler
|
||||
# or gives an error. (Warnings, however, are ignored)
|
||||
#
|
||||
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||
# success/failure.
|
||||
#
|
||||
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||
# force the compiler to issue an error when a bad flag is given.
|
||||
#
|
||||
# INPUT gives an alternative input source to AC_COMPILE_IFELSE.
|
||||
#
|
||||
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||
#
|
||||
# LICENSE
|
||||
#
|
||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 6
|
||||
|
||||
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
|
||||
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
|
||||
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||
[AS_VAR_SET(CACHEVAR,[no])])
|
||||
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||
AS_VAR_IF(CACHEVAR,yes,
|
||||
[m4_default([$2], :)],
|
||||
[m4_default([$3], :)])
|
||||
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||
])dnl AX_CHECK_COMPILE_FLAGS
|
||||
@@ -1 +1 @@
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
|
||||
+31
-65
@@ -1,93 +1,59 @@
|
||||
#
|
||||
# Copyright (C) 2017 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
# Copyright (C) 2018 - ntop.org
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libndpi
|
||||
PKG_VERSION:=3.4
|
||||
PKG_VERSION:=1333.ab2f3ce
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/ntop/nDPI/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=dc9b291c7fde94edb45fb0f222e0d93c93f8d6d37f4efba20ebd9c655bfcedf9
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/nDPI-$(PKG_VERSION)
|
||||
PKG_SOURCE_URL:=https://github.com/ntop/nDPI.git
|
||||
PKG_SOURCE_VERSION:=ab2f3cefc89017d73e67faa4eb4011e7e3f2044d
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
|
||||
PKG_MAINTAINER:=Banglang Huang <banglang.huang@foxmail.com>, Toni Uhlig <matzeton@googlemail.com>
|
||||
PKG_LICENSE:=LGPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_REMOVE_FILES:=autogen.sh
|
||||
PKG_BUILD_DEPENDS:=libpcap
|
||||
PKG_MAINTAINER:=Emanuele Faranda <faranda@ntop.org>
|
||||
PKG_LICENSE:=GPL3
|
||||
PKG_BUILD_DEPENDS:=+libpcap
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/uclibc++.mk
|
||||
# autogen fix
|
||||
PKG_FIXUP:=autoreconf
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_LIBNDPI_GCRYPT),)
|
||||
CONFIGURE_ARGS += --disable-gcrypt
|
||||
endif
|
||||
|
||||
define Package/libndpi
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Library for deep-packet inspection
|
||||
URL:=https://github.com/ntop/nDPI
|
||||
DEPENDS:=$(CXX_DEPENDS) +LIBNDPI_GCRYPT:libgcrypt +libpcap +libjson-c
|
||||
SECTION:=network
|
||||
CATEGORY:=Network
|
||||
#DEPENDS:=+libc +libjson-c +libpthread
|
||||
TITLE:=nDPI Deep Packet Inspection Library
|
||||
URL:=https://www.ntop.org
|
||||
endef
|
||||
|
||||
define Package/libndpi/description
|
||||
nDPI is an open source LGPLv3 library for deep-packet inspection.
|
||||
Based on OpenDPI it includes ntop extensions.
|
||||
Open and Extensible GPLv3 Deep Packet Inspection Library
|
||||
endef
|
||||
|
||||
define Package/libndpi/config
|
||||
config LIBNDPI_GCRYPT
|
||||
bool "GCrypt support"
|
||||
depends on PACKAGE_libndpi
|
||||
default n
|
||||
help
|
||||
This option enables QUIC client hello decryption.
|
||||
Disabled by default.
|
||||
endef
|
||||
CONFIGURE_ARGS += \
|
||||
--with-pic \
|
||||
--disable-json-c \
|
||||
|
||||
define Build/Prepare
|
||||
$(PKG_UNPACK)
|
||||
$(Build/Patch)
|
||||
mv $(PKG_BUILD_DIR)/configure.seed $(PKG_BUILD_DIR)/configure.ac
|
||||
$(SED) "s/@NDPI_MAJOR@/3/g" \
|
||||
-e "s/@NDPI_MINOR@/4/g" \
|
||||
-e "s/@NDPI_PATCH@/0/g" \
|
||||
-e "s/@NDPI_VERSION_SHORT@/3.4.0/g" \
|
||||
-e "s/@FUZZY@/dnl> /g" \
|
||||
$(PKG_BUILD_DIR)/configure.ac
|
||||
$(call Build/Prepare/Default)
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
( cd $(PKG_BUILD_DIR); ./autogen.sh )
|
||||
$(call Build/Configure/Default)
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/ndpi
|
||||
$(CP) $(PKG_BUILD_DIR)/src/include/*.h \
|
||||
$(1)/usr/include/ndpi/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/src/lib/libndpi.so* \
|
||||
$(1)/usr/lib/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_BUILD_DIR)/libndpi.pc \
|
||||
$(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/libndpi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/lib/libndpi.so* \
|
||||
$(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/example/ndpiReader \
|
||||
$(1)/usr/bin/
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/local/include/libndpi
|
||||
$(CP) $(PKG_BUILD_DIR)/src/include/* $(STAGING_DIR)/usr/local/include/libndpi
|
||||
$(INSTALL_DIR) $(STAGING_DIR)/usr/local/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/src/lib/libndpi.* $(STAGING_DIR)/usr/local/lib
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libndpi))
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
#
|
||||
# Copyright (C) 2017 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libndpi
|
||||
# Avoid a specfic version
|
||||
PKG_VERSION:=dev
|
||||
PKG_RELEASE:=1
|
||||
|
||||
# Compile it from soucre
|
||||
SOURCE_DIR:=/home/deri/openwrt-dependencies/nDPI/
|
||||
|
||||
PKG_MAINTAINER:=Luca Deri <deri@ntop.org>
|
||||
PKG_LICENSE:=LGPL-3.0-or-later
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
PKG_FIXUP:=autoreconf
|
||||
PKG_REMOVE_FILES:=autogen.sh
|
||||
PKG_BUILD_DEPENDS:=libpcap
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/uclibc++.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
ifeq ($(CONFIG_LIBNDPI_GCRYPT),)
|
||||
CONFIGURE_ARGS += --disable-gcrypt
|
||||
endif
|
||||
|
||||
define Package/libndpi
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
TITLE:=Library for deep-packet inspection
|
||||
URL:=https://github.com/ntop/nDPI
|
||||
DEPENDS:=$(CXX_DEPENDS) +LIBNDPI_GCRYPT:libgcrypt +libpcap +libjson-c
|
||||
endef
|
||||
|
||||
define Package/libndpi/description
|
||||
nDPI is an open source LGPLv3 library for deep-packet inspection.
|
||||
Based on OpenDPI it includes ntop extensions.
|
||||
endef
|
||||
|
||||
define Package/libndpi/config
|
||||
config LIBNDPI_GCRYPT
|
||||
bool "GCrypt support"
|
||||
depends on PACKAGE_libndpi
|
||||
default n
|
||||
help
|
||||
This option enables QUIC client hello decryption.
|
||||
Disabled by default.
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
cp -r $(SOURCE_DIR)/* $(PKG_BUILD_DIR)
|
||||
$(PKG_UNPACK)
|
||||
$(Build/Patch)
|
||||
mv $(PKG_BUILD_DIR)/configure.seed $(PKG_BUILD_DIR)/configure.ac
|
||||
$(SED) "s/@NDPI_MAJOR@/3/g" \
|
||||
-e "s/@NDPI_MINOR@/4/g" \
|
||||
-e "s/@NDPI_PATCH@/0/g" \
|
||||
-e "s/@NDPI_VERSION_SHORT@/3.4.0/g" \
|
||||
-e "s/@FUZZY@/dnl> /g" \
|
||||
$(PKG_BUILD_DIR)/configure.ac
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include/ndpi
|
||||
$(CP) $(PKG_BUILD_DIR)/src/include/*.h \
|
||||
$(1)/usr/include/ndpi/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/src/lib/libndpi.so* \
|
||||
$(1)/usr/lib/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||
$(CP) $(PKG_BUILD_DIR)/libndpi.pc \
|
||||
$(1)/usr/lib/pkgconfig/
|
||||
endef
|
||||
|
||||
define Package/libndpi/install
|
||||
$(INSTALL_DIR) $(1)/usr/lib/
|
||||
$(CP) $(PKG_BUILD_DIR)/src/lib/libndpi.so* \
|
||||
$(1)/usr/lib/
|
||||
$(INSTALL_DIR) $(1)/usr/bin/
|
||||
$(CP) $(PKG_BUILD_DIR)/example/ndpiReader \
|
||||
$(1)/usr/bin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,libndpi))
|
||||
@@ -1,32 +0,0 @@
|
||||
Howto Compile libndpi on OpenWRT
|
||||
-------------------------------
|
||||
|
||||
cd myopenwrt_directory
|
||||
mkdir package/network/services/libndpi
|
||||
cd package/network/services/libndpi
|
||||
|
||||
# (a) Stable version
|
||||
ln -s ~/nDPI/packages/openwrt/Makefile .
|
||||
|
||||
# (b) Dev version
|
||||
cp ~/nDPI/packages/openwrt/Makefile.dev Makefile
|
||||
|
||||
cd myopenwrt_directory
|
||||
make menuconfig
|
||||
|
||||
Go under libraries and select
|
||||
|
||||
<M> libndpi.............................. nDPI Deep Packet Inspection Library
|
||||
|
||||
|
||||
Build Commands
|
||||
--------------
|
||||
|
||||
If you want to build just libndpi do:
|
||||
make -j1 V=s package/network/services/libndpi/clean
|
||||
make -j1 V=s package/network/services/libndpi/compile
|
||||
|
||||
Other Documents
|
||||
---------------
|
||||
https://openwrt.org/packages/pkgdata/libndpi
|
||||
|
||||
Vendored
+2
-1600
File diff suppressed because it is too large
Load Diff
@@ -39,18 +39,10 @@ if test "$CENTOS_RELEASE" -ne 8; then
|
||||
RPM_SIGN_CMD="./rpm-sign.exp"
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([maxminddb], [MMDB_lookup_sockaddr])
|
||||
AC_HAVE_HEADERS(maxminddb.h)
|
||||
if test ".${ac_cv_lib_maxminddb_MMDB_lookup_sockaddr}" = ".yes" &&
|
||||
test ".${ac_cv_header_maxminddb_h}" = ".yes"; then
|
||||
GEOIP_DEP="libmaxminddb"
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([Makefile ndpi.spec])
|
||||
|
||||
AC_SUBST(PACKAGE_VERSION)
|
||||
AC_SUBST(PLATFORM)
|
||||
AC_SUBST(GEOIP_DEP)
|
||||
AC_SUBST(MACHINE)
|
||||
AC_SUBST(EXTN)
|
||||
AC_SUBST(DATE)
|
||||
|
||||
+17
-23
@@ -8,16 +8,12 @@ URL: http://www.ntop.org/products/deep-packet-inspection/ndpi/
|
||||
Source: ndpi-%{version}.tgz
|
||||
Packager: Luca Deri <deri@ntop.org>
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-root
|
||||
%{?el8:Requires: glibc >= 2.3.4 numactl coreutils @GEOIP_DEP@ }
|
||||
%{?el7:Requires: glibc >= 2.3.4 numactl coreutils @GEOIP_DEP@ }
|
||||
%{?el6:Requires: glibc >= 2.3.4 numactl coreutils @GEOIP_DEP@ }
|
||||
%{?el7:Requires: glibc >= 2.3.4 numactl coreutils }
|
||||
%{?el6:Requires: glibc >= 2.3.4 numactl coreutils }
|
||||
AutoReqProv: no
|
||||
|
||||
%define debug_package %{nil}
|
||||
|
||||
# Make sure .build-id is not part of the package
|
||||
%define _build_id_links none
|
||||
|
||||
%description
|
||||
nDPI Open and Extensible LGPLv3 Deep Packet Inspection Library.
|
||||
|
||||
@@ -47,11 +43,9 @@ you will need to install %{name}-dev.
|
||||
%build
|
||||
PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
|
||||
%define includedir /usr/include/ndpi
|
||||
%{?el6:%define libdir /usr/lib}
|
||||
%{?el7:%define libdir /usr/lib}
|
||||
%{?el8:%define libdir /usr/lib64}
|
||||
%define bindir /usr/bin
|
||||
%define includedir /usr/local/include/ndpi
|
||||
%define libdir /usr/local/lib
|
||||
%define bindir /usr/local/bin
|
||||
|
||||
%install
|
||||
PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
||||
@@ -62,13 +56,13 @@ mkdir -p $RPM_BUILD_ROOT%{includedir}
|
||||
mkdir -p $RPM_BUILD_ROOT%{libdir}
|
||||
mkdir -p $RPM_BUILD_ROOT%{bindir}
|
||||
cd $HOME/nDPI; make DESTDIR=$RPM_BUILD_ROOT install;
|
||||
rm $RPM_BUILD_ROOT/usr/lib/libndpi.so
|
||||
rm $RPM_BUILD_ROOT/usr/lib/libndpi.so.?
|
||||
cd $RPM_BUILD_ROOT/usr/lib/; ln -s libndpi.so.@PACKAGE_VERSION@ libndpi.so.@MAJOR_RELEASE@; cd -
|
||||
cd $RPM_BUILD_ROOT/usr/lib/; ln -s libndpi.so.@PACKAGE_VERSION@ libndpi.so; cd -
|
||||
rm $RPM_BUILD_ROOT%{libdir}/libndpi.so
|
||||
rm $RPM_BUILD_ROOT%{libdir}/libndpi.so.?
|
||||
cd $RPM_BUILD_ROOT%{libdir}/; ln -s libndpi.so.@PACKAGE_VERSION@ libndpi.so.@MAJOR_RELEASE@; cd -
|
||||
cd $RPM_BUILD_ROOT%{libdir}/; ln -s libndpi.so.@PACKAGE_VERSION@ libndpi.so; cd -
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
|
||||
cp $HOME/nDPI/packages/etc/ld.so.conf.d/ndpi.conf $RPM_BUILD_ROOT/etc/ld.so.conf.d
|
||||
rm -rf $RPM_BUILD_ROOT/usr/sbin/ndpi
|
||||
rm -rf $RPM_BUILD_ROOT/usr/local/sbin/ndpi
|
||||
strip $RPM_BUILD_ROOT%{bindir}/*
|
||||
rm -fr %{buildroot}%{includedir}/ndpi_win32.h
|
||||
#sed -i -e "s/#include \"ndpi_win32.h\"//g" %{buildroot}%{includedir}/ndpi_main.h
|
||||
@@ -79,12 +73,12 @@ rm -fr $RPM_BUILD_ROOT
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
|
||||
/usr/lib/libndpi.so
|
||||
/usr/lib/libndpi.so.@MAJOR_RELEASE@
|
||||
/usr/lib/libndpi.so.@PACKAGE_VERSION@
|
||||
/usr/bin/ndpiReader
|
||||
/usr/share/ndpi/ndpiCustomCategory.txt
|
||||
/usr/share/ndpi/ndpiProtos.txt
|
||||
/usr/local/lib/libndpi.so
|
||||
/usr/local/lib/libndpi.so.@MAJOR_RELEASE@
|
||||
/usr/local/lib/libndpi.so.@PACKAGE_VERSION@
|
||||
/usr/local/bin/ndpiReader
|
||||
/usr/local/share/ndpi/ndpiCustomCategory.txt
|
||||
/usr/local/share/ndpi/ndpiProtos.txt
|
||||
/etc/ld.so.conf.d/ndpi.conf
|
||||
%{libdir}/pkgconfig/libndpi.pc
|
||||
|
||||
@@ -94,7 +88,7 @@ rm -fr $RPM_BUILD_ROOT
|
||||
%defattr(-,root,root,-)
|
||||
|
||||
%{includedir}
|
||||
/usr/lib/libndpi.a
|
||||
%{libdir}/libndpi.a
|
||||
|
||||
%changelog
|
||||
* Mon Nov 19 2018 Alfredo Cardigliano <cardigliano@ntop.org> 2.5
|
||||
|
||||
+18
-14
@@ -1,19 +1,24 @@
|
||||
#
|
||||
# Change it according to your setup
|
||||
#
|
||||
NDPI_HOME=$(PWD)/../..
|
||||
NDPI_BUILD="$(realpath ${NDPI_HOME}/packages/ubuntu)"
|
||||
NDPI_BUILD=${NDPI_HOME}/packages/ubuntu
|
||||
|
||||
all: clean ndpi
|
||||
|
||||
ndpi:
|
||||
\rm -rf ./debian/ndpi-tmp ./debian/ndpi-dev-tmp ./debian/ndpi ./debian/ndpi-dev
|
||||
mkdir -p ./debian/ndpi-tmp ./debian/ndpi-dev-tmp
|
||||
mkdir -p ./debian/ndpi-tmp/usr/lib ./debian/ndpi-tmp/usr/bin
|
||||
mkdir -p ./debian/ndpi-dev-tmp/usr/lib ./debian/ndpi-dev-tmp/usr/include/ndpi
|
||||
mkdir -p ./debian/ndpi-tmp/usr/local/lib ./debian/ndpi-tmp/usr/local/bin
|
||||
mkdir -p ./debian/ndpi-dev-tmp/usr/local/lib ./debian/ndpi-dev-tmp/usr/local/include/ndpi
|
||||
cd ${NDPI_HOME}; ./autogen.sh; ./configure; make
|
||||
cp $(NDPI_HOME)/src/lib/libndpi.so.@NDPI_VERS@ ./debian/ndpi-tmp/usr/lib/
|
||||
cd ./debian/ndpi-tmp/usr/lib/; ln -s libndpi.so.@NDPI_VERS@ libndpi.so; cd -
|
||||
cd ./debian/ndpi-tmp/usr/lib/; ln -s libndpi.so.@NDPI_VERS@ libndpi.so.@MAJOR_RELEASE@; cd -
|
||||
cp $(NDPI_HOME)/src/lib/libndpi.a ./debian/ndpi-dev-tmp/usr/lib/
|
||||
cp $(NDPI_HOME)/example/ndpiReader ./debian/ndpi-tmp/usr/bin/
|
||||
cp $(NDPI_HOME)/src/include/*.h ./debian/ndpi-dev-tmp/usr/include/ndpi/
|
||||
-rm -fr ./debian/ndpi-dev-tmp/usr/include/ndpi/ndpi_win32.h*
|
||||
cp $(NDPI_HOME)/src/lib/libndpi.so.@NDPI_VERS@ ./debian/ndpi-tmp/usr/local/lib/
|
||||
cd ./debian/ndpi-tmp/usr/local/lib/; ln -s libndpi.so.@NDPI_VERS@ libndpi.so; cd -
|
||||
cd ./debian/ndpi-tmp/usr/local/lib/; ln -s libndpi.so.@NDPI_VERS@ libndpi.so.@MAJOR_RELEASE@; cd -
|
||||
cp $(NDPI_HOME)/src/lib/libndpi.a ./debian/ndpi-dev-tmp/usr/local/lib/
|
||||
cp $(NDPI_HOME)/example/ndpiReader ./debian/ndpi-tmp/usr/local/bin/
|
||||
cp $(NDPI_HOME)/src/include/*.h ./debian/ndpi-dev-tmp/usr/local/include/ndpi/
|
||||
-rm -fr ./debian/ndpi-dev-tmp/usr/local/include/ndpi/ndpi_win32.h*
|
||||
@echo
|
||||
@find ./debian/ndpi-tmp -name "*~" -exec /bin/rm {} ';'
|
||||
@find ./debian/ndpi-dev-tmp -name "*~" -exec /bin/rm {} ';'
|
||||
@@ -32,11 +37,10 @@ ndpi:
|
||||
@echo "-------------------------------"
|
||||
|
||||
distclean:
|
||||
-cd ${NDPI_HOME} && make distclean
|
||||
echo "dummy distclean"
|
||||
|
||||
install:
|
||||
cd ${NDPI_HOME}; make install DESTDIR="${NDPI_BUILD}/debian/tmp" AM_UPDATE_INFO_DIR=no
|
||||
echo "dummy install"
|
||||
|
||||
clean:
|
||||
-cd ${NDPI_HOME} && make clean
|
||||
-rm -rf *~ *deb ./usr ./debian/ndpi ./debian/ndpi-dev ./debian/ndpi ./debian/ndpi-dev
|
||||
-rm -rf *~ *deb ./usr ./debian/ndpi ./debian/ndpi-dev ./debian/ndpi-tmp ./debian/ndpi-dev-tmp
|
||||
|
||||
Vendored
+18
-1604
File diff suppressed because it is too large
Load Diff
@@ -24,21 +24,13 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
NDPI_VERS=`$(dirname "${0}")/../version.sh --release`
|
||||
MAJOR_RELEASE=`$(dirname "${0}")/../version.sh --major-release`
|
||||
GIT_REVISION=`$(dirname "${0}")/../version.sh --revision`
|
||||
|
||||
AC_CHECK_LIB([maxminddb], [MMDB_lookup_sockaddr])
|
||||
AC_HAVE_HEADERS(maxminddb.h)
|
||||
if test ".${ac_cv_lib_maxminddb_MMDB_lookup_sockaddr}" = ".yes" &&
|
||||
test ".${ac_cv_header_maxminddb_h}" = ".yes"; then
|
||||
GEOIP_DEP=", libmaxminddb0"
|
||||
fi
|
||||
NDPI_VERS=`../version.sh --release`
|
||||
MAJOR_RELEASE=`../version.sh --major-release`
|
||||
GIT_REVISION=`../version.sh --revision`
|
||||
|
||||
AC_CONFIG_FILES([Makefile debian/changelog debian/files debian/control])
|
||||
|
||||
AC_SUBST(NDPI_VERS)
|
||||
AC_SUBST(GEOIP_DEP)
|
||||
AC_SUBST(MACHINE)
|
||||
AC_SUBST(EXTN)
|
||||
AC_SUBST(DATE)
|
||||
|
||||
@@ -8,7 +8,7 @@ Build-Conflicts:
|
||||
|
||||
Package: ndpi
|
||||
Architecture: @EXTN@
|
||||
Depends: libnuma1 @GEOIP_DEP@
|
||||
Depends: libnuma1
|
||||
Recommends:
|
||||
Suggests:
|
||||
Pre-Depends:
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
CC=@CC@
|
||||
CFLAGS=-I. -I../src/include -I./src/lib/third_party/include @CFLAGS@ @CUSTOM_NDPI@ -shared
|
||||
CFLAGS=-I. -I../src/include -I./src/lib/third_party/include -shared -Wl,
|
||||
#LIBNDPI=../src/lib/libndpi.so.@NDPI_VERSION_SHORT@
|
||||
LIBNDPI=../src/lib/libndpi.a
|
||||
LDFLAGS=$(CFILE) $(LIBNDPI) -lpcap @LIBS@ @ADDITIONAL_LIBS@
|
||||
LDFLAGS=$(CFILE) $(LIBNDPI) -lpcap
|
||||
SHARE = -soname,ndpi_wrap
|
||||
SO=ndpi_wrap.so
|
||||
OBJS = ndpi_wrap.o
|
||||
@@ -19,7 +19,7 @@ endif
|
||||
all: $(SO)
|
||||
|
||||
$(SO): $(CFILE) $(LIBNDPI) Makefile
|
||||
$(CC) $(CFLAGS) -Wl,$(SHARE) -o $@ $(PIC) $(LDFLAGS)
|
||||
$(CC) $(CFLAGS)$(SHARE) -o $@ $(PIC) $(LDFLAGS)
|
||||
# ln -s $(LIBNDPI) .
|
||||
|
||||
clean:
|
||||
|
||||
+20
-19
@@ -1,25 +1,7 @@
|
||||
nDPI Python bindings
|
||||
--------------------
|
||||
|
||||
This directory contains the Python3 bindings for nDPI. We provide both cffi and ctypes based bindings.
|
||||
|
||||
**cffi bindings**
|
||||
|
||||
Files:
|
||||
|
||||
* ndpi.py
|
||||
|
||||
Example (using `nfstream <https://github.com/aouinizied/nfstream>`_ package):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install nfstream
|
||||
python3 flow_printer.py <interface>
|
||||
python3 flow_printer.py <pcap_file>
|
||||
|
||||
Code courtesy:
|
||||
|
||||
* Zied Aouini
|
||||
This directory contains the Python3 bindings for nDPI. We provide both ctypes and cffi based bindings.
|
||||
|
||||
**ctypes bindings**
|
||||
|
||||
@@ -41,3 +23,22 @@ Code courtesy:
|
||||
|
||||
* Massimo Puddu
|
||||
* Zied Aouini
|
||||
|
||||
**cffi bindings**
|
||||
|
||||
Files:
|
||||
|
||||
* ndpi.py
|
||||
|
||||
|
||||
Example (using NFStream package):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install nfstream
|
||||
python3 flow_printer.py <interface>
|
||||
python3 flow_printer.py <pcap_file>
|
||||
|
||||
Code courtesy:
|
||||
|
||||
* Zied Aouini
|
||||
+19
-18
@@ -2,37 +2,38 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
flow_printer.py
|
||||
Copyright (C) 2019-20 - NFStream Developers
|
||||
This file is part of NFStream, a Flexible Network Data Analysis Framework (https://www.nfstream.org/).
|
||||
NFStream 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.
|
||||
NFStream 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 NFStream.
|
||||
file: flow_printer.py
|
||||
This file is part of nfstream.
|
||||
|
||||
Copyright (C) 2019 - Zied Aouini <aouinizied@gmail.com>
|
||||
|
||||
nfstream is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
nfstream 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with nfstream.
|
||||
If not, see <http://www.gnu.org/licenses/>.
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
from nfstream import NFStreamer
|
||||
import sys
|
||||
|
||||
# Example must run with nfstream >= 6.1.1
|
||||
|
||||
path = sys.argv[1]
|
||||
flow_streamer = NFStreamer(source=path, statistical_analysis=False, performance_report=1)
|
||||
flow_streamer = NFStreamer(source=path)
|
||||
result = {}
|
||||
try:
|
||||
for flow in flow_streamer:
|
||||
print(flow)
|
||||
try:
|
||||
result[flow.application_name] += flow.bidirectional_packets
|
||||
result[flow.application_name] += flow.total_packets
|
||||
except KeyError:
|
||||
result[flow.application_name] = flow.bidirectional_packets
|
||||
print("\nSummary (Application Name: Packets):")
|
||||
result[flow.application_name] = flow.total_packets
|
||||
print("Summary (Application Name: Packets):")
|
||||
print(result)
|
||||
except KeyboardInterrupt:
|
||||
print("\nSummary (Application Name: Packets):")
|
||||
print("Summary (Application Name: Packets):")
|
||||
print(result)
|
||||
print("Terminated.")
|
||||
print("Terminated.")
|
||||
+761
-929
File diff suppressed because it is too large
Load Diff
@@ -94,10 +94,11 @@ class NDPIProtoDefaultsT(Structure):
|
||||
_fields_ = [
|
||||
("protoName", c_char_p),
|
||||
("protoCategory", c_uint),
|
||||
("subprotocols", c_uint16_p),
|
||||
("subprotocol_count", c_uint32),
|
||||
("can_have_a_subprotocol", c_uint8),
|
||||
("protoId", c_uint16),
|
||||
("protoIdx", c_uint16),
|
||||
("master_tcp_protoId", c_uint16 * 2),
|
||||
("master_udp_protoId", c_uint16 * 2),
|
||||
("protoBreed", c_uint),
|
||||
("func", CFUNCTYPE(None, POINTER(NDPIDetectionModuleStruct), POINTER(NDPIFlowStruct))),
|
||||
]
|
||||
@@ -426,7 +427,7 @@ class NDPIFlowUdpStruct(Structure):
|
||||
('snmp_stage', c_uint32, 2),
|
||||
('ppstream_stage', c_uint32, 3),
|
||||
('halflife2_stage', c_uint32, 2),
|
||||
('tftp_stage', c_uint32, 2),
|
||||
('tftp_stage', c_uint32, 1),
|
||||
('aimini_stage', c_uint32, 5),
|
||||
('xbox_stage', c_uint32, 1),
|
||||
('wsus_stage', c_uint32, 1),
|
||||
@@ -455,7 +456,6 @@ class Http(Structure):
|
||||
("num_response_headers", c_uint8),
|
||||
("request_version", c_uint8),
|
||||
("response_status_code", c_uint16),
|
||||
("detected_os", c_char * 32),
|
||||
]
|
||||
|
||||
|
||||
@@ -535,6 +535,7 @@ class Ubntac2(Structure):
|
||||
|
||||
class Http2(Structure):
|
||||
_fields_ = [
|
||||
("detected_os", c_char * 32),
|
||||
("nat_ip", c_char * 24)
|
||||
]
|
||||
|
||||
@@ -652,6 +653,7 @@ class NDPIUdpHdr(Structure):
|
||||
class NDPIPacketStructStack(Structure):
|
||||
_pack_ = 1
|
||||
_fields_ = [
|
||||
('detected_subprotocol_stack', c_uint8 * ndpi.ndpi_wrap_ndpi_procol_size()),
|
||||
('protocol_stack_info', c_uint16)
|
||||
]
|
||||
|
||||
@@ -859,4 +861,4 @@ ndpi.ndpi_set_protocol_detection_bitmask2.argtypes = [POINTER(NDPIDetectionModul
|
||||
ndpi.ndpi_twalk.argtypes = [c_void_p, CFUNCTYPE(None, c_void_p, c_int32, c_int, c_void_p), c_void_p]
|
||||
|
||||
""" ndpi_tdestroy: node destroy. """
|
||||
ndpi.ndpi_tdestroy.argtypes = [c_void_p, CFUNCTYPE(None, c_void_p)]
|
||||
ndpi.ndpi_tdestroy.argtypes = [c_void_p, CFUNCTYPE(None, c_void_p)]
|
||||
@@ -1,12 +0,0 @@
|
||||
sonar.projectKey=ntop_nDPI
|
||||
sonar.organization=ntop
|
||||
|
||||
# This is the name and version displayed in the SonarCloud UI.
|
||||
#sonar.projectName=nDPI
|
||||
#sonar.projectVersion=1.0
|
||||
|
||||
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
|
||||
#sonar.sources=.
|
||||
|
||||
# Encoding of the source code. Default is default system encoding
|
||||
#sonar.sourceEncoding=UTF-8
|
||||
@@ -0,0 +1,10 @@
|
||||
plibrary_includedir=$(includedir)/libndpi-@VERSION@/libndpi
|
||||
|
||||
library_include_HEADERS = ndpi_api.h \
|
||||
ndpi_define.h \
|
||||
ndpi_typedefs.h \
|
||||
ndpi_main.h \
|
||||
ndpi_protocol_ids.h \
|
||||
ndpi_protocols.h \
|
||||
ndpi_win32.h \
|
||||
ndpi_includes.h
|
||||
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -43,7 +43,7 @@
|
||||
#ifndef NDPI_CLASSIFY_H
|
||||
#define NDPI_CLASSIFY_H
|
||||
|
||||
#include "ndpi_includes.h"
|
||||
|
||||
|
||||
/* constants */
|
||||
#define NUM_PARAMETERS_SPLT_LOGREG 208
|
||||
@@ -66,27 +66,27 @@ extern float parameters_bd[NUM_PARAMETERS_BD_LOGREG];
|
||||
extern float parameters_splt[NUM_PARAMETERS_SPLT_LOGREG];
|
||||
|
||||
/* Classifier functions */
|
||||
float ndpi_classify(const unsigned short *pkt_len, const pkt_timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
float ndpi_classify(const unsigned short *pkt_len, const struct timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
|
||||
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t);
|
||||
|
||||
void ndpi_merge_splt_arrays(const uint16_t *pkt_len, const pkt_timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin,
|
||||
void ndpi_merge_splt_arrays(const uint16_t *pkt_len, const struct timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin,
|
||||
uint16_t s_idx, uint16_t r_idx,
|
||||
uint16_t *merged_lens, uint16_t *merged_times);
|
||||
|
||||
void ndpi_update_params(classifier_type_codes_t param_type, const char *param_file);
|
||||
|
||||
void ndpi_flow_info_freer(void *node);
|
||||
unsigned int ndpi_timer_eq(const pkt_timeval *a, const pkt_timeval *b);
|
||||
unsigned int ndpi_timer_lt(const pkt_timeval *a, const pkt_timeval *b);
|
||||
void ndpi_timer_sub(const pkt_timeval *a, const pkt_timeval *b, pkt_timeval *result);
|
||||
void ndpi_timer_clear(pkt_timeval *a);
|
||||
unsigned int ndpi_timeval_to_milliseconds(pkt_timeval ts);
|
||||
unsigned int ndpi_timeval_to_microseconds(pkt_timeval ts);
|
||||
unsigned int ndpi_timer_eq(const struct timeval *a, const struct timeval *b);
|
||||
unsigned int ndpi_timer_lt(const struct timeval *a, const struct timeval *b);
|
||||
void ndpi_timer_sub(const struct timeval *a, const struct timeval *b, struct timeval *result);
|
||||
void ndpi_timer_clear(struct timeval *a);
|
||||
unsigned int ndpi_timeval_to_milliseconds(struct timeval ts);
|
||||
unsigned int ndpi_timeval_to_microseconds(struct timeval ts);
|
||||
void ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len);
|
||||
|
||||
#endif /* NDPI_CLASSIFY_H */
|
||||
|
||||
@@ -35,9 +35,7 @@
|
||||
#include <endian.h>
|
||||
#define __BYTE_ORDER BYTE_ORDER
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__
|
||||
#endif /* __LITTLE_ENDIAN__ */
|
||||
#else
|
||||
#define __BIG_ENDIAN__
|
||||
#endif/* BYTE_ORDER */
|
||||
@@ -181,11 +179,6 @@
|
||||
#define NDPI_JABBER_FT_TIMEOUT 5
|
||||
#define NDPI_SOULSEEK_CONNECTION_IP_TICK_TIMEOUT 600
|
||||
|
||||
#ifndef _NDPI_CONFIG_H_
|
||||
#include "ndpi_config.h" /* To have access to NDPI_ENABLE_DEBUG_MESSAGES */
|
||||
#define _NDPI_CONFIG_H_
|
||||
#endif
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
#define NDPI_LOG(proto, m, log_level, args...) \
|
||||
{ \
|
||||
@@ -194,7 +187,7 @@
|
||||
(*(mod->ndpi_debug_printf))(proto, mod, log_level, __FILE__, __FUNCTION__, __LINE__, args); \
|
||||
}
|
||||
|
||||
/* We must define NDPI_CURRENT_PROTO before include ndpi_main.h !!!
|
||||
/* We must define NDPI_CURRENT_PROTO before include ndpi_main.h !!!
|
||||
*
|
||||
* #include "ndpi_protocol_ids.h"
|
||||
* #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_XXXX
|
||||
@@ -203,7 +196,7 @@
|
||||
*/
|
||||
|
||||
#ifndef NDPI_CURRENT_PROTO
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_UNKNOWN
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTO_UNKNOWN
|
||||
#endif
|
||||
|
||||
#define NDPI_LOG_ERR(mod, args...) \
|
||||
@@ -260,7 +253,6 @@
|
||||
((x.u6_addr.u6_addr64[0] < y.u6_addr.u6_addr64[0]) || ((x.u6_addr.u6_addr64[0] == y.u6_addr.u6_addr64[0]) && (x.u6_addr.u6_addr64[1] < y.u6_addr.u6_addr64[1])))
|
||||
|
||||
#define NDPI_NUM_BITS 512
|
||||
#define NDPI_NUM_BITS_MASK (512-1)
|
||||
|
||||
#define NDPI_BITS /* 32 */ (sizeof(ndpi_ndpi_mask) * 8 /* number of bits in a byte */) /* bits per mask */
|
||||
#define howmanybits(x, y) (((x)+((y)-1))/(y))
|
||||
@@ -282,18 +274,12 @@
|
||||
#define NDPI_BITMASK_SET_ALL(a) NDPI_ONE(&a)
|
||||
#define NDPI_BITMASK_SET(a, b) { memcpy(&a, &b, sizeof(NDPI_PROTOCOL_BITMASK)); }
|
||||
|
||||
#define NDPI_SET_BIT(num, n) num |= 1ULL << ( n )
|
||||
#define NDPI_CLR_BIT(num, n) num &= ~(1ULL << ( n ))
|
||||
#define NDPI_CLR_BIT(num, n) num &= ~(1ULL << ( n ))
|
||||
#define NDPI_ISSET_BIT(num, n) (num & (1ULL << ( n )))
|
||||
#define NDPI_ZERO_BIT(num) num = 0
|
||||
|
||||
/* this is a very very tricky macro *g*,
|
||||
* the compiler will remove all shifts here if the protocol is static...
|
||||
*/
|
||||
#define NDPI_ADD_PROTOCOL_TO_BITMASK(bmask,value) NDPI_SET(&bmask, value & NDPI_NUM_BITS_MASK)
|
||||
#define NDPI_DEL_PROTOCOL_FROM_BITMASK(bmask,value) NDPI_CLR(&bmask, value & NDPI_NUM_BITS_MASK)
|
||||
#define NDPI_COMPARE_PROTOCOL_TO_BITMASK(bmask,value) NDPI_ISSET(&bmask, value & NDPI_NUM_BITS_MASK)
|
||||
#define NDPI_ADD_PROTOCOL_TO_BITMASK(bmask,value) NDPI_SET(&bmask,value)
|
||||
#define NDPI_DEL_PROTOCOL_FROM_BITMASK(bmask,value) NDPI_CLR(&bmask,value)
|
||||
#define NDPI_COMPARE_PROTOCOL_TO_BITMASK(bmask,value) NDPI_ISSET(&bmask,value)
|
||||
|
||||
#define NDPI_SAVE_AS_BITMASK(bmask,value) { NDPI_ZERO(&bmask) ; NDPI_ADD_PROTOCOL_TO_BITMASK(bmask, value); }
|
||||
|
||||
@@ -318,10 +304,10 @@
|
||||
#define NDPI_ICMPV6_PROTOCOL_TYPE 0x3a
|
||||
|
||||
/* the get_uXX will return raw network packet bytes !! */
|
||||
#define get_u_int8_t(X,O) (*(u_int8_t *)((&(((u_int8_t *)X)[O]))))
|
||||
#define get_u_int16_t(X,O) (*(u_int16_t *)((&(((u_int8_t *)X)[O]))))
|
||||
#define get_u_int32_t(X,O) (*(u_int32_t *)((&(((u_int8_t *)X)[O]))))
|
||||
#define get_u_int64_t(X,O) (*(u_int64_t *)((&(((u_int8_t *)X)[O]))))
|
||||
#define get_u_int8_t(X,O) (*(u_int8_t *)(((u_int8_t *)X) + O))
|
||||
#define get_u_int16_t(X,O) (*(u_int16_t *)(((u_int8_t *)X) + O))
|
||||
#define get_u_int32_t(X,O) (*(u_int32_t *)(((u_int8_t *)X) + O))
|
||||
#define get_u_int64_t(X,O) (*(u_int64_t *)(((u_int8_t *)X) + O))
|
||||
|
||||
/* new definitions to get little endian from network bytes */
|
||||
#define get_ul8(X,O) get_u_int8_t(X,O)
|
||||
@@ -342,7 +328,7 @@
|
||||
#define match_first_bytes(payload,st) (memcmp((payload),(st),(sizeof(st)-1))==0)
|
||||
|
||||
#if defined(WIN32) && !defined(snprintf)
|
||||
#define snprintf _snprintf
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#define NDPI_MAX_DNS_REQUESTS 16
|
||||
@@ -357,10 +343,6 @@
|
||||
#define NDPI_CIPHER_WEAK 1
|
||||
#define NDPI_CIPHER_INSECURE 2
|
||||
|
||||
#define NDPI_OPTIMAL_HLL_NUM_BUCKETS 16
|
||||
|
||||
#define NDPI_MAX_NUM_TLS_APPL_BLOCKS 8
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <libkern/OSByteOrder.h>
|
||||
|
||||
@@ -1,408 +0,0 @@
|
||||
/*
|
||||
* ndpi_encryption.h
|
||||
*
|
||||
* Copyright (C) 2016-21 - 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/* https://wiki.mozilla.org/Security/Cipher_Suites */
|
||||
/* https://www.oryx-embedded.com/doc/tls__cipher__suites_8h.html */
|
||||
|
||||
#define TLS_NULL_WITH_NULL_NULL 0x0000
|
||||
#define TLS_RSA_EXPORT_WITH_RC4_40_MD5 0x0003
|
||||
#define TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 0x0006
|
||||
#define TLS_RSA_EXPORT_WITH_DES40_CBC_SHA 0x0008
|
||||
#define TLS_RSA_WITH_NULL_MD5 0x0001
|
||||
#define TLS_RSA_WITH_NULL_SHA 0x0002
|
||||
#define TLS_RSA_WITH_NULL_SHA256 0x003B
|
||||
#define TLS_RSA_WITH_RC4_128_MD5 0x0004
|
||||
#define TLS_RSA_WITH_RC4_128_SHA 0x0005
|
||||
#define TLS_RSA_WITH_IDEA_CBC_SHA 0x0007
|
||||
#define TLS_RSA_WITH_DES_CBC_SHA 0x0009
|
||||
#define TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x000A
|
||||
#define TLS_RSA_WITH_AES_128_CBC_SHA 0x002F
|
||||
#define TLS_RSA_WITH_AES_256_CBC_SHA 0x0035
|
||||
#define TLS_RSA_WITH_AES_128_CBC_SHA256 0x003C
|
||||
#define TLS_RSA_WITH_AES_256_CBC_SHA256 0x003D
|
||||
#define TLS_RSA_WITH_AES_128_GCM_SHA256 0x009C
|
||||
#define TLS_RSA_WITH_AES_256_GCM_SHA384 0x009D
|
||||
#define TLS_RSA_WITH_AES_128_CCM 0xC09C
|
||||
#define TLS_RSA_WITH_AES_256_CCM 0xC09D
|
||||
#define TLS_RSA_WITH_AES_128_CCM_8 0xC0A0
|
||||
#define TLS_RSA_WITH_AES_256_CCM_8 0xC0A1
|
||||
#define TLS_RSA_WITH_CAMELLIA_128_CBC_SHA 0x0041
|
||||
#define TLS_RSA_WITH_CAMELLIA_256_CBC_SHA 0x0084
|
||||
#define TLS_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x00BA
|
||||
#define TLS_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x00C0
|
||||
#define TLS_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07A
|
||||
#define TLS_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07B
|
||||
#define TLS_RSA_WITH_SEED_CBC_SHA 0x0096
|
||||
#define TLS_RSA_WITH_ARIA_128_CBC_SHA256 0xC03C
|
||||
#define TLS_RSA_WITH_ARIA_256_CBC_SHA384 0xC03D
|
||||
#define TLS_RSA_WITH_ARIA_128_GCM_SHA256 0xC050
|
||||
#define TLS_RSA_WITH_ARIA_256_GCM_SHA384 0xC051
|
||||
#define TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA 0x000E
|
||||
#define TLS_DH_RSA_WITH_DES_CBC_SHA 0x000F
|
||||
#define TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA 0x0010
|
||||
#define TLS_DH_RSA_WITH_AES_128_CBC_SHA 0x0031
|
||||
#define TLS_DH_RSA_WITH_AES_256_CBC_SHA 0x0037
|
||||
#define TLS_DH_RSA_WITH_AES_128_CBC_SHA256 0x003F
|
||||
#define TLS_DH_RSA_WITH_AES_256_CBC_SHA256 0x0069
|
||||
#define TLS_DH_RSA_WITH_AES_128_GCM_SHA256 0x00A0
|
||||
#define TLS_DH_RSA_WITH_AES_256_GCM_SHA384 0x00A1
|
||||
#define TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA 0x0043
|
||||
#define TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA 0x0086
|
||||
#define TLS_DH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x00BC
|
||||
#define TLS_DH_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x00C2
|
||||
#define TLS_DH_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07E
|
||||
#define TLS_DH_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07F
|
||||
#define TLS_DH_RSA_WITH_SEED_CBC_SHA 0x0098
|
||||
#define TLS_DH_RSA_WITH_ARIA_128_CBC_SHA256 0xC040
|
||||
#define TLS_DH_RSA_WITH_ARIA_256_CBC_SHA384 0xC041
|
||||
#define TLS_DH_RSA_WITH_ARIA_128_GCM_SHA256 0xC054
|
||||
#define TLS_DH_RSA_WITH_ARIA_256_GCM_SHA384 0xC055
|
||||
#define TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA 0x0014
|
||||
#define TLS_DHE_RSA_WITH_DES_CBC_SHA 0x0015
|
||||
#define TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 0x0016
|
||||
#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x0033
|
||||
#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x0039
|
||||
#define TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x0067
|
||||
#define TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x006B
|
||||
#define TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x009E
|
||||
#define TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x009F
|
||||
#define TLS_DHE_RSA_WITH_AES_128_CCM 0xC09E
|
||||
#define TLS_DHE_RSA_WITH_AES_256_CCM 0xC09F
|
||||
#define TLS_DHE_RSA_WITH_AES_128_CCM_8 0xC0A2
|
||||
#define TLS_DHE_RSA_WITH_AES_256_CCM_8 0xC0A3
|
||||
#define TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA 0x0045
|
||||
#define TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA 0x0088
|
||||
#define TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0x00BE
|
||||
#define TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 0x00C4
|
||||
#define TLS_DHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC07C
|
||||
#define TLS_DHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC07D
|
||||
#define TLS_DHE_RSA_WITH_SEED_CBC_SHA 0x009A
|
||||
#define TLS_DHE_RSA_WITH_ARIA_128_CBC_SHA256 0xC044
|
||||
#define TLS_DHE_RSA_WITH_ARIA_256_CBC_SHA384 0xC045
|
||||
#define TLS_DHE_RSA_WITH_ARIA_128_GCM_SHA256 0xC052
|
||||
#define TLS_DHE_RSA_WITH_ARIA_256_GCM_SHA384 0xC053
|
||||
#define TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCAA
|
||||
#define TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA 0x000B
|
||||
#define TLS_DH_DSS_WITH_DES_CBC_SHA 0x000C
|
||||
#define TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA 0x000D
|
||||
#define TLS_DH_DSS_WITH_AES_128_CBC_SHA 0x0030
|
||||
#define TLS_DH_DSS_WITH_AES_256_CBC_SHA 0x0036
|
||||
#define TLS_DH_DSS_WITH_AES_128_CBC_SHA256 0x003E
|
||||
#define TLS_DH_DSS_WITH_AES_256_CBC_SHA256 0x0068
|
||||
#define TLS_DH_DSS_WITH_AES_128_GCM_SHA256 0x00A4
|
||||
#define TLS_DH_DSS_WITH_AES_256_GCM_SHA384 0x00A5
|
||||
#define TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA 0x0042
|
||||
#define TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA 0x0085
|
||||
#define TLS_DH_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x00BB
|
||||
#define TLS_DH_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x00C1
|
||||
#define TLS_DH_DSS_WITH_CAMELLIA_128_GCM_SHA256 0xC082
|
||||
#define TLS_DH_DSS_WITH_CAMELLIA_256_GCM_SHA384 0xC083
|
||||
#define TLS_DH_DSS_WITH_SEED_CBC_SHA 0x0097
|
||||
#define TLS_DH_DSS_WITH_ARIA_128_CBC_SHA256 0xC03E
|
||||
#define TLS_DH_DSS_WITH_ARIA_256_CBC_SHA384 0xC03F
|
||||
#define TLS_DH_DSS_WITH_ARIA_128_GCM_SHA256 0xC058
|
||||
#define TLS_DH_DSS_WITH_ARIA_256_GCM_SHA384 0xC059
|
||||
#define TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA 0x0011
|
||||
#define TLS_DHE_DSS_WITH_DES_CBC_SHA 0x0012
|
||||
#define TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA 0x0013
|
||||
#define TLS_DHE_DSS_WITH_AES_128_CBC_SHA 0x0032
|
||||
#define TLS_DHE_DSS_WITH_AES_256_CBC_SHA 0x0038
|
||||
#define TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 0x0040
|
||||
#define TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 0x006A
|
||||
#define TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 0x00A2
|
||||
#define TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 0x00A3
|
||||
#define TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA 0x0044
|
||||
#define TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA 0x0087
|
||||
#define TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA256 0x00BD
|
||||
#define TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA256 0x00C3
|
||||
#define TLS_DHE_DSS_WITH_CAMELLIA_128_GCM_SHA256 0xC080
|
||||
#define TLS_DHE_DSS_WITH_CAMELLIA_256_GCM_SHA384 0xC081
|
||||
#define TLS_DHE_DSS_WITH_SEED_CBC_SHA 0x0099
|
||||
#define TLS_DHE_DSS_WITH_ARIA_128_CBC_SHA256 0xC042
|
||||
#define TLS_DHE_DSS_WITH_ARIA_256_CBC_SHA384 0xC043
|
||||
#define TLS_DHE_DSS_WITH_ARIA_128_GCM_SHA256 0xC056
|
||||
#define TLS_DHE_DSS_WITH_ARIA_256_GCM_SHA384 0xC057
|
||||
#define TLS_DH_ANON_EXPORT_WITH_RC4_40_MD5 0x0017
|
||||
#define TLS_DH_ANON_EXPORT_WITH_DES40_CBC_SHA 0x0019
|
||||
#define TLS_DH_ANON_WITH_RC4_128_MD5 0x0018
|
||||
#define TLS_DH_ANON_WITH_DES_CBC_SHA 0x001A
|
||||
#define TLS_DH_ANON_WITH_3DES_EDE_CBC_SHA 0x001B
|
||||
#define TLS_DH_ANON_WITH_AES_128_CBC_SHA 0x0034
|
||||
#define TLS_DH_ANON_WITH_AES_256_CBC_SHA 0x003A
|
||||
#define TLS_DH_ANON_WITH_AES_128_CBC_SHA256 0x006C
|
||||
#define TLS_DH_ANON_WITH_AES_256_CBC_SHA256 0x006D
|
||||
#define TLS_DH_ANON_WITH_AES_128_GCM_SHA256 0x00A6
|
||||
#define TLS_DH_ANON_WITH_AES_256_GCM_SHA384 0x00A7
|
||||
#define TLS_DH_ANON_WITH_CAMELLIA_128_CBC_SHA 0x0046
|
||||
#define TLS_DH_ANON_WITH_CAMELLIA_256_CBC_SHA 0x0089
|
||||
#define TLS_DH_ANON_WITH_CAMELLIA_128_CBC_SHA256 0x00BF
|
||||
#define TLS_DH_ANON_WITH_CAMELLIA_256_CBC_SHA256 0x00C5
|
||||
#define TLS_DH_ANON_WITH_CAMELLIA_128_GCM_SHA256 0xC084
|
||||
#define TLS_DH_ANON_WITH_CAMELLIA_256_GCM_SHA384 0xC085
|
||||
#define TLS_DH_ANON_WITH_SEED_CBC_SHA 0x009B
|
||||
#define TLS_DH_ANON_WITH_ARIA_128_CBC_SHA256 0xC046
|
||||
#define TLS_DH_ANON_WITH_ARIA_256_CBC_SHA384 0xC047
|
||||
#define TLS_DH_ANON_WITH_ARIA_128_GCM_SHA256 0xC05A
|
||||
#define TLS_DH_ANON_WITH_ARIA_256_GCM_SHA384 0xC05B
|
||||
#define TLS_ECDH_RSA_WITH_NULL_SHA 0xC00B
|
||||
#define TLS_ECDH_RSA_WITH_RC4_128_SHA 0xC00C
|
||||
#define TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA 0xC00D
|
||||
#define TLS_ECDH_RSA_WITH_AES_128_CBC_SHA 0xC00E
|
||||
#define TLS_ECDH_RSA_WITH_AES_256_CBC_SHA 0xC00F
|
||||
#define TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 0xC029
|
||||
#define TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 0xC02A
|
||||
#define TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 0xC031
|
||||
#define TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 0xC032
|
||||
#define TLS_ECDH_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC078
|
||||
#define TLS_ECDH_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC079
|
||||
#define TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC08C
|
||||
#define TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC08D
|
||||
#define TLS_ECDH_RSA_WITH_ARIA_128_CBC_SHA256 0xC04E
|
||||
#define TLS_ECDH_RSA_WITH_ARIA_256_CBC_SHA384 0xC04F
|
||||
#define TLS_ECDH_RSA_WITH_ARIA_128_GCM_SHA256 0xC062
|
||||
#define TLS_ECDH_RSA_WITH_ARIA_256_GCM_SHA384 0xC063
|
||||
#define TLS_ECDHE_RSA_WITH_NULL_SHA 0xC010
|
||||
#define TLS_ECDHE_RSA_WITH_RC4_128_SHA 0xC011
|
||||
#define TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 0xC012
|
||||
#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013
|
||||
#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014
|
||||
#define TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xC027
|
||||
#define TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xC028
|
||||
#define TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F
|
||||
#define TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xC030
|
||||
#define TLS_ECDHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 0xC076
|
||||
#define TLS_ECDHE_RSA_WITH_CAMELLIA_256_CBC_SHA384 0xC077
|
||||
#define TLS_ECDHE_RSA_WITH_CAMELLIA_128_GCM_SHA256 0xC08A
|
||||
#define TLS_ECDHE_RSA_WITH_CAMELLIA_256_GCM_SHA384 0xC08B
|
||||
#define TLS_ECDHE_RSA_WITH_ARIA_128_CBC_SHA256 0xC04C
|
||||
#define TLS_ECDHE_RSA_WITH_ARIA_256_CBC_SHA384 0xC04D
|
||||
#define TLS_ECDHE_RSA_WITH_ARIA_128_GCM_SHA256 0xC060
|
||||
#define TLS_ECDHE_RSA_WITH_ARIA_256_GCM_SHA384 0xC061
|
||||
#define TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA8
|
||||
#define TLS_ECDH_ECDSA_WITH_NULL_SHA 0xC001
|
||||
#define TLS_ECDH_ECDSA_WITH_RC4_128_SHA 0xC002
|
||||
#define TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC003
|
||||
#define TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0xC004
|
||||
#define TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0xC005
|
||||
#define TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 0xC025
|
||||
#define TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 0xC026
|
||||
#define TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0xC02D
|
||||
#define TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0xC02E
|
||||
#define TLS_ECDH_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC074
|
||||
#define TLS_ECDH_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC075
|
||||
#define TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC088
|
||||
#define TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC089
|
||||
#define TLS_ECDH_ECDSA_WITH_ARIA_128_CBC_SHA256 0xC04A
|
||||
#define TLS_ECDH_ECDSA_WITH_ARIA_256_CBC_SHA384 0xC04B
|
||||
#define TLS_ECDH_ECDSA_WITH_ARIA_128_GCM_SHA256 0xC05E
|
||||
#define TLS_ECDH_ECDSA_WITH_ARIA_256_GCM_SHA384 0xC05F
|
||||
#define TLS_ECDHE_ECDSA_WITH_NULL_SHA 0xC006
|
||||
#define TLS_ECDHE_ECDSA_WITH_RC4_128_SHA 0xC007
|
||||
#define TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC008
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xC009
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xC00A
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xC023
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 0xC024
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xC02B
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0xC02C
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_128_CCM 0xC0AC
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_256_CCM 0xC0AD
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 0xC0AE
|
||||
#define TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 0xC0AF
|
||||
#define TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_CBC_SHA256 0xC072
|
||||
#define TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_CBC_SHA384 0xC073
|
||||
#define TLS_ECDHE_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 0xC086
|
||||
#define TLS_ECDHE_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 0xC087
|
||||
#define TLS_ECDHE_ECDSA_WITH_ARIA_128_CBC_SHA256 0xC048
|
||||
#define TLS_ECDHE_ECDSA_WITH_ARIA_256_CBC_SHA384 0xC049
|
||||
#define TLS_ECDHE_ECDSA_WITH_ARIA_128_GCM_SHA256 0xC05C
|
||||
#define TLS_ECDHE_ECDSA_WITH_ARIA_256_GCM_SHA384 0xC05D
|
||||
#define TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA9
|
||||
#define TLS_ECDH_ANON_WITH_NULL_SHA 0xC015
|
||||
#define TLS_ECDH_ANON_WITH_RC4_128_SHA 0xC016
|
||||
#define TLS_ECDH_ANON_WITH_3DES_EDE_CBC_SHA 0xC017
|
||||
#define TLS_ECDH_ANON_WITH_AES_128_CBC_SHA 0xC018
|
||||
#define TLS_ECDH_ANON_WITH_AES_256_CBC_SHA 0xC019
|
||||
#define TLS_PSK_WITH_NULL_SHA 0x002C
|
||||
#define TLS_PSK_WITH_NULL_SHA256 0x00B0
|
||||
#define TLS_PSK_WITH_NULL_SHA384 0x00B1
|
||||
#define TLS_PSK_WITH_RC4_128_SHA 0x008A
|
||||
#define TLS_PSK_WITH_3DES_EDE_CBC_SHA 0x008B
|
||||
#define TLS_PSK_WITH_AES_128_CBC_SHA 0x008C
|
||||
#define TLS_PSK_WITH_AES_256_CBC_SHA 0x008D
|
||||
#define TLS_PSK_WITH_AES_128_CBC_SHA256 0x00AE
|
||||
#define TLS_PSK_WITH_AES_256_CBC_SHA384 0x00AF
|
||||
#define TLS_PSK_WITH_AES_128_GCM_SHA256 0x00A8
|
||||
#define TLS_PSK_WITH_AES_256_GCM_SHA384 0x00A9
|
||||
#define TLS_PSK_WITH_AES_128_CCM 0xC0A4
|
||||
#define TLS_PSK_WITH_AES_256_CCM 0xC0A5
|
||||
#define TLS_PSK_WITH_AES_128_CCM_8 0xC0A8
|
||||
#define TLS_PSK_WITH_AES_256_CCM_8 0xC0A9
|
||||
#define TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC094
|
||||
#define TLS_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC095
|
||||
#define TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC08E
|
||||
#define TLS_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC08F
|
||||
#define TLS_PSK_WITH_ARIA_128_CBC_SHA256 0xC064
|
||||
#define TLS_PSK_WITH_ARIA_256_CBC_SHA384 0xC065
|
||||
#define TLS_PSK_WITH_ARIA_128_GCM_SHA256 0xC06A
|
||||
#define TLS_PSK_WITH_ARIA_256_GCM_SHA384 0xC06B
|
||||
#define TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAB
|
||||
#define TLS_RSA_PSK_WITH_NULL_SHA 0x002E
|
||||
#define TLS_RSA_PSK_WITH_NULL_SHA256 0x00B8
|
||||
#define TLS_RSA_PSK_WITH_NULL_SHA384 0x00B9
|
||||
#define TLS_RSA_PSK_WITH_RC4_128_SHA 0x0092
|
||||
#define TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA 0x0093
|
||||
#define TLS_RSA_PSK_WITH_AES_128_CBC_SHA 0x0094
|
||||
#define TLS_RSA_PSK_WITH_AES_256_CBC_SHA 0x0095
|
||||
#define TLS_RSA_PSK_WITH_AES_128_CBC_SHA256 0x00B6
|
||||
#define TLS_RSA_PSK_WITH_AES_256_CBC_SHA384 0x00B7
|
||||
#define TLS_RSA_PSK_WITH_AES_128_GCM_SHA256 0x00AC
|
||||
#define TLS_RSA_PSK_WITH_AES_256_GCM_SHA384 0x00AD
|
||||
#define TLS_RSA_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC098
|
||||
#define TLS_RSA_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC099
|
||||
#define TLS_RSA_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC092
|
||||
#define TLS_RSA_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC093
|
||||
#define TLS_RSA_PSK_WITH_ARIA_128_CBC_SHA256 0xC068
|
||||
#define TLS_RSA_PSK_WITH_ARIA_256_CBC_SHA384 0xC069
|
||||
#define TLS_RSA_PSK_WITH_ARIA_128_GCM_SHA256 0xC06E
|
||||
#define TLS_RSA_PSK_WITH_ARIA_256_GCM_SHA384 0xC06F
|
||||
#define TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAE
|
||||
#define TLS_DHE_PSK_WITH_NULL_SHA 0x002D
|
||||
#define TLS_DHE_PSK_WITH_NULL_SHA256 0x00B4
|
||||
#define TLS_DHE_PSK_WITH_NULL_SHA384 0x00B5
|
||||
#define TLS_DHE_PSK_WITH_RC4_128_SHA 0x008E
|
||||
#define TLS_DHE_PSK_WITH_3DES_EDE_CBC_SHA 0x008F
|
||||
#define TLS_DHE_PSK_WITH_AES_128_CBC_SHA 0x0090
|
||||
#define TLS_DHE_PSK_WITH_AES_256_CBC_SHA 0x0091
|
||||
#define TLS_DHE_PSK_WITH_AES_128_CBC_SHA256 0x00B2
|
||||
#define TLS_DHE_PSK_WITH_AES_256_CBC_SHA384 0x00B3
|
||||
#define TLS_DHE_PSK_WITH_AES_128_GCM_SHA256 0x00AA
|
||||
#define TLS_DHE_PSK_WITH_AES_256_GCM_SHA384 0x00AB
|
||||
#define TLS_DHE_PSK_WITH_AES_128_CCM 0xC0A6
|
||||
#define TLS_DHE_PSK_WITH_AES_256_CCM 0xC0A7
|
||||
#define TLS_DHE_PSK_WITH_AES_128_CCM_8 0xC0AA
|
||||
#define TLS_DHE_PSK_WITH_AES_256_CCM_8 0xC0AB
|
||||
#define TLS_DHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC096
|
||||
#define TLS_DHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC097
|
||||
#define TLS_DHE_PSK_WITH_CAMELLIA_128_GCM_SHA256 0xC090
|
||||
#define TLS_DHE_PSK_WITH_CAMELLIA_256_GCM_SHA384 0xC091
|
||||
#define TLS_DHE_PSK_WITH_ARIA_128_CBC_SHA256 0xC066
|
||||
#define TLS_DHE_PSK_WITH_ARIA_256_CBC_SHA384 0xC067
|
||||
#define TLS_DHE_PSK_WITH_ARIA_128_GCM_SHA256 0xC06C
|
||||
#define TLS_DHE_PSK_WITH_ARIA_256_GCM_SHA384 0xC06D
|
||||
#define TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAD
|
||||
#define TLS_ECDHE_PSK_WITH_NULL_SHA 0xC039
|
||||
#define TLS_ECDHE_PSK_WITH_NULL_SHA256 0xC03A
|
||||
#define TLS_ECDHE_PSK_WITH_NULL_SHA384 0xC03B
|
||||
#define TLS_ECDHE_PSK_WITH_RC4_128_SHA 0xC033
|
||||
#define TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA 0xC034
|
||||
#define TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA 0xC035
|
||||
#define TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA 0xC036
|
||||
#define TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256 0xC037
|
||||
#define TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384 0xC038
|
||||
#define TLS_ECDHE_PSK_WITH_AES_128_GCM_SHA256 0xD001
|
||||
#define TLS_ECDHE_PSK_WITH_AES_256_GCM_SHA384 0xD002
|
||||
#define TLS_ECDHE_PSK_WITH_AES_128_CCM_SHA256 0xD005
|
||||
#define TLS_ECDHE_PSK_WITH_AES_128_CCM_8_SHA256 0xD003
|
||||
#define TLS_ECDHE_PSK_WITH_CAMELLIA_128_CBC_SHA256 0xC09A
|
||||
#define TLS_ECDHE_PSK_WITH_CAMELLIA_256_CBC_SHA384 0xC09B
|
||||
#define TLS_ECDHE_PSK_WITH_ARIA_128_CBC_SHA256 0xC070
|
||||
#define TLS_ECDHE_PSK_WITH_ARIA_256_CBC_SHA384 0xC071
|
||||
#define TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAC
|
||||
#define TLS_KRB5_EXPORT_WITH_RC4_40_MD5 0x002B
|
||||
#define TLS_KRB5_EXPORT_WITH_RC4_40_SHA 0x0028
|
||||
#define TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5 0x002A
|
||||
#define TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA 0x0027
|
||||
#define TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5 0x0029
|
||||
#define TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA 0x0026
|
||||
#define TLS_KRB5_WITH_RC4_128_MD5 0x0024
|
||||
#define TLS_KRB5_WITH_RC4_128_SHA 0x0020
|
||||
#define TLS_KRB5_WITH_IDEA_CBC_MD5 0x0025
|
||||
#define TLS_KRB5_WITH_IDEA_CBC_SHA 0x0021
|
||||
#define TLS_KRB5_WITH_DES_CBC_MD5 0x0022
|
||||
#define TLS_KRB5_WITH_DES_CBC_SHA 0x001E
|
||||
#define TLS_KRB5_WITH_3DES_EDE_CBC_MD5 0x0023
|
||||
#define TLS_KRB5_WITH_3DES_EDE_CBC_SHA 0x001F
|
||||
#define TLS_SRP_SHA_WITH_3DES_EDE_CBC_SHA 0xC01A
|
||||
#define TLS_SRP_SHA_WITH_AES_128_CBC_SHA 0xC01D
|
||||
#define TLS_SRP_SHA_WITH_AES_256_CBC_SHA 0xC020
|
||||
#define TLS_SRP_SHA_RSA_WITH_3DES_EDE_CBC_SHA 0xC01B
|
||||
#define TLS_SRP_SHA_RSA_WITH_AES_128_CBC_SHA 0xC01E
|
||||
#define TLS_SRP_SHA_RSA_WITH_AES_256_CBC_SHA 0xC021
|
||||
#define TLS_SRP_SHA_DSS_WITH_3DES_EDE_CBC_SHA 0xC01C
|
||||
#define TLS_SRP_SHA_DSS_WITH_AES_128_CBC_SHA 0xC01F
|
||||
#define TLS_SRP_SHA_DSS_WITH_AES_256_CBC_SHA 0xC022
|
||||
#define TLS_ECCPWD_WITH_AES_128_GCM_SHA256 0xC0B0
|
||||
#define TLS_ECCPWD_WITH_AES_256_GCM_SHA384 0xC0B1
|
||||
#define TLS_ECCPWD_WITH_AES_128_CCM_SHA256 0xC0B2
|
||||
#define TLS_ECCPWD_WITH_AES_256_CCM_SHA384 0xC0B3
|
||||
#define TLS_GOSTR341112_256_WITH_KUZNYECHIK_CTR_OMAC 0xC100
|
||||
#define TLS_GOSTR341112_256_WITH_MAGMA_CTR_OMAC 0xC101
|
||||
#define TLS_GOSTR341112_256_WITH_28147_CNT_IMIT 0xC102
|
||||
#define TLS_AES_128_GCM_SHA256 0x1301
|
||||
#define TLS_AES_256_GCM_SHA384 0x1302
|
||||
#define TLS_AES_128_CCM_SHA256 0x1304
|
||||
#define TLS_AES_128_CCM_8_SHA256 0x1305
|
||||
#define TLS_CHACHA20_POLY1305_SHA256 0x1303
|
||||
#define TLS_SM4_GCM_SM3 0x00C6
|
||||
#define TLS_SM4_CCM_SM3 0x00C7
|
||||
#define TLS_SHA256_SHA256 0xC0B4
|
||||
#define TLS_SHA384_SHA384 0xC0B5
|
||||
#define TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00FF
|
||||
#define TLS_FALLBACK_SCSV 0x5600
|
||||
|
||||
/* https://datatracker.ietf.org/doc/html/rfc8701 */
|
||||
#define TLS_CIPHER_GREASE_RESERVED_0 0x0A0A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_1 0x1A1A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_2 0x2A2A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_3 0x3A3A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_4 0x4A4A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_5 0x5A5A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_6 0x6A6A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_7 0x7A7A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_8 0x8A8A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_9 0x9A9A
|
||||
#define TLS_CIPHER_GREASE_RESERVED_A 0xAAAA
|
||||
#define TLS_CIPHER_GREASE_RESERVED_B 0xBABA
|
||||
#define TLS_CIPHER_GREASE_RESERVED_C 0xCACA
|
||||
#define TLS_CIPHER_GREASE_RESERVED_D 0xDADA
|
||||
#define TLS_CIPHER_GREASE_RESERVED_E 0xEAEA
|
||||
#define TLS_CIPHER_GREASE_RESERVED_F 0xFAFA
|
||||
|
||||
/* ********************************************** */
|
||||
|
||||
/* Signature algorithms */
|
||||
|
||||
#define RSA_PKCS1_SHA1 0x0201
|
||||
#define ECDSA_SHA1 0x0203
|
||||
#define RSA_PKCS1_SHA256 0x0401
|
||||
#define ECDSA_SECP256R1_SHA256 0x0403
|
||||
#define RSA_PKCS1_SHA384 0x0501
|
||||
#define ECDSA_SECP384R1_SHA384 0x0503
|
||||
#define RSA_PKCS1_SHA512 0x0601
|
||||
#define ECDSA_SECP521R1_SHA512 0x0603
|
||||
#define RSA_PSS_RSAE_SHA256 0x0804
|
||||
#define RSA_PSS_RSAE_SHA384 0x0805
|
||||
#define RSA_PSS_RSAE_SHA512 0x0806
|
||||
#define ED25519 0x0807
|
||||
#define ED448 0x0808
|
||||
#define RSA_PSS_PSS_SHA256 0x0809
|
||||
#define RSA_PSS_PSS_SHA384 0x080A
|
||||
#define RSA_PSS_PSS_SHA512 0x080B
|
||||
@@ -57,7 +57,7 @@
|
||||
#if defined __NetBSD__ || defined __OpenBSD__
|
||||
#include <netinet/in_systm.h>
|
||||
|
||||
#if defined __OpenBSD__
|
||||
#ifdef __OpenBSD__
|
||||
#include <pthread.h>
|
||||
|
||||
#endif
|
||||
@@ -67,10 +67,4 @@
|
||||
|
||||
#endif /* Win32 */
|
||||
|
||||
#if defined __OpenBSD__
|
||||
#include "ndpi_includes_OpenBSD.h"
|
||||
#else
|
||||
typedef struct timeval pkt_timeval;
|
||||
#endif /* __OpenBSD__ */
|
||||
|
||||
#endif /* __NDPI_INCLUDES_H__ */
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* ndpi_includes_OpenBSD.h
|
||||
*
|
||||
* Copyright (C) 2011-16 - 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __NDPI_INCLUDES_OPENBSD_H__
|
||||
#define __NDPI_INCLUDES_OPENBSD_H__
|
||||
|
||||
#ifndef IPPROTO_SCTP
|
||||
#define IPPROTO_SCTP 132
|
||||
#endif /* IPPROTO_SCTP */
|
||||
|
||||
#include <net/bpf.h>
|
||||
|
||||
typedef struct bpf_timeval pkt_timeval;
|
||||
|
||||
#endif /* __NDPI_INCLUDES_OPENBSD_H__ */
|
||||
+12
-20
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_main.h
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - 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
|
||||
@@ -31,10 +31,6 @@
|
||||
#include "ndpi_api.h"
|
||||
#include "ndpi_protocols.h"
|
||||
|
||||
/* used by ndpi_set_proto_subprotocols */
|
||||
#define NDPI_PROTOCOL_NO_MORE_SUBPROTOCOLS (-1)
|
||||
#define NDPI_PROTOCOL_MATCHED_BY_CONTENT (-2)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -99,11 +95,11 @@ extern "C" {
|
||||
struct ndpi_flow_struct *flow,
|
||||
ndpi_protocol_category_t protocol_category);
|
||||
|
||||
extern void ndpi_set_proto_subprotocols(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
int protoId, ...);
|
||||
|
||||
extern void ndpi_set_proto_defaults(struct ndpi_detection_module_struct *ndpi_mod,
|
||||
ndpi_protocol_breed_t protoBreed, u_int16_t protoId, char *protoName,
|
||||
ndpi_protocol_breed_t protoBreed, u_int16_t protoId,
|
||||
u_int8_t can_have_a_subprotocol,
|
||||
u_int16_t tcp_alias_protoId[2],
|
||||
u_int16_t udp_alias_protoId[2], char *protoName,
|
||||
ndpi_protocol_category_t protoCategory,
|
||||
ndpi_port_range *tcpDefPorts,
|
||||
ndpi_port_range *udpDefPorts);
|
||||
@@ -131,7 +127,13 @@ extern "C" {
|
||||
extern u_int8_t ndpi_is_proto(ndpi_protocol proto, u_int16_t 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,
|
||||
u_int16_t** tcp_master_proto,
|
||||
u_int16_t** udp_master_proto);
|
||||
#/* NDPI_PROTOCOL_NETBIOS */
|
||||
int ndpi_netbios_name_interpret(char *in, char *out, u_int out_len);
|
||||
|
||||
#ifdef NDPI_ENABLE_DEBUG_MESSAGES
|
||||
void ndpi_debug_get_last_log_function_line(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
const char **file, const char **func, u_int32_t * line);
|
||||
@@ -148,16 +150,6 @@ extern "C" {
|
||||
#define ndpi_match_strprefix(payload, payload_len, str) \
|
||||
ndpi_match_prefix((payload), (payload_len), (str), (sizeof(str)-1))
|
||||
|
||||
int ndpi_handle_ipv6_extension_headers(struct ndpi_detection_module_struct *ndpi_str,
|
||||
const u_int8_t ** l4ptr, u_int16_t * l4len,
|
||||
u_int8_t * nxt_hdr);
|
||||
void ndpi_set_risk(struct ndpi_detection_module_struct *ndpi_str,
|
||||
struct ndpi_flow_struct *flow, ndpi_risk_enum r);
|
||||
int ndpi_is_printable_string(char const * const str, size_t len);
|
||||
float ndpi_calculate_entropy(u_int8_t const * const buf, size_t len);
|
||||
void load_common_alpns(struct ndpi_detection_module_struct *ndpi_str);
|
||||
u_int8_t is_a_common_alpn(struct ndpi_detection_module_struct *ndpi_str,
|
||||
const char *alpn_to_check, u_int alpn_to_check_len);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* ndpi_patricia_typedef.h
|
||||
*
|
||||
* Copyright (C) 2011-21 - 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Id: ndpi_patricia.h,v 1.6 2005/12/07 20:53:01 dplonka Exp $
|
||||
* Dave Plonka <plonka@doit.wisc.edu>
|
||||
*
|
||||
* This product includes software developed by the University of Michigan,
|
||||
* Merit Network, Inc., and their contributors.
|
||||
*
|
||||
* This file had been called "radix.h" in the MRT sources.
|
||||
*
|
||||
* I renamed it to "ndpi_patricia.h" since it's not an implementation of a general
|
||||
* radix trie. Also, pulled in various requirements from "mrt.h" and added
|
||||
* some other things it could be used as a standalone API.
|
||||
|
||||
https://github.com/deepfield/MRT/blob/master/COPYRIGHT
|
||||
|
||||
Copyright (c) 1999-2013
|
||||
|
||||
The Regents of the University of Michigan ("The Regents") and Merit
|
||||
Network, Inc.
|
||||
|
||||
Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _NDPI_PATRICIA_TYPEDEF_H_
|
||||
#define _NDPI_PATRICIA_TYPEDEF_H_
|
||||
|
||||
/* pointer to usr data (ex. route flap info) */
|
||||
union ndpi_patricia_node_value_t {
|
||||
void *user_data;
|
||||
|
||||
/* User-defined values */
|
||||
union {
|
||||
struct {
|
||||
u_int32_t user_value, additional_user_value;
|
||||
} uv32;
|
||||
|
||||
u_int64_t uv64;
|
||||
} u;
|
||||
};
|
||||
|
||||
typedef struct _ndpi_prefix_t {
|
||||
u_int16_t family; /* AF_INET | AF_INET6 */
|
||||
u_int16_t bitlen; /* same as mask? */
|
||||
int ref_count; /* reference count */
|
||||
union {
|
||||
struct in_addr sin;
|
||||
struct in6_addr sin6;
|
||||
u_int8_t mac[6];
|
||||
} add;
|
||||
} ndpi_prefix_t;
|
||||
|
||||
typedef struct _ndpi_patricia_node_t {
|
||||
u_int16_t bit; /* flag if this node used */
|
||||
ndpi_prefix_t *prefix; /* who we are in patricia tree */
|
||||
struct _ndpi_patricia_node_t *l, *r; /* left and right children */
|
||||
struct _ndpi_patricia_node_t *parent;/* may be used */
|
||||
void *data; /* pointer to data */
|
||||
union ndpi_patricia_node_value_t value;
|
||||
} ndpi_patricia_node_t;
|
||||
|
||||
typedef struct _ndpi_patricia_tree_t {
|
||||
ndpi_patricia_node_t *head;
|
||||
u_int16_t maxbits; /* for IP, 32 bit addresses */
|
||||
int num_active_node; /* for debug purpose */
|
||||
} ndpi_patricia_tree_t;
|
||||
|
||||
#endif /* _NDPI_PATRICIA_TYPEDEF_H_ */
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_protocol_ids.h
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - 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
|
||||
@@ -25,6 +25,7 @@
|
||||
#ifndef __NDPI_PROTOCOLS_IDS_H__
|
||||
#define __NDPI_PROTOCOLS_IDS_H__
|
||||
|
||||
#define NDPI_DETECTION_SUPPORT_IPV6
|
||||
#define NDPI_PROTOCOL_SIZE 2
|
||||
|
||||
typedef enum {
|
||||
@@ -58,7 +59,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_COAP = 27,
|
||||
NDPI_PROTOCOL_VMWARE = 28,
|
||||
NDPI_PROTOCOL_MAIL_SMTPS = 29,
|
||||
NDPI_PROTOCOL_DTLS = 30,
|
||||
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,
|
||||
@@ -81,25 +82,25 @@ typedef enum {
|
||||
NDPI_PROTOCOL_RTSP = 50,
|
||||
NDPI_PROTOCOL_MAIL_IMAPS = 51,
|
||||
NDPI_PROTOCOL_ICECAST = 52,
|
||||
NDPI_PROTOCOL_CPHA = 53,
|
||||
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_DISCORD = 58,
|
||||
NDPI_PROTOCOL_TVANTS = 58,
|
||||
NDPI_PROTOCOL_TVUPLAYER = 59,
|
||||
NDPI_PROTOCOL_MONGODB = 60, /* Leonn Paiva <leonn.paiva@gmail.com> */
|
||||
NDPI_PROTOCOL_HTTP_DOWNLOAD = 60,
|
||||
NDPI_PROTOCOL_QQLIVE = 61,
|
||||
NDPI_PROTOCOL_THUNDER = 62,
|
||||
NDPI_PROTOCOL_SOULSEEK = 63,
|
||||
NDPI_PROTOCOL_PS_VUE = 64,
|
||||
NDPI_PROTOCOL_IRC = 65,
|
||||
NDPI_PROTOCOL_AYIYA = 66,
|
||||
NDPI_PROTOCOL_JABBER = 67,
|
||||
NDPI_PROTOCOL_NATS = 68,
|
||||
NDPI_PROTOCOL_AMONG_US = 69, /* Toni Uhlig <matzeton@googlemail.com> */
|
||||
NDPI_PROTOCOL_UNENCRYPTED_JABBER = 67,
|
||||
NDPI_PROTOCOL_MSN = 68,
|
||||
NDPI_PROTOCOL_OSCAR = 69,
|
||||
NDPI_PROTOCOL_YAHOO = 70,
|
||||
NDPI_PROTOCOL_DISNEYPLUS = 71, /* Zied Aouini <aouinizied@gmail.com> */
|
||||
NDPI_PROTOCOL_BATTLEFIELD = 71,
|
||||
NDPI_PROTOCOL_GOOGLE_PLUS = 72,
|
||||
NDPI_PROTOCOL_IP_VRRP = 73,
|
||||
NDPI_PROTOCOL_STEAM = 74, /* Tomasz Bujlow <tomasz@skatnet.dk> */
|
||||
@@ -118,7 +119,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_RTP = 87,
|
||||
NDPI_PROTOCOL_RDP = 88,
|
||||
NDPI_PROTOCOL_VNC = 89,
|
||||
NDPI_PROTOCOL_TUMBLR = 90, /* Zied Aouini <aouinizied@gmail.com> */
|
||||
NDPI_PROTOCOL_PCANYWHERE = 90,
|
||||
NDPI_PROTOCOL_TLS = 91,
|
||||
NDPI_PROTOCOL_SSH = 92,
|
||||
NDPI_PROTOCOL_USENET = 93,
|
||||
@@ -138,7 +139,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_FIESTA = 107,
|
||||
NDPI_PROTOCOL_FLORENSIA = 108,
|
||||
NDPI_PROTOCOL_GUILDWARS = 109,
|
||||
NDPI_PROTOCOL_AMAZON_ALEXA = 110, /* Zied Aouini <aouinizied@gmail.com> */
|
||||
NDPI_PROTOCOL_HTTP_ACTIVESYNC = 110,
|
||||
NDPI_PROTOCOL_KERBEROS = 111,
|
||||
NDPI_PROTOCOL_LDAP = 112,
|
||||
NDPI_PROTOCOL_MAPLESTORY = 113,
|
||||
@@ -153,7 +154,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_GMAIL = 122,
|
||||
NDPI_PROTOCOL_GOOGLE_MAPS = 123,
|
||||
NDPI_PROTOCOL_YOUTUBE = 124,
|
||||
NDPI_PROTOCOL_SKYPE_TEAMS = 125,
|
||||
NDPI_PROTOCOL_SKYPE = 125,
|
||||
NDPI_PROTOCOL_GOOGLE = 126,
|
||||
NDPI_PROTOCOL_DCERPC = 127,
|
||||
NDPI_PROTOCOL_NETFLOW = 128,
|
||||
@@ -181,7 +182,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_LOTUS_NOTES = 150,
|
||||
NDPI_PROTOCOL_SAP = 151,
|
||||
NDPI_PROTOCOL_GTP = 152,
|
||||
NDPI_PROTOCOL_WSD = 153,
|
||||
NDPI_PROTOCOL_UPNP = 153,
|
||||
NDPI_PROTOCOL_LLMNR = 154,
|
||||
NDPI_PROTOCOL_REMOTE_SCAN = 155,
|
||||
NDPI_PROTOCOL_SPOTIFY = 156,
|
||||
@@ -211,7 +212,7 @@ typedef enum {
|
||||
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_PINTEREST = 183, /* Zied Aouini <aouinizied@gmail.com> */
|
||||
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,
|
||||
@@ -224,7 +225,7 @@ typedef enum {
|
||||
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_DOH_DOT = 196, /* DoH (DNS over HTTPS), DoT (DNS over TLS), DoQ (DNS over QUIC). TODO: rename in NDPI_PROTOCOL_DOH_DOT_DOQ? */
|
||||
NDPI_PROTOCOL_DOH_DOT = 196, /* DoH (DNS over HTTPS), DoT (DNS over TLS) */
|
||||
NDPI_PROTOCOL_WECHAT = 197,
|
||||
NDPI_PROTOCOL_MPEGTS = 198,
|
||||
NDPI_PROTOCOL_SNAPCHAT = 199,
|
||||
@@ -233,10 +234,10 @@ typedef enum {
|
||||
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_REDDIT = 205, /* Zied Aouini <aouinizied@gmail.com> */
|
||||
NDPI_PROTOCOL_FREE_205 = 205,
|
||||
NDPI_PROTOCOL_WIREGUARD = 206,
|
||||
NDPI_PROTOCOL_SMPP = 207, /* Damir Franusic <df@release14.org> */
|
||||
NDPI_PROTOCOL_DNSCRYPT = 208, /* Toni Uhlig <matzeton@googlemail.com> */
|
||||
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> */
|
||||
@@ -247,7 +248,7 @@ typedef enum {
|
||||
NDPI_PROTOCOL_IMO = 216,
|
||||
NDPI_PROTOCOL_GOOGLE_DRIVE = 217,
|
||||
NDPI_PROTOCOL_OCS = 218,
|
||||
NDPI_PROTOCOL_MICROSOFT_365 = 219,
|
||||
NDPI_PROTOCOL_OFFICE_365 = 219,
|
||||
NDPI_PROTOCOL_CLOUDFLARE = 220,
|
||||
NDPI_PROTOCOL_MS_ONE_DRIVE = 221,
|
||||
NDPI_PROTOCOL_MQTT = 222,
|
||||
@@ -264,8 +265,8 @@ typedef enum {
|
||||
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_LISP = 236,
|
||||
NDPI_PROTOCOL_DIAMETER = 237,
|
||||
NDPI_PROTOCOL_APPLE_PUSH = 238,
|
||||
NDPI_PROTOCOL_GOOGLE_SERVICES = 239,
|
||||
NDPI_PROTOCOL_AMAZON_VIDEO = 240,
|
||||
@@ -277,25 +278,10 @@ typedef enum {
|
||||
NDPI_PROTOCOL_BLOOMBERG = 246,
|
||||
NDPI_PROTOCOL_CAPWAP = 247,
|
||||
NDPI_PROTOCOL_ZABBIX = 248,
|
||||
NDPI_PROTOCOL_S7COMM = 249,
|
||||
NDPI_PROTOCOL_MSTEAMS = 250,
|
||||
NDPI_PROTOCOL_WEBSOCKET = 251, /* Leonn Paiva <leonn.paiva@gmail.com> */
|
||||
NDPI_PROTOCOL_ANYDESK = 252, /* Toni Uhlig <matzeton@googlemail.com> */
|
||||
NDPI_PROTOCOL_SOAP = 253, /* Toni Uhlig <matzeton@googlemail.com> */
|
||||
NDPI_PROTOCOL_APPLE_SIRI = 254, /* Zied Aouini <aouinizied@gmail.com> */
|
||||
NDPI_PROTOCOL_SNAPCHAT_CALL = 255,
|
||||
NDPI_PROTOCOL_HPVIRTGRP = 256, /* Toni Uhlig <matzeton@googlemail.com> */
|
||||
NDPI_PROTOCOL_GENSHIN_IMPACT = 257, /* Toni Uhlig <matzeton@googlemail.com> */
|
||||
NDPI_PROTOCOL_ACTIVISION = 258,
|
||||
NDPI_PROTOCOL_FORTICLIENT = 259,
|
||||
NDPI_PROTOCOL_Z3950 = 260, /* Toni Uhlig <matzeton@googlemail.com> */
|
||||
NDPI_PROTOCOL_LIKEE = 261,
|
||||
NDPI_PROTOCOL_GITLAB = 262,
|
||||
NDPI_PROTOCOL_AVAST_SECUREDNS = 263, /* Toni Uhlig <matzeton@googlemail.com> */
|
||||
|
||||
#ifdef CUSTOM_NDPI_PROTOCOLS
|
||||
#include "../../../nDPI-custom/custom_ndpi_protocol_ids.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
IMPORTANT
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_protocols.h
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - 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
|
||||
@@ -58,6 +58,7 @@ void init_applejuice_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
void init_armagetron_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ayiya_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_amqp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_battlefield_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_bgp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_bittorrent_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_lisp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -87,6 +88,7 @@ void init_guildwars_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
void init_h323_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_halflife2_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_http_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_http_activesync_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_iax_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_icecast_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ipp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -101,11 +103,12 @@ void init_mail_imap_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
void init_mail_pop_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mail_smtp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_maplestory_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mdns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_megaco_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mgpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mining_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mms_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_nats_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);
|
||||
void init_mpegts_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mssql_tds_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mysql_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -118,7 +121,11 @@ void init_ntp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
|
||||
void init_openft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_openvpn_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_oracle_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_oscar_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pando_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pcanywhere_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_postgres_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pplive_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ppstream_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_pptp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_qq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -159,9 +166,11 @@ void init_telegram_dissector(struct ndpi_detection_module_struct *ndpi_struct, u
|
||||
void init_telnet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tftp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_thunder_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tor_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tvants_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_tvuplayer_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_usenet_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_wsd_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_upnp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_veohtv_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_vhua_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_viber_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -173,6 +182,7 @@ void init_world_of_warcraft_dissector(struct ndpi_detection_module_struct *ndpi_
|
||||
void init_world_of_kung_fu_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_xbox_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_xdmcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_yahoo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_zattoo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_zmq_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_stracraft_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -191,11 +201,11 @@ void init_fix_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int3
|
||||
void init_nintendo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_csgo_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_cpha_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_amazon_video_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);
|
||||
void init_nest_log_sink_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_ookla_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
@@ -206,15 +216,4 @@ void init_wireguard_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
void init_targus_getdata_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dnp3_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_104_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_s7comm_dissector(struct ndpi_detection_module_struct *ndpi_struct,u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_websocket_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_soap_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_dnscrypt_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_mongodb_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_among_us_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_hpvirtgrp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_genshin_impact_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_z3950_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
void init_avast_securedns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask);
|
||||
|
||||
#endif /* __NDPI_PROTOCOLS_H__ */
|
||||
|
||||
+225
-498
File diff suppressed because it is too large
Load Diff
@@ -1,32 +0,0 @@
|
||||
|
||||
|
||||
#ifndef __NDPI_UTILS_H__
|
||||
#define __NDPI_UTILS_H__
|
||||
|
||||
#include "ndpi_define.h"
|
||||
|
||||
#define MYDBG(m, ...) \
|
||||
printf(" DBG[%s:%s:%u]: \t" m "\n", __FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
|
||||
|
||||
// #define NDPI_ENABLE_DEBUG_POINTER_MESSAGES
|
||||
// #define NDPI_ENABLE_DEBUG_INFO_MESSAGES
|
||||
// #define NDPI_ENABLE_DEBUG_TRACE_MESSAGES
|
||||
|
||||
extern void printRawData(const uint8_t *ptr, size_t len);
|
||||
//extern uint8_t add_segment_to_buffer( struct ndpi_flow_struct *flow, struct ndpi_tcphdr const * tcph, uint32_t waited);
|
||||
//extern uint8_t check_for_sequence( struct ndpi_flow_struct *flow, struct ndpi_tcphdr const * tcph);
|
||||
|
||||
/* **************************************** */
|
||||
|
||||
/* Can't call libc functions from kernel space, define some stub instead */
|
||||
|
||||
#define ndpi_isalpha(ch) (((ch) >= 'a' && (ch) <= 'z') || ((ch) >= 'A' && (ch) <= 'Z'))
|
||||
#define ndpi_isdigit(ch) ((ch) >= '0' && (ch) <= '9')
|
||||
#define ndpi_isspace(ch) (((ch) >= '\t' && (ch) <= '\r') || ((ch) == ' '))
|
||||
#define ndpi_isprint(ch) ((ch) >= 0x20 && (ch) <= 0x7e)
|
||||
#define ndpi_ispunct(ch) (((ch) >= '!' && (ch) <= '/') || \
|
||||
((ch) >= ':' && (ch) <= '@') || \
|
||||
((ch) >= '[' && (ch) <= '`') || \
|
||||
((ch) >= '{' && (ch) <= '~'))
|
||||
|
||||
#endif
|
||||
@@ -31,8 +31,6 @@
|
||||
#define __mingw_forceinline __inline__ __attribute__((__always_inline__,__gnu_inline__))
|
||||
#endif
|
||||
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT _WIN32_WINNT_WIN8
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <ws2tcpip.h>
|
||||
@@ -41,7 +39,6 @@
|
||||
#include <getopt.h> /* getopt from: http://www.pwilson.net/sample.html. */
|
||||
#include <process.h> /* for getpid() and the exec..() family */
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
@@ -51,19 +48,6 @@
|
||||
|
||||
#define IPVERSION 4 /* on *nix it is defined in netinet/ip.h */
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
|
||||
#endif
|
||||
|
||||
#ifndef IPPROTO_SCTP
|
||||
#define IPPROTO_SCTP 132
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__) || defined(__MINGW64__)
|
||||
#undef gettimeofday
|
||||
#define gettimeofday mingw_gettimeofday
|
||||
#endif
|
||||
|
||||
extern char* strsep(char **sp, char *sep);
|
||||
|
||||
typedef unsigned char u_char;
|
||||
@@ -92,9 +76,8 @@ typedef unsigned __int64 u_int64_t;
|
||||
extern unsigned long waitForNextEvent(unsigned long ulDelay /* ms */);
|
||||
|
||||
#define sleep(a /* sec */) waitForNextEvent(1000*a /* ms */)
|
||||
#define localtime_r(a, b) localtime_s(b, a)
|
||||
#define strtok_r strtok_s
|
||||
#define timegm _mkgmtime
|
||||
|
||||
extern struct tm* localtime_r(const time_t* timep, struct tm* r);
|
||||
|
||||
#endif /* __NDPI_WIN32_H__ */
|
||||
|
||||
+8
-19
@@ -6,16 +6,17 @@
|
||||
# make Makefile
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
# Installation directories
|
||||
#
|
||||
prefix = @prefix@
|
||||
libdir = ${prefix}/lib
|
||||
includedir = ${prefix}/include/ndpi
|
||||
CC = @GNU_PREFIX@@CC@
|
||||
CC = @CC@
|
||||
CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -Wall @CFLAGS@ @CUSTOM_NDPI@
|
||||
LDFLAGS = @LDFLAGS@ @ADDITIONAL_LIBS@ @LIBS@ -lm
|
||||
RANLIB = @GNU_PREFIX@ranlib
|
||||
LDFLAGS = @LDFLAGS@
|
||||
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)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c))
|
||||
HEADERS = $(wildcard ../include/*.h)
|
||||
@@ -28,44 +29,32 @@ NDPI_LIBS = $(NDPI_LIB_STATIC) $(NDPI_LIB_SHARED)
|
||||
ifneq ($(OS),Windows_NT)
|
||||
OS := $(shell uname)
|
||||
endif
|
||||
BUILD_MINGW = @BUILD_MINGW@
|
||||
|
||||
ifeq ($(OS),Darwin)
|
||||
CC=clang
|
||||
SONAME_FLAG=
|
||||
else
|
||||
ifneq ($(BUILD_MINGW),)
|
||||
NDPI_LIB_SHARED_BASE = libndpi
|
||||
NDPI_LIB_SHARED = $(NDPI_LIB_SHARED_BASE)-@NDPI_VERSION_SHORT@.dll
|
||||
else
|
||||
SONAME_FLAG=-Wl,-soname,$(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR)
|
||||
endif
|
||||
endif
|
||||
|
||||
all: $(NDPI_LIBS)
|
||||
|
||||
ndpi_main.c: ndpi_content_match.c.inc
|
||||
|
||||
$(NDPI_LIB_STATIC): $(OBJECTS)
|
||||
@GNU_PREFIX@ar rc $@ $(OBJECTS)
|
||||
ar rc $@ $(OBJECTS)
|
||||
$(RANLIB) $@
|
||||
|
||||
$(NDPI_LIB_SHARED): $(OBJECTS)
|
||||
$(CC) -shared -fPIC $(SONAME_FLAG) -o $@ $(OBJECTS) $(LDFLAGS)
|
||||
$(CC) -shared -fPIC $(SONAME_FLAG) -o $@ $(OBJECTS) $(LDFLAGS) @ADDITIONAL_LIBS@
|
||||
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE)
|
||||
ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR)
|
||||
|
||||
%.o: %.c $(HEADERS) Makefile
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(CC) $(CFLAGS) -c $< -o $@ $(LDFLAGS)
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(NDPI_LIB_STATIC) $(OBJECTS) *.o *.so *.lo libndpi.so*
|
||||
|
||||
distdir:
|
||||
cp ndpi_content_match.c.inc '$(distdir)/'
|
||||
find . -type d | xargs -I'{}' mkdir -p '$(distdir)/{}'
|
||||
find ../include -type f -name '*.h' | xargs -I'{}' cp '{}' '$(distdir)/{}'
|
||||
find . -type f -name '*.c' -o -name '*.h' | xargs -I'{}' cp '{}' '$(distdir)/{}'
|
||||
/bin/rm -f $(NDPI_LIB_STATIC) $(OBJECTS) *.o *.so *.lo $(NDPI_LIB_SHARED)
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
|
||||
+33
-1133
File diff suppressed because it is too large
Load Diff
+26
-27
@@ -51,7 +51,6 @@
|
||||
#include <math.h>
|
||||
#include "ndpi_main.h"
|
||||
#include "ndpi_classify.h"
|
||||
#include "ndpi_includes.h"
|
||||
|
||||
/** finds the minimum value between to inputs */
|
||||
#ifndef min
|
||||
@@ -241,9 +240,9 @@ float ndpi_parameters_bd[NUM_PARAMETERS_BD_LOGREG] = {
|
||||
};
|
||||
|
||||
/**
|
||||
* \fn void ndpi_merge_splt_arrays (const uint16_t *pkt_len, const pkt_timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin,
|
||||
* \fn void ndpi_merge_splt_arrays (const uint16_t *pkt_len, const struct timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin,
|
||||
uint16_t s_idx, uint16_t r_idx,
|
||||
uint16_t *merged_lens, uint16_t *merged_times,
|
||||
uint32_t max_num_pkt_len, uint32_t max_merged_num_pkts)
|
||||
@@ -261,16 +260,16 @@ float ndpi_parameters_bd[NUM_PARAMETERS_BD_LOGREG] = {
|
||||
* \return none
|
||||
*/
|
||||
void
|
||||
ndpi_merge_splt_arrays (const uint16_t *pkt_len, const pkt_timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin,
|
||||
ndpi_merge_splt_arrays (const uint16_t *pkt_len, const struct timeval *pkt_time,
|
||||
const uint16_t *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin,
|
||||
uint16_t s_idx, uint16_t r_idx,
|
||||
uint16_t *merged_lens, uint16_t *merged_times)
|
||||
{
|
||||
int s,r;
|
||||
pkt_timeval ts_start = { 0, 0 }; /* initialize to avoid spurious warnings */
|
||||
pkt_timeval tmp, tmp_r;
|
||||
pkt_timeval start_m;
|
||||
struct timeval ts_start = { 0, 0 }; /* initialize to avoid spurious warnings */
|
||||
struct timeval tmp, tmp_r;
|
||||
struct timeval start_m;
|
||||
|
||||
if(r_idx + s_idx == 0) {
|
||||
return ;
|
||||
@@ -420,9 +419,9 @@ ndpi_get_mc_rep_times (uint16_t *times, float *time_mc, uint16_t num_packets)
|
||||
}
|
||||
|
||||
/**
|
||||
* \fn float classify (const unsigned short *pkt_len, const pkt_timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
* \fn float classify (const unsigned short *pkt_len, const struct timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
|
||||
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t)
|
||||
* \param pkt_len length of the packet
|
||||
@@ -446,9 +445,9 @@ ndpi_get_mc_rep_times (uint16_t *times, float *time_mc, uint16_t num_packets)
|
||||
* \return float score
|
||||
*/
|
||||
float
|
||||
ndpi_classify (const unsigned short *pkt_len, const pkt_timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const pkt_timeval *pkt_time_twin,
|
||||
pkt_timeval start_time, pkt_timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
ndpi_classify (const unsigned short *pkt_len, const struct timeval *pkt_time,
|
||||
const unsigned short *pkt_len_twin, const struct timeval *pkt_time_twin,
|
||||
struct timeval start_time, struct timeval start_time_twin, uint32_t max_num_pkt_len,
|
||||
uint16_t sp, uint16_t dp, uint32_t op, uint32_t ip, uint32_t np_o, uint32_t np_i,
|
||||
uint32_t ob, uint32_t ib, uint16_t use_bd, const uint32_t *bd, const uint32_t *bd_t)
|
||||
{
|
||||
@@ -605,8 +604,8 @@ ndpi_update_params (classifier_type_codes_t param_type, const char *param_file)
|
||||
* \return 1 if equal, 0 otherwise
|
||||
*/
|
||||
unsigned int
|
||||
ndpi_timer_eq(const pkt_timeval *a,
|
||||
const pkt_timeval *b)
|
||||
ndpi_timer_eq(const struct timeval *a,
|
||||
const struct timeval *b)
|
||||
{
|
||||
if(a->tv_sec == b->tv_sec && a->tv_usec == b->tv_usec) {
|
||||
return 1;
|
||||
@@ -616,8 +615,8 @@ ndpi_timer_eq(const pkt_timeval *a,
|
||||
}
|
||||
|
||||
unsigned int
|
||||
ndpi_timer_lt(const pkt_timeval *a,
|
||||
const pkt_timeval *b)
|
||||
ndpi_timer_lt(const struct timeval *a,
|
||||
const struct timeval *b)
|
||||
{
|
||||
return (a->tv_sec == b->tv_sec) ?
|
||||
(a->tv_usec < b->tv_usec):(a->tv_sec < b->tv_sec);
|
||||
@@ -631,9 +630,9 @@ ndpi_timer_lt(const pkt_timeval *a,
|
||||
* \return none
|
||||
*/
|
||||
void
|
||||
ndpi_timer_sub(const pkt_timeval *a,
|
||||
const pkt_timeval *b,
|
||||
pkt_timeval *result)
|
||||
ndpi_timer_sub(const struct timeval *a,
|
||||
const struct timeval *b,
|
||||
struct timeval *result)
|
||||
{
|
||||
result->tv_sec = a->tv_sec - b->tv_sec;
|
||||
result->tv_usec = a->tv_usec - b->tv_usec;
|
||||
@@ -649,7 +648,7 @@ ndpi_timer_sub(const pkt_timeval *a,
|
||||
* \return none
|
||||
*/
|
||||
void
|
||||
ndpi_timer_clear(pkt_timeval *a)
|
||||
ndpi_timer_clear(struct timeval *a)
|
||||
{
|
||||
a->tv_sec = a->tv_usec = 0;
|
||||
}
|
||||
@@ -660,7 +659,7 @@ ndpi_timer_clear(pkt_timeval *a)
|
||||
* \return unsigned int - Milliseconds
|
||||
*/
|
||||
unsigned int
|
||||
ndpi_timeval_to_milliseconds(pkt_timeval ts)
|
||||
ndpi_timeval_to_milliseconds(struct timeval ts)
|
||||
{
|
||||
unsigned int result = ts.tv_usec / 1000 + ts.tv_sec * 1000;
|
||||
return result;
|
||||
@@ -672,7 +671,7 @@ ndpi_timeval_to_milliseconds(pkt_timeval ts)
|
||||
* \return unsigned int - Milliseconds
|
||||
*/
|
||||
unsigned int
|
||||
ndpi_timeval_to_microseconds(pkt_timeval ts)
|
||||
ndpi_timeval_to_microseconds(struct timeval ts)
|
||||
{
|
||||
unsigned int result = ts.tv_usec + ts.tv_sec * 1000 * 1000;
|
||||
return result;
|
||||
@@ -681,7 +680,7 @@ ndpi_timeval_to_microseconds(pkt_timeval ts)
|
||||
void
|
||||
ndpi_log_timestamp(char *log_ts, uint32_t log_ts_len)
|
||||
{
|
||||
pkt_timeval tv;
|
||||
struct timeval tv;
|
||||
time_t nowtime;
|
||||
struct tm nowtm_r;
|
||||
char tmbuf[NDPI_TIMESTAMP_LEN];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ndpi_community_id.c
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - 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
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
#include "ndpi_api.h"
|
||||
#include "ndpi_config.h"
|
||||
#include "ndpi_includes.h"
|
||||
|
||||
#include <time.h>
|
||||
#ifndef WIN32
|
||||
@@ -70,7 +69,7 @@
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
static u_int16_t ndpi_community_id_buf_copy(u_int8_t * const dst, const void * const src, u_int16_t len) {
|
||||
static ssize_t ndpi_community_id_buf_copy(u_int8_t * const dst, const void * const src, ssize_t len) {
|
||||
if(src)
|
||||
memcpy(dst, src, len);
|
||||
else
|
||||
@@ -168,15 +167,13 @@ static int ndpi_community_id_peer_v4_is_less_than(u_int32_t ip1, u_int32_t ip2,
|
||||
|
||||
static int ndpi_community_id_peer_v6_is_less_than(struct ndpi_in6_addr *ip1, struct ndpi_in6_addr *ip2, u_int16_t p1, u_int16_t p2) {
|
||||
int comp = memcmp(ip1, ip2, sizeof(struct ndpi_in6_addr));
|
||||
|
||||
return comp < 0 || (comp == 0 && p1 < p2);
|
||||
}
|
||||
|
||||
/* **************************************************** */
|
||||
|
||||
void ndpi_string_sha1_hash(const uint8_t *message, size_t len, u_char *hash /* 20-bytes */) {
|
||||
static void ndpi_community_id_sha1_hash(const uint8_t *message, size_t len, u_char *hash /* 20-bytes */) {
|
||||
SHA1_CTX ctx;
|
||||
|
||||
SHA1Init(&ctx);
|
||||
SHA1Update(&ctx, message, len);
|
||||
SHA1Final(hash, &ctx);
|
||||
@@ -188,8 +185,7 @@ void ndpi_string_sha1_hash(const uint8_t *message, size_t len, u_char *hash /* 2
|
||||
https://github.com/corelight/community-id-spec/blob/bda913f617389df07cdaa23606e11bbd318e265c/community-id.py#L285
|
||||
*/
|
||||
static int ndpi_community_id_finalize_and_compute_hash(u_int8_t *comm_buf, u_int16_t off, u_int8_t l4_proto,
|
||||
u_int16_t src_port, u_int16_t dst_port,
|
||||
char *hash_buf, u_int8_t hash_buf_len) {
|
||||
u_int16_t src_port, u_int16_t dst_port, char *hash_buf, u_int8_t hash_buf_len) {
|
||||
u_int8_t pad = 0;
|
||||
uint32_t hash[5];
|
||||
char *community_id;
|
||||
@@ -213,12 +209,12 @@ static int ndpi_community_id_finalize_and_compute_hash(u_int8_t *comm_buf, u_int
|
||||
}
|
||||
|
||||
/* Compute SHA1 */
|
||||
ndpi_string_sha1_hash(comm_buf, off, (u_char*)hash);
|
||||
ndpi_community_id_sha1_hash(comm_buf, off, (u_char*)hash);
|
||||
|
||||
/* Base64 encoding */
|
||||
community_id = ndpi_base64_encode((u_int8_t*)hash, sizeof(hash));
|
||||
|
||||
if(community_id == NULL)
|
||||
if (community_id == NULL)
|
||||
return -1;
|
||||
|
||||
#if 0 /* Debug Info */
|
||||
@@ -235,7 +231,7 @@ static int ndpi_community_id_finalize_and_compute_hash(u_int8_t *comm_buf, u_int
|
||||
printf("Base64: %s\n", community_id);
|
||||
#endif
|
||||
|
||||
if(hash_buf_len < 2 || hash_buf_len-2 < strlen(community_id)+1) {
|
||||
if (hash_buf_len < 2 || hash_buf_len-2 < strlen(community_id)+1) {
|
||||
ndpi_free(community_id);
|
||||
return -1;
|
||||
}
|
||||
|
||||
+7211
-7578
File diff suppressed because one or more lines are too long
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* ndpi_geoip.c
|
||||
*
|
||||
* Copyright (C) 2021 - ntop.org
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
* library.
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "ndpi_config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "ndpi_api.h"
|
||||
#include "ndpi_config.h"
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
int ndpi_load_geoip(struct ndpi_detection_module_struct *ndpi_str,
|
||||
const char *ip_city_data, const char *ip_as_data) {
|
||||
#ifdef HAVE_MAXMINDDB
|
||||
int status;
|
||||
|
||||
/* Open the MMDB files */
|
||||
if((status = MMDB_open(ip_city_data, MMDB_MODE_MMAP, &ndpi_str->mmdb_city)) != MMDB_SUCCESS)
|
||||
return(-1);
|
||||
else
|
||||
ndpi_str->mmdb_city_loaded = 1;
|
||||
|
||||
if((status = MMDB_open(ip_as_data, MMDB_MODE_MMAP, &ndpi_str->mmdb_as)) != MMDB_SUCCESS)
|
||||
return(-2);
|
||||
else
|
||||
ndpi_str->mmdb_as_loaded = 1;
|
||||
|
||||
return(0);
|
||||
#else
|
||||
return(-3);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
void ndpi_free_geoip(struct ndpi_detection_module_struct *ndpi_str) {
|
||||
#ifdef HAVE_MAXMINDDB
|
||||
if(ndpi_str->mmdb_city_loaded) MMDB_close(&ndpi_str->mmdb_city);
|
||||
if(ndpi_str->mmdb_as_loaded) MMDB_close(&ndpi_str->mmdb_as);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
int ndpi_get_geoip_asn(struct ndpi_detection_module_struct *ndpi_str, char *ip, u_int32_t *asn) {
|
||||
#ifdef HAVE_MAXMINDDB
|
||||
int gai_error, mmdb_error, status;
|
||||
MMDB_lookup_result_s result;
|
||||
MMDB_entry_data_s entry_data;
|
||||
|
||||
if(ndpi_str->mmdb_as_loaded) {
|
||||
result = MMDB_lookup_string(&ndpi_str->mmdb_as, ip, &gai_error, &mmdb_error);
|
||||
|
||||
if((gai_error != 0)
|
||||
|| (mmdb_error != MMDB_SUCCESS)
|
||||
|| (!result.found_entry))
|
||||
*asn = 0;
|
||||
else {
|
||||
/* Get the ASN */
|
||||
if((status = MMDB_get_value(&result.entry, &entry_data, "autonomous_system_number", NULL)) == MMDB_SUCCESS) {
|
||||
if(entry_data.has_data && entry_data.type == MMDB_DATA_TYPE_UINT32)
|
||||
*asn = entry_data.uint32;
|
||||
else
|
||||
*asn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
return(-2);
|
||||
}
|
||||
|
||||
/* ********************************************************************************* */
|
||||
|
||||
int ndpi_get_geoip_country_continent(struct ndpi_detection_module_struct *ndpi_str, char *ip,
|
||||
char *country_code, u_int8_t country_code_len,
|
||||
char *continent, u_int8_t continent_len) {
|
||||
#ifdef HAVE_MAXMINDDB
|
||||
int gai_error, mmdb_error;
|
||||
MMDB_lookup_result_s result;
|
||||
MMDB_entry_data_s entry_data;
|
||||
|
||||
|
||||
if(ndpi_str->mmdb_city_loaded) {
|
||||
int status;
|
||||
|
||||
result = MMDB_lookup_string(&ndpi_str->mmdb_city, ip, &gai_error, &mmdb_error);
|
||||
|
||||
if((gai_error != 0)
|
||||
|| (mmdb_error != MMDB_SUCCESS)
|
||||
|| (!result.found_entry))
|
||||
country_code[0] = '\0';
|
||||
else {
|
||||
if(country_code_len > 0) {
|
||||
status = MMDB_get_value(&result.entry, &entry_data, "country", "iso_code", NULL);
|
||||
|
||||
if((status != MMDB_SUCCESS) || (!entry_data.has_data))
|
||||
country_code[0] = '\0';
|
||||
else {
|
||||
int str_len = ndpi_min(entry_data.data_size, country_code_len);
|
||||
|
||||
memcpy(country_code, entry_data.utf8_string, str_len);
|
||||
country_code[str_len] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
if(continent_len > 0) {
|
||||
status = MMDB_get_value(&result.entry, &entry_data, "continent", "names", "en", NULL);
|
||||
|
||||
if((status != MMDB_SUCCESS) || (!entry_data.has_data))
|
||||
continent[0] = '\0';
|
||||
else {
|
||||
int str_len = ndpi_min(entry_data.data_size, continent_len);
|
||||
|
||||
memcpy(continent, entry_data.utf8_string, str_len);
|
||||
continent[str_len] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
return(-2);
|
||||
}
|
||||
+3029
-4005
File diff suppressed because it is too large
Load Diff
+389
-921
File diff suppressed because it is too large
Load Diff
+448
-1284
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
* afp.c
|
||||
*
|
||||
* Copyright (C) 2009-11 by ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
+50
-25
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* aimini.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
@@ -33,10 +33,22 @@
|
||||
static void ndpi_int_aimini_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow/* , */
|
||||
/* ndpi_protocol_type_t protocol_type */)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_HTTP, NDPI_PROTOCOL_AIMINI);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AIMINI, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
|
||||
static u_int8_t is_special_aimini_host(struct ndpi_int_one_line_struct host_line)
|
||||
{
|
||||
if (host_line.ptr != NULL && host_line.len >= NDPI_STATICSTRING_LEN("X.X.X.X.aimini.net")) {
|
||||
if ((get_u_int32_t(host_line.ptr, 0) & htonl(0x00ff00ff)) == htonl(0x002e002e) &&
|
||||
(get_u_int32_t(host_line.ptr, 4) & htonl(0x00ff00ff)) == htonl(0x002e002e) &&
|
||||
memcmp(&host_line.ptr[8], "aimini.net", NDPI_STATICSTRING_LEN("aimini.net")) == 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
@@ -220,32 +232,45 @@ void ndpi_search_aimini(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (flow->detected_protocol_stack[0] == NDPI_PROTOCOL_HTTP) {
|
||||
if (flow->http.method == NDPI_HTTP_METHOD_GET)
|
||||
{
|
||||
if ((LINE_STARTS(packet->http_url_name, "/download/") == 1 ||
|
||||
LINE_STARTS(packet->http_url_name, "/player/") == 1 ||
|
||||
LINE_STARTS(packet->http_url_name, "/play/") == 1 ||
|
||||
LINE_STARTS(packet->http_url_name, "/member/") == 1) &&
|
||||
(LINE_ENDS(packet->host_line, ".aimini.net") == 1 ||
|
||||
LINE_ENDS(packet->host_line, ".aimini.com") == 1))
|
||||
{
|
||||
} else if (packet->tcp != NULL) {
|
||||
if ((packet->payload_packet_len > NDPI_STATICSTRING_LEN("GET /player/") &&
|
||||
(memcmp(packet->payload, "GET /player/", NDPI_STATICSTRING_LEN("GET /player/")) == 0)) ||
|
||||
(packet->payload_packet_len > NDPI_STATICSTRING_LEN("GET /play/?fid=") &&
|
||||
(memcmp(packet->payload, "GET /play/?fid=", NDPI_STATICSTRING_LEN("GET /play/?fid=")) == 0))) {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "HTTP packet detected\n");
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
if (packet->host_line.ptr != NULL && packet->host_line.len > 11
|
||||
&& (memcmp(&packet->host_line.ptr[packet->host_line.len - 11], ".aimini.net", 11) == 0)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found AIMINI HTTP traffic\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
} else if (flow->http.method == NDPI_HTTP_METHOD_POST)
|
||||
{
|
||||
if ((LINE_STARTS(packet->http_url_name, "/upload/") == 1 ||
|
||||
LINE_STARTS(packet->http_url_name, "/member/") == 1) &&
|
||||
(LINE_ENDS(packet->host_line, ".aimini.net") == 1 ||
|
||||
LINE_ENDS(packet->host_line, ".aimini.com") == 1))
|
||||
{
|
||||
NDPI_LOG_INFO(ndpi_struct, "found AIMINI HTTP traffic\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
if (packet->payload_packet_len > 100) {
|
||||
if (memcmp(packet->payload, "GET /", NDPI_STATICSTRING_LEN("GET /")) == 0) {
|
||||
if (memcmp(&packet->payload[NDPI_STATICSTRING_LEN("GET /")], "play/",
|
||||
NDPI_STATICSTRING_LEN("play/")) == 0 ||
|
||||
memcmp(&packet->payload[NDPI_STATICSTRING_LEN("GET /")], "download/",
|
||||
NDPI_STATICSTRING_LEN("download/")) == 0) {
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
if (is_special_aimini_host(packet->host_line) == 1) {
|
||||
NDPI_LOG_INFO(ndpi_struct,
|
||||
"found AIMINI HTTP traffic\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (memcmp(packet->payload, "POST /", NDPI_STATICSTRING_LEN("POST /")) == 0) {
|
||||
if (memcmp(&packet->payload[NDPI_STATICSTRING_LEN("POST /")], "upload/",
|
||||
NDPI_STATICSTRING_LEN("upload/")) == 0) {
|
||||
ndpi_parse_packet_line_info(ndpi_struct, flow);
|
||||
if (is_special_aimini_host(packet->host_line) == 1) {
|
||||
NDPI_LOG_INFO(ndpi_struct,
|
||||
"found AIMINI HTTP traffic detected.\n");
|
||||
ndpi_int_aimini_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ static void set_ajp_detected(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
/* 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, NDPI_PROTOCOL_AJP, flow->guessed_host_protocol_id);
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, flow->guessed_host_protocol_id, NDPI_PROTOCOL_AJP);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* amazon_video.c
|
||||
*
|
||||
* Copyright (C) 2018-21 - ntop.org
|
||||
* Copyright (C) 2018-20 by 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
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* among_us.c
|
||||
*
|
||||
* Copyright (C) 2020 - 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"
|
||||
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AMONG_US
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
static void ndpi_int_among_us_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AMONG_US, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
void ndpi_search_among_us(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct * const packet = &flow->packet;
|
||||
|
||||
/* handshake packet */
|
||||
if (packet->payload_packet_len > 9 &&
|
||||
ntohl(*(u_int32_t*)&packet->payload[0]) == 0x08000100 &&
|
||||
ntohl(*(u_int32_t*)&packet->payload[4]) == 0x80d90203)
|
||||
{
|
||||
ndpi_int_among_us_add_connection(ndpi_struct, flow);
|
||||
} else {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
}
|
||||
|
||||
void init_among_us_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id,
|
||||
NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection(
|
||||
"AmongUs", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AMONG_US, ndpi_search_among_us, NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN, ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* amqp.c
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* applejuice.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* armagetron.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* flash.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* ftp.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* manolito.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* popo.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* secondlife.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* avast.c
|
||||
*
|
||||
* Copyright (C) 2012-21 - ntop.org
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This module 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.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ndpi_protocol_ids.h"
|
||||
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_AVAST_SECUREDNS
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "ndpi_api.h"
|
||||
|
||||
static void ndpi_int_avast_securedns_add_connection(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_AVAST_SECUREDNS, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
static void ndpi_search_avast_securedns(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct * packet = &flow->packet;
|
||||
|
||||
if (packet->payload_packet_len < 34 ||
|
||||
ntohl(get_u_int32_t(packet->payload, 11)) != 0x00013209 ||
|
||||
flow->packet_counter > 1)
|
||||
{
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strncasecmp((char *)&packet->payload[15], "securedns", strlen("securedns")) == 0)
|
||||
{
|
||||
ndpi_int_avast_securedns_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
void init_avast_securedns_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id,
|
||||
NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("AVAST SecureDNS",
|
||||
ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_AVAST_SECUREDNS,
|
||||
ndpi_search_avast_securedns,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* ayiya.c
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - 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
|
||||
@@ -57,7 +57,7 @@ void ndpi_search_ayiya(struct ndpi_detection_module_struct *ndpi_struct, struct
|
||||
u_int32_t epoch = ntohl(a->epoch), now;
|
||||
u_int32_t fiveyears = 86400 * 365 * 5;
|
||||
|
||||
now = flow->packet.current_time_ms;
|
||||
now = flow->packet.tick_timestamp;
|
||||
|
||||
if((epoch >= (now - fiveyears)) && (epoch <= (now+86400 /* 1 day */))) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found AYIYA\n");
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* battlefield.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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"
|
||||
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_BATTLEFIELD
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
static void ndpi_int_battlefield_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BATTLEFIELD, NDPI_PROTOCOL_UNKNOWN);
|
||||
|
||||
if (src != NULL) {
|
||||
src->battlefield_ts = packet->tick_timestamp;
|
||||
}
|
||||
if (dst != NULL) {
|
||||
dst->battlefield_ts = packet->tick_timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
void ndpi_search_battlefield(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
|
||||
struct ndpi_id_struct *src = flow->src;
|
||||
struct ndpi_id_struct *dst = flow->dst;
|
||||
|
||||
if (packet->detected_protocol_stack[0] == NDPI_PROTOCOL_BATTLEFIELD) {
|
||||
if (src != NULL && ((u_int32_t)
|
||||
(packet->tick_timestamp - src->battlefield_ts) < ndpi_struct->battlefield_timeout)) {
|
||||
NDPI_LOG_DBG2(ndpi_struct,
|
||||
"battlefield : save src connection packet detected\n");
|
||||
src->battlefield_ts = packet->tick_timestamp;
|
||||
} else if (dst != NULL && ((u_int32_t)
|
||||
(packet->tick_timestamp - dst->battlefield_ts) < ndpi_struct->battlefield_timeout)) {
|
||||
NDPI_LOG_DBG2(ndpi_struct,
|
||||
"battlefield : save dst connection packet detected\n");
|
||||
dst->battlefield_ts = packet->tick_timestamp;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (NDPI_SRC_OR_DST_HAS_PROTOCOL(src, dst, NDPI_PROTOCOL_BATTLEFIELD)) {
|
||||
if (flow->l4.udp.battlefield_stage == 0 || flow->l4.udp.battlefield_stage == 1 + packet->packet_direction) {
|
||||
if (packet->payload_packet_len > 8 && get_u_int16_t(packet->payload, 0) == htons(0xfefd)) {
|
||||
flow->l4.udp.battlefield_msg_id = get_u_int32_t(packet->payload, 2);
|
||||
flow->l4.udp.battlefield_stage = 1 + packet->packet_direction;
|
||||
return;
|
||||
}
|
||||
} else if (flow->l4.udp.battlefield_stage == 2 - packet->packet_direction) {
|
||||
if (packet->payload_packet_len > 8 && get_u_int32_t(packet->payload, 0) == flow->l4.udp.battlefield_msg_id) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found Battlefield message and reply detected\n");
|
||||
ndpi_int_battlefield_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flow->l4.udp.battlefield_stage == 0) {
|
||||
if (packet->payload_packet_len == 46 && packet->payload[2] == 0 && packet->payload[4] == 0
|
||||
&& get_u_int32_t(packet->payload, 7) == htonl(0x98001100)) {
|
||||
flow->l4.udp.battlefield_stage = 3 + packet->packet_direction;
|
||||
return;
|
||||
}
|
||||
} else if (flow->l4.udp.battlefield_stage == 4 - packet->packet_direction) {
|
||||
if (packet->payload_packet_len == 7
|
||||
&& (packet->payload[0] == 0x02 || packet->payload[packet->payload_packet_len - 1] == 0xe0)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found Battlefield message and reply detected\n");
|
||||
ndpi_int_battlefield_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (packet->payload_packet_len == 18 && memcmp(&packet->payload[5], "battlefield2\x00", 13) == 0) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found Battlefield 2 hello packet detected\n");
|
||||
ndpi_int_battlefield_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
} else if (packet->payload_packet_len > 10 &&
|
||||
(memcmp(packet->payload, "\x11\x20\x00\x01\x00\x00\x50\xb9\x10\x11", 10) == 0
|
||||
|| memcmp(packet->payload, "\x11\x20\x00\x01\x00\x00\x30\xb9\x10\x11", 10) == 0
|
||||
|| memcmp(packet->payload, "\x11\x20\x00\x01\x00\x00\xa0\x98\x00\x11", 10) == 0)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found Battlefield safe pattern detected\n");
|
||||
ndpi_int_battlefield_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_battlefield_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("BattleField", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_BATTLEFIELD,
|
||||
ndpi_search_battlefield,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* bgp.c
|
||||
*
|
||||
* Copyright (C) 2016-21 - ntop.org
|
||||
* Copyright (C) 2016-20 - 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* bittorrent.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
@@ -43,7 +43,7 @@ struct ndpi_utp_hdr {
|
||||
u_int16_t sequence_nr, ack_nr;
|
||||
};
|
||||
|
||||
static u_int8_t is_utpv1_pkt(const u_int8_t *payload, u_int payload_len) {
|
||||
static u_int8_t is_utp_pkt(const u_int8_t *payload, u_int payload_len) {
|
||||
struct ndpi_utp_hdr *h = (struct ndpi_utp_hdr*)payload;
|
||||
|
||||
if(payload_len < sizeof(struct ndpi_utp_hdr)) return(0);
|
||||
@@ -52,9 +52,6 @@ static u_int8_t is_utpv1_pkt(const u_int8_t *payload, u_int payload_len) {
|
||||
if(h->next_extension > 2) return(0);
|
||||
if(ntohl(h->window_size) > 65565) return(0);
|
||||
|
||||
if((h->window_size == 0) && (payload_len != sizeof(struct ndpi_utp_hdr)))
|
||||
return(0);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
@@ -65,7 +62,7 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc
|
||||
{
|
||||
if(check_hash) {
|
||||
const char *bt_hash = NULL; /* 20 bytes long */
|
||||
|
||||
|
||||
if(bt_offset == -1) {
|
||||
const char *bt_magic = ndpi_strnstr((const char *)flow->packet.payload,
|
||||
"BitTorrent protocol", flow->packet.payload_packet_len);
|
||||
@@ -75,8 +72,7 @@ static void ndpi_add_connection_as_bittorrent(struct ndpi_detection_module_struc
|
||||
} else
|
||||
bt_hash = (const char*)&flow->packet.payload[28];
|
||||
|
||||
if(bt_hash && (flow->packet.payload_packet_len >= (20 + (bt_hash-(const char*)flow->packet.payload))))
|
||||
memcpy(flow->protos.bittorrent.hash, bt_hash, 20);
|
||||
if(bt_hash) memcpy(flow->protos.bittorrent.hash, bt_hash, 20);
|
||||
}
|
||||
|
||||
ndpi_int_change_protocol(ndpi_struct, flow, NDPI_PROTOCOL_BITTORRENT, NDPI_PROTOCOL_UNKNOWN);
|
||||
@@ -389,8 +385,10 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
|
||||
/* This is broadcast */
|
||||
if(packet->iph) {
|
||||
|
||||
if((packet->iph->saddr == 0xFFFFFFFF) || (packet->iph->daddr == 0xFFFFFFFF))
|
||||
goto exclude_bt;
|
||||
|
||||
|
||||
if(packet->udp) {
|
||||
u_int16_t sport = ntohs(packet->udp->source), dport = ntohs(packet->udp->dest);
|
||||
@@ -415,11 +413,9 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
char *bt_search = "BT-SEARCH * HTTP/1.1\r\n";
|
||||
|
||||
if((ntohs(packet->udp->source) < 1024)
|
||||
|| (ntohs(packet->udp->dest) < 1024) /* High ports only */) {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
|| (ntohs(packet->udp->dest) < 1024) /* High ports only */)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Check for uTP http://www.bittorrent.org/beps/bep_0029.html
|
||||
|
||||
@@ -436,10 +432,14 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
u_int8_t v0_extension = packet->payload[17];
|
||||
u_int8_t v0_flags = packet->payload[18];
|
||||
|
||||
if(is_utpv1_pkt(packet->payload, packet->payload_packet_len)) {
|
||||
bt_proto = ndpi_strnstr((const char *)&packet->payload[20], "BitTorrent protocol", packet->payload_packet_len-20);
|
||||
/* Check if this is protocol v1 */
|
||||
u_int8_t v1_version = packet->payload[0];
|
||||
u_int8_t v1_extension = packet->payload[1];
|
||||
u_int32_t v1_window_size = *((u_int32_t*)&packet->payload[12]);
|
||||
|
||||
if(is_utp_pkt(packet->payload, packet->payload_packet_len))
|
||||
goto bittorrent_found;
|
||||
} else if((packet->payload[0]== 0x60)
|
||||
else if((packet->payload[0]== 0x60)
|
||||
&& (packet->payload[1]== 0x0)
|
||||
&& (packet->payload[2]== 0x0)
|
||||
&& (packet->payload[3]== 0x0)
|
||||
@@ -447,7 +447,14 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
/* Heuristic */
|
||||
bt_proto = ndpi_strnstr((const char *)&packet->payload[20], "BitTorrent protocol", packet->payload_packet_len-20);
|
||||
goto bittorrent_found;
|
||||
/* CSGO/DOTA conflict */
|
||||
/* CSGO/DOTA conflict */
|
||||
} else if(flow->packet_counter > 8 && ((v1_version & 0x0f) == 1)
|
||||
&& ((v1_version >> 4) < 5 /* ST_NUM_STATES */)
|
||||
&& (v1_extension < 3 /* EXT_NUM_EXT */)
|
||||
&& (v1_window_size < 32768 /* 32k */)
|
||||
) {
|
||||
bt_proto = ndpi_strnstr((const char *)&packet->payload[20], "BitTorrent protocol", packet->payload_packet_len-20);
|
||||
goto bittorrent_found;
|
||||
} else if((v0_flags < 6 /* ST_NUM_STATES */) && (v0_extension < 3 /* EXT_NUM_EXT */)) {
|
||||
u_int32_t ts = ntohl(*((u_int32_t*)&(packet->payload[4])));
|
||||
u_int32_t now;
|
||||
@@ -464,7 +471,7 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
|
||||
flow->bittorrent_stage++;
|
||||
|
||||
if(flow->bittorrent_stage < 5) {
|
||||
if(flow->bittorrent_stage < 10) {
|
||||
/* We have detected bittorrent but we need to wait until we get a hash */
|
||||
|
||||
if(packet->payload_packet_len > 19 /* min size */) {
|
||||
@@ -489,15 +496,9 @@ void ndpi_search_bittorrent(struct ndpi_detection_module_struct *ndpi_struct, st
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
}
|
||||
|
||||
if(flow->packet_counter > 8) {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* btlib.c
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - ntop.org
|
||||
* Contributed by Vitaly Lavrov <vel21ripn@gmail.com>
|
||||
*
|
||||
* This file is part of nDPI, an open source deep packet inspection
|
||||
@@ -23,13 +23,12 @@
|
||||
*/
|
||||
|
||||
#include "ndpi_api.h"
|
||||
#if 0
|
||||
|
||||
#ifndef NDPI_NO_STD_INC
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#include <strings.h>
|
||||
|
||||
/*
|
||||
@@ -44,7 +43,6 @@ typedef unsigned long long int u_int64_t;
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "btlib.h"
|
||||
|
||||
|
||||
@@ -66,12 +66,10 @@ static void ndpi_search_setup_capwap(struct ndpi_detection_module_struct *ndpi_s
|
||||
else
|
||||
offset = 15, to_add = 17;
|
||||
|
||||
if (packet->payload_packet_len >= offset + sizeof(u_int16_t)) {
|
||||
msg_len = ntohs(*(u_int16_t*)&packet->payload[offset]);
|
||||
msg_len = ntohs(*(u_int16_t*)&packet->payload[offset]);
|
||||
|
||||
if((msg_len+to_add) == packet->payload_packet_len)
|
||||
goto capwap_found;
|
||||
}
|
||||
if((msg_len+to_add) == packet->payload_packet_len)
|
||||
goto capwap_found;
|
||||
}
|
||||
|
||||
if(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* checkmk.c
|
||||
*
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
@@ -1,22 +1,6 @@
|
||||
/*
|
||||
* ciscovpn.c
|
||||
*
|
||||
* Copyright (C) 2013-21 - 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/>.
|
||||
*
|
||||
* Dissector developed by Remy Mudingay <mudingay@ill.fr>
|
||||
* Copyright (C) 2013 by Remy Mudingay <mudingay@ill.fr>
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -26,15 +10,12 @@
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
/* ****************************************************************** */
|
||||
|
||||
static void ndpi_int_ciscovpn_add_connection(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CISCOVPN, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
/* ****************************************************************** */
|
||||
|
||||
void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
@@ -48,7 +29,6 @@ void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
tsport = ntohs(packet->tcp->source), tdport = ntohs(packet->tcp->dest);
|
||||
NDPI_LOG_DBG2(ndpi_struct, "calculated CISCOVPN over tcp ports\n");
|
||||
}
|
||||
|
||||
if(packet->udp != NULL) {
|
||||
usport = ntohs(packet->udp->source), udport = ntohs(packet->udp->dest);
|
||||
NDPI_LOG_DBG2(ndpi_struct, "calculated CISCOVPN over udp ports\n");
|
||||
@@ -56,39 +36,39 @@ void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
if((tdport == 10000 && tsport == 10000) ||
|
||||
((tsport == 443 || tdport == 443) &&
|
||||
(packet->payload_packet_len >= 4) &&
|
||||
(packet->payload[0] == 0x17 /* TLS Application Data */ &&
|
||||
(packet->payload[0] == 0x17 &&
|
||||
packet->payload[1] == 0x01 &&
|
||||
packet->payload[2] == 0x00 &&
|
||||
packet->payload[3] == 0x00)
|
||||
)
|
||||
) {
|
||||
/* This is a good query 17010000*/
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCOVPN\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
/* Code disabled as it is too generic and it can lead to false positives */
|
||||
)
|
||||
|
||||
{
|
||||
/* This is a good query 17010000*/
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCOVPN\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
else if(((tsport == 443 || tdport == 443) ||
|
||||
(tsport == 80 || tdport == 80)) &&
|
||||
(packet->payload_packet_len >= 5) &&
|
||||
((packet->payload[0] == 0x17 /* TLS Application Data */ &&
|
||||
packet->payload[1] == 0x03 && packet->payload[2] == 0x03 && /* TLS 1.2 */
|
||||
packet->payload[3] == 0x00 && packet->payload[4] == 0x3A /* Length */)))
|
||||
(tsport == 80 || tdport == 80)) &&
|
||||
((packet->payload[0] == 0x17 &&
|
||||
packet->payload[1] == 0x03 &&
|
||||
packet->payload[2] == 0x03 &&
|
||||
packet->payload[3] == 0x00 &&
|
||||
packet->payload[4] == 0x3A)))
|
||||
{
|
||||
/* TLS signature of Cisco AnyConnect 0X170303003A */
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCO Anyconnect VPN\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
else if(((tsport == 8009 || tdport == 8009) ||
|
||||
(tsport == 8008 || tdport == 8008)) &&
|
||||
(packet->payload_packet_len >= 5) &&
|
||||
((packet->payload[0] == 0x17 /* TLS Application Data */ &&
|
||||
packet->payload[1] == 0x03 && packet->payload[2] == 0x03 && /* TLS 1.2 */
|
||||
packet->payload[3] == 0x00 && packet->payload[4] == 0x69 /* Length */)))
|
||||
(tsport == 8008 || tdport == 8008)) &&
|
||||
((packet->payload[0] == 0x17 &&
|
||||
packet->payload[1] == 0x03 &&
|
||||
packet->payload[2] == 0x03 &&
|
||||
packet->payload[3] == 0x00 &&
|
||||
packet->payload[4] == 0x69)))
|
||||
{
|
||||
/* TCP signature of Cisco AnyConnect 0X1703030069 */
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCO Anyconnect VPN\n");
|
||||
@@ -99,7 +79,6 @@ void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
(
|
||||
(usport == 10000 && udport == 10000)
|
||||
&&
|
||||
(packet->payload_packet_len >= 4) &&
|
||||
(packet->payload[0] == 0xfe &&
|
||||
packet->payload[1] == 0x57 &&
|
||||
packet->payload[2] == 0x7e &&
|
||||
@@ -107,29 +86,15 @@ void ndpi_search_ciscovpn(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
)
|
||||
)
|
||||
{
|
||||
|
||||
|
||||
/* This is a good query fe577e2b */
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCOVPN\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
} else if(
|
||||
(
|
||||
(usport == 443 || udport == 443)
|
||||
&&
|
||||
(packet->payload_packet_len >= 5) &&
|
||||
(packet->payload[0] == 0x17 /* TLS Application Data */ &&
|
||||
packet->payload[1] == 0x01 &&
|
||||
packet->payload[2] == 0x00 &&
|
||||
packet->payload[3] == 0x00 &&
|
||||
packet->payload[4] == 0x01)
|
||||
)
|
||||
)
|
||||
{
|
||||
NDPI_LOG_INFO(ndpi_struct, "found CISCOVPN\n");
|
||||
ndpi_int_ciscovpn_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
}
|
||||
|
||||
if(flow->num_processed_pkts > 5)
|
||||
} else {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* citrix.c
|
||||
*
|
||||
* Copyright (C) 2012-21 - ntop.org
|
||||
* Copyright (C) 2012-20 - 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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* collectd.c
|
||||
*
|
||||
* Copyright (C) 2014-21 - ntop.org
|
||||
* Copyright (C) 2014-20 - 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
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* qq.c
|
||||
*
|
||||
* Copyright (C) 2011-21 - 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"
|
||||
|
||||
/* CPHA - CheckPoint High Availability Protocol */
|
||||
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_CPHA
|
||||
|
||||
#include "ndpi_api.h"
|
||||
|
||||
|
||||
void ndpi_search_cpha(struct ndpi_detection_module_struct *ndpi_struct, struct ndpi_flow_struct *flow) {
|
||||
struct ndpi_packet_struct *packet = &flow->packet;
|
||||
const u_int16_t cpha_port = htons(8116);
|
||||
|
||||
NDPI_LOG_DBG(ndpi_struct, "search CPHA\n");
|
||||
|
||||
if((packet->payload_packet_len > 20)
|
||||
&& (packet->payload[0] == 0x1a)
|
||||
&& (packet->payload[1] == 0x90)
|
||||
&& packet->udp
|
||||
&& packet->iph
|
||||
&& (packet->udp->source == cpha_port)
|
||||
&& (packet->udp->dest == cpha_port)
|
||||
&& packet->iph->saddr == 0 /* 0.0.0.0 */
|
||||
) {
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CPHA, NDPI_PROTOCOL_UNKNOWN);
|
||||
} else
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
|
||||
void init_cpha_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id,
|
||||
NDPI_PROTOCOL_BITMASK *detection_bitmask) {
|
||||
ndpi_set_bitmask_protocol_detection("CPHA", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CPHA,
|
||||
ndpi_search_cpha,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* crossfire.c
|
||||
*
|
||||
* Copyright (C) 2012-21 - ntop.org
|
||||
* Copyright (C) 2012-20 - 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
|
||||
|
||||
+32
-47
@@ -29,8 +29,8 @@
|
||||
void ndpi_search_csgo(struct ndpi_detection_module_struct* ndpi_struct, struct ndpi_flow_struct* flow) {
|
||||
struct ndpi_packet_struct* packet = &flow->packet;
|
||||
|
||||
if(packet->udp != NULL) {
|
||||
if(packet->payload_packet_len < sizeof(uint32_t)) {
|
||||
if (packet->udp != NULL) {
|
||||
if (packet->payload_packet_len < sizeof(uint32_t)) {
|
||||
NDPI_LOG_DBG2(ndpi_struct, "Short csgo packet\n");
|
||||
return;
|
||||
}
|
||||
@@ -38,65 +38,58 @@ void ndpi_search_csgo(struct ndpi_detection_module_struct* ndpi_struct, struct n
|
||||
uint32_t w = htonl(get_u_int32_t(packet->payload, 0));
|
||||
NDPI_LOG_DBG2(ndpi_struct, "CSGO: word %08x\n", w);
|
||||
|
||||
if(!flow->csgo_state && packet->payload_packet_len == 23 && w == 0xfffffffful) {
|
||||
if(!memcmp(packet->payload + 5, "connect0x", 9)) {
|
||||
if (!flow->csgo_state && packet->payload_packet_len == 23 && w == 0xfffffffful) {
|
||||
if (!memcmp(packet->payload + 5, "connect0x", 9)) {
|
||||
flow->csgo_state++;
|
||||
memcpy(flow->csgo_strid, packet->payload + 5, 18);
|
||||
NDPI_LOG_DBG2(ndpi_struct, "Found csgo connect0x\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(flow->csgo_state == 1 && packet->payload_packet_len >= 42 && w == 0xfffffffful) {
|
||||
if(!memcmp(packet->payload + 24, flow->csgo_strid, 18)) {
|
||||
if (flow->csgo_state == 1 && packet->payload_packet_len >= 42 && w == 0xfffffffful) {
|
||||
if (!memcmp(packet->payload + 24, flow->csgo_strid, 18)) {
|
||||
flow->csgo_state++;
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo connect0x reply\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(packet->payload_packet_len == 8 && ( w == 0x3a180000 || w == 0x39180000) ) {
|
||||
if (packet->payload_packet_len == 8 && ( w == 0x3a180000 || w == 0x39180000) ) {
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo udp 8b\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
if(packet->payload_packet_len >= 36 && w == 0x56533031ul) {
|
||||
if (packet->payload_packet_len >= 36 && w == 0x56533031ul) {
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo udp\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
if(packet->payload_packet_len >= 36 && w == 0x01007364) {
|
||||
if (packet->payload_packet_len >= 36 && w == 0x01007364) {
|
||||
uint32_t w2 = htonl(get_u_int32_t(packet->payload, 4));
|
||||
if(w2 == 0x70696e67) {
|
||||
if (w2 == 0x70696e67) {
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo udp ping\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(flow->csgo_s2 < 3 && (w & 0xffff0000ul) == 0x0d1d0000) {
|
||||
if (flow->csgo_s2 < 3 && (w & 0xffff0000ul) == 0x0d1d0000) {
|
||||
uint32_t w2 = get_u_int32_t(packet->payload, 2);
|
||||
if(packet->payload_packet_len == 13) {
|
||||
if(!flow->csgo_s2) {
|
||||
if (packet->payload_packet_len == 13) {
|
||||
if (!flow->csgo_s2) {
|
||||
flow->csgo_id2 = w2;
|
||||
flow->csgo_s2 = 1;
|
||||
NDPI_LOG_DBG2( ndpi_struct, "Found csgo udp 0d1d step1\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if(flow->csgo_s2 == 1 && flow->csgo_id2 == w2) {
|
||||
if (flow->csgo_s2 == 1 && flow->csgo_id2 == w2) {
|
||||
NDPI_LOG_DBG2( ndpi_struct, "Found csgo udp 0d1d step1 DUP\n");
|
||||
return;
|
||||
}
|
||||
flow->csgo_s2 = 3;
|
||||
return;
|
||||
}
|
||||
|
||||
if(packet->payload_packet_len == 15) {
|
||||
if(flow->csgo_s2 == 1 && flow->csgo_id2 == w2) {
|
||||
if (packet->payload_packet_len == 15) {
|
||||
if (flow->csgo_s2 == 1 && flow->csgo_id2 == w2) {
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo udp 0d1d\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
@@ -104,39 +97,31 @@ void ndpi_search_csgo(struct ndpi_detection_module_struct* ndpi_struct, struct n
|
||||
}
|
||||
flow->csgo_s2 = 3;
|
||||
}
|
||||
|
||||
if(packet->payload_packet_len >= 140 && (w == 0x02124c6c || w == 0x02125c6c) &&
|
||||
if (packet->payload_packet_len >= 140 && (w == 0x02124c6c || w == 0x02125c6c) &&
|
||||
!memcmp(&packet->payload[3], "lta\000mob\000tpc\000bhj\000bxd\000tae\000urg\000gkh\000", 32)) {
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo dictionary udp\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo dictionary udp\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
if(packet->payload_packet_len >= 33 && packet->iph && packet->iph->daddr == 0xffffffff &&
|
||||
if (packet->payload_packet_len >= 33 && packet->iph && packet->iph->daddr == 0xffffffff &&
|
||||
!memcmp(&packet->payload[17], "LanSearch", 9)) {
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo LanSearch udp\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
|
||||
if(w == 0) {
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
return;
|
||||
NDPI_LOG_INFO( ndpi_struct, "found csgo LanSearch udp\n");
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_CSGO, NDPI_PROTOCOL_UNKNOWN);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(flow->packet_counter > 5)
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
if (flow->packet_counter > 20)
|
||||
NDPI_EXCLUDE_PROTO(ndpi_struct, flow);
|
||||
}
|
||||
|
||||
void init_csgo_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("CSGO", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CSGO,
|
||||
ndpi_search_csgo,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
ndpi_set_bitmask_protocol_detection("CSGO", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_CSGO,
|
||||
ndpi_search_csgo,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_DCERPC
|
||||
|
||||
#include "ndpi_api.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
static void ndpi_int_dcerpc_add_connection(struct ndpi_detection_module_struct
|
||||
*ndpi_struct, struct ndpi_flow_struct *flow)
|
||||
@@ -34,55 +34,18 @@ static void ndpi_int_dcerpc_add_connection(struct ndpi_detection_module_struct
|
||||
ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_DCERPC, NDPI_PROTOCOL_UNKNOWN);
|
||||
}
|
||||
|
||||
bool is_connection_oriented_dcerpc(struct ndpi_packet_struct *packet, struct ndpi_flow_struct *flow)
|
||||
void ndpi_search_dcerpc(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 DCERPC\n");
|
||||
|
||||
if((packet->tcp != NULL)
|
||||
&& (packet->payload_packet_len >= 64)
|
||||
&& (packet->payload[0] == 0x05) /* version 5 */
|
||||
&& (packet->payload[2] < 16) /* Packet type */
|
||||
&& (((packet->payload[9]<<8) | packet->payload[8]) == packet->payload_packet_len) /* Packet Length */
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_connectionless_dcerpc(struct ndpi_packet_struct *packet, struct ndpi_flow_struct *flow)
|
||||
{
|
||||
u_int16_t fragment_len;
|
||||
|
||||
if (packet->udp == NULL)
|
||||
return false;
|
||||
if (packet->payload_packet_len < 80)
|
||||
return false;
|
||||
if (packet->payload[0] != 0x04) /* type must be equal to 4 */
|
||||
return false;
|
||||
if (packet->payload[1] > 10) /* must be <= CANCEL ACK or it's not connectionless DCE/RPC */
|
||||
return false;
|
||||
if (packet->payload[3] & 0xFC) /* flags2: bit 3:8 are reserved for future use and must be set to 0 */
|
||||
return false;
|
||||
if (packet->payload[4] & 0xEE) /* neither big endian nor little endian */
|
||||
return false;
|
||||
if (packet->payload[5] > 3) /* invalid floating point type */
|
||||
return false;
|
||||
|
||||
if(packet->payload[4] == 0x10)
|
||||
fragment_len = (packet->payload[75] << 8) + packet->payload[74]; /* Big endian */
|
||||
else
|
||||
fragment_len = (packet->payload[74] << 8) + packet->payload[75]; /* Little endian */
|
||||
|
||||
if(packet->payload_packet_len != (fragment_len+76 /* offset */ + 4 /* rest of the packet */))
|
||||
return false; /* Too short or too long, bot RPC */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ndpi_search_dcerpc(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 DCERPC\n");
|
||||
if (is_connection_oriented_dcerpc(packet, flow) || is_connectionless_dcerpc(packet, flow)) {
|
||||
NDPI_LOG_INFO(ndpi_struct, "found DCERPC\n");
|
||||
ndpi_int_dcerpc_add_connection(ndpi_struct, flow);
|
||||
return;
|
||||
@@ -98,8 +61,9 @@ void init_dcerpc_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_i
|
||||
ndpi_set_bitmask_protocol_detection("DCE_RPC", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DCERPC,
|
||||
ndpi_search_dcerpc,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION,
|
||||
SAVE_DETECTION_BITMASK_AS_UNKNOWN,
|
||||
ADD_TO_DETECTION_BITMASK);
|
||||
*id += 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* dhcp.c
|
||||
*
|
||||
* Copyright (C) 2016-21 - ntop.org
|
||||
* Copyright (C) 2016-20 - 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
|
||||
@@ -66,7 +66,7 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
|
||||
/* this detection also works for asymmetric dhcp traffic */
|
||||
|
||||
/* check standard DHCP 0.0.0.0:68 -> 255.255.255.255:67 */
|
||||
/*check standard DHCP 0.0.0.0:68 -> 255.255.255.255:67 */
|
||||
if(packet->udp) {
|
||||
dhcp_packet_t *dhcp = (dhcp_packet_t*)packet->payload;
|
||||
|
||||
@@ -89,10 +89,8 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
u_int8_t len = ndpi_min(dhcp->options[i+1] /* len as found in the packet */,
|
||||
dhcp_options_size - (i+2) /* 1 for the type and 1 for the value */);
|
||||
|
||||
if(len == 0)
|
||||
break;
|
||||
|
||||
|
||||
if(len == 0) break;
|
||||
|
||||
#ifdef DHCP_DEBUG
|
||||
NDPI_LOG_DBG2(ndpi_struct, "[DHCP] Id=%d [len=%d]\n", id, len);
|
||||
#endif
|
||||
@@ -152,8 +150,8 @@ void ndpi_search_dhcp_udp(struct ndpi_detection_module_struct *ndpi_struct, stru
|
||||
}
|
||||
|
||||
|
||||
void init_dhcp_dissector(struct ndpi_detection_module_struct *ndpi_struct,
|
||||
u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask) {
|
||||
void init_dhcp_dissector(struct ndpi_detection_module_struct *ndpi_struct, u_int32_t *id, NDPI_PROTOCOL_BITMASK *detection_bitmask)
|
||||
{
|
||||
ndpi_set_bitmask_protocol_detection("DHCP", ndpi_struct, detection_bitmask, *id,
|
||||
NDPI_PROTOCOL_DHCP,
|
||||
ndpi_search_dhcp_udp,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* dhcpv6.c
|
||||
*
|
||||
* Copyright (C) 2009-11 - ipoque GmbH
|
||||
* Copyright (C) 2011-21 - ntop.org
|
||||
* Copyright (C) 2009-2011 by ipoque GmbH
|
||||
* Copyright (C) 2011-20 - 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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user