Skip to content

Latest commit

Β 

History

History
193 lines (146 loc) Β· 8.09 KB

File metadata and controls

193 lines (146 loc) Β· 8.09 KB

πŸ›‘οΈ NetSentry β€” IoT Network Monitor & Traffic Inspector

Real-time network surveillance tool for discovering IoT devices, monitoring their traffic, intercepting DNS queries, and inspecting packet-level data on your local network.

Built in response to growing concerns about IoT devices being exploited as residential proxies and botnet nodes. NetSentry gives you full visibility into what every device on your network is doing.


✨ Features

πŸ” Network Discovery

  • ARP-based device scanning β€” discovers all devices on your local subnet
  • Vendor identification via MAC address OUI lookup
  • Device type classification β€” routers, phones, smart TVs, security cameras, robot vacuums, IoT sensors, and more
  • Smart iconography β€” 15+ SVG icons mapped to device types and vendors

πŸ“‘ Live Traffic Capture

  • Real-time packet capture via tcpdump with ASCII payload extraction
  • Per-device traffic monitoring β€” select any device to inspect its traffic
  • Protocol detection β€” HTTP, HTTPS, DNS, SSH, FTP, MQTT, CoAP, SOCKS, and more
  • TCP flag decoding β€” SYN, ACK, FIN, RST, PSH with human-readable labels
  • Traffic statistics β€” packets, bytes transferred, unique destinations, risk scoring

🌐 DNS Proxy & Monitoring

  • Built-in DNS proxy β€” intercepts all DNS queries when devices use your machine as DNS server
  • Passive DNS monitoring β€” fallback tcpdump-based DNS capture
  • Per-device DNS profiles β€” see which domains each device contacts
  • Top domains ranking β€” identify the most contacted domains per device
  • Suspicious domain detection β€” flags DynDNS, free TLDs, and suspicious patterns

πŸ”¬ Packet Inspector (Click any packet row)

  • Connection flow diagram β€” visual Source β†’ Protocol β†’ Destination layout
  • Full packet metadata β€” timestamp, direction, protocol, port service name, size, TCP flags
  • ASCII payload viewer β€” see raw HTTP headers, DNS queries, and unencrypted data
  • Reverse DNS lookup β€” automatic hostname resolution for remote IPs
  • IP intelligence β€” links to IPinfo.io, AbuseIPDB, and Shodan for public IPs
  • Related packets β€” group packets by connection (same src/dst pair)
  • Copy to clipboard β€” full packet details including payload

πŸ› οΈ Request Builder (Built-in HTTP Client)

  • Replay captured requests β€” pre-fills destination IP, port, and protocol
  • Full HTTP client β€” edit URL, method (GET/POST/PUT/DELETE/PATCH/HEAD/OPTIONS), headers, and body
  • Response inspector β€” status code, timing, response headers, and full response body
  • Supports HTTPS β€” with self-signed certificate tolerance

⚠️ Risk Analysis

  • Per-device risk scoring (0-100) based on traffic patterns
  • Alert system β€” detects proxy ports, botnet indicators, suspicious DNS, and anomalies
  • Severity levels β€” low, medium, high, critical with visual indicators

πŸ“Š Visualization

  • Protocol distribution β€” donut chart showing traffic breakdown
  • Traffic over time β€” real-time line chart of inbound/outbound data
  • Risk gauges β€” per-device risk bars with color-coded severity

πŸš€ Quick Start

Prerequisites

  • macOS or Linux (uses tcpdump and arp)
  • Node.js 18+
  • sudo access (required for packet capture and DNS proxy on port 53)

Install & Run

# Clone the repo
git clone https://github.com/viralcode/netsentry.git
cd netsentry

# Install dependencies
npm install

# Run with sudo (required for tcpdump and port 53)
sudo node server.js

Open http://localhost:3000 in your browser.

What happens on startup:

  1. Express server starts on port 3000
  2. DNS proxy binds to your LAN IP on port 53
  3. WebSocket server initializes for real-time updates
  4. Dashboard is ready β€” click Scan Network to discover devices

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Browser (UI)                    β”‚
β”‚  Device Grid β†’ Inspector β†’ Packet Drawer        β”‚
β”‚  DNS Log β†’ Alerts β†’ Charts                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ WebSocket + REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Node.js Server                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Scanner  β”‚ β”‚ Capture  β”‚ β”‚   DNS Proxy     β”‚  β”‚
β”‚  β”‚ (arp)    β”‚ β”‚(tcpdump) β”‚ β”‚ (UDP port 53)   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚           Traffic Analyzer               β”‚    β”‚
β”‚  β”‚  Risk scoring, protocol detection,       β”‚    β”‚
β”‚  β”‚  anomaly detection, alert generation     β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

netsentry/
β”œβ”€β”€ server.js              # Main server: Express + WebSocket + DNS Proxy
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ scanner.js          # Network scanning (arp, ping sweep)
β”‚   β”œβ”€β”€ capture.js          # Traffic capture via tcpdump (with payload)
β”‚   β”œβ”€β”€ analyzer.js         # Traffic analysis & risk scoring
β”‚   └── dns-proxy.js        # UDP DNS proxy server
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html          # Single-page dashboard
β”‚   β”œβ”€β”€ css/style.css       # Glassmorphic dark theme design system
β”‚   └── js/app.js           # Frontend: WebSocket, charts, drawer, request builder
└── package.json

πŸ”§ Configuration

Enable Full DNS Visibility

To see DNS queries from all devices on your network (not just your Mac):

  1. Set your router's DNS server to your Mac's IP (shown in the terminal output)
  2. Or configure individual devices to use your Mac as DNS

Environment Variables

Variable Default Description
PORT 3000 HTTP server port

πŸ›‘οΈ Security Considerations

  • This tool requires root/sudo for packet capture and DNS port 53
  • Only use on networks you own or have permission to monitor
  • The DNS proxy forwards all queries to upstream (8.8.8.8 by default)
  • The request builder can send HTTP requests to any host β€” use responsibly
  • No data is sent externally β€” everything stays local

🧰 Tech Stack

  • Backend: Node.js, Express, WebSocket (ws)
  • Frontend: Vanilla JS, CSS (no frameworks)
  • Network: tcpdump, arp, raw UDP sockets (DNS proxy)
  • Design: Glassmorphic dark theme, SVG icon system, Canvas charts

πŸ“‹ API Endpoints

Method Endpoint Description
GET /api/network-info Get network interface info
GET /api/scan Trigger network scan
GET /api/devices Get cached scan results
POST /api/capture/start/:ip Start packet capture for device
POST /api/capture/stop/:ip Stop capture for device
GET /api/dns-log Get DNS query log
GET /api/device-dns/:ip Get DNS profile for a device
GET /api/lookup/:ip Reverse DNS + IP metadata
POST /api/request-builder Send arbitrary HTTP request
GET /api/alerts Get security alerts
GET /api/dns-proxy/stats DNS proxy statistics

πŸ“„ License

MIT


Built with β˜• and paranoia about IoT devices.