Multi-Threaded Port Scanner

A powerful and efficient port scanning tool built with Python

Project Overview

This port scanner is designed to efficiently scan multiple IP addresses for open ports using multi-threading capabilities. It provides detailed information about open ports and their associated services, making it a valuable tool for network analysis and security assessment.

Key Features

  • Multi-threaded scanning for optimal performance
  • Support for multiple target IP addresses
  • Service detection for open ports
  • User-friendly colored output
  • Configurable port range scanning
  • Built-in IP validation

Example Scans

Single Target Scan (Local)


$ python port_scanner.py 127.0.0.1
Scanning target: 127.0.0.1
Port 80 is open (HTTP)
Port 3306 is open (MySQL)
Port 5432 is open (PostgreSQL)
Scanning completed in 2.34 seconds

Single Target Scan (Common Website)


$ python port_scanner.py example.com
Scanning target: example.com (93.184.216.34)
Port 80 is open (HTTP)
Port 443 is open (HTTPS)
Scanning completed in 3.12 seconds

Multiple Targets Scan


$ python port_scanner.py 192.168.1.1 192.168.1.2 192.168.1.3
Scanning target: 192.168.1.1
Port 80 is open (HTTP)
Port 443 is open (HTTPS)

Scanning target: 192.168.1.2
Port 22 is open (SSH)
Port 3306 is open (MySQL)

Scanning target: 192.168.1.3
Port 27017 is open (MongoDB)
Scanning completed in 5.67 seconds

# Import required libraries
import socket
import termcolor
from socket import gaierror
import sys
import threading
from queue import Queue
import time

def validate_ip(ip):
    """Validate if the given string is a valid IP address"""
    try:
        socket.inet_aton(ip.strip())
        return True
    except socket.error:
        return False

# ... Rest of the code can be viewed on GitHub ...
            
View on GitHub