A network monitoring and management tool for Android, built with Jetpack Compose.
Harpy is a network monitoring application that displays details and controls for devices on a local network. It allows discovering connected devices, managing network access, and configuring network protocols from a Jetpack Compose Material 3 interface.
Note: This application requires root access to execute its active network modification features.
We analyzed the feasibility of running HarpyAndroid using Shizuku (which grants ADB shell UID 2000 permissions) instead of direct root (UID 0) access. The system permissions partition is as follows:
- Allowed: Reading the ARP cache (
/proc/net/arpor executingip neigh show) to scan and discover local devices. This allows device discovery to function on Android 10 and higher, where standard applications are blocked from accessing these files. - Allowed: Listing running system processes via the
pscommand. - Blocked: Opening raw sockets (
AF_PACKET) to send custom ARP frames. This operation requires theCAP_NET_RAWLinux capability, which is not granted to theshelluser. - Blocked: Binding to privileged UDP/TCP ports below 1024 (such as port 53 for DNS spoofing or port 67 for DHCP spoofing).
- Allowed: All discovery features, process management, custom raw socket creation, and binding to privileged system ports.
Because active network interception features rely on raw sockets and privileged ports, ARP spoofing, DNS spoofing, DHCP spoofing, and the iOS Void Attack toolkit require root access.
- Real-time device scanning using the ARP protocol.
- Detailed device information including IP address, MAC address, and device manufacturer.
- Gateway detection with interface indicators.
- Custom device naming with persistent storage across app restarts.
- Device pinning to keep selected devices visible at the top.
- IPv4/IPv6 filtering for list organization.
- Real-time Interface Selection: Dynamic detection of active network interfaces (such as
wlan0,ap0,eth0) for scanning operations. - Interface Mismatch Protection: Warning banner and instant interface switching logic when the system network changes.
- Smart Device Name Caching: Saved device names load before the first network scan after an app restart.
- Block/unblock devices using three methods: ARP spoofing, blackhole routing, or traffic control.
- Per-Device Rate Limiting: Bandwidth limits for specific devices using the Linux traffic control utility.
- Persistent blocking across app restarts.
- Bulk operations to unblock all devices.
- Ping testing to check device connectivity.
- Gateway blocking to disconnect all devices on the subnet.
- DNS spoofing with domain matching, target IP selection, and upstream query forwarding.
- DHCP spoofing with auto-detected gateway and interface configuration.
- Spoofing session management: Unified controls to pause, resume, and edit active DNS and DHCP sessions.
- iOS Void Attack Toolkit: Four Layer 3 and 4 vectors to block iOS network connectivity: DHCP self-implosion, ICMP redirect forgery, DNS nullification, and TCP RST asymmetry.
- Performance monitoring with real-time CPU/memory charts and process management.
- Network topology mapping.
- Real-time logging with export capability.
- Helper binary for running privileged operations.
- Dynamic network interface detection across all application screens.
- Built with Jetpack Compose and Material 3.
- Dark theme optimized for OLED displays.
- Animations and transitions.
- Bottom navigation for feature access.
- Responsive layouts adapting to different screen sizes.
- Stack-based navigation with scroll state preservation.
- Form auto-fill in spoofing dialogs with dropdown selectors.
- MAC deduplication to prevent UI errors on complex networks.
- Full API 24/25 Support: Compatible process management using custom
ProcessUtilsfor Android 7.x devices.
Runtime Requirements:
- Android device with root access.
- Android 7.0 (API 24) or higher.
- Active Wi-Fi connection.
Development Requirements:
- Android Studio Hedgehog or later.
- JDK 21.
- Android SDK 36.
- Gradle 8.13.
- Clone the repository:
git clone https://github.com/VishaL6i9/HarpyAndroid.git
cd HarpyAndroid- Build the debug APK for your desired flavor:
Standard flavor:
./gradlew assembleStandardDebugCTOS flavor:
./gradlew assembleCtosDebug- Install on your device:
Standard flavor:
adb install app/build/outputs/apk/standard/debug/app-standard-debug.apkCTOS flavor:
adb install app/build/outputs/apk/ctos/debug/app-ctos-debug.apkOr build and install in one step:
Standard flavor:
./gradlew installStandardDebugCTOS flavor:
./gradlew installCtosDebug- Grant the requested application permissions.
- Grant root access when prompted by your superuser manager.
- Tap "Scan Network" to discover devices.
- Open the app and navigate to the Network Monitor tab.
- Tap the Scan Network button. The app will detect the active interface and display a warning if a mismatch occurs.
- Wait for the scan to complete.
- View discovered devices in the device list.
Block a device:
- Tap the block icon on a device card.
- Confirm the action in the dialog.
Unblock a device:
- Tap the checkmark icon on a blocked device.
Customize device name:
- Tap the edit icon on any device.
- Enter a custom name.
- The device will appear at the top of the list.
Pin a device:
- Tap the pin icon to keep the device visible at the top.
Test connectivity:
- Tap the ping icon to check if a device is reachable.
- Navigate to the DNS Spoofing tab.
- Tap Start DNS Spoofing.
- Enter the domain to spoof (e.g.,
example.com). - Enter the IP address to redirect to.
- Specify the network interface (e.g.,
wlan0). - Tap Start.
- Navigate to the DHCP Spoofing tab.
- Tap Start DHCP Spoofing.
- Enter the target device's MAC address.
- Configure the spoofed IP, gateway, and DNS settings.
- Tap Start.
- Navigate to Settings > Advanced > iOS Void Attacks.
- Target configuration:
- Enter the Target IP. The MAC address auto-fills if a matching device was scanned.
- Router IP and Router MAC auto-detect from the network gateway.
- Deploy one or more void vectors:
- ① DHCP Self-Implosion: Forges a unicast DHCPACK with the router set to the client's own IP and a /32 subnet. The iOS device deletes its default gateway.
- ② ICMP Redirect Forge: Forges ICMP Type 5 redirects covering the IPv4 space via the client's own IP.
- ③ DNS Nullification: Sets the DNS Server to 0.0.0.0. The network interface remains active but names do not resolve.
- ④ TCP RST Asymmetry: Sniffs TCP SYN packets and replies with forged RST packets. Works when DHCP configuration is locked.
- Tap DEPLOY on any vector to activate it. Tap STOP ATTACK to disable.
- Navigate to Settings > Performance Monitor.
- View real-time CPU usage, memory consumption, and thermal statistics.
- Tap on any metric to view detailed graphs.
- Access the process list to view running processes.
- Sort processes by memory, CPU, name, or UID.
- Stop processes or adjust OOM scores (requires root).
Harpy follows clean architecture guidelines and uses Product Flavors for build variants.
Harpy uses Android Product Flavors to manage multiple build variants (standard and ctos) while keeping a shared codebase:
Shared Code Structure (src/main/):
- Common screens, repositories, use cases, and ViewModels.
- Common UI components and navigation.
Flavor-Specific Code:
src/standard/: Standard theme and flavor-specific configuration.src/ctos/: CTOS theme and flavor-specific configuration.
Theme Injection via Hilt:
ThemeProviderinterface defines the theme contract.StandardThemeModule: ProvidesStandardThemefor the standard flavor.CtosThemeModule: ProvidesCtosThemefor the ctos flavor.- Dynamic theme injection through Hilt.
This approach reduces code duplication across flavors.
app/src/main/kotlin/com/vishal/harpy/
├── core/ # Shared utilities and components
│ ├── native/ # JNI bindings for C++ code
│ ├── network/ # Network utilities
│ ├── ui/ # Common UI components
│ ├── di/ # Dependency injection modules
│ ├── service/ # Background services
│ ├── state/ # State management
│ └── utils/ # Helper classes
├── features/ # Feature modules
│ ├── device_manager/
│ │ ├── data/ # Data layer (repositories)
│ │ ├── domain/ # Business logic (use cases)
│ │ └── presentation/ # ViewModels
│ ├── network_monitor/
│ ├── dns/
│ │ ├── data/
│ │ ├── domain/
│ │ └── di/
│ └── dhcp/
│ ├── data/
│ ├── domain/
│ └── di/
├── ui/ # Compose UI layer
│ ├── screens/ # Screen composables
│ │ ├── network/
│ │ ├── dns/
│ │ ├── dhcp/
│ │ ├── settings/
│ │ ├── status/
│ │ ├── device_management/
│ │ └── performance/ # Performance monitoring screens
│ ├── components/ # Reusable UI components
│ ├── theme/ # Material 3 theme (shared interface)
│ ├── di/ # Theme provider modules
│ ├── viewmodel/ # Shared ViewModels
│ └── HarpyApp.kt # Main app composable
└── main/
└── MainActivityCompose.kt # Entry point
app/src/standard/kotlin/com/vishal/harpy/
├── ui/
│ ├── theme/
│ │ └── StandardTheme.kt # Standard flavor theme
│ └── di/
│ └── StandardThemeModule.kt # Hilt module for standard theme
└── ... # Other flavor-specific overrides
app/src/ctos/kotlin/com/vishal/harpy/
├── ui/
│ ├── theme/
│ │ └── CtosTheme.kt # CTOS flavor theme
│ └── di/
│ └── CtosThemeModule.kt # Hilt module for CTOS theme
└── ... # Other flavor-specific overrides
UI Layer:
- Jetpack Compose for declarative UI.
- Material 3 components.
- Compose Navigation with stack-based back navigation.
- Lifecycle-aware state management.
- Scroll state preservation across navigation.
Domain Layer:
- Use cases for business logic.
- Repository pattern for data access.
- Kotlin Coroutines for async operations.
Data Layer:
- SharedPreferences with
SettingsRepositoryfor application and device preferences. - Native C++ for low-level network operations.
- Helper binary for running privileged operations.
Dependency Injection:
- Hilt for compile-time DI with custom
ServiceEntryPoint.
Native Code:
- C++ for raw socket operations.
- JNI for Kotlin-C++ interop.
- CMake for native builds.
Harpy uses a combination of techniques for network operations:
Device Discovery:
- ARP scanning with packet pacing.
- Multi-pass scanning for reliability.
- Vendor identification using the OUI database.
Device Blocking:
- Bidirectional ARP spoofing.
- Persistent block state tracking.
- Automatic restoration after app restart.
DNS Spoofing:
- UDP socket listener on port 53.
- DNS packet parsing and response crafting.
- Domain-to-IP redirection.
DHCP Spoofing:
- UDP socket listener on port 67.
- DHCP packet interception.
- Custom IP configuration injection.
For process separation and stability, privileged operations are executed by a separate helper binary (libharpy_root_helper.so).
The helper supports these command commands:
scan: Network device discovery.mac: MAC address resolution.block: Device blocking via ARP spoofing.block_iptables_drop: Device blocking via blackhole route.block_traffic_control: Device rate limiting or blocking via traffic control.unblock: Device unblocking.dns_spoof: DNS query interception.dhcp_spoof: DHCP request interception.ios_dhcp_void: iOS DHCP self-implosion (XID sniff and unicast self-router ACK).ios_dhcp_nullify_dns: iOS DNS nullification via DHCPACK.icmp_redirect: ICMP Type 5 redirect forgery.tcp_rst: TCP RST asymmetry (SYN sniff and reply with forged RST).
The developers of Harpy are not responsible for any misuse of this application. Use at your own risk.
Contributions are welcome. Please submit a Pull Request.
- Fork the repository.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
- Follow Kotlin coding conventions.
- Use descriptive variable and function names.
- Add comments for non-obvious logic.
- Write unit tests for new features.
- Verify your device is rooted.
- Grant root permission when prompted.
- Check logcat for error logs.
- Verify you are connected to a Wi-Fi network.
- Verify root access is granted.
- Increase the scan timeout in Settings > Scan Settings.
- Verify the correct network interface is selected in Settings > Interface Selection (the app displays a warning if there is a mismatch).
- Verify the target device is on the same local network.
- Verify the helper binary is installed.
- Check logs for error messages.
# Clean and rebuild
./gradlew clean
./gradlew assembleDebug --refresh-dependenciesThis project is licensed under the MIT License. See the LICENSE file for details.