A high-performance, fully containerized TCP SYN Port Scanner built with Python and Scapy. This tool provides fast network reconnaissance by utilizing multithreading and manipulating packets at a low level to perform Half-Open scans.
To understand how this scanner achieves stealth, we must analyze how standard TCP communication differs from a modified, malicious one.
- Standard Connection (Logged): Connecting to a server requires a 3-way handshake. Once completed, the OS passes the connection to the application (e.g., Apache), which creates a log entry.
- Stealth SYN Scan (Unlogged): We manipulate the raw packet headers. We send the initial request (
SYN), receive confirmation from the target (SYN-ACK), and immediately drop the connection by sending a Reset (RST) packet before the target logs the interaction.
sequenceDiagram
autonumber
rect rgb(40, 40, 40)
Note over Client, Server: Standard TCP Connection (Logged)
Client->>Server: SYN (Attempt Connection)
Server-->>Client: SYN-ACK (Port is Open)
Client->>Server: ACK (Establish Connection)
Note over Server: Connection established.<br/>Application creates a log entry.
end
rect rgb(20, 40, 50)
Note over Scanner, Target: Stealth SYN Scan (Unlogged)
Scanner->>Target: SYN (Is Port Open?)
Target-->>Scanner: SYN-ACK (Yes, Open!)
Scanner->>Target: RST (Nevermind, RESET!)
Note over Target: Connection aborted by OS.<br/>NO LOG generated in App Layer.
end
| Feature | Description |
|---|---|
| Speed | Utilizes concurrent.futures to map and execute multithreaded requests, launching 100 simultaneous workers to scan hundreds of ports in seconds. |
| Stealth | Implements a true Half-open scan, abusing low-level TCP flag manipulation to receive responses without establishing a full, loggable connection. |
| Evasion | Helps bypass basic firewall tracking and Intrusion Detection Systems (IDS) by generating randomized source ports for every individual packet. |
| Clean | Fully containerized via Docker. It requires zero host-level dependencies (like libpcap or tcpdump), keeping your main operating system pristine. |
- Clone the repository:
git clone [https://github.com/franlrs/stealth-scanner.git](https://github.com/franlrs/stealth-scanner.git)
cd stealth-scanner
- Configure the Target IP:
Open the
docker-compose.yamlfile and modify theTARGET_IPenvironment variable to match your target.
environment:
- TARGET_IP=10.9.128.1
- Execute the Scanner:
Run the following command. The
--rmflag ensures the container is completely destroyed after the scan finishes.
docker compose run --rm stealth-scanner
Para entender cómo este escáner logra el sigilo, debemos analizar cómo difiere una comunicación TCP estándar de una modificada.
- Conexión Estándar (Registrada): Conectarse a un servidor requiere un protocolo de enlace de 3 vías. Una vez completado, el sistema operativo pasa la conexión a la aplicación (ej: Apache), la cual crea una entrada en sus logs.
- Escaneo Sigiloso SYN (No Registrado): Manipulamos las cabeceras de los paquetes. Enviamos la solicitud inicial (
SYN), recibimos la confirmación (SYN-ACK), e inmediatamente cortamos la conexión enviando un paquete de Reinicio (RST) antes de que el objetivo genere el log.
sequenceDiagram
autonumber
rect rgb(40, 40, 40)
Note over Cliente, Servidor: Conexión TCP Estándar (Registrada)
Cliente->>Servidor: SYN (Intento de conexión)
Servidor-->>Cliente: SYN-ACK (Puerto abierto)
Cliente->>Servidor: ACK (Establecer conexión)
Note over Servidor: Conexión establecida.<br/>La aplicación genera un log.
end
rect rgb(20, 40, 50)
Note over Escáner, Objetivo: Escaneo Sigiloso SYN (No Registrado)
Escáner->>Objetivo: SYN (¿Puerto abierto?)
Objetivo-->>Escáner: SYN-ACK (¡Sí, abierto!)
Escáner->>Objetivo: RST (Olvídalo, ¡RESET!)
Note over Objetivo: Conexión abortada por el SO.<br/>NO genera log en la aplicación.
end
| Característica | Descripción |
|---|---|
| Rapidez | Utiliza concurrent.futures para ejecutar peticiones multihilo, lanzando 100 procesos simultáneos para escanear cientos de puertos en segundos. |
| Sigiloso | Implementa un verdadero escaneo semiabierto (Half-open), abusando de la manipulación de flags TCP a bajo nivel para recibir respuestas sin establecer una conexión completa. |
| Evasión | Ayuda a evadir el rastreo de firewalls básicos y Sistemas de Detección de Intrusos (IDS) generando puertos de origen aleatorios para cada paquete. |
| Limpio | Totalmente contenerizado en Docker. No requiere dependencias a nivel de sistema host (como libpcap o tcpdump), manteniendo el sistema operativo principal limpio. |
- Clonar el repositorio:
git clone [https://github.com/franlrs/stealth-scanner.git](https://github.com/franlrs/stealth-scanner.git)
cd stealth-scanner
- Configurar el Objetivo:
Abre el archivo
docker-compose.yamly modifica la variable de entornoTARGET_IPpara que coincida con tu objetivo.
environment:
- TARGET_IP=10.9.128.1
- Ejecutar el Escáner:
Lanza el siguiente comando. El parámetro
--rmasegura que el contenedor sea destruido automáticamente en cuanto el escaneo termine.
docker compose run --rm stealth-scanner
Project developed by franlrs. Distributed under the MIT License.
