Skip to content

Latest commit

 

History

History
136 lines (98 loc) · 3.37 KB

File metadata and controls

136 lines (98 loc) · 3.37 KB

Linux Setup Guide

Build and run the DPI Engine on Fedora, Ubuntu/Debian, or Arch Linux.


Prerequisites

Distribution Install Command
Fedora sudo dnf install cmake gcc-c++ make python3
Ubuntu/Debian sudo apt install cmake g++ make python3
Arch sudo pacman -S cmake gcc make python
openSUSE sudo zypper install cmake gcc-c++ make python3

Build

# Clone the repository
git clone https://github.com/souravvoid/DPI-Engine---Deep-Packet-Inspection-System.git
cd DPI-Engine---Deep-Packet-Inspection-System

# Configure and build
mkdir build && cd build
cmake ..
cmake --build . --parallel

Build Variants

# Debug build (with symbols, assertions)
cmake .. -DCMAKE_BUILD_TYPE=Debug

# Release build (optimized)
cmake .. -DCMAKE_BUILD_TYPE=Release

# Sanitizer build (AddressSanitizer + UndefinedBehaviorSanitizer)
cmake .. -DCMAKE_BUILD_TYPE=Sanitizer

# With tests
cmake .. -DBUILD_TESTING=ON

# Use Ninja instead of Make (faster)
cmake .. -G Ninja

Build Targets

Command Produces
cmake --build . --parallel All targets
cmake --build . --target dpi_engine Modular multi-threaded DPI engine
cmake --build . --target dpi_mt Self-contained multi-threaded DPI engine
cmake --build . --target dpi_simple Single-threaded DPI engine
cmake --build . --target packet_analyzer Simple packet display tool
cmake --build . --target packet_analyzer_tests Unit tests

Run

Generate test data

python3 generate_test_pcap.py

Basic DPI analysis

./dpi_engine test_dpi.pcap output.pcap

With blocking rules

./dpi_engine test_dpi.pcap output.pcap \
    --block-app YouTube \
    --block-app TikTok \
    --block-ip 192.168.1.50 \
    --block-domain facebook

Multi-threaded version

./dpi_mt test_dpi.pcap output.pcap --lbs 4 --fps 4

Run Tests

# From the build directory
cmake .. -DBUILD_TESTING=ON
cmake --build . --parallel
ctest --output-on-failure

Static Analysis

# Install tools (Fedora)
sudo dnf install clang-tools-extra cppcheck

# Run clang-tidy
run-clang-tidy -p build -quiet

# Run cppcheck
cppcheck --enable=all --suppress=missingIncludeSystem --std=c++17 -I include src/

# Run clang-format check
find src/ include/ tests/ -name "*.cpp" -o -name "*.h" | xargs clang-format --dry-run --Werror

Troubleshooting

Problem Solution
cmake: command not found Install CMake: sudo dnf install cmake (Fedora) or sudo apt install cmake (Ubuntu)
g++: command not found Install GCC: sudo dnf install gcc-c++ (Fedora) or sudo apt install g++ (Ubuntu)
fatal error: 'algorithm' file not found Update GCC: sudo dnf upgrade gcc-c++
undefined reference to pthread_create Link with Threads::Threads (CMake handles this automatically)
Could NOT find Threads Install pthread: sudo dnf install glibc-devel
Python not found Install Python: sudo dnf install python3
test_dpi.pcap not found Run python3 generate_test_pcap.py from the project root
Permission denied running executable chmod +x ./dpi_engine or use cmake --build . which sets permissions
Build very slow Use -j$(nproc) flag or Ninja: cmake .. -G Ninja && ninja