- Notifications
You must be signed in to change notification settings - Fork0
A fast and efficient Python port scanner with multithreading support for network reconnaissance and security testing.
License
AkshayRane05/Port-Scanner
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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.gitcd Port-Scannerchmod +x port_scanner.py
python port_scanner.py
Port-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.1Enter start port (1-65535): 1Enter 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.2p180 http Open Apache/2.4.41 (Ubuntu)443 https Open3306 mysql Open 5.7.34-0ubuntu0.18.04.18080 http-alt Open Jetty/9.4.z-SNAPSHOT------------------------------------------------------------[+] Found 5 open ports# Scan common ports on local networkpython port_scanner.py# Target: 192.168.1.1# Ports: 1-1000
# Focus on web-related portspython port_scanner.py# Target: example.com# Ports: 80-90
# Scan well-known service portspython port_scanner.py# Target: 10.0.0.1# Ports: 1-1024
# Scan specific port rangepython 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 portspython -m http.server 8080&python -m http.server 8081&python -m http.server 8082&# Scan the test serverspython port_scanner.py# Target: localhost# Ports: 8000-8100
# Test against common servicespython 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.gitcd Port-Scanner# Make your changespython port_scanner.py# Test your changes
This project is licensed under the MIT License - see theLICENSE 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
About
A fast and efficient Python port scanner with multithreading support for network reconnaissance and security testing.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.