Implementation Story
March 10, 2025: The Beginning
I have started sketching out the architecture for what I hope will be a security-first dashboard. I want to see exactly what is happening on my network, not just high-level summaries. I have decided to go with Python for the backend: it is readable, and the Scapy library seems incredibly flexible for working with raw packets. I am a bit nervous about the performance overhead of Python for a sniffer, but for a learning project, the ability to rapidly prototype new detection rules is more important to me right now.
March 28, 2025: The Loopback Wall
I hit a massive wall today. I spent hours trying to figure out why my sniffer could not see any of the attack packets I was sending from my own machine. I was using a standard socket listener, but it turns out that on Linux, local traffic on the loopback interface often bypasses the parts of the networking stack where standard sockets live. It was incredibly frustrating. Then I had an aha! moment after digging through some old forums: I need to use Scapy Layer 2 sockets and the sendp() function to talk directly to the interface. Once I made the switch, the terminal finally started lighting up with the ICMP packets I was injecting. It felt like I finally found the key to the front door.
April 15, 2025: WAF & False Positives
Moving up the stack to the Web Application Firewall today. I am using Flask to intercept and inspect incoming HTTP requests. I ran into a classic beginner mistake: false positives. I noticed that my WAF was blocking perfectly legitimate requests just because they contained the word DELETE in the headers. It was a nightmare. I realized I was looking at the wrong headers and being way too aggressive with my pattern matching. This taught me a valuable lesson about fail-open versus fail-closed security. I have decided to move to a whitelist-only approach for user inputs, specifically targeting the request body and URL parameters. It is much cleaner and way less prone to breaking the app for actual users.
May 10, 2025: Testing & Polish
It is finally coming together. I just hit a milestone of 100+ passing tests in the test_waf.py suite. It took a long time to write all those edge cases for SQL injection and XSS, but seeing that wall of green text in the terminal is so satisfying. The highlight of the day was seeing the first real-time SQLi alert pop up in the React frontend. I am using Socket.IO to stream alerts from the Python engine, and seeing that terminal-style notification slide in when I sent a malicious UNION SELECT payload made all the late nights worth it.
Reflections
Building this project from scratch has changed how I think about security. It is not just about setting up a firewall and walking away: it is about visibility and constant, rigorous testing. If you cannot see the traffic, you cannot defend against it. I am coming out of this with a much deeper respect for the tools I use every day.