Building NetRadar – My First Real Network Scanner in Python
Instead of doing another tutorial project, I decided to build something that actually works in a real environment.
That’s how NetRadar came to life — a simple CLI tool for scanning local networks and detecting open ports.
💡 Why I built it
I didn’t want to just follow guides anymore.
I wanted to understand how networking actually works — not just in theory, but in practice.
So the idea was simple:
Scan a local network → find active devices → check which ports are open.
At first, it sounded straightforward.
In reality, it turned into a much more interesting challenge.
🔧 What NetRadar does
NetRadar is a CLI-based tool that allows you to:
- discover active hosts in a local network
- scan TCP ports (quick / deep modes)
- detect open ports using sockets
- map ports to known services (HTTP, SSH, RDP, etc.)
- validate user input (IP ranges, modes, etc.)
- export results to a structured JSON file
- display clean, readable output in the terminal
🖥️ Example output
======= RESULTS =======
Host: 192.168.0.1
80 (HTTP)
443 (HTTPS)
Host: 192.168.0.5
No open ports
======= SUMMARY =======
Active hosts: 2
Open ports found: 2
📁 JSON output
One of the things I focused on was making the output usable, not just visible.
{
"scan_info": {
"base": "192.168.0.",
"range": "192.168.0.1-192.168.0.10",
"mode": "quick",
"timestamp": "2026-04-12 20:15:33"
},
"results": [
{
"ip": "192.168.0.1",
"open_ports": [
{ "port": 80, "service": "HTTP" }
]
}
]
}
⚙️ How it works (simplified)
1. Host discovery
I used subprocess to ping IP addresses:
ping -n 1 192.168.0.x
If the response is successful → the host is active.
2. Port scanning
This was the most interesting part.
I used Python sockets:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.settimeout(0.5)
result = sock.connect_ex((host_ip, port))
If result == 0, the port is open.
3. Data structure
Instead of just printing results, I stored everything in dictionaries:
{
"ip": "192.168.0.1",
"active": True,
"open_ports": [
{"port": 80, "service": "HTTP"}
]
}
This made it easy to:
- print results
- export to JSON
- extend the project later
🧠 What I learned
This project taught me a lot more than I expected:
- how socket connections actually work
- how to design clean and usable data structures
- how to handle user input properly
- how to turn logic into a real CLI tool
- how small UX details (like output formatting) matter
The biggest difference compared to tutorials was this:
I had to solve real problems on my own.
🚀 Challenges
Some things were harder than I thought:
- handling invalid user input
- structuring the data cleanly
- making the output readable
- debugging network behavior
At one point, nothing worked and I had no idea why —
but fixing those issues was the most valuable part.
🔥 What’s next (NetRadar V2)
I’m already working on improvements:
- multi-threading (faster scanning)
- better performance
- more advanced features
- possibly a simple GUI
🧭 Final thoughts
This is not a huge project, but it’s the first one that actually feels like a real tool, not just an exercise.
And that changed the way I approach learning.
Instead of just consuming content, I’m trying to build things that:
- solve real problems
- can be improved over time
- actually work outside of tutorials
If you have any feedback or ideas — I’d love to hear them 👇
Top comments (0)