DEV Community

harristars stars
harristars stars

Posted on

I Built a Network Scanner Dashboard with Python & Flask (Here’s How It Works)


🧠 Introduction

Ever wondered what devices are connected to your network?

I did—and instead of guessing, I built a simple Network Scanner Dashboard using Python and Flask to find out.

👉 The goal: real-time visibility + basic network security

🔍 What the Project Does

This tool scans your local network and shows:

Connected devices
IP & MAC addresses
Vendor information
Unknown/suspicious devices

And all of this is displayed in a simple web dashboard.

⚙️ Tech Stack
Python 🐍
Flask 🌐
Scapy (network scanning)
JavaScript (AJAX updates)
Chart.js 📊
🧪 How It Works (Simplified)

  1. Scan the network

Using ARP scanning:

from scapy.all import ARP, Ether, srp

def scan_network(ip_range):
    arp = ARP(pdst=ip_range)
    ether = Ether(dst="ff:ff:ff:ff:ff:ff")
    packet = ether / arp

    result = srp(packet, timeout=2, verbose=0)[0]

    devices = []
    for sent, received in result:
        devices.append({
            "ip": received.psrc,
            "mac": received.hwsrc
        })

    return devices
Enter fullscreen mode Exit fullscreen mode
  1. Identify vendors

Each MAC address is matched with a vendor:

import requests

def get_vendor(mac):
    try:
        return requests.get(f"https://api.macvendors.com/{mac}").text
    except:
        return "Unknown"
Enter fullscreen mode Exit fullscreen mode
  1. Display results in Flask
@app.route("/")
def index():
    devices = scan_network("192.168.0.0/24")

    for d in devices:
        d["vendor"] = get_vendor(d["mac"])

    return render_template("index.html", devices=devices)
Enter fullscreen mode Exit fullscreen mode
  1. Real-time updates

Using AJAX to refresh data without reloading the page.

📊 What I Learned
Networking fundamentals (ARP, MAC, IP)
Building real-time dashboards
Combining backend + frontend
Handling real-world edge cases
🚨 Why This Matters

This isn’t just a fun project.

It can help:

Detect unknown devices
Improve network visibility
Support IT troubleshooting

👉 Especially useful for small businesses without dedicated monitoring tools.

⚠️ Challenges
Unknown vendors
Device classification
Performance with frequent scans
🔥 Future Improvements
Device fingerprinting
Alerts (email/SMS)
Historical tracking
SaaS version (multi-user dashboard 👀)
💡 Final Thoughts

Simple tools can solve real problems.

This project showed me that you don’t need complex systems to improve security—you just need visibility.

🏷️
#python #flask #networking #cybersecurity #webdev

Top comments (0)