From 074e790c67b353044ee0ea2761bc2f36ab308101 Mon Sep 17 00:00:00 2001 From: Kevin Munoz Date: Sun, 17 Nov 2024 09:06:33 -0500 Subject: [PATCH] mejora de deteccion de servidores de correo --- sevo | 62 +++++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/sevo b/sevo index 7ce5325..ecd2a8a 100755 --- a/sevo +++ b/sevo @@ -1,7 +1,7 @@ #!/bin/bash # Versión del script -VERSION="1.0.0" +VERSION="1.1.0" # Colores y símbolos RED='\033[0;31m' @@ -229,30 +229,54 @@ EOF fingerprint_server() { local response=$1 local server_info=$(echo "$response" | grep -i "^220" | head -n1) + local additional_info=$(echo "$response" | grep -i "at your service" | head -n1) + + if [[ $server_info =~ "mx.google.com" ]] || [[ $server_info =~ "gmail-smtp" ]] || [[ $additional_info =~ "mx.google.com" ]]; then + if [[ $server_info =~ "gsmtp" ]]; then + if [[ $HOSTNAME =~ "gmail-smtp" ]]; then + log "INFO" "Servidor detectado: Google Gmail (SMTP)" + elif [[ $HOSTNAME =~ "aspmx" ]]; then + log "INFO" "Servidor detectado: Google Workspace" + elif [[ $HOSTNAME =~ "google" ]]; then + log "INFO" "Servidor detectado: Google Mail Services" + else + log "INFO" "Servidor detectado: Google Mail Infrastructure" + fi + [[ $VERBOSE == true ]] && log "DEBUG" "Motor SMTP: Google SMTP (gsmtp)" + fi - if [[ $server_info =~ "Microsoft" ]]; then - log "INFO" "Servidor detectado: Microsoft Exchange/Office 365" - [[ $VERBOSE == true ]] && log "DEBUG" "Sistema de correo empresarial Microsoft" - elif [[ $server_info =~ "Google" ]]; then - log "INFO" "Servidor detectado: Google Workspace" - [[ $VERBOSE == true ]] && log "DEBUG" "Sistema de correo Google Workspace" + if [[ $response =~ "STARTTLS" ]]; then + [[ $VERBOSE == true ]] && log "DEBUG" "Soporta: STARTTLS (Cifrado TLS)" + fi + if [[ $response =~ "SMTPUTF8" ]]; then + [[ $VERBOSE == true ]] && log "DEBUG" "Soporta: SMTPUTF8 (Caracteres internacionales)" + fi + if [[ $response =~ "SIZE" ]]; then + local size=$(echo "$response" | grep -i "SIZE" | grep -oP '\d+') + [[ $VERBOSE == true ]] && log "DEBUG" "Tamaño máximo de mensaje: $(($size/1024/1024))MB" + fi + + return 0 + elif [[ $server_info =~ "Microsoft" ]]; then + log "INFO" "Servidor detectado: Microsoft Exchange/Office 365" + [[ $VERBOSE == true ]] && log "DEBUG" "Sistema de correo empresarial Microsoft Exchange" elif [[ $server_info =~ "Postfix" ]]; then - log "INFO" "Servidor detectado: Postfix" - [[ $VERBOSE == true ]] && log "DEBUG" "Servidor de correo Postfix (Linux)" + log "INFO" "Servidor detectado: Postfix" + [[ $VERBOSE == true ]] && log "DEBUG" "Servidor de correo Postfix (Linux)" elif [[ $server_info =~ "Exim" ]]; then - log "INFO" "Servidor detectado: Exim" - [[ $VERBOSE == true ]] && log "DEBUG" "Servidor de correo Exim" + log "INFO" "Servidor detectado: Exim" + [[ $VERBOSE == true ]] && log "DEBUG" "Servidor de correo Exim" elif [[ $server_info =~ "Sendmail" ]]; then - log "INFO" "Servidor detectado: Sendmail" - [[ $VERBOSE == true ]] && log "DEBUG" "Servidor de correo Sendmail" + log "INFO" "Servidor detectado: Sendmail" + [[ $VERBOSE == true ]] && log "DEBUG" "Servidor de correo Sendmail" elif [[ $server_info =~ "Zimbra" ]]; then - log "INFO" "Servidor detectado: Zimbra" - [[ $VERBOSE == true ]] && log "DEBUG" "Suite de colaboración Zimbra" + log "INFO" "Servidor detectado: Zimbra" + [[ $VERBOSE == true ]] && log "DEBUG" "Suite de colaboración Zimbra" else - log "INFO" "Servidor no identificado específicamente" - [[ $VERBOSE == true ]] && log "DEBUG" "Banner del servidor: $server_info" + log "INFO" "Servidor no identificado específicamente" + [[ $VERBOSE == true ]] && log "DEBUG" "Banner del servidor: $server_info" fi - } +} validate_email() { local email=$1 @@ -296,7 +320,7 @@ EOF if [ -n "$primary_mx" ]; then [[ $STEALTH == true ]] && sleep $DELAY - echo -ne "${LOADING} Iniciando diálogo con $primary_mx " + echo -ne "${LOADING} Iniciando diálogo con $primary_mx " temp_commands=$(mktemp) {