A small concurrent TCP network scanner written in Go.
NetPulse was built primarily as a practical exercise in Go concurrency rather than as a production-ready network scanning tool. The scanner uses a worker pool to process network targets concurrently and dynamically adjusts the desired number of workers based on connection timeout rate.
- Scan individual IP addresses and CIDR ranges
- Scan individual ports and port ranges
- Concurrent TCP connections using a worker pool
- Configurable minimum, maximum and initial worker count
- Adaptive concurrency based on timeout rate
- Graceful cancellation with context.Context
- Thread-safe worker pool lifecycle management
Targets
│
▼
Target generator
│
▼
target channel
│
▼
┌─────────────────┐
│ Worker pool │
│ │
│ TCP workers │
└────────┬────────┘
│
▼
result channel
│
▼
┌─────────────────┐
│ Regulator │
│ │
│ timeout rate │
│ ↓ │
│ desired workers │
└────────┬────────┘
│
└──────────► Worker pool
The worker pool separates the desired concurrency from the actual number of running workers. The regulator periodically evaluates the timeout rate and adjusts the desired worker count.
A rising timeout rate causes the pool to reduce concurrency, while a low timeout rate allows it to increase concurrency.
The project intentionally keeps the concurrency model simple:
- channels distribute targets and results
- context.Context provides cancellation
- sync.Mutex protects worker-pool lifecycle state
- atomic.Int64 stores the desired worker count
- workers can terminate themselves when the desired concurrency decreases
- the last worker closes the results channel
The worker pool carefully synchronizes worker creation and termination. The check of the pool state and increment of the active worker count must happen in the same critical section to prevent the results channel from being closed while a new worker is being started.
git clone https://github.com/Cheasezz/netpulse.git
cd netpulse
go build -o netpulse .
Example:
./netpulse -targets 127.0.0.1 -ports 22,80,443,8000-8080
Run ./netpulse -h to see all available options.
NetPulse intentionally has a flat structure and minimal abstractions. The goal is to keep the concurrency model visible and easy to reason about rather than build a feature-rich or production-grade scanner.
The project was created to practice:
- goroutines and channels
- worker pools
- synchronization with mutexes and atomics
- context cancellation
- adaptive concurrency control
Only scan systems and networks that you own or have explicit permission to test.