mirror of
https://github.com/emanuele-f/PCAPdroid.git
synced 2026-05-08 21:12:26 +00:00
Update dependencies
- libpcap 1.10.1 - nDPI 4.0 - gradle, ndk, build tools
This commit is contained in:
+3
-3
@@ -2,8 +2,8 @@ apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
ndkVersion "22.1.7171670"
|
||||
buildToolsVersion "31.0.0"
|
||||
ndkVersion "23.0.7599858"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.emanuelef.remote_capture"
|
||||
@@ -49,7 +49,7 @@ android {
|
||||
dependencies {
|
||||
// AndroidX
|
||||
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||
implementation 'androidx.fragment:fragment:1.3.6'
|
||||
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
|
||||
implementation 'androidx.preference:preference:1.1.1'
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
<activity
|
||||
android:name=".activities.MainActivity"
|
||||
android:theme="@style/AppTheme.SplashScreen"
|
||||
android:launchMode="singleTop">
|
||||
android:launchMode="singleTop"
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
@@ -78,7 +79,8 @@
|
||||
|
||||
<service
|
||||
android:name=".CaptureService"
|
||||
android:permission="android.permission.BIND_VPN_SERVICE">
|
||||
android:permission="android.permission.BIND_VPN_SERVICE"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.net.VpnService" />
|
||||
</intent-filter>
|
||||
|
||||
@@ -418,7 +418,7 @@ static int open_interface(pcapd_iface_t *iface, pcapd_runtime_t *rt, const char
|
||||
|
||||
if(!pd) {
|
||||
log_i("pcap_open_offline(%s) failed: %s", READ_FROM_PCAP, errbuf);
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
strcpy(ifname, "pcap");
|
||||
|
||||
@@ -17,9 +17,10 @@ AUX_SOURCE_DIRECTORY(${NDPI_ROOT}/src/lib ndpiSources)
|
||||
AUX_SOURCE_DIRECTORY(${NDPI_ROOT}/src/lib/third_party/src ndpiSources)
|
||||
AUX_SOURCE_DIRECTORY(${NDPI_ROOT}/src/lib/protocols ndpiSources)
|
||||
|
||||
configure_file(${NDPI_ROOT}/Android/ndpi_api.h ${NDPI_ROOT}/src/include/ndpi_api.h)
|
||||
configure_file(${NDPI_ROOT}/Android/ndpi_config.h ${NDPI_ROOT}/src/include/ndpi_config.h)
|
||||
configure_file(${NDPI_ROOT}/Android/ndpi_define.h ${NDPI_ROOT}/src/include/ndpi_define.h)
|
||||
set(NDPI_GEN ${ROOTDIR}/generated/nDPI)
|
||||
configure_file(${NDPI_GEN}/ndpi_api.h ${NDPI_ROOT}/src/include/ndpi_api.h)
|
||||
configure_file(${NDPI_GEN}/ndpi_config.h ${NDPI_ROOT}/src/include/ndpi_config.h)
|
||||
configure_file(${NDPI_GEN}/ndpi_define.h ${NDPI_ROOT}/src/include/ndpi_define.h)
|
||||
|
||||
ADD_LIBRARY(ndpi SHARED ${ndpiSources} ${NDPI_ROOT}/src/include/ndpi_api.h)
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ static bool check_dns_req_allowed(struct vpnproxy_data *proxy, zdtun_conn_t *con
|
||||
|
||||
if(!is_dns_server) {
|
||||
// try with known DNS servers
|
||||
u_int32_t matched = 0;
|
||||
u_int64_t matched = 0;
|
||||
ndpi_ip_addr_t addr = {0};
|
||||
|
||||
if(tuple->ipver == 4)
|
||||
|
||||
@@ -45,15 +45,12 @@ void init_protocols_bitmask(ndpi_protocol_bitmask_struct_t *b) {
|
||||
NDPI_SET(b, NDPI_PROTOCOL_MYSQL);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_MAIL_POPS);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_MAIL_SMTPS);
|
||||
//NDPI_SET(b, NDPI_PROTOCOL_DTLS);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_DTLS);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_BITTORRENT);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_SMBV23);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_RTSP);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_MAIL_IMAPS);
|
||||
//NDPI_SET(b, NDPI_PROTOCOL_MONGODB);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_IRC);
|
||||
//NDPI_SET(b, NDPI_PROTOCOL_JABBER);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_UNENCRYPTED_JABBER);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_NATS);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_TELNET);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_STUN);
|
||||
@@ -95,4 +92,5 @@ void init_protocols_bitmask(ndpi_protocol_bitmask_struct_t *b) {
|
||||
NDPI_SET(b, NDPI_PROTOCOL_RX);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_GIT);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_WEBSOCKET);
|
||||
NDPI_SET(b, NDPI_PROTOCOL_Z3950);
|
||||
}
|
||||
@@ -272,7 +272,7 @@ struct ndpi_detection_module_struct* init_ndpi() {
|
||||
NDPI_BITMASK_SET_ALL(protocols);
|
||||
|
||||
ndpi_set_protocol_detection_bitmask2(ndpi, &protocols);
|
||||
ndpi_finalize_initalization(ndpi);
|
||||
ndpi_finalize_initialization(ndpi);
|
||||
|
||||
return(ndpi);
|
||||
}
|
||||
@@ -422,11 +422,11 @@ void conn_end_ndpi_detection(conn_data_t *data, vpnproxy_data_t *proxy, const zd
|
||||
|
||||
break;
|
||||
case NDPI_PROTOCOL_TLS:
|
||||
if(data->ndpi_flow->protos.stun_ssl.ssl.client_requested_server_name[0]) {
|
||||
if(data->ndpi_flow->protos.tls_quic_stun.tls_quic.client_requested_server_name[0]) {
|
||||
if(data->info)
|
||||
free(data->info);
|
||||
|
||||
data->info = strndup(data->ndpi_flow->protos.stun_ssl.ssl.client_requested_server_name, 256);
|
||||
data->info = strndup(data->ndpi_flow->protos.tls_quic_stun.tls_quic.client_requested_server_name, 256);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.2.1'
|
||||
classpath 'com.android.tools.build:gradle:7.0.3'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
The subfolders in this directory contain pre-generated autotools files. Using these files removes the need to install autotools and allows to build PCAPdroid in Windows.
|
||||
To update the files, run `./refresh.sh` in this folder.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,119 @@
|
||||
/* src/include/ndpi_config.h. Generated from ndpi_config.h.in by configure. */
|
||||
/* src/include/ndpi_config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <json.h> header file. */
|
||||
/* #undef HAVE_JSON_H */
|
||||
|
||||
/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
|
||||
/* #undef HAVE_LIBGCRYPT */
|
||||
|
||||
/* Define to 1 if you have the `gpg-error' library (-lgpg-error). */
|
||||
/* #undef HAVE_LIBGPG_ERROR */
|
||||
|
||||
/* Define to 1 if you have the `maxminddb' library (-lmaxminddb). */
|
||||
/* #undef HAVE_LIBMAXMINDDB */
|
||||
|
||||
/* MaxMind DB support */
|
||||
/* #undef HAVE_MAXMINDDB */
|
||||
|
||||
/* Define to 1 if you have the <maxminddb.h> header file. */
|
||||
/* #undef HAVE_MAXMINDDB_H */
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* libpcre(-dev) is present */
|
||||
/* #undef HAVE_PCRE */
|
||||
|
||||
/* Define if you have POSIX threads libraries and header files. */
|
||||
#define HAVE_PTHREAD 1
|
||||
|
||||
/* Have PTHREAD_PRIO_INHERIT. */
|
||||
#define HAVE_PTHREAD_PRIO_INHERIT 1
|
||||
|
||||
/* libc has pthread_setaffinity_np */
|
||||
/* #undef HAVE_PTHREAD_SETAFFINITY_NP */
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#define HAVE_STDIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Enable ndpi_debug_messages */
|
||||
/* #undef NDPI_ENABLE_DEBUG_MESSAGES */
|
||||
|
||||
/* Last GIT change */
|
||||
#define NDPI_GIT_DATE "Thu Oct 14 14:31:59 2021 +0200"
|
||||
|
||||
/* GIT Release */
|
||||
#define NDPI_GIT_RELEASE "4.0.0-3212-f732a761"
|
||||
|
||||
/* nDPI major release */
|
||||
#define NDPI_MAJOR_RELEASE "4"
|
||||
|
||||
/* nDPI minor release */
|
||||
#define NDPI_MINOR_RELEASE "0"
|
||||
|
||||
/* nDPI patch level */
|
||||
#define NDPI_PATCH_LEVEL "0"
|
||||
|
||||
/* Name of package */
|
||||
/* #undef PACKAGE */
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
/* #undef PACKAGE_BUGREPORT */
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
/* #undef PACKAGE_NAME */
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
/* #undef PACKAGE_STRING */
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
/* #undef PACKAGE_TARNAME */
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
/* #undef PACKAGE_URL */
|
||||
|
||||
/* Define to the version of this package. */
|
||||
/* #undef PACKAGE_VERSION */
|
||||
|
||||
/* Define to necessary symbol if this constant uses a non-standard name on
|
||||
your system. */
|
||||
/* #undef PTHREAD_CREATE_JOINABLE */
|
||||
|
||||
/* Define to 1 if all of the C90 standard headers exist (not just the ones
|
||||
required in a freestanding environment). This macro is provided for
|
||||
backward compatibility; new code need not use it. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Version number of package */
|
||||
/* #undef VERSION */
|
||||
@@ -0,0 +1,385 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2011-17 - 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_DEFINE_INCLUDE_FILE__
|
||||
#define __NDPI_DEFINE_INCLUDE_FILE__
|
||||
|
||||
/*
|
||||
gcc -E -dM - < /dev/null |grep ENDIAN
|
||||
*/
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||
#include <machine/endian.h>
|
||||
#endif
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
#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 */
|
||||
#endif/* __OPENBSD__ */
|
||||
|
||||
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__
|
||||
#endif
|
||||
#else
|
||||
#ifndef __BIG_ENDIAN__
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef __LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__ 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !(defined(__LITTLE_ENDIAN__) || defined(__BIG_ENDIAN__))
|
||||
#if defined(__mips__)
|
||||
#undef __LITTLE_ENDIAN__
|
||||
#undef __LITTLE_ENDIAN
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
|
||||
/* Everything else */
|
||||
#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__))
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
#define __LITTLE_ENDIAN__
|
||||
#else
|
||||
#define __BIG_ENDIAN__
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define NDPI_USE_ASYMMETRIC_DETECTION 0
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_SIZE u_int32_t
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_IP (1<<0)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP (1<<1)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_INT_UDP (1<<2)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP_OR_UDP (1<<3)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD (1<<4)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION (1<<5)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_IPV6 (1<<6)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6 (1<<7)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_COMPLETE_TRAFFIC (1<<8)
|
||||
/* now combined detections */
|
||||
|
||||
/* v4 */
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP (NDPI_SELECTION_BITMASK_PROTOCOL_IP | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IP | NDPI_SELECTION_BITMASK_PROTOCOL_INT_UDP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IP | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP_OR_UDP)
|
||||
|
||||
/* v6 */
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_UDP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP_OR_UDP)
|
||||
|
||||
/* v4 or v6 */
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_UDP)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP (NDPI_SELECTION_BITMASK_PROTOCOL_IPV4_OR_IPV6 | NDPI_SELECTION_BITMASK_PROTOCOL_INT_TCP_OR_UDP)
|
||||
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
/* does it make sense to talk about udp with payload ??? have you ever seen empty udp packets ? */
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V6_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
#define NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP_WITH_PAYLOAD_WITHOUT_RETRANSMISSION (NDPI_SELECTION_BITMASK_PROTOCOL_V4_V6_TCP_OR_UDP | NDPI_SELECTION_BITMASK_PROTOCOL_NO_TCP_RETRANSMISSION | NDPI_SELECTION_BITMASK_PROTOCOL_HAS_PAYLOAD)
|
||||
|
||||
/* safe src/dst protocol check macros... */
|
||||
|
||||
#define NDPI_SRC_HAS_PROTOCOL(src,protocol) ((src) != NULL && NDPI_COMPARE_PROTOCOL_TO_BITMASK((src)->detected_protocol_bitmask,(protocol)) != 0)
|
||||
|
||||
#define NDPI_DST_HAS_PROTOCOL(dst,protocol) ((dst) != NULL && NDPI_COMPARE_PROTOCOL_TO_BITMASK((dst)->detected_protocol_bitmask,(protocol)) != 0)
|
||||
|
||||
#define NDPI_SRC_OR_DST_HAS_PROTOCOL(src,dst,protocol) (NDPI_SRC_HAS_PROTOCOL(src,protocol) || NDPI_SRC_HAS_PROTOCOL(dst,protocol))
|
||||
|
||||
/**
|
||||
* convenience macro to check for excluded protocol
|
||||
* a protocol is excluded if the flow is known and either the protocol is not detected at all
|
||||
* or the excluded bitmask contains the protocol
|
||||
*/
|
||||
#define NDPI_FLOW_PROTOCOL_EXCLUDED(ndpi_struct,flow,protocol) ((flow) != NULL && \
|
||||
( NDPI_COMPARE_PROTOCOL_TO_BITMASK((ndpi_struct)->detection_bitmask, (protocol)) == 0 || \
|
||||
NDPI_COMPARE_PROTOCOL_TO_BITMASK((flow)->excluded_protocol_bitmask, (protocol)) != 0 ) )
|
||||
|
||||
/* misc definitions */
|
||||
#define NDPI_DEFAULT_MAX_TCP_RETRANSMISSION_WINDOW_SIZE 0x10000
|
||||
|
||||
|
||||
/* TODO: rebuild all memory areas to have a more aligned memory block here */
|
||||
|
||||
/* DEFINITION OF MAX LINE NUMBERS FOR line parse algorithm */
|
||||
#define NDPI_MAX_PARSE_LINES_PER_PACKET 64
|
||||
|
||||
#define MAX_PACKET_COUNTER 65000
|
||||
#define MAX_DEFAULT_PORTS 5
|
||||
|
||||
#define NDPI_DIRECTCONNECT_CONNECTION_IP_TICK_TIMEOUT 600
|
||||
#define NDPI_IRC_CONNECTION_TIMEOUT 120
|
||||
#define NDPI_GNUTELLA_CONNECTION_TIMEOUT 60
|
||||
#define NDPI_BATTLEFIELD_CONNECTION_TIMEOUT 60
|
||||
#define NDPI_THUNDER_CONNECTION_TIMEOUT 30
|
||||
#define NDPI_RTSP_CONNECTION_TIMEOUT 5
|
||||
#define NDPI_TVANTS_CONNECTION_TIMEOUT 5
|
||||
#define NDPI_YAHOO_DETECT_HTTP_CONNECTIONS 1
|
||||
#define NDPI_YAHOO_LAN_VIDEO_TIMEOUT 30
|
||||
#define NDPI_ZATTOO_CONNECTION_TIMEOUT 120
|
||||
#define NDPI_ZATTOO_FLASH_TIMEOUT 5
|
||||
#define NDPI_JABBER_STUN_TIMEOUT 30
|
||||
#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...) \
|
||||
{ \
|
||||
struct ndpi_detection_module_struct *mod = (struct ndpi_detection_module_struct*) m; \
|
||||
if(mod != NULL && mod->ndpi_debug_printf != NULL) \
|
||||
(*(mod->ndpi_debug_printf))(proto, mod, log_level, __FILE__, __FUNCTION__, __LINE__, args); \
|
||||
}
|
||||
|
||||
/* We must define NDPI_CURRENT_PROTO before include ndpi_main.h !!!
|
||||
*
|
||||
* #include "ndpi_protocol_ids.h"
|
||||
* #define NDPI_CURRENT_PROTO NDPI_PROTOCOL_XXXX
|
||||
* #include "ndpi_api.h"
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NDPI_CURRENT_PROTO
|
||||
#define NDPI_CURRENT_PROTO NDPI_PROTOCOL_UNKNOWN
|
||||
#endif
|
||||
|
||||
#define NDPI_LOG_ERR(mod, args...) \
|
||||
if(mod && mod->ndpi_log_level >= NDPI_LOG_ERROR) { \
|
||||
if(mod != NULL && mod->ndpi_debug_printf != NULL) \
|
||||
(*(mod->ndpi_debug_printf))(NDPI_CURRENT_PROTO, mod, NDPI_LOG_ERROR , __FILE__, __FUNCTION__, __LINE__, args); \
|
||||
}
|
||||
|
||||
#define NDPI_LOG_INFO(mod, args...) \
|
||||
if(mod && mod->ndpi_log_level >= NDPI_LOG_TRACE) { \
|
||||
if(mod != NULL && mod->ndpi_debug_printf != NULL) \
|
||||
(*(mod->ndpi_debug_printf))(NDPI_CURRENT_PROTO, mod, NDPI_LOG_TRACE , __FILE__, __FUNCTION__, __LINE__, args); \
|
||||
}
|
||||
|
||||
#define NDPI_LOG_DBG(mod, args...) \
|
||||
if(mod && mod->ndpi_log_level >= NDPI_LOG_DEBUG) { \
|
||||
if(mod != NULL && mod->ndpi_debug_printf != NULL) \
|
||||
(*(mod->ndpi_debug_printf))(NDPI_CURRENT_PROTO, mod, NDPI_LOG_DEBUG , __FILE__, __FUNCTION__, __LINE__, args); \
|
||||
}
|
||||
|
||||
#define NDPI_LOG_DBG2(mod, args...) \
|
||||
if(mod && mod->ndpi_log_level >= NDPI_LOG_DEBUG_EXTRA) { \
|
||||
if(mod != NULL && mod->ndpi_debug_printf != NULL) \
|
||||
(*(mod->ndpi_debug_printf))(NDPI_CURRENT_PROTO, mod, NDPI_LOG_DEBUG_EXTRA , __FILE__, __FUNCTION__, __LINE__, args); \
|
||||
}
|
||||
|
||||
#else /* not defined NDPI_ENABLE_DEBUG_MESSAGES */
|
||||
# ifdef WIN32
|
||||
# define NDPI_LOG(...) {}
|
||||
# define NDPI_LOG_ERR(...) {}
|
||||
# define NDPI_LOG_INFO(...) {}
|
||||
# define NDPI_LOG_DBG(...) {}
|
||||
# define NDPI_LOG_DBG2(...) {}
|
||||
# else
|
||||
# define NDPI_LOG(proto, mod, log_level, args...) { /* printf(args); */ }
|
||||
# define NDPI_LOG_ERR(mod, args...) { printf(args); }
|
||||
# define NDPI_LOG_INFO(mod, args...) { /* printf(args); */ }
|
||||
# define NDPI_LOG_DBG(mod, args...) { /* printf(args); */ }
|
||||
# define NDPI_LOG_DBG2(mod, args...) { /* printf(args); */ }
|
||||
# endif
|
||||
#endif /* NDPI_ENABLE_DEBUG_MESSAGES */
|
||||
|
||||
#define NDPI_EXCLUDE_PROTO(mod,flow) ndpi_exclude_protocol(mod, flow, NDPI_CURRENT_PROTO, __FILE__, __FUNCTION__, __LINE__)
|
||||
|
||||
/**
|
||||
* macro for getting the string len of a static string
|
||||
*
|
||||
* use it instead of strlen to avoid runtime calculations
|
||||
*/
|
||||
#define NDPI_STATICSTRING_LEN( s ) ( sizeof( s ) - 1 )
|
||||
|
||||
/** macro to compare 2 IPv6 addresses with each other to identify the "smaller" IPv6 address */
|
||||
#define NDPI_COMPARE_IPV6_ADDRESS_STRUCTS(x,y) \
|
||||
((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))
|
||||
|
||||
|
||||
#define NDPI_SET(p, n) ((p)->fds_bits[(n)/NDPI_BITS] |= (1ul << (((u_int32_t)n) % NDPI_BITS)))
|
||||
#define NDPI_CLR(p, n) ((p)->fds_bits[(n)/NDPI_BITS] &= ~(1ul << (((u_int32_t)n) % NDPI_BITS)))
|
||||
#define NDPI_ISSET(p, n) ((p)->fds_bits[(n)/NDPI_BITS] & (1ul << (((u_int32_t)n) % NDPI_BITS)))
|
||||
#define NDPI_ZERO(p) memset((char *)(p), 0, sizeof(*(p)))
|
||||
#define NDPI_ONE(p) memset((char *)(p), 0xFF, sizeof(*(p)))
|
||||
|
||||
#define NDPI_NUM_FDS_BITS howmanybits(NDPI_NUM_BITS, NDPI_BITS)
|
||||
|
||||
#define NDPI_PROTOCOL_BITMASK ndpi_protocol_bitmask_struct_t
|
||||
|
||||
#define NDPI_BITMASK_ADD(a,b) NDPI_SET(&a,b)
|
||||
#define NDPI_BITMASK_DEL(a,b) NDPI_CLR(&a,b)
|
||||
#define NDPI_BITMASK_RESET(a) NDPI_ZERO(&a)
|
||||
#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_SAVE_AS_BITMASK(bmask,value) { NDPI_ZERO(&bmask) ; NDPI_ADD_PROTOCOL_TO_BITMASK(bmask, value); }
|
||||
|
||||
|
||||
#define ndpi_min(a,b) ((a < b) ? a : b)
|
||||
#define ndpi_max(a,b) ((a > b) ? a : b)
|
||||
|
||||
#define NDPI_PARSE_PACKET_LINE_INFO(ndpi_struct,flow,packet) \
|
||||
if (packet->packet_lines_parsed_complete != 1) { \
|
||||
ndpi_parse_packet_line_info(ndpi_struct,flow); \
|
||||
} \
|
||||
|
||||
#define NDPI_IPSEC_PROTOCOL_ESP 50
|
||||
#define NDPI_IPSEC_PROTOCOL_AH 51
|
||||
#define NDPI_GRE_PROTOCOL_TYPE 0x2F
|
||||
#define NDPI_ICMP_PROTOCOL_TYPE 0x01
|
||||
#define NDPI_IGMP_PROTOCOL_TYPE 0x02
|
||||
#define NDPI_EGP_PROTOCOL_TYPE 0x08
|
||||
#define NDPI_OSPF_PROTOCOL_TYPE 0x59
|
||||
#define NDPI_SCTP_PROTOCOL_TYPE 132
|
||||
#define NDPI_IPIP_PROTOCOL_TYPE 0x04
|
||||
#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]))))
|
||||
|
||||
/* new definitions to get little endian from network bytes */
|
||||
#define get_ul8(X,O) get_u_int8_t(X,O)
|
||||
|
||||
|
||||
#if defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
|
||||
#define get_l16(X,O) get_u_int16_t(X,O)
|
||||
#define get_l32(X,O) get_u_int32_t(X,O)
|
||||
#elif defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN)
|
||||
/* convert the bytes from big to little endian */
|
||||
# define get_l16(X,O) bswap_16(get_u_int16_t(X,O))
|
||||
# define get_l32(X,O) bswap_32(get_u_int32_t(X,O))
|
||||
#else
|
||||
#error "__BYTE_ORDER MUST BE DEFINED !"
|
||||
#endif /* __BYTE_ORDER */
|
||||
|
||||
/* define memory callback function */
|
||||
#define match_first_bytes(payload,st) (memcmp((payload),(st),(sizeof(st)-1))==0)
|
||||
|
||||
#if defined(WIN32) && !defined(snprintf)
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#define NDPI_MAX_DNS_REQUESTS 16
|
||||
#define NDPI_MIN_NUM_STUN_DETECTION 8
|
||||
|
||||
#define NDPI_MAJOR 4
|
||||
#define NDPI_MINOR 0
|
||||
#define NDPI_PATCH 0
|
||||
|
||||
/* IMPORTANT: order according to its severity */
|
||||
#define NDPI_CIPHER_SAFE 0
|
||||
#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>
|
||||
|
||||
#define htobe16(x) OSSwapHostToBigInt16(x)
|
||||
#define htole16(x) OSSwapHostToLittleInt16(x)
|
||||
#define be16toh(x) OSSwapBigToHostInt16(x)
|
||||
#define le16toh(x) OSSwapLittleToHostInt16(x)
|
||||
|
||||
#define htobe32(x) OSSwapHostToBigInt32(x)
|
||||
#define htole32(x) OSSwapHostToLittleInt32(x)
|
||||
#define be32toh(x) OSSwapBigToHostInt32(x)
|
||||
#define le32toh(x) OSSwapLittleToHostInt32(x)
|
||||
|
||||
#define htobe64(x) OSSwapHostToBigInt64(x)
|
||||
#define htole64(x) OSSwapHostToLittleInt64(x)
|
||||
#define be64toh(x) OSSwapBigToHostInt64(x)
|
||||
#define le64toh(x) OSSwapLittleToHostInt64(x)
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
#endif /* __NDPI_DEFINE_INCLUDE_FILE__ */
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set this to your NDK path
|
||||
ANDROID_NDK="${ANDROID_NDK:-${HOME}/Android/Sdk/ndk-bundle}"
|
||||
|
||||
# https://developer.android.com/ndk/guides/other_build_systems
|
||||
export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64
|
||||
export TARGET=x86_64-linux-android21
|
||||
export ANDROID_NATIVE_API_LEVEL=21
|
||||
export AR=$TOOLCHAIN/bin/llvm-ar
|
||||
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
|
||||
export AS=$CC
|
||||
export CXX=$TOOLCHAIN/bin/$TARGET$API-clang++
|
||||
export LD=$TOOLCHAIN/bin/ld
|
||||
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
|
||||
export STRIP=$TOOLCHAIN/bin/llvm-strip
|
||||
|
||||
SUBMODULES_PATH=../submodules
|
||||
|
||||
# libpcap
|
||||
( cd $SUBMODULES_PATH/libpcap && ./configure --host $TARGET )
|
||||
cp $SUBMODULES_PATH/libpcap/{grammar.c,grammar.h,scanner.c,scanner.h} ./libpcap
|
||||
|
||||
# nDPI
|
||||
( cd $SUBMODULES_PATH/nDPI && ./autogen.sh; ./configure --host $TARGET --disable-gcrypt --with-only-libndpi )
|
||||
cp $SUBMODULES_PATH/nDPI/src/include/{ndpi_api.h,ndpi_config.h,ndpi_define.h} ./nDPI
|
||||
+1
-1
Submodule submodules/libpcap updated: f8e410a8fe...c7642e2cc0
+1
-1
Submodule submodules/nDPI updated: 4b195acf2e...f732a761f8
Reference in New Issue
Block a user