A powerful network connectivity analyzer with real-time system monitoring and IPv6 support
Project description
๐ TCP Port and Ping Checker
A powerful, real-time network connectivity analyzer that performs both ping and TCP port checks with intelligent system resource management.
๐ Features
- ๐ Dual Connectivity Check: Both ping and TCP port verification
- ๐ IPv6 Support: Full support for IPv4, IPv6, and domain names
- โก Real-time System Monitoring: CPU and RAM usage tracking
- ๐ค Dynamic Resource Management: Auto-adjusting thread count and batch sizes
- ๐ก๏ธ Intelligent Throttling: Automatic slowdown on high system load
- ๐ Comprehensive Reporting: Beautiful HTML and detailed TXT reports
- ๐ง CLI Support: Flexible command-line interface
- ๐ฏ Multi-format Input: Single IPs, comma-separated lists, or file-based
- ๐งต Thread-safe Operations: Secure concurrent processing
- ๐ Performance Analytics: Real-time progress monitoring
๐ Project Structure
tcp-port-checker/
โโโ main.py # Main application with CLI support
โโโ config.py # Configuration and IP loading
โโโ network_checker.py # Core network checking logic
โโโ system_monitor.py # Real-time system monitoring
โโโ report_generator.py # Report generation (TXT/HTML)
โโโ ip_addresses.txt # IP addresses list (auto-generated)
โโโ requirements.txt # Dependencies
โโโ README.md # This file
๐ ๏ธ Installation
Prerequisites
- Python 3.6+ (recommended: Python 3.8+)
Quick Setup
# Clone the repository
git clone https://github.com/ismailTrk/tcp-port-checker.git
cd tcp-port-checker
# Install dependencies
pip install -r requirements.txt
# Run with default settings
python3 main.py
Dependencies
psutil>=5.8.0- System resource monitoring
All other components use Python standard library.
๐ Usage
Basic Usage
# Check IPs from default file (ip_addresses.txt)
python3 main.py
# Quick single IP check
python3 main.py -ip 192.168.1.1
# Check specific port
python3 main.py -ip 192.168.1.1 -p 22
# Check IPv6 addresses
python3 main.py -ip "2001:4860:4860::8888,::1" -p 53
# Mixed IPv4, IPv6, and domains
python3 main.py -ip "8.8.8.8,2001:4860:4860::8888,google.com" -p 443
Advanced Usage
# Use custom IP file
python3 main.py -f /path/to/custom_ips.txt
# Custom timeout and workers
python3 main.py -ip 10.0.0.1 -t 5 --no-monitor -w 20
# Generate only specific report type
python3 main.py --txt-only -o scan_results
# Complex scan with custom settings
python3 main.py -f /var/network_ips.txt -p 9000 -t 10 -o network_audit
CLI Parameters
| Parameter | Description | Example |
|---|---|---|
-ip, --ip-address |
Single IP or comma-separated list | -ip 192.168.1.1 |
-p, --port |
Target port to check | -p 9000 |
-f, --file |
Custom IP list file | -f /var/ips.txt |
-t, --timeout |
Connection timeout (seconds) | -t 5 |
-o, --output |
Output file prefix | -o scan_results |
--txt-only |
Generate only TXT report | --txt-only |
--html-only |
Generate only HTML report | --html-only |
--no-monitor |
Disable system monitoring | --no-monitor |
-w, --workers |
Worker thread count (static mode) | -w 15 |
๐ IP Address File Format
Create ip_addresses.txt or use custom files:
# TCP Port Checker - IP Addresses List
# Lines starting with # are comments
# Single IPs
192.168.1.1
10.0.0.1
# Comma-separated IPs
192.168.1.10, 192.168.1.11, 192.168.1.12
# Domain names
google.com
github.com
๐ System Features
๐ค Dynamic Worker Management
- Low Load (<30%): CPU_COUNT ร 3 workers
- Medium Load (30-60%): CPU_COUNT ร 2 workers
- High Load (60-80%): CPU_COUNT ร 1 worker
- Critical Load (>80%): CPU_COUNT รท 2 workers
๐ฆ Dynamic Batch Processing
- High Load: Small batches (ร0.4)
- Normal Load: Regular batches (ร1.0)
- Low Load: Large batches (ร1.4)
๐ก๏ธ Intelligent Throttling
- >95% Usage: 2-second delays
- >90% Usage: 1-second delays
- >85% Usage: 0.5-second delays
๐ Output Examples
Console Output
๐ Checking 5 hosts on port 52311
๐ป CPU:โโโโโโโโโ(87.3%) | RAM:โโโโโโโโ(75.2%) | Workers:8 | Throttle:๐ข
IP ADDRESS | PING | PORT | STATUS
----------------------------------------------------------------------
192.168.1.1 | PING โ | TCP52311 โ | ๐ก PING OK, PORT CLOSED
10.0.0.1 | PING โ | TCP52311 โ | ๐ข FULL ACCESS
google.com | PING โ | TCP52311 โ | ๐ก PING OK, PORT CLOSED
Status Codes
- ๐ข FULL ACCESS: Ping โ + Port โ
- ๐ก PING OK, PORT CLOSED: Ping โ + Port โ
- ๐ PING FAILED, PORT OPEN: Ping โ + Port โ
- ๐ด NO ACCESS: Ping โ + Port โ
๐จ Report Generation
TXT Report
- Detailed statistics and analysis
- Categorized results by status
- Performance recommendations
- Problem analysis and suggestions
HTML Report
- Interactive web interface
- Color-coded status indicators
- Real-time filtering
- Responsive design for all devices
โ๏ธ Configuration
Edit config.py to customize:
DEFAULT_PORT = 52311 # Default port to check
DEFAULT_TIMEOUT = 3 # Connection timeout
MIN_WORKERS = 2 # Minimum threads
MAX_WORKERS_LIMIT = 50 # Maximum threads
THROTTLE_CPU_THRESHOLD = 85 # CPU throttle threshold
THROTTLE_MEMORY_THRESHOLD = 85 # RAM throttle threshold
๐ง Development
Code Structure
- Modular Design: Clean separation of concerns
- PEP 8 Compliant: Professional Python standards
- Thread-safe: RLock protection for shared resources
- Error Handling: Comprehensive exception management
- Type Hints: Enhanced code readability
Testing
# Test with minimal IPs
echo "127.0.0.1" > test_ips.txt
python3 main.py -f test_ips.txt
# Test CLI arguments
python3 main.py -ip 127.0.0.1 -p 22 --txt-only
๐ Troubleshooting
Common Issues
IP file not found:
โ IP list file not found: ip_addresses.txt
Solution: The program will auto-create a sample file. Edit it and run again.
Permission denied for ping:
โ Ping command failed
Solution: On some systems, you may need sudo privileges for ping commands.
Invalid IP format:
โ ๏ธ Line 5: Invalid IP format skipped: 10.25.1.300
Solution: Fix IP addresses (values must be 0-255).
Performance Tips
- Use
--no-monitorfor consistent performance on stable systems - Adjust
-w(workers) based on your system capabilities - Use
-t(timeout) appropriate for your network latency
๐ System Requirements
- OS: Linux, Windows, macOS
- Python: 3.6+ (recommended: 3.8+)
- RAM: Minimum 256MB available
- CPU: Any modern processor
- Network: Ping command access, TCP socket permissions
๐ค Contributing
Contributions are welcome! Please feel free to submit pull requests.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
๐ License
This project is open source and available under the MIT License.
๐ Support
If you encounter any issues or have questions:
- Open an issue on GitHub
- Check the troubleshooting section
- Review the example usage patterns
โก Pro Tip: Start with python3 main.py -ip 127.0.0.1 to test the application quickly!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tcp_port_checker-1.0.2.tar.gz.
File metadata
- Download URL: tcp_port_checker-1.0.2.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ef20009a72cdebd26aa3fa5e2461fbdbdd37b60b3ea521bbbca94b6d70aad49
|
|
| MD5 |
ad14e876a248a811e85fc65f6bd72526
|
|
| BLAKE2b-256 |
2f32fb9361d74594997635a05a7138ca921e50f5117afbfcaf67c773de0f50e0
|
File details
Details for the file tcp_port_checker-1.0.2-py3-none-any.whl.
File metadata
- Download URL: tcp_port_checker-1.0.2-py3-none-any.whl
- Upload date:
- Size: 22.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f9f8cbfc7dffaa9496ee812c4f9d3fa7c1a6060869b532472dc8e5ae61ed277
|
|
| MD5 |
6fb1fca410ee392f281c0f12bafaf7d9
|
|
| BLAKE2b-256 |
741b51eca63417aebda32055662af06cf7a2222f56af132e19248686b524d542
|