Construyendo un arma específica contra la dictadura
Hasta la fecha todo ha sido ir probando herramientas y comandos de forma manual, en base al análisis de sus resultados nos hemos hecho una idea más o menos acertada de la red del “país”. El siguiente script automatiza parte del trabajo manual y ahorra tiempo, todos los servicios susceptibles de ser atacados los tienen la mayoría del tiempo apagados, y casi todos están instalados en hosts con servicios web, por lo que si el servicio web no funciona los servicios que pretendemos analizar estarán también apagados, por eso no los escaneamos. El script lo podemos ejecutar manualmente o programarlo en crontab para que lo ejecute cron (servicio de crontab) a determinadas horas o cada x minutos como una tarea.
#!/bin/bash <<'EOF' > /dev/null MIT License Copyright (c) 2025 anonimo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. EOF PORT=80 #wifi a usar para hacer el escaner, si es otra no funciona WIFI=$(iwgetid | grep -o 'Galaxy') #hosts con protocolo http siempre activo a escanear pero que a veces abren más puertos HOSTS=(175.45.177.10 175.45.177.11 175.45.176.72) if [ "$WIFI" = "Galaxy" ]; then for HOST in "${HOSTS[@]}"; do # Escaneo al servicio http (puerto 80) SCAN_RESULT=$(nmap -Pn -p $PORT $HOST | grep -oE "$PORT.*open") # Si el puerto está abierto (si $SCAN_RESULT contiene algo), ejecutar un escaneo detallado if [[ ! -z "$SCAN_RESULT" ]]; then echo "[✔] Puerto $PORT abierto en $HOST, iniciando escaneo detallado..." if [ "$HOST" = "175.45.177.10" ]; then nmap -p 5900 -sV --version-all $HOST elif [ "$HOST" = "175.45.177.11" ]; then nmap -p 5900,2049,1025,3306,587 -sV --version-all $HOST elif [ "$HOST" = "175.45.176.72" ]; then nmap -p 1433 -sV --version-all $HOST fi else #si $SCAN_RESULT no contiene nada echo "[✘] Puerto $PORT cerrado en $HOST." fi done SCAN_ROUTER=$(nmap -Pn -p 22 175.45.178.129 | grep -oE "22.*open") if [[ ! -z "$SCAN_ROUTER" ]]; then echo "[✔] Puerto 22 abierto en 175.45.178.129 (Router), iniciando escaneo detallado..." nmap -p 22 -sV --version-all 175.45.178.129 else #si $SCAN_ROUTER no contiene nada echo "[✘] Puerto 22 cerrado en 175.45.178.129 (Router)." fi fi
Ejecutamos el script y vemos que funciona perfectamente
./ciberarma.sh [✔] Puerto 80 abierto en 175.45.177.10, iniciando escaneo detallado... Starting Nmap 7.80 ( https://nmap.org ) at 2025-02-19 02:01 CET Nmap scan report for 175.45.177.10 Host is up (0.46s latency). PORT STATE SERVICE VERSION 5900/tcp filtered vnc Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 6.12 seconds [✔] Puerto 80 abierto en 175.45.177.11, iniciando escaneo detallado... Starting Nmap 7.80 ( https://nmap.org ) at 2025-02-19 02:02 CET Nmap scan report for 175.45.177.11 Host is up (0.46s latency). PORT STATE SERVICE VERSION 587/tcp filtered submission 1025/tcp filtered NFS-or-IIS 2049/tcp filtered nfs 3306/tcp filtered mysql 5900/tcp filtered vnc Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 7.60 seconds [✔] Puerto 80 abierto en 175.45.176.72, iniciando escaneo detallado... Starting Nmap 7.80 ( https://nmap.org ) at 2025-02-19 02:02 CET Nmap scan report for 175.45.176.72 Host is up (0.80s latency). PORT STATE SERVICE VERSION 1433/tcp open ms-sql-s Microsoft SQL Server 2000 8.00.311; RTMa Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 15.55 seconds [✔] Puerto 22 abierto en 175.45.178.129 (Router), iniciando escaneo detallado... Starting Nmap 7.80 ( https://nmap.org ) at 2025-02-19 02:02 CET Nmap scan report for 175.45.178.129 Host is up (0.77s latency). PORT STATE SERVICE VERSION 22/tcp open ssh Cisco SSH 1.25 (protocol 1.99) Service Info: OS: IOS; CPE: cpe:/o:cisco:ios Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 3.82 seconds