pNet — Android Network & Bluetooth Swiss Knife

pNet is a lightweight, all-in-one network and wireless diagnostics toolkit built exclusively with standard Android classes and Kotlin.

Design Philosophy:
Strictly zero third-party dependencies (no deps). Pure Android SDK and Kotlin standard library only. Instant startup, minimal footprint, robust network & wireless primitives.


🛠️ The 14 Swiss Knife Tools

IP & Network Tools

  1. Network Info & Interfaces Inspector

    • Real-time connection detection: Wi-Fi, Cellular, Ethernet, VPN, or Offline.
    • Local IPv4 & IPv6 addresses, subnet mask, prefix length, default gateway, and DNS servers.
    • Wi-Fi telemetry: SSID, BSSID, RSSI (dBm), link speed (Mbps), and operating frequency (MHz).
    • Full hardware and software interface list (NetworkInterface) with MTU, MAC addresses, status (UP/DOWN), loopback flags, and assigned addresses.
  2. Ping / Latency Tester

    • Real ICMP ping execution with TCP socket fallback.
    • Real-time streaming log with seq numbers, TTL, and latency in milliseconds.
    • Comprehensive statistics: packets transmitted, received, loss percentage, min/avg/max RTT.
  3. Multi-Threaded TCP Port Scanner

    • High-performance concurrent TCP port scanner (configurable concurrency up to 24 parallel workers).
    • Built-in database of top well-known services (HTTP, HTTPS, SSH, FTP, Telnet, SMTP, DNS, MySQL, Postgres, Redis, RDP, SMB, etc.).
    • Support for common presets, comma-separated port lists (e.g. 80,443,8080), or custom port ranges (e.g. 20-100).
  4. LAN / Subnet Device Discovery

    • Subnet sweep probing active hosts on the local network (/24).
    • Dynamic /proc/net/arp table inspection to resolve hardware MAC addresses.
    • Hostname resolution (canonicalHostName) and real-time live device listing.
  5. Direct UDP DNS Query Engine

    • Pure Kotlin RFC 1035 packet builder and response parser running directly over UDP port 53.
    • Query custom DNS servers (e.g. 1.1.1.1, 8.8.8.8, 9.9.9.9, or local gateway).
    • Supports record types: A, AAAA, MX, TXT, NS, CNAME, SOA, PTR with TTL values.
    • System resolver fallback if UDP is blocked by ISP/firewall.
  6. IPv4 CIDR Subnet Calculator

    • Full bitwise subnet calculation from CIDR notation (e.g. 192.168.1.100/24).
    • Output includes: Netmask, Wildcard mask, Network IP, Broadcast IP, First and Last usable host addresses, Total and Usable host counts, IP Class (A/B/C/D/E), Private RFC 1918 classification, and 32-bit binary mask layout.
  7. Traceroute Hop Discovery

    • Hop-by-hop route tracing using incremental TTL packets.
    • Identifies intermediate router IPs, hostnames, and round-trip times per hop up to destination.
  8. Wake-on-LAN (WOL)

    • Generates standard 102-byte magic packets (6 * 0xFF + 16 * Target MAC).
    • Broadcasts over UDP to port 9 (or custom port) across local subnet or global broadcast (255.255.255.255).
  9. HTTP / HTTPS Inspector

    • Inspect web endpoints with GET, HEAD, or POST methods using native HttpURLConnection / HttpsURLConnection.
    • Displays HTTP status code, status message, round-trip latency, and full response headers.
    • TLS/SSL inspection: cipher suite and peer SSL certificate details (Subject, Issuer, Validity).
    • Scrollable response body preview.
  10. Netcat / Raw Socket Client

    • Interactive TCP client and UDP packet sender/receiver.
    • Connect to arbitrary host:port and stream bidirectionally.
    • Send ASCII or raw Hex payloads with real-time terminal output.
  11. WHOIS Protocol Client

    • Connects directly to port 43 (RFC 3912) across global domain registries (Verisign, PIR, ARIN, RIPE, APNIC, IANA).
    • Fetches full domain and IP registration / ownership records into a scrollable terminal.

Bluetooth & BLE Tools

  1. Bluetooth & BLE Scanner

    • Comprehensive hardware capabilities audit: BLE support, Multiple Advertising, 2M PHY, Coded PHY (long range), Extended Advertising.
    • Paired (bonded) devices listing with single-tap connection.
    • Dual scanning engines:
      • BLE Scanner: Real-time advertising packet inspection, live RSSI signal meter, decoded manufacturer identification (Apple, Microsoft, Google, Nordic, Samsung, Xiaomi, etc.), and standard Bluetooth SIG Service UUID mapping.
      • Classic Bluetooth Discovery: Discovers nearby classic devices with device class breakdown (Audio/Video, Phone, Computer, Wearable, Peripheral).
    • One-tap handoff to GATT Explorer or Serial Terminal.
  2. BLE GATT Client & Service Explorer

    • Connects to any Bluetooth Low Energy peripheral (BluetoothGatt).
    • Service discovery with automatic SIG UUID resolution (Battery Service, Generic Access, Device Info, Heart Rate, Environmental Sensing, etc.).
    • Characteristic inspector:
      • Property detection: Read, Write, Notify, Indicate, Write Without Response.
      • Asynchronous Read: displays raw Hex and ASCII/UTF-8 decoded values.
      • Live Notify/Indicate: writes to CCCD (0x2902) to stream sensor and telemetry updates in real-time.
      • Asynchronous Write: send Hex or UTF-8 payloads to writable characteristics.
  3. Bluetooth Serial Terminal (RFCOMM / SPP)

    • Connects to classic Bluetooth serial devices (Arduino, HC-05, HC-06, ESP32, OBD-II dongles, serial adapters) via standard Serial Port Profile (SPP UUID 00001101-0000-1000-8000-00805F9B34FB).
    • Bidirectional streaming console with ASCII and Hex payload transmission.

🏗️ Architecture & Project Structure

pNet/
├── app/
│   ├── build.gradle.kts          # Zero external dependencies
│   ├── proguard-rules.pro
│   └── src/main/
│       ├── AndroidManifest.xml   # Network & Bluetooth/BLE permissions
│       ├── java/net/pnet/app/
│       │   ├── MainActivity.kt   # Swiss knife tab navigation & lifecycle controller
│       │   ├── core/
│       │   │   ├── AsyncRunner.kt          # Background thread pool & main-thread dispatcher
│       │   │   ├── NetworkInfoEngine.kt    # NetworkCapabilities, LinkProperties & NetworkInterfaces
│       │   │   ├── PingEngine.kt           # ICMP process & TCP ping engine
│       │   │   ├── PortScannerEngine.kt    # Multi-threaded TCP socket scanner
│       │   │   ├── LanScannerEngine.kt     # Subnet sweep & ARP table parser
│       │   │   ├── DnsEngine.kt            # RFC 1035 UDP DNS packet builder/parser
│       │   │   ├── SubnetCalculator.kt     # Bitwise IPv4 CIDR math
│       │   │   ├── TracerouteEngine.kt     # Hop-by-hop route tracer
│       │   │   ├── WakeOnLanEngine.kt      # WOL magic packet generator & broadcaster
│       │   │   ├── HttpInspectorEngine.kt  # Native Http/HttpsURLConnection inspector
│       │   │   ├── SocketClientEngine.kt   # Netcat TCP/UDP raw socket terminal
│       │   │   ├── WhoisEngine.kt          # Port 43 WHOIS client
│       │   │   └── BluetoothEngine.kt      # Classic BT, BLE scan, GATT client, RFCOMM serial
│       │   ├── model/
│       │   │   ├── NetworkModels.kt        # Network data classes
│       │   │   └── BluetoothModels.kt      # Bluetooth & BLE data classes
│       │   └── ui/
│       │       ├── UIHelper.kt             # View builders, cards, formatting, clipboard copy
│       │       └── ToolViews.kt            # Interactive UI views for all 14 tools
│       └── res/
│           ├── drawable/                   # Shapes, ripple buttons, dark theme assets, vector launcher icon
│           ├── layout/activity_main.xml    # Header status bar, horizontal tool chips, dynamic content area
│           └── values/                     # Colors, strings, dark tech style
├── build.gradle.kts              # Root build script
├── settings.gradle.kts           # Module definitions
├── gradle.properties
├── gradlew / gradlew.bat
└── README.md

🚀 Building & Running

Prerequisites

Build with Gradle:

./gradlew assembleDebug

The APK will be generated at:

app/build/outputs/apk/debug/app-debug.apk

Install directly on an Android device:

adb install -r app/build/outputs/apk/debug/app-debug.apk