# ๐ 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
```bash
# 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
```bash
# 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
```bash
# 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:
```txt
# 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:
```python
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
```bash
# 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-monitor` for 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.
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests if applicable
5. Submit a pull request
## ๐ License
This project is open source and available under the [MIT License](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!
Raw data
{
"_id": null,
"home_page": "https://github.com/ismailTrk/tcp-port-checker",
"name": "tcp-port-checker",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "network, tcp, port, checker, ping, monitoring, connectivity, scanner",
"author": "iturkyilmazoglu",
"author_email": "ismail.turkyilmazoglu@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/2f/32/fb9361d74594997635a05a7138ca921e50f5117afbfcaf67c773de0f50e0/tcp_port_checker-1.0.2.tar.gz",
"platform": null,
"description": "# \ud83c\udf10 TCP Port and Ping Checker\r\n\r\nA powerful, real-time network connectivity analyzer that performs both ping and TCP port checks with intelligent system resource management.\r\n\r\n\r\n\r\n\r\n\r\n## \ud83d\ude80 Features\r\n\r\n- **\ud83d\udd0d Dual Connectivity Check**: Both ping and TCP port verification\r\n- **\ud83c\udf10 IPv6 Support**: Full support for IPv4, IPv6, and domain names\r\n- **\u26a1 Real-time System Monitoring**: CPU and RAM usage tracking\r\n- **\ud83e\udd16 Dynamic Resource Management**: Auto-adjusting thread count and batch sizes\r\n- **\ud83d\udee1\ufe0f Intelligent Throttling**: Automatic slowdown on high system load\r\n- **\ud83d\udcca Comprehensive Reporting**: Beautiful HTML and detailed TXT reports\r\n- **\ud83d\udd27 CLI Support**: Flexible command-line interface\r\n- **\ud83c\udfaf Multi-format Input**: Single IPs, comma-separated lists, or file-based\r\n- **\ud83e\uddf5 Thread-safe Operations**: Secure concurrent processing\r\n- **\ud83d\udcc8 Performance Analytics**: Real-time progress monitoring\r\n\r\n## \ud83d\udcc1 Project Structure\r\n\r\n```\r\ntcp-port-checker/\r\n\u251c\u2500\u2500 main.py # Main application with CLI support\r\n\u251c\u2500\u2500 config.py # Configuration and IP loading\r\n\u251c\u2500\u2500 network_checker.py # Core network checking logic\r\n\u251c\u2500\u2500 system_monitor.py # Real-time system monitoring\r\n\u251c\u2500\u2500 report_generator.py # Report generation (TXT/HTML)\r\n\u251c\u2500\u2500 ip_addresses.txt # IP addresses list (auto-generated)\r\n\u251c\u2500\u2500 requirements.txt # Dependencies\r\n\u2514\u2500\u2500 README.md # This file\r\n```\r\n\r\n## \ud83d\udee0\ufe0f Installation\r\n\r\n### Prerequisites\r\n- **Python 3.6+** (recommended: Python 3.8+)\r\n\r\n### Quick Setup\r\n```bash\r\n# Clone the repository\r\ngit clone https://github.com/ismailTrk/tcp-port-checker.git\r\ncd tcp-port-checker\r\n\r\n# Install dependencies\r\npip install -r requirements.txt\r\n\r\n# Run with default settings\r\npython3 main.py\r\n```\r\n\r\n### Dependencies\r\n- `psutil>=5.8.0` - System resource monitoring\r\n\r\nAll other components use Python standard library.\r\n\r\n## \ud83d\ude80 Usage\r\n\r\n### Basic Usage\r\n\r\n```bash\r\n# Check IPs from default file (ip_addresses.txt)\r\npython3 main.py\r\n\r\n# Quick single IP check\r\npython3 main.py -ip 192.168.1.1\r\n\r\n# Check specific port\r\npython3 main.py -ip 192.168.1.1 -p 22\r\n\r\n# Check IPv6 addresses\r\npython3 main.py -ip \"2001:4860:4860::8888,::1\" -p 53\r\n\r\n# Mixed IPv4, IPv6, and domains\r\npython3 main.py -ip \"8.8.8.8,2001:4860:4860::8888,google.com\" -p 443\r\n```\r\n\r\n### Advanced Usage\r\n\r\n```bash\r\n# Use custom IP file\r\npython3 main.py -f /path/to/custom_ips.txt\r\n\r\n# Custom timeout and workers\r\npython3 main.py -ip 10.0.0.1 -t 5 --no-monitor -w 20\r\n\r\n# Generate only specific report type\r\npython3 main.py --txt-only -o scan_results\r\n\r\n# Complex scan with custom settings\r\npython3 main.py -f /var/network_ips.txt -p 9000 -t 10 -o network_audit\r\n```\r\n\r\n### CLI Parameters\r\n\r\n| Parameter | Description | Example |\r\n|-----------|-------------|---------|\r\n| `-ip, --ip-address` | Single IP or comma-separated list | `-ip 192.168.1.1` |\r\n| `-p, --port` | Target port to check | `-p 9000` |\r\n| `-f, --file` | Custom IP list file | `-f /var/ips.txt` |\r\n| `-t, --timeout` | Connection timeout (seconds) | `-t 5` |\r\n| `-o, --output` | Output file prefix | `-o scan_results` |\r\n| `--txt-only` | Generate only TXT report | `--txt-only` |\r\n| `--html-only` | Generate only HTML report | `--html-only` |\r\n| `--no-monitor` | Disable system monitoring | `--no-monitor` |\r\n| `-w, --workers` | Worker thread count (static mode) | `-w 15` |\r\n\r\n## \ud83d\udcc4 IP Address File Format\r\n\r\nCreate `ip_addresses.txt` or use custom files:\r\n\r\n```txt\r\n# TCP Port Checker - IP Addresses List\r\n# Lines starting with # are comments\r\n\r\n# Single IPs\r\n192.168.1.1\r\n10.0.0.1\r\n\r\n# Comma-separated IPs\r\n192.168.1.10, 192.168.1.11, 192.168.1.12\r\n\r\n# Domain names\r\ngoogle.com\r\ngithub.com\r\n```\r\n\r\n## \ud83d\udcca System Features\r\n\r\n### \ud83e\udd16 Dynamic Worker Management\r\n- **Low Load** (<30%): CPU_COUNT \u00d7 3 workers\r\n- **Medium Load** (30-60%): CPU_COUNT \u00d7 2 workers \r\n- **High Load** (60-80%): CPU_COUNT \u00d7 1 worker\r\n- **Critical Load** (>80%): CPU_COUNT \u00f7 2 workers\r\n\r\n### \ud83d\udce6 Dynamic Batch Processing\r\n- **High Load**: Small batches (\u00d70.4)\r\n- **Normal Load**: Regular batches (\u00d71.0)\r\n- **Low Load**: Large batches (\u00d71.4)\r\n\r\n### \ud83d\udee1\ufe0f Intelligent Throttling\r\n- **>95% Usage**: 2-second delays\r\n- **>90% Usage**: 1-second delays\r\n- **>85% Usage**: 0.5-second delays\r\n\r\n## \ud83d\udcc8 Output Examples\r\n\r\n### Console Output\r\n```\r\n\ud83d\ude80 Checking 5 hosts on port 52311\r\n\ud83d\udcbb CPU:\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591(87.3%) | RAM:\u2588\u2588\u2588\u2588\u2588\u2588\u2591\u2591(75.2%) | Workers:8 | Throttle:\ud83d\udfe2\r\n\r\nIP ADDRESS | PING | PORT | STATUS\r\n----------------------------------------------------------------------\r\n192.168.1.1 | PING \u2713 | TCP52311 \u2717 | \ud83d\udfe1 PING OK, PORT CLOSED\r\n10.0.0.1 | PING \u2713 | TCP52311 \u2713 | \ud83d\udfe2 FULL ACCESS\r\ngoogle.com | PING \u2713 | TCP52311 \u2717 | \ud83d\udfe1 PING OK, PORT CLOSED\r\n```\r\n\r\n### Status Codes\r\n- \ud83d\udfe2 **FULL ACCESS**: Ping \u2713 + Port \u2713\r\n- \ud83d\udfe1 **PING OK, PORT CLOSED**: Ping \u2713 + Port \u2717\r\n- \ud83d\udfe0 **PING FAILED, PORT OPEN**: Ping \u2717 + Port \u2713\r\n- \ud83d\udd34 **NO ACCESS**: Ping \u2717 + Port \u2717\r\n\r\n## \ud83c\udfa8 Report Generation\r\n\r\n### TXT Report\r\n- Detailed statistics and analysis\r\n- Categorized results by status\r\n- Performance recommendations\r\n- Problem analysis and suggestions\r\n\r\n### HTML Report\r\n- Interactive web interface\r\n- Color-coded status indicators\r\n- Real-time filtering\r\n- Responsive design for all devices\r\n\r\n## \u2699\ufe0f Configuration\r\n\r\nEdit `config.py` to customize:\r\n\r\n```python\r\nDEFAULT_PORT = 52311 # Default port to check\r\nDEFAULT_TIMEOUT = 3 # Connection timeout\r\nMIN_WORKERS = 2 # Minimum threads\r\nMAX_WORKERS_LIMIT = 50 # Maximum threads\r\nTHROTTLE_CPU_THRESHOLD = 85 # CPU throttle threshold\r\nTHROTTLE_MEMORY_THRESHOLD = 85 # RAM throttle threshold\r\n```\r\n\r\n## \ud83d\udd27 Development\r\n\r\n### Code Structure\r\n- **Modular Design**: Clean separation of concerns\r\n- **PEP 8 Compliant**: Professional Python standards\r\n- **Thread-safe**: RLock protection for shared resources\r\n- **Error Handling**: Comprehensive exception management\r\n- **Type Hints**: Enhanced code readability\r\n\r\n### Testing\r\n```bash\r\n# Test with minimal IPs\r\necho \"127.0.0.1\" > test_ips.txt\r\npython3 main.py -f test_ips.txt\r\n\r\n# Test CLI arguments\r\npython3 main.py -ip 127.0.0.1 -p 22 --txt-only\r\n```\r\n\r\n## \ud83d\udc1b Troubleshooting\r\n\r\n### Common Issues\r\n\r\n**IP file not found:**\r\n```\r\n\u274c IP list file not found: ip_addresses.txt\r\n```\r\n**Solution**: The program will auto-create a sample file. Edit it and run again.\r\n\r\n**Permission denied for ping:**\r\n```\r\n\u274c Ping command failed\r\n```\r\n**Solution**: On some systems, you may need sudo privileges for ping commands.\r\n\r\n**Invalid IP format:**\r\n```\r\n\u26a0\ufe0f Line 5: Invalid IP format skipped: 10.25.1.300\r\n```\r\n**Solution**: Fix IP addresses (values must be 0-255).\r\n\r\n### Performance Tips\r\n- Use `--no-monitor` for consistent performance on stable systems\r\n- Adjust `-w` (workers) based on your system capabilities\r\n- Use `-t` (timeout) appropriate for your network latency\r\n\r\n## \ud83d\udccb System Requirements\r\n\r\n- **OS**: Linux, Windows, macOS\r\n- **Python**: 3.6+ (recommended: 3.8+)\r\n- **RAM**: Minimum 256MB available\r\n- **CPU**: Any modern processor\r\n- **Network**: Ping command access, TCP socket permissions\r\n\r\n## \ud83e\udd1d Contributing\r\n\r\nContributions are welcome! Please feel free to submit pull requests.\r\n\r\n1. Fork the repository\r\n2. Create a feature branch\r\n3. Make your changes\r\n4. Add tests if applicable\r\n5. Submit a pull request\r\n\r\n## \ud83d\udcdd License\r\n\r\nThis project is open source and available under the [MIT License](LICENSE).\r\n\r\n## \ud83c\udd98 Support\r\n\r\nIf you encounter any issues or have questions:\r\n- Open an issue on GitHub\r\n- Check the troubleshooting section\r\n- Review the example usage patterns\r\n\r\n---\r\n\r\n**\u26a1 Pro Tip**: Start with `python3 main.py -ip 127.0.0.1` to test the application quickly!\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A powerful network connectivity analyzer with real-time system monitoring and IPv6 support",
"version": "1.0.2",
"project_urls": {
"Bug Reports": "https://github.com/ismailTrk/tcp-port-checker/issues",
"Documentation": "https://github.com/ismailTrk/tcp-port-checker#readme",
"Homepage": "https://github.com/ismailTrk/tcp-port-checker",
"Source": "https://github.com/ismailTrk/tcp-port-checker"
},
"split_keywords": [
"network",
" tcp",
" port",
" checker",
" ping",
" monitoring",
" connectivity",
" scanner"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "741b51eca63417aebda32055662af06cf7a2222f56af132e19248686b524d542",
"md5": "6fb1fca410ee392f281c0f12bafaf7d9",
"sha256": "6f9f8cbfc7dffaa9496ee812c4f9d3fa7c1a6060869b532472dc8e5ae61ed277"
},
"downloads": -1,
"filename": "tcp_port_checker-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6fb1fca410ee392f281c0f12bafaf7d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 22084,
"upload_time": "2025-08-02T19:13:22",
"upload_time_iso_8601": "2025-08-02T19:13:22.602310Z",
"url": "https://files.pythonhosted.org/packages/74/1b/51eca63417aebda32055662af06cf7a2222f56af132e19248686b524d542/tcp_port_checker-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2f32fb9361d74594997635a05a7138ca921e50f5117afbfcaf67c773de0f50e0",
"md5": "ad14e876a248a811e85fc65f6bd72526",
"sha256": "9ef20009a72cdebd26aa3fa5e2461fbdbdd37b60b3ea521bbbca94b6d70aad49"
},
"downloads": -1,
"filename": "tcp_port_checker-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "ad14e876a248a811e85fc65f6bd72526",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 23070,
"upload_time": "2025-08-02T19:13:23",
"upload_time_iso_8601": "2025-08-02T19:13:23.937124Z",
"url": "https://files.pythonhosted.org/packages/2f/32/fb9361d74594997635a05a7138ca921e50f5117afbfcaf67c773de0f50e0/tcp_port_checker-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-02 19:13:23",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ismailTrk",
"github_project": "tcp-port-checker",
"github_not_found": true,
"lcname": "tcp-port-checker"
}