diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..2b6b2e03 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "submodules/nDPI"] + path = submodules/nDPI + url = https://github.com/ntop/nDPI +[submodule "submodules/zdtun"] + path = submodules/zdtun + url = https://github.com/emanuele-f/zdtun diff --git a/.idea/vcs.xml b/.idea/vcs.xml index c225cd15..c32a59d3 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -2,6 +2,7 @@ - + + - \ No newline at end of file + diff --git a/README.md b/README.md index fb928567..25453013 100644 --- a/README.md +++ b/README.md @@ -68,10 +68,7 @@ PCAPdroid integrates [nDPI](https://github.com/ntop/nDPI) to detect the applicat ## Building -1. Clone this repo locally -2. Clone https://github.com/emanuele-f/zdtun beside this repository -3. Clone https://github.com/ntop/nDPI beside this repository -4. Link the cmake file into nDPI: from this repo execute: `ln -s $(readlink -f nDPI/CMakeLists.txt) ../nDPI` -4. Inside the nDPI directory, run `git checkout 3.4-stable; ./autogen.sh; ./configure --disable-gcrypt` -6. Build the `zdtun` and `ndpi` modules first -7. Then build the `app` module +1. Clone this repo +2. Run `git submodule update --init` +3. Build the `zdtun` and `ndpi` modules first +4. Then build the `app` module diff --git a/app/build.gradle b/app/build.gradle index 5736e867..4151c3c3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,18 +28,17 @@ android { } dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(path: ':zdtun') + implementation project(path: ':ndpi') implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.preference:preference:1.1.1' implementation 'androidx.viewpager:viewpager:1.0.0' implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' implementation 'com.google.android.material:material:1.2.1' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.3.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' - implementation project(path: ':zdtun') implementation 'cat.ereza:customactivityoncrash:2.2.0' - implementation project(path: ':ndpi') implementation 'org.nanohttpd:nanohttpd:2.3.1' + androidTestImplementation 'androidx.test:runner:1.3.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + testImplementation 'junit:junit:4.12' } \ No newline at end of file diff --git a/nDPI/CMakeLists.txt b/nDPI/CMakeLists.txt deleted file mode 100644 index d3c32ae9..00000000 --- a/nDPI/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) - -# A C project -project(C) - -set(CMAKE_VERBOSE_MAKEFILE ON) - -add_definitions(-DNDPI_LIB_COMPILATION) - -include_directories(./src/include ./src/lib/third_party/include) - -AUX_SOURCE_DIRECTORY(./src/lib AllSources) -AUX_SOURCE_DIRECTORY(./src/lib/third_party/src AllSources) -AUX_SOURCE_DIRECTORY(./src/lib/protocols AllSources) - -# libndpi.so target -ADD_LIBRARY(ndpi SHARED ${AllSources}) diff --git a/ndpi/build.gradle b/ndpi/build.gradle index 79777078..7ca5ff4c 100644 --- a/ndpi/build.gradle +++ b/ndpi/build.gradle @@ -1,8 +1,8 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 29 - buildToolsVersion "29.0.0" + compileSdkVersion 30 + buildToolsVersion "29.0.2" defaultConfig { @@ -23,7 +23,7 @@ android { } externalNativeBuild { cmake { - path file('../../nDPI/CMakeLists.txt') + path file('src/main/CMakeLists.txt') } } diff --git a/ndpi/src/main/CMakeLists.txt b/ndpi/src/main/CMakeLists.txt new file mode 100644 index 00000000..61c8b88a --- /dev/null +++ b/ndpi/src/main/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8.11) +include(ExternalProject) + +set(CMAKE_VERBOSE_MAKEFILE ON) +set(ROOTDIR ../../../../../submodules/nDPI) +add_definitions(-DNDPI_LIB_COMPILATION) + +ExternalProject_Add(libndpi + SOURCE_DIR ${ROOTDIR} + CONFIGURE_COMMAND ./autogen.sh COMMAND ./configure --disable-gcrypt) diff --git a/submodules/nDPI b/submodules/nDPI new file mode 160000 index 00000000..75898a4f --- /dev/null +++ b/submodules/nDPI @@ -0,0 +1 @@ +Subproject commit 75898a4f9e7034e8af8fe24eb442114f5c7339f6 diff --git a/submodules/zdtun b/submodules/zdtun new file mode 160000 index 00000000..5f6331b1 --- /dev/null +++ b/submodules/zdtun @@ -0,0 +1 @@ +Subproject commit 5f6331b1d596be19031c287d796a83436c6cf216 diff --git a/zdtun/build.gradle b/zdtun/build.gradle index 34472ed3..0d82eb1c 100644 --- a/zdtun/build.gradle +++ b/zdtun/build.gradle @@ -1,8 +1,8 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 29 - buildToolsVersion "29.0.0" + compileSdkVersion 30 + buildToolsVersion "29.0.2" defaultConfig { @@ -23,7 +23,7 @@ android { } externalNativeBuild { cmake { - path file('../../zdtun/CMakeLists.txt') + path file('../submodules/zdtun/CMakeLists.txt') } } }