NetworkScanner is a C++ network scanning tool designed to discover active devices on a network and check the status of common ports.
- 🔍 Network Scanning: Automatically detect active hosts within a subnet
- 🚪 Port Checking: Check SSH (port 22) and HTTP (port 80) status
- ⚡ Multi-threaded: Uses async tasks for fast scanning
- 🖥️ Cross-platform: Supports both Windows and Linux
- ⏱️ Configurable Timeout: Adjustable timeout settings
- CMake 3.8+
- GCC with C++20 support
- GDB (for debugging)
- CMake 3.8+
- Visual Studio 2019+ or MinGW
- MSVC or GCC
# Using Cursor IDE
Ctrl + B
# Or using terminal
mkdir -p build/Release
cmake -B build/Release -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build/Release# Using Cursor IDE: Ctrl+Shift+P -> Tasks: Run Task -> Build Debug
# Or using terminal
mkdir -p build/Debug
cmake -B build/Debug -S . -DCMAKE_BUILD_TYPE=Debug
cmake --build build/Debug# Release version
./build/Release/NetworkScanner/NetworkScanner [network_prefix]
# Debug version
./build/Debug/NetworkScanner/NetworkScanner [network_prefix]# Default scan (192.168.1.1-254)
./NetworkScanner
# Custom network scanning with flexible formats
./NetworkScanner 172 # Scan 172.0.0.1-254
./NetworkScanner 10.5 # Scan 10.5.0.1-254
./NetworkScanner 192.168.1 # Scan 192.168.1.1-254
./NetworkScanner 192.168.1. # Scan 192.168.1.1-254 (with trailing dot)
# Show help
./NetworkScanner -h
./NetworkScanner --help- Single octet:
172→ automatically becomes172.0.0. - Double octet:
10.5→ automatically becomes10.5.0. - Triple octet:
192.168.1→ automatically becomes192.168.1. - With trailing dot:
192.168.1.→ remains192.168.1.
The program will scan the specified network range and display:
- IP addresses of active devices
- SSH port (22) status
- HTTP port (80) status
- Scan summary with statistics
- Each octet must be between 0-255
- Maximum 3 octets can be specified
- Invalid formats will show helpful error messages
- F5 - Start debug session
- Set breakpoints by clicking on line numbers
- Use debug controls to step through code
- F5 - Start/Continue
- F10 - Step Over
- F11 - Step Into
- Shift+F11 - Step Out
- Shift+F5 - Stop debugging
NetworkScanner/
├── CMakeLists.txt # Root CMake configuration
├── NetworkScanner/
│ ├── CMakeLists.txt # Executable CMake config
│ ├── NetworkScanner.cpp # Main application
│ ├── NetworkScanner.h # Main header
│ ├── Scanner.cpp # Network scanning logic
│ ├── Scanner.h # Scanner class header
│ └── Host.h # Host structure definition
├── .vscode/
│ ├── tasks.json # Build tasks
│ └── launch.json # Debug configuration
├── build/
│ ├── Debug/ # Debug build output
│ └── Release/ # Release build output
└── README.md # Project documentation
The project comes pre-configured with:
- Ctrl+B: Build Release
- F5: Debug with GDB
- CMake integration
- C++ IntelliSense
- Scanner class: Handles network scanning logic
- Host structure: Stores device information
- Async scanning: Multi-threaded port checking
- Cross-platform sockets: Windows and Linux compatibility
- Ping sweep to detect alive hosts
- Parallel port scanning on discovered hosts
- Results sorting by IP address
- Clean output display
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Project Link: https://github.com/yourusername/NetworkScanner
⭐ Star this repo if you find it helpful!
