Skip to content

ASHEN-IX/NetLens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‘ NetLens

Real-time Network Traffic Analysis Dashboard

A professional-grade network monitoring tool that provides complete visibility into your local network. Discover connected devices, monitor bandwidth usage, track DNS queries, identify network services, and analyze traffic patterns in real-time through an intuitive web interface.

✨ Features

🎯 Core Capabilities

  • πŸ“± Device Discovery - Automatically scan and discover all connected devices on your network with nmap
  • 🌐 DNS Tracking - See which websites and domains are being accessed by each device
  • πŸ”Œ Service Detection - Identify network services (HTTP, SSH, MySQL, RDP, etc.) using port analysis
  • πŸ“Š Bandwidth Analytics - Real-time bandwidth monitoring with per-device and network-wide metrics
  • πŸ“ˆ Traffic Timeline - Visualize network activity over time with interactive charts
  • πŸŽ›οΈ Per-Device Monitoring - Focus on a single device to see detailed statistics and activity

πŸ› οΈ Technical Features

  • Real-time Processing - Packet capture and analysis with zero latency
  • Automatic Discovery - Network range auto-detection
  • Device Status Tracking - Online/offline device status
  • Low Memory Footprint - Efficient packet storage with circular buffer
  • Thread-safe Operations - Robust background processing
  • Professional Logging - Comprehensive logging for debugging and monitoring

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • Ubuntu/Debian (or compatible Linux)
  • nmap - Network scanning utility
  • Sudo access - Required for packet capture

Installation

  1. Clone or download the project:

    cd ~/Desktop/network-dashboard
  2. Create virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Ensure nmap is installed:

    sudo apt-get update
    sudo apt-get install -y nmap

Usage

Run the dashboard:

sudo /path/to/.venv/bin/streamlit run dashboard.py

Open in browser:

http://localhost:8501

πŸ’‘ Note: Requires sudo for packet capture privileges

πŸ“‹ Requirements

streamlit>=1.28.0          # Web dashboard framework
pandas>=2.0.0              # Data processing
scapy>=2.5.0               # Packet capture
plotly>=5.17.0             # Interactive visualizations
python-nmap>=0.0.1         # Network scanning

πŸ—οΈ Project Structure

network-dashboard/
β”œβ”€β”€ README.md               # This file
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ config.py              # Configuration constants
β”œβ”€β”€ dashboard.py           # Main Streamlit application
β”‚
β”œβ”€β”€ src/                   # Source modules
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ packet_processor.py   # Packet capture & analysis
β”‚   β”œβ”€β”€ network_scanner.py    # Device discovery
β”‚   └── utils.py             # Utility functions
β”‚
└── .venv/                 # Virtual environment (created after setup)

πŸ“– How It Works

Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚     Streamlit Web Interface             β”‚
β”‚  (Dashboard β€’ Device Selection β€’ Stats) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚                     β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PacketProcessor  β”‚  β”‚ NetworkScanner  β”‚
β”‚                  β”‚  β”‚                 β”‚
β”‚ β€’ Capture        β”‚  β”‚ β€’ nmap scan     β”‚
β”‚ β€’ Extract DNS    β”‚  β”‚ β€’ Device list   β”‚
β”‚ β€’ Port analysis  β”‚  β”‚ β€’ Status track  β”‚
β”‚ β€’ Per-device     β”‚  β”‚                 β”‚
β”‚   stats          β”‚  β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                     β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚
            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
            β”‚   Linux Kernel   β”‚
            β”‚ β€’ Packet capture β”‚
            β”‚ β€’ nmap scanning  β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

  1. Device Discovery

    • Scanner runs periodic network scans (every 30 seconds)
    • Identifies online/offline devices
    • Maintains device hostname cache
  2. Packet Capture

    • Scapy sniffs all IP packets on the network
    • Extracts protocol, ports, DNS queries
    • Aggregates per-device statistics
  3. Data Visualization

    • Streamlit renders real-time dashboard
    • Updates every 2 seconds
    • User selects device to focus monitoring

🎨 Dashboard Sections

Overall Network View

  • Top devices by bandwidth and packets
  • Protocol distribution (TCP/UDP/ICMP)
  • Top network services
  • Bandwidth timeline
  • All connected devices table

Per-Device View

  • Device metrics (packets, bandwidth, services, domains)
  • Websites visited (DNS queries)
  • Services used (port analysis)
  • Traffic timeline
  • Recent packets captured

πŸ”§ Configuration

Edit config.py to customize:

# Scan frequency (seconds)
NETWORK_SCAN_INTERVAL = 30

# Network range (auto-detected by default)
DEFAULT_NETWORK_RANGE = "192.168.1.0/24"

# Maximum packets to keep in memory
MAX_PACKETS_STORED = 10000

πŸ› Troubleshooting

"Permission denied" error

# Solution: Run with sudo
sudo /path/to/.venv/bin/streamlit run dashboard.py

Devices not showing

  1. Check if nmap is installed: which nmap
  2. Verify network range: hostname -I
  3. Manual scan test: sudo nmap -sn 192.168.1.0/24
  4. Click "πŸ”„ Scan Now" button to force rescan

No traffic captured

  1. Generate network traffic: ping google.com or curl https://google.com
  2. Check packet capture interface
  3. Verify running with sudo

Dashboard slow/freezing

  1. Reduce MAX_PACKETS_STORED in config
  2. Check system resources: free -h
  3. Monitor logs for errors

πŸ“Š Service Port Mapping

Supports 24+ common services:

  • HTTP/HTTPS (80, 443)
  • SSH (22)
  • DNS (53)
  • FTP (20, 21)
  • SMTP/POP3/IMAP (25, 110, 143)
  • MySQL/PostgreSQL (3306, 5432)
  • RDP (3389)
  • MongoDB (27017)
  • And many more...

πŸ” Security Notes

  • Packet Capture: Requires root/sudo - ensure you run in trusted environments
  • DNS Logging: All DNS queries are captured - be aware of privacy implications
  • Network Access: Only use on networks you own or have permission to monitor
  • Data Storage: Packets kept in memory only - no persistent storage by default

🀝 Contributing

Improvements welcome! Feel free to:

  1. Report bugs and issues
  2. Suggest new features
  3. Submit improvements
  4. Optimize performance

πŸ“ License

MIT License - See LICENSE file for details

πŸ‘¨β€πŸ’» Author

NetLens Contributors - Professional network monitoring made simple.


Last Updated: April 2026
Version: 1.0.0
Status: Production Ready

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages