Network attacks rarely announce themselves.
A system can be running normally while thousands of packets move across a network every second. Somewhere inside that traffic, there could be scanning activity, unusual communication patterns, or behavior that deserves investigation.
That raises an important cybersecurity question:
How can we automatically identify network behavior that looks abnormal?
To explore that problem, I built Netra-X, a Python-based Network Intrusion Detection System (NIDS) that captures network traffic, extracts features, uses machine learning for anomaly detection, generates security alerts, and displays those events through a real-time SOC-style dashboard.
The project was developed by Yinkfu Bazil at Grae-X Labs as a hands-on cybersecurity engineering project.
You can explore the source code here:
GitHub: https://github.com/ndi-tech/Netra-X
What Is Netra-X?
Netra-X is a machine learning-based Network Intrusion Detection System built with Python.
Its purpose is to monitor network traffic and identify behavior that deviates from an established baseline.
The project combines traditional network monitoring concepts with machine learning and a real-time web dashboard.
At a high level, Netra-X follows this architecture:
Network Traffic → Packet Capture → Feature Extraction → ML Detection → Alert Manager → Dashboard
This allows the system to move from raw network activity to a security event that a human analyst can investigate.
According to the project’s repository, Netra-X includes real-time packet capture with Scapy, Isolation Forest anomaly detection, a Flask dashboard, SQLite alert storage, severity-based alerts, filtering, search, JSON export, and Server-Sent Events for live updates.
Why I Built a Network Intrusion Detection System
One of the biggest challenges in cybersecurity is visibility.
If you cannot see what is happening on a network, detecting suspicious behavior becomes significantly harder.
Commercial security platforms can provide sophisticated monitoring and detection capabilities, but building a smaller NIDS from scratch is an excellent way to understand the underlying concepts.
Instead of treating intrusion detection as a black box, I wanted to understand the complete pipeline:
- How network packets are captured
- How raw traffic can be converted into useful features
- How normal network behavior can be established
- How machine learning can identify anomalies
- How anomalies become security alerts
- How those alerts can be visualized
- How a security dashboard can communicate events in real time
Netra-X was created around that learning and engineering objective.
How Netra-X Works
The architecture is divided into several stages.
1. Network Packet Capture
The first step is collecting network traffic.
Netra-X uses Scapy for packet capture and network traffic manipulation.
Instead of relying on manually entered data, the system can observe traffic from a selected network interface and process packets as they are captured.
This creates the raw material needed for the rest of the detection pipeline.
2. Feature Extraction
Raw packets contain a large amount of information.
A machine-learning model, however, needs structured numerical information that can be analyzed.
Netra-X therefore includes a feature extraction stage that converts network observations into features that can be processed by the detection system.
Conceptually, the process looks like:
Packet → Network information → Features → Detection model
This stage is critical because the quality and relevance of extracted features directly influence what the detection system can identify.
3. Establishing a Network Baseline
One of the interesting parts of Netra-X is its baseline approach.
Before looking for anomalies, the system can observe traffic that represents normal behavior.
The idea is straightforward:
If we understand what normal network behavior looks like, we can look for activity that significantly deviates from it.
This is particularly useful for anomaly-based intrusion detection.
Instead of trying to manually program a rule for every possible suspicious behavior, the system establishes a model of expected behavior and then looks for deviations.
4. Machine Learning With Isolation Forest
Netra-X uses Isolation Forest from Scikit-learn for anomaly detection.
Isolation Forest is an unsupervised machine-learning technique designed to identify unusual observations.
The underlying concept is particularly useful for anomaly detection because unusual data points can often be isolated more easily than common data points.
In the context of Netra-X:
Normal traffic → establishes expected behavior
Unusual traffic → receives greater anomaly attention
The resulting detection information can then be passed to the alerting layer.
This doesn’t mean that every anomaly is automatically a confirmed cyberattack.
That’s an important distinction.
A legitimate network event can sometimes look unusual.
Therefore, anomaly detection should be treated as a mechanism for identifying behavior that deserves investigation rather than as perfect proof of malicious activity.
5. Alert Generation
Once the detection layer identifies suspicious behavior, Netra-X can generate an alert.
The project supports multiple severity levels:
- LOW
- MEDIUM
- HIGH
- CRITICAL
This gives security events a level of prioritization.
Instead of presenting every event as equally important, the dashboard can communicate which events deserve immediate attention.
For a security analyst, that distinction matters.
A dashboard containing hundreds of identical alerts isn’t necessarily useful.
A dashboard that helps prioritize potentially important events is much more valuable.
6. Real-Time Security Dashboard
One of the most visible parts of Netra-X is its SOC-style dashboard.
The dashboard was designed to provide a visual representation of what the detection engine is seeing.
It includes features such as:
- Total alert statistics
- Severity indicators
- Critical, high, medium, and low alerts
- Alert tables
- Search functionality
- Severity filtering
- Anomaly score visualization
- Intrusion status
- Animated alert notifications
- JSON export
- Alert clearing
- Live traffic statistics
- Live clock and uptime indicators
The project also uses Server-Sent Events (SSE) to deliver real-time dashboard updates.
That means the dashboard isn’t simply a static webpage showing previously stored information.
It can receive events from the backend and update the interface as new alerts are generated.
Netra-X Technology Stack
Netra-X was built using a collection of technologies commonly encountered in Python development, networking, machine learning, and web applications.
| Technology | Purpose |
|---|---|
| Python 3.13+ | Core application and detection logic |
| Scapy | Network packet capture and manipulation |
| Scikit-learn | Machine learning and Isolation Forest |
| Flask | Web dashboard/backend |
| SQLite | Local alert database |
| HTML/CSS/JavaScript | Dashboard interface |
| Server-Sent Events | Real-time dashboard updates |
These technologies are documented in the project’s GitHub repository.
Netra-X Project Architecture
The project is organized into separate components rather than putting the entire application into one file.
The repository includes areas for:
- Packet capture
- Feature extraction
- Detection
- Alert management
- Database operations
- Dashboard functionality
- Demo traffic generation
- Machine-learning models
The main project files include components such as app.py, netrax.py, nids.py, config.py, and requirements.txt.
This modular structure makes the project easier to understand and provides a foundation for future development.
Testing Netra-X
After building the core system, the next step was testing.
A useful intrusion detection system needs more than a dashboard.
It needs to process traffic and demonstrate that the detection pipeline can generate events.
The project includes modes for establishing a baseline, running detection, and running a demonstration with generated traffic.
For example, the repository documents commands such as:
python netrax.py --interface lo --mode baselinefollowed by detection or demonstration modes.
The repository also includes utilities for generating test alerts and pushing events to the dashboard.
This makes it possible to demonstrate the complete pipeline in a controlled environment.
The Netra-X Dashboard in Action
The most satisfying part of the project is seeing the different components work together.
Instead of simply printing a detection message in a terminal, Netra-X can turn an event into a visual security alert.
A typical flow looks like this:
Network activity begins
↓
Packets are captured
↓
Features are extracted
↓
The detection model evaluates the traffic
↓
An anomaly is identified
↓
An alert is generated
↓
The dashboard receives the event
↓
The security interface updates
This creates the feeling of a miniature Security Operations Center.
The dashboard can show alert counts, severity levels, scores, and individual security events in one interface.
What Makes Netra-X Different From a Simple Python NIDS Project?
There are many introductory Python network-monitoring projects.
Netra-X goes beyond simply sniffing packets and printing them to the terminal.
The project combines several layers:
Network monitoring
Traffic is captured using Scapy.
Machine learning
Isolation Forest is used for anomaly detection.
Alert management
Detected events are assigned severity levels.
Persistence
Alerts can be stored using SQLite.
Web application
Flask powers the dashboard.
Real-time communication
SSE enables live dashboard updates.
Security visualization
The interface presents events through a SOC-inspired design.
This combination makes Netra-X a practical learning project covering several areas of cybersecurity engineering at once.
What I Learned Building Netra-X
Building a cybersecurity system from scratch teaches lessons that are difficult to get from theory alone.
One of the biggest lessons is that detection is not simply about finding “bad traffic.”
Real networks are noisy.
Normal applications can generate unusual traffic.
Different environments have different baselines.
And a machine-learning model can identify anomalies without necessarily understanding the intent behind them.
That means a real detection system needs more than a model.
It needs:
Data → Detection → Context → Prioritization → Investigation
The dashboard and alerting layers are therefore just as important as the detection algorithm.
Limitations of This NIDS Project
Netra-X is a cybersecurity engineering and learning project.
It should not be presented as a replacement for a production enterprise NIDS, SIEM, EDR, or SOC platform.
There are several areas that could be improved in future versions.
For example:
- More advanced feature engineering
- Multiple detection models
- Signature-based detection
- Better false-positive handling
- Alert correlation
- Historical analytics
- Authentication and access control
- Distributed monitoring
- More network protocols
- Improved model evaluation
- PCAP replay and analysis
- Threat-intelligence integration
- Automated response workflows
- Production-grade deployment
These improvements could transform Netra-X from a focused NIDS project into a much broader security monitoring platform.
Future Development of Netra-X
The current version provides a strong foundation.
Future versions could explore hybrid intrusion detection.
Instead of relying exclusively on anomaly detection, Netra-X could combine:
Signature-based detection + anomaly detection + behavioral analysis + threat intelligence
That would provide multiple perspectives when evaluating network activity.
Another interesting direction would be building historical dashboards that allow analysts to investigate:
- When an alert occurred
- Which host generated it
- What protocol was involved
- How frequently similar events occurred
- Whether the behavior continued
- Whether multiple alerts are related
That would move the project closer to a complete security analytics platform.
Why Build Cybersecurity Tools From Scratch?
There is a major difference between using a cybersecurity tool and understanding how one works.
Using a commercial NIDS can teach you how to operate the interface.
Building one teaches you what happens behind the interface.
You have to think about:
Data collection.
Network protocols.
Feature engineering.
Machine learning.
Detection thresholds.
False positives.
Alert prioritization.
Data storage.
Real-time communication.
Security visualization.
That is why projects like Netra-X are valuable for cybersecurity developers, students, ethical hackers, and security engineers.
Ethical Use and Lab Testing
Netra-X should be used responsibly.
Network monitoring and security testing should only be performed on systems and networks that you own or have explicit authorization to test.
For demonstrations, I recommend using a controlled local environment, virtual machines, loopback interfaces, or other isolated laboratory infrastructure.
The purpose of Netra-X is defensive:
observe → detect → alert → investigate
Not unauthorized access.
Netra-X: Built by Yinkfu Bazil at Grae-X Labs
Netra-X was developed by Yinkfu Bazil as part of the cybersecurity engineering work associated with Grae-X Labs.
Grae-X Labs focuses on technology innovation across areas including:
- Cybersecurity
- Artificial intelligence
- Software engineering
- Cloud technologies
- DevOps
- DevSecOps
- AI agent development
- IT solutions
Projects such as Netra-X are part of a broader approach to learning by building real systems.
Rather than simply discussing cybersecurity concepts…
we build them.
Explore the Netra-X Source Code
The complete project is publicly available on GitHub.
You can inspect the architecture, explore the Python implementation, review the dashboard components, and experiment with the project in your own authorized cybersecurity laboratory.
View the Netra-X GitHub repository:
Final Thoughts
Building Netra-X started with a simple question:
Can I build my own Network Intrusion Detection System with Python and machine learning?
The answer became a working project.
Netra-X captures network traffic, extracts features, establishes a baseline, applies machine-learning-based anomaly detection, generates severity-based alerts, stores security events, and presents those events through a real-time dashboard.
More importantly, the project demonstrates how different cybersecurity engineering concepts can be connected into one system.
A packet is just data.
A feature gives that data meaning.
A detection model identifies unusual behavior.
An alert gives the behavior context.
And a dashboard gives a human analyst visibility.
That’s the idea behind Netra-X.
Network Intelligence. Extra Security.
About the Developer
Yinkfu Bazil is a cybersecurity and technology developer working through Grae-X Labs, building projects across cybersecurity, artificial intelligence, software engineering, cloud, DevOps, and DevSecOps.
Netra-X represents a hands-on approach to cybersecurity development: learn the underlying technology, build the system, test it in an authorized environment, and continuously improve it.
Frequently Asked Questions
What is Netra-X?
Netra-X is a Python-based Network Intrusion Detection System designed to monitor network traffic, detect anomalous behavior using machine learning, generate security alerts, and display those events through a real-time dashboard.
What machine learning algorithm does Netra-X use?
Netra-X uses Isolation Forest for anomaly detection through Scikit-learn.
What programming language is Netra-X built with?
Netra-X is primarily built with Python.
What is Scapy used for in Netra-X?
Scapy is used for network packet capture and manipulation.
Does Netra-X have a real-time dashboard?
Yes. Netra-X includes a Flask-based SOC-style dashboard with real-time updates using Server-Sent Events.
Does Netra-X store alerts?
Yes. The project uses SQLite for local alert storage.
Is Netra-X open source?
The Netra-X repository is publicly available on GitHub.
Can I use Netra-X for cybersecurity learning?
Yes. Netra-X is particularly useful as a learning and experimentation project for understanding network monitoring, anomaly detection, Python cybersecurity development, and security dashboards.
Is Netra-X a replacement for an enterprise security platform?
No. Netra-X is a project designed for learning, experimentation, and demonstrating core NIDS concepts. Production environments require significantly more testing, validation, monitoring, security controls, and operational capabilities.
Project Information
Project: Netra-X
Category: Network Intrusion Detection System
Developer: Yinkfu Bazil
Company: Grae-X Labs
Language: Python
Detection: Machine Learning / Isolation Forest
Packet Capture: Scapy
Web Framework: Flask
Database: SQLite
Dashboard: HTML / CSS / JavaScript
Real-Time Updates: Server-Sent Events
Repository: GitHub
Built for cybersecurity education, experimentation, and defensive security engineering.

