Skip to content
CheasezzPublic

About

A small concurrency experiment in which the scanner serves as a practical example.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

10 Commits

Folders and files

Repository files navigation

NetPulse

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.

Features

  • 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

How it works

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.

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.

Installation

git clone https://github.com/Cheasezz/netpulse.git
cd netpulse
go build -o netpulse .

Usage

Example:

./netpulse -targets 127.0.0.1 -ports 22,80,443,8000-8080

Run ./netpulse -h to see all available options.

Project scope

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

Disclaimer

Only scan systems and networks that you own or have explicit permission to test.

About

A small concurrency experiment in which the scanner serves as a practical example.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages