# Scripting

### Script - AutoScan

> Herramienta de automatización para un reconocimiento de red completo. El proceso incluye un escáner nmap general de puertos, un escáner nmap específico de servicios y versiones, y un escáner nmap UDP top 1000. Por último, exporta los resultados en dos archivos de texto.

{% code title="autoscan.sh" overflow="wrap" %}

```bash
#!/bin/bash

# Colores
Grey='\033[1;30m'  
Red='\033[1;31m' 
Green='\033[1;32m' 
Yellow='\033[1;33m' 
Blue='\033[1;34m' 
Magenta='\033[1;35m'  
Cyan='\033[1;36m' 
White='\033[1;37m'

# Verifica si se pasó una IP
if [ $# -ne 1 ]; then
    echo -e "${Red}[*] Oopss! No se ha proporcionado una dirección IP uwu"
    echo -e "${Grey}--- Uso: sudo $0 <IP> ---"
    exit 1
fi

IP="$1"

echo -e "${Magenta}    ___           __         _____                   "
echo -e "${Magenta}   /   |  __  __ / /_ ____  / ___/ _____ ____ _ ____ "
echo -e "${Magenta}  / /| | / / / // __// __ \ \__ \ / ___// __ \`/  __\ "
echo -e "${Magenta} / ___ |/ /_/ // /_ / /_/ /___/ // /__ / /_/ // / / / "
echo -e "${Magenta}/_/  |_|\__,_/ \__/ \____//____/ \___/ \__,_//_/ /_/  "
echo -e "                                                                "                                   
echo -e "${White}by jesssuwu <3 "

echo -e "${Magenta}\n[*] Iniciando Scan General para IP: ${White}$IP"
echo -e "\n${Grey}Espere..."
sudo nmap -sS --min-rate 5000 -p- --open "$IP" -n -Pn -oN puertos > /dev/null

ports=$(grep '^[0-9]' puertos | cut -d '/' -f1 | xargs | tr ' ' ',')

echo -e "${Green}\n[+] Puertos Abiertos Encontrados: ${White}$ports"

echo -e "${Magenta}\n[*] Escaneando Puertos y Servicios..."
echo -e "\n${Grey}Espere..."
nmap -sCV -p$ports "$IP" -oN scan_$IP.txt > /dev/null

echo -e "${Green}\n[+] Listo!"
echo -e "${Magenta}\n[*] Realizando Scan UDP Top 1000..."
echo -e "\n${Grey}Espere..."
nmap -sU --top-ports 1000 --open -T5 -v -n "$IP" -oN udp_$IP.txt > /dev/null

echo -e "${Magenta}\n[*] Finalizando AutoScan uwu..."
rm -rf puertos
sleep 1
echo -e "\n${Yellow}Resultado Exportado: ${White}[ scan_$IP.txt ] & [ udp_$IP.txt ]"

```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hack.jesssperez.com/scripting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
