NetSecure is an Android network security and privacy monitoring app that captures real-time traffic via a local VPN, classifies it by app and category, performs Deep Packet Inspection with nDPI, runs a local Intrusion Detection System, and submits suspicious observables to an IntelOwl threat intelligence backend β all without root access.
- Features
- Screenshots
- Architecture
- Tech Stack
- Project Structure
- Getting Started
- IntelOwl Setup
- How It Works
- Security & Privacy
- License
- Contributing
- Real-Time Packet Capture β Intercepts all TCP/UDP traffic through a high-performance local VPN tunnel powered by a native C engine with
zdtunandlibpcap. - Deep Packet Inspection β nDPI identifies 300+ application-layer protocols (TLS.Facebook, QUIC.YouTube, etc.) for accurate traffic classification.
- Per-App Traffic Breakdown β Resolves every connection to the originating app via UID mapping, showing per-app request counts, data in/out, and connection details.
- Traffic Categorization β Automatically classifies all connections into 10 categories: Social Media, Streaming, Ads & Trackers, Cloud, Messaging, Gaming, Shopping, System, CDN, and Other β using a three-stage pipeline (nDPI protocol β domain suffix β IP heuristics) with 300+ classification rules.
- Connection Details β Every connection logs source/destination IPs and ports, L7 protocol, SNI/domain, bytes transferred, duration, encryption status, and timestamps.
- CSV Export β Export all captured connections to a CSV file in your Downloads folder.
- IntelOwl Integration β Automatically submits suspicious IPs and domains to a self-hosted IntelOwl instance for analysis using configurable analyzers (AbuseIPDB, OTX, GreyNoise, MalwareBazaar).
- Weighted Threat Scoring β Aggregates results from multiple analyzers with weighted scoring (AbuseIPDB 40%, OTX 30%, MalwareBazaar 20%, GreyNoise 10%) and classifies severity as Clean, Low, Medium, High, or Critical.
- Priority Scan Queue β Intelligent queueing system that prioritizes blacklisted IPs, unknown protocols, and non-standard ports while skipping private IPs and known-safe endpoints.
- Threat Alerts β Real-time dismissible alert banners for HIGH and CRITICAL findings on the dashboard.
- Signature-Based IDS β Scans unencrypted payloads against 11 regex-based signatures covering: cryptominer user-agents, IRC botnet commands, shell download chains, cleartext password exposure, SQL injection attempts, DNS queries to mining pools, malware C2 domains, DGA domains, Tor/onion routing, and phishing domains.
- Privacy Report β Automated privacy concern detection: high tracker activity, excessive data transfer, suspicious request rates, and tracker domain exposure.
- Top Talkers β Identifies the top 5 apps by data volume.
- Threat Intelligence History β Searchable, filterable table of all scanned observables with severity breakdown, per-analyzer results, and score visualizations.
- Persistent Logging β Dual-output logger (in-memory ring buffer + 1 MB rotating log file) with 5 levels and 4 tag categories, shareable via Android share sheet.
- No Root Required β Uses Android's VPN Service API with split routing for transparent packet capture.
- Dark Cybersecurity Theme β Navy/cyan/purple Material 3 dark theme designed for security monitoring.
| Screen | Description |
|---|---|
| Dashboard | Summary cards (apps, requests, data in/out), category breakdown bar graph, per-app traffic cards with threat severity indicators, start/stop FAB, CSV export |
| App Detail | Per-app deep dive with connection list (up to 300), L7 protocol chips, expandable connection details, per-connection IntelOwl threat reports |
| Report | Privacy report with overall summary, data category breakdown, auto-generated privacy concern alerts, top talkers, threat intel summary |
| Threat Intelligence | Full threat history with severity distribution chart, searchable observable table, per-analyzer result expansion (AbuseIPDB, OTX, GreyNoise, MalwareBazaar) |
| IntelOwl Settings | Server URL, encrypted API token, TLP level selection, analyzer picker, cache TTL and concurrency sliders, connection test |
| Logs | Live auto-scrolling log viewer with level/category/text filters, share/copy/save/clear actions |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Jetpack Compose UI β
β Dashboard Β· App Detail Β· Report Β· Threat Intel Β· Logs β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β ViewModels (StateFlow + MVVM) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββ€
β TrafficRepository β ThreatIntelRepository β
β TrafficClassifier β ScanQueue Β· ThreatCache Β· IDS β
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββ€
β ConnectionsRegister β IntelOwl API (Retrofit) β
β (Ring Buffer 8K) β EncryptedSharedPreferences β
ββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββ€
β CaptureService (VPN Service) β
β JNI Bridge β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Native C Engine β
β pcapdroid core Β· zdtun Β· nDPI Β· libpcap β
β TUN fd β Packet Loop β DPI Classification β Callbacks β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Data flow:
CaptureServicecreates a TUN interface via VPN Service and passes the file descriptor to the native engine.- The native C core (
pcapdroid.c) runs a packet loop usingzdtunfor TCP/UDP routing andnDPIfor protocol identification. - Connection data flows back to Kotlin via JNI callbacks β
ConnectionsRegister(ring buffer) βTrafficRepository(classification & aggregation) β ViewModels β Compose UI. - In parallel,
ThreatIntelRepositoryextracts observables from connections, queues them by priority, batch-submits to IntelOwl every 5s, and polls for results every 10s. - The
SignatureScannerruns locally on unencrypted payloads and injects findings into the threat alert pipeline.
| Layer | Technology | Version |
|---|---|---|
| Language | Kotlin (app) Β· C (native engine) | β |
| UI | Jetpack Compose + Material 3 | BOM 2024.09.00 |
| Navigation | Jetpack Navigation Compose | 2.8.9 |
| Architecture | MVVM (ViewModel + StateFlow + Repository) | β |
| Networking | Retrofit 2 + OkHttp | 2.11.0 / 4.12.0 |
| JSON | Gson | 2.11.0 |
| Async | Kotlin Coroutines | 1.8.1 |
| Security | EncryptedSharedPreferences (AES-256-GCM) | 1.1.0-alpha06 |
| Native Engine | PCAPdroid core via JNI | NDK 28.2 |
| DPI | nDPI | submodule |
| Tunneling | zdtun | submodule |
| Packet Capture | libpcap | submodule (1.10.6) |
| GeoIP | MaxMind DB Reader Java | submodule |
| Build | Gradle (Kotlin DSL) Β· CMake 3.22.1 | AGP 9.0.1 |
| Min SDK | Android 7.0 (API 24) | |
| Target SDK | API 36 |
app/src/main/
βββ java/com/example/netsecure/
β βββ NetSecureApp.kt # Application class β initializes logger & IntelOwl config
β βββ MainActivity.kt # Single-activity Compose host with bottom navigation
β βββ CaptureService.kt # VPN foreground service + JNI bridge
β β
β βββ navigation/
β β βββ NavGraph.kt # 6 routes: Dashboard, AppDetail, Report, ThreatIntel, Settings, Logs
β β
β βββ ui/
β β βββ screens/
β β β βββ DashboardScreen.kt # Main dashboard with traffic overview
β β β βββ AppDetailScreen.kt # Per-app connection inspector
β β β βββ ReportScreen.kt # Privacy report & analysis
β β β βββ ThreatIntelligenceScreen.kt # Threat intel history & search
β β β βββ IntelOwlSettingsScreen.kt # IntelOwl configuration
β β β βββ LogsScreen.kt # Live system log viewer
β β βββ viewmodel/
β β β βββ DashboardViewModel.kt # Traffic state, capture control, threat summary
β β β βββ AppDetailViewModel.kt # Per-app connection filtering & threat lookup
β β β βββ ThreatIntelViewModel.kt # Observable table, severity stats, remote job fetch
β β β βββ LogsViewModel.kt # Log polling, filtering, export
β β βββ theme/ # Dark cybersecurity theme (Color, Theme, Type)
β β
β βββ data/
β β βββ TrafficRepository.kt # Traffic aggregation & app classification
β β βββ TrafficClassifier.kt # 3-stage classifier (nDPI β domain β IP heuristics)
β β βββ ConnectionsRegister.kt # Thread-safe ring buffer (8192 slots)
β β βββ ThreatIntelRepository.kt # IntelOwl orchestration & result scoring
β β βββ ScanQueue.kt # Priority-based scan queue (max 500)
β β βββ ThreatCache.kt # LRU cache (2000 entries) with TTL
β β βββ SignatureScanner.kt # Local IDS with 11 regex signatures
β β βββ model/ # AppTrafficInfo, TrafficCategory, ThreatReport, etc.
β β
β βββ model/ # JNI-bridged models
β β βββ ConnectionDescriptor.kt # Per-connection state (IPs, ports, L7 proto, SNI, payload)
β β βββ ConnectionUpdate.kt # Incremental connection updates from native
β β βββ CaptureStats.kt # Global capture statistics
β β βββ PayloadChunk.kt # Raw payload bytes with metadata
β β βββ BlacklistDescriptor.kt # IP/domain blacklist entries
β β βββ MatchList.kt # Firewall/whitelist rules
β β
β βββ network/
β β βββ IntelOwlApiService.kt # Retrofit interface (6 endpoints)
β β βββ IntelOwlConfig.kt # Encrypted config with AndroidKeyStore
β β βββ model/AnalysisModels.kt # API request/response models
β β
β βββ logging/
β βββ NetSecureLogger.kt # Dual-output logger (memory + file)
β
βββ jni/
β βββ CMakeLists.txt # Builds libcapture.so, libndpi.so, libzdtun.so
β βββ core/ # Packet processing loop, VPN/PCAP capture, nDPI integration
β βββ common/ # JNI utilities, UID resolution
β βββ pcapd/ # Root capture daemon (alternative mode)
β βββ third_party/ # libchash (hash table)
β
βββ res/ # Drawables, icons, strings, themes
submodules/
βββ nDPI/ # Deep Packet Inspection library
βββ zdtun/ # TCP/UDP tunnel library
βββ libpcap/ # Packet capture library
βββ MaxMind-DB-Reader-java/ # GeoIP database reader
- Android Studio Ladybug or newer
- JDK 17+
- Android SDK with API 36
- Android NDK
28.2.13676358(auto-downloaded by Gradle) - CMake 3.22.1+
-
Clone with submodules:
git clone --recurse-submodules https://github.com/harshbpathak/Netsecure-android.git
If already cloned:
git submodule update --init --recursive
-
Open in Android Studio and sync Gradle.
-
Run on a physical device (API 24+).
Note: VPN capture and native routing work best on a physical device. Emulators may have limited networking depending on the configuration.
The app requests these permissions at install or runtime:
| Permission | Why |
|---|---|
INTERNET |
IntelOwl API calls |
ACCESS_NETWORK_STATE |
Detect connectivity changes |
ACCESS_WIFI_STATE |
Wi-Fi state detection |
FOREGROUND_SERVICE |
Keep VPN capture alive in background |
POST_NOTIFICATIONS |
Show capture notification (Android 13+) |
QUERY_ALL_PACKAGES |
Resolve connection UIDs to app names and icons |
NetSecure integrates with IntelOwl β an open-source threat intelligence platform β to analyze suspicious IPs and domains observed in your traffic.
- Deploy an IntelOwl instance (see IntelOwl docs).
- In NetSecure, go to Dashboard β βοΈ Settings.
- Enter your Server URL and API Token.
- Hit Test Connection to verify.
- Select your preferred TLP level and analyzers.
- Enable the IntelOwl toggle β scanning starts automatically during capture.
| Analyzer | What it checks |
|---|---|
| AbuseIPDB | IP reputation from crowd-sourced abuse reports |
| OTXQuery | AlienVault OTX threat pulse data |
| GreyNoiseCommunity | Internet-wide scan/noise classification |
| MalwareBazaar | Known malware indicator matching |
Results are scored with weighted aggregation and cached locally (configurable TTL) to minimize API calls.
Android Apps
β (all TCP/UDP traffic)
βΌ
TUN Interface (VPN Service)
β
βΌ
Native C Engine (libcapture.so)
βββ zdtun: Routes packets through tunnel
βββ nDPI: Identifies application-layer protocol
βββ Blacklist matching: Flags known-bad IPs/domains
β
βΌ (JNI callbacks)
ConnectionsRegister (ring buffer, 8192 slots)
β
βΌ
TrafficRepository
βββ UID β App resolution (PackageManager)
βββ TrafficClassifier (300+ domain/protocol rules)
βββ Per-app aggregation
β
ββββΆ UI (Dashboard, App Detail, Report)
β
ββββΆ ThreatIntelRepository
βββ ScanQueue (priority-based, max 500)
βββ SignatureScanner (local IDS, 11 signatures)
βββ IntelOwl API (batch submit every 5s)
βββ Job Poller (check results every 10s)
βββ Weighted scoring & severity classification
βββ Alert pipeline β UI
Each connection goes through three classification stages:
- nDPI Protocol β Protocol name matching (e.g.,
TLS.Facebookβ Social Media) - Domain Suffix β 300+ domain rules covering all major services and tracker networks
- IP Heuristics β Private IPs and well-known ports (53, 123) mapped to System category
- Encrypted Token Storage β IntelOwl API token protected with AES-256-GCM via
EncryptedSharedPreferencesbacked by Android KeyStore. - Local Processing β All packet capture and classification happens on-device. Only observables you explicitly enable are sent to IntelOwl.
- VPN Self-Exclusion β The app excludes itself from capture to prevent routing loops.
- Split Routing β Uses
0.0.0.0/1+128.0.0.0/1routes instead of default route to preserve system connectivity. - Private IP Filtering β RFC 1918 and link-local addresses are automatically excluded from threat scanning.
- Rate Limiting β Exponential backoff (5s β 60s) on API throttling to respect server limits.
- No Data Collection β NetSecure does not send any data to external servers other than your configured IntelOwl instance.
This project is licensed under the GPL-3.0 License.
Contributions, issues, and feature requests are welcome. Feel free to open an issue or submit a pull request.