Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A fast and efficient Python port scanner with multithreading support for network reconnaissance and security testing.

License

NotificationsYou must be signed in to change notification settings

AkshayRane05/Port-Scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

A fast and efficient Port-Scanner with multithreading support for network reconnaissance and security testing.

⚠️ Legal Disclaimer

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

🚀 Features

  • 🏃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

🛠️ Installation

Prerequisites

  • Python 3.6 or higher
  • No external dependencies required (uses built-in libraries)

Clone the Repository

git clone https://github.com/AkshayRane05/Port-Scanner.gitcd Port-Scanner

Make it Executable (Optional)

chmod +x port_scanner.py

📖 Usage

Basic Syntax

python port_scanner.py

Interactive Mode

Port-Scanner will prompt you for:

  • Target IP address or hostname
  • Start port number (1-65535)
  • End port number (1-65535)

Example Session

==================================================         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

🎯 Common Use Cases

1.Network Discovery

# Scan common ports on local networkpython port_scanner.py# Target: 192.168.1.1# Ports: 1-1000

2.Web Server Analysis

# Focus on web-related portspython port_scanner.py# Target: example.com# Ports: 80-90

3.Service Enumeration

# Scan well-known service portspython port_scanner.py# Target: 10.0.0.1# Ports: 1-1024

4.Custom Port Range

# Scan specific port rangepython port_scanner.py# Target: localhost# Ports: 8000-9000

🔧 Technical Details

Multithreading

  • UsesThreadPoolExecutor with 100 concurrent workers
  • Optimized for balance between speed and resource usage
  • Prevents overwhelming target systems

Service Detection

  • Leverages Python'ssocket.getservbyport() for service identification
  • Covers standard IANA port assignments
  • Falls back to "Unknown" for unregistered ports

Banner Grabbing

  • Attempts to capture service banners for identification
  • Sends appropriate requests for common services (HTTP, FTP, SSH, etc.)
  • Timeout protection to prevent hanging connections

Progress Tracking

  • Real-time progress bar using\r character for line overwriting
  • Shows ports scanned and open ports found
  • Clean, single-line progress indicator

📊 Performance

Speed Metrics

  • Local Network: 500-1000 ports/second
  • Internet Hosts: 100-500 ports/second (depends on latency)
  • Large Ranges: Efficiently handles 1000+ port scans

Resource Usage

  • Memory: ~10-20MB for typical scans
  • CPU: Moderate usage, scales with thread count
  • Network: Minimal bandwidth per connection

🛡️ Security Considerations

Ethical Usage

  • Always obtain proper authorization before scanning
  • Respect rate limits and avoid aggressive scanning
  • Use for legitimate security testing and research only

Detection Avoidance

  • Consider using smaller port ranges for stealth
  • Add delays between connections if needed
  • Be aware that port scanning can be logged by target systems

🔍 Testing

Create Test Environment

# 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 with Real Services

# Test against common servicespython port_scanner.py# Target: google.com# Ports: 80-443

🚨 Troubleshooting

Common Issues

ProblemSolution
Permission deniedRun with appropriate privileges or use ports >1024
Connection timeoutTarget may be firewalled or non-responsive
Host unreachableCheck network connectivity and DNS resolution
Too many open filesReduce concurrent connections or increase system limits

Error Messages

  • "Could not resolve hostname": Check DNS settings and hostname spelling
  • "Connection refused": Port is closed or filtered
  • "Network unreachable": Check routing and network configuration

🤝 Contributing

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

Development Setup

git clone https://github.com/AkshayRane05/Port-Scanner.gitcd Port-Scanner# Make your changespython port_scanner.py# Test your changes

📜 License

This project is licensed under the MIT License - see theLICENSE file for details.

⚖️ Ethical Guidelines

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

🙏 Acknowledgments

  • Python'ssocket library for networking capabilities
  • concurrent.futures for efficient multithreading
  • Security research community for best practices
  • Open source community for inspiration and feedback

📞 Contact


If this tool helped you learn about network security, please star the repository!

🔗 Related Projects

About

A fast and efficient Python port scanner with multithreading support for network reconnaissance and security testing.

Topics

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2026 Movatter.jp