A fast and efficient Port-Scanner with multithreading support for network reconnaissance and security testing.
This tool is for educational and authorized testing purposes only.
- Only scan networks and systems you own or have explicit permission to test
- Unauthorized port scanning may be illegal in your jurisdiction
- Users are responsible for compliance with local laws and regulations
- The developers assume no liability for misuse of this tool
- π Fast Multithreaded Scanning: Concurrent port scanning with configurable thread count
- π― Service Detection: Identifies services running on open ports
- π·οΈ Banner Grabbing: Attempts to capture service banners for identification
- π Real-time Progress: Live progress bar showing scan status
- π Hostname Support: Accepts both IP addresses and hostnames
- π¨ Colored Output: Easy-to-read results with color-coded information
- β‘ Efficient Resource Usage: Optimized for speed without overwhelming targets
- π‘οΈ Input Validation: Comprehensive error handling and validation
- Python 3.6 or higher
- No external dependencies required (uses built-in libraries)
git clone https://github.com/AkshayRane05/Port-Scanner.git
cd Port-Scannerchmod +x port_scanner.pypython port_scanner.pyPort-Scanner will prompt you for:
- Target IP address or hostname
- Start port number (1-65535)
- End port number (1-65535)
==================================================
PORT SCANNER
==================================================
Enter target IP/hostname: 192.168.1.1
Enter start port (1-65535): 1
Enter end port (1-65535): 1000
[+] Starting scan on host: 192.168.1.1
[+] Scanning ports 1-1000
[+] Progress: 1000/1000 ports scanned, 5 open
[+] Port Scan Results:
------------------------------------------------------------
Port Service Status Banner
------------------------------------------------------------
22 ssh Open SSH-2.0-OpenSSH_8.2p1
80 http Open Apache/2.4.41 (Ubuntu)
443 https Open
3306 mysql Open 5.7.34-0ubuntu0.18.04.1
8080 http-alt Open Jetty/9.4.z-SNAPSHOT
------------------------------------------------------------
[+] Found 5 open ports
# Scan common ports on local network
python port_scanner.py
# Target: 192.168.1.1
# Ports: 1-1000# Focus on web-related ports
python port_scanner.py
# Target: example.com
# Ports: 80-90# Scan well-known service ports
python port_scanner.py
# Target: 10.0.0.1
# Ports: 1-1024# Scan specific port range
python port_scanner.py
# Target: localhost
# Ports: 8000-9000- Uses
ThreadPoolExecutorwith 100 concurrent workers - Optimized for balance between speed and resource usage
- Prevents overwhelming target systems
- Leverages Python's
socket.getservbyport()for service identification - Covers standard IANA port assignments
- Falls back to "Unknown" for unregistered ports
- Attempts to capture service banners for identification
- Sends appropriate requests for common services (HTTP, FTP, SSH, etc.)
- Timeout protection to prevent hanging connections
- Real-time progress bar using
\rcharacter for line overwriting - Shows ports scanned and open ports found
- Clean, single-line progress indicator
- Local Network: 500-1000 ports/second
- Internet Hosts: 100-500 ports/second (depends on latency)
- Large Ranges: Efficiently handles 1000+ port scans
- Memory: ~10-20MB for typical scans
- CPU: Moderate usage, scales with thread count
- Network: Minimal bandwidth per connection
- Always obtain proper authorization before scanning
- Respect rate limits and avoid aggressive scanning
- Use for legitimate security testing and research only
- Consider using smaller port ranges for stealth
- Add delays between connections if needed
- Be aware that port scanning can be logged by target systems
# Start test servers on different ports
python -m http.server 8080 &
python -m http.server 8081 &
python -m http.server 8082 &
# Scan the test servers
python port_scanner.py
# Target: localhost
# Ports: 8000-8100# Test against common services
python port_scanner.py
# Target: google.com
# Ports: 80-443| Problem | Solution |
|---|---|
Permission denied |
Run with appropriate privileges or use ports >1024 |
Connection timeout |
Target may be firewalled or non-responsive |
Host unreachable |
Check network connectivity and DNS resolution |
Too many open files |
Reduce concurrent connections or increase system limits |
- "Could not resolve hostname": Check DNS settings and hostname spelling
- "Connection refused": Port is closed or filtered
- "Network unreachable": Check routing and network configuration
Contributions are welcome! Areas for improvement:
- Custom timeout settings
- Output format options (JSON, CSV, XML)
- Steganographic scanning techniques
- Integration with vulnerability databases
- GUI interface development
git clone https://github.com/AkshayRane05/Port-Scanner.git
cd Port-Scanner
# Make your changes
python port_scanner.py # Test your changesThis project is licensed under the MIT License - see the LICENSE file for details.
This tool is provided for:
- β Educational purposes and learning network security
- β Testing your own networks and systems
- β Authorized penetration testing with proper permissions
- β Security research and vulnerability assessment
NOT for:
- β Unauthorized scanning of systems you don't own
- β Malicious reconnaissance or attack preparation
- β Violating terms of service or acceptable use policies
- β Any illegal activities
- Python's
socketlibrary for networking capabilities concurrent.futuresfor efficient multithreading- Security research community for best practices
- Open source community for inspiration and feedback
- GitHub: @AkshayRane05
- Issues: Report bugs or request features
β If this tool helped you learn about network security, please star the repository!
- Network Scanner - Comprehensive network discovery tool
- Network Monitor - Real-time network monitoring