Skip to content

Laboratorio de Wireshark sin conexión: capturas sintéticas de un pentest, filtros validados al instante, retos guiados y un megalodón 3D en WebGL2.

Armazón nuevo e interfaz completa en inglés (1.3.0)

Yoandy Ramírez Delgadobbceeeaba61d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d0a355e..c179b52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,22 @@
Formato [Keep a Changelog](https://keepachangelog.com/es-ES/1.1.0/) y versionado semántico.
+## [1.3.0] - 2026-11-25
+
+### Añadido
+- **Armazón nuevo** al estilo de BlueJr y RiskManager-Jr: barra lateral a la izquierda con los ocho módulos y su progreso (punto de estado y retos x/y), nivel y XP abajo, e indicador que se desliza hasta la sección activa.
+- **Barra lateral plegable**: botón en la barra superior o tecla `[`. Plegada queda un carril de iconos que se despliega por encima al pasar el ratón o al llegar con el teclado. El estado se recuerda.
+- **Móvil**: la barra lateral desaparece y aparece una barra de pestañas abajo (Inicio, Módulos, Laboratorio, Chuleta y Más). «Más» abre una hoja con Glosario, Ajustes, Ayuda y Atajos.
+- **Interruptores** en la barra superior: idioma ES|EN segmentado y tema claro|oscuro (`role="switch"`, el pomo se estira al pulsar). Muelles sin rebote (`cubic-bezier(0.32, 0.72, 0, 1)`) y todo desactivado con «reducir movimiento».
+- **Interfaz completa en inglés**: vistas, retos (mensajes de corrección), diálogos de Wireshark, **árbol de detalle con las etiquetas que muestra Wireshark** (`Frame 1: 77 bytes on wire`, `Sequence Number`, `Request Method`…), exportar, buscar, ayuda, atajos, ajustes, búsqueda `Ctrl K`, niveles, títulos, subtítulos e insignias de los ocho módulos, diagrama de escalera y etiquetas del megalodón 3D. Los errores del motor de filtros se traducen en la interfaz sin tocar el motor.
+- Pruebas: `tests/i18n.test.mjs` (paridad de claves ES/EN, módulos con versión inglesa, traducción de cada error del filtro y de cada etiqueta del árbol en los 578 paquetes) y cinco e2e nuevas (lateral plegable, idioma, tema, móvil con la hoja «Más» y axe del lateral plegado, el inglés y la hoja).
+
+### Cambiado
+- La barra superior pasa a ser una píldora flotante con buscador. El menú hamburguesa desaparece: en móvil lo sustituye la barra de pestañas.
+
+### Sin traducir
+- Las lecciones, los enunciados y las pistas de los retos, el glosario y las descripciones de los campos siguen en español. La interfaz lo avisa en inglés.
+
## [1.2.0] - 2026-11-25
### Añadido
diff --git a/README.md b/README.md
index 55e6849..4f65390 100644
--- a/README.md
+++ b/README.md
@@ -1,94 +1,489 @@
-# Megalodon · Laboratorio de Wireshark
+<p align="center"><img src="docs/assets/header.svg" alt="Megalodon · Laboratorio de Wireshark · eWPT · SOC · Directorio Activo" width="100%"/></p>
-Aprende a leer la red como un pentester sin instalar nada: capturas sintéticas de un ataque real en miniatura, filtros de visualización que se validan mientras escribes y retos guiados desde el saludo TCP hasta la inyección SQL, Kerberos y la caza en el SOC.
+<p align="center">
+ <b>Laboratorio de Wireshark en el navegador: aprende a leer la red como un pentester con capturas de un ataque real en miniatura, filtros que se validan mientras escribes y retos guiados desde el saludo TCP hasta la inyección SQL, Kerberos y la caza en el SOC.</b>
+</p>
-**Demo:** https://heindall92.github.io/megalodon/ · o descarga [`megalodon.html`](megalodon.html) y ábrelo en el navegador. Funciona sin conexión, sin cuenta y sin servidor.
+<p align="center">
+ <a href="https://heindall92.github.io/megalodon/"><img alt="Abrir Megalodon" src="https://img.shields.io/badge/ABRIR-heindall92.github.io%2Fmegalodon-3B8BFF?style=for-the-badge"/></a>
+ <a href="megalodon.html"><img alt="Descargar megalodon.html y abrirlo sin instalar nada" src="https://img.shields.io/badge/O%20DESCARGA-megalodon.html%20%C2%B7%20sin%20instalar%20nada-1A4FE0?style=for-the-badge"/></a>
+</p>
-![Inicio con el megalodón 3D](docs/capturas/inicio-oscuro.webp)
+<p align="center">
+ <a href="LICENSE"><img alt="Licencia MIT" src="https://img.shields.io/badge/LICENCIA-MIT-4169A1?style=flat"/></a>
+ <img alt="Versión 1.3.0" src="https://img.shields.io/badge/versi%C3%B3n-1.3.0-3B8BFF?style=flat"/>
+ <img alt="Filtros de Wireshark 4.x" src="https://img.shields.io/badge/filtros-Wireshark%204.x-1679A7?style=flat"/>
+ <img alt="Ruta eWPT" src="https://img.shields.io/badge/ruta-eWPT-E07B39?style=flat"/>
+ <img alt="8 módulos y 58 retos" src="https://img.shields.io/badge/8%20m%C3%B3dulos-58%20retos-7B4FD1?style=flat"/>
+ <a href="https://github.com/heindall92/megalodon/actions/workflows/tests.yml"><img alt="Pruebas" src="https://github.com/heindall92/megalodon/actions/workflows/tests.yml/badge.svg"/></a>
+ <img alt="axe-core: 0 violaciones" src="https://img.shields.io/badge/axe--core-0%20violaciones-2E8B57?style=flat"/>
+ <img alt="Interfaz ES/EN" src="https://img.shields.io/badge/UI-ES%20%2F%20EN-2E8B57?style=flat"/>
+ <img alt="Peticiones a terceros: 0" src="https://img.shields.io/badge/peticiones%20a%20terceros-0-2E8B57?style=flat"/>
+ <img alt="Iconos Lucide" src="https://img.shields.io/badge/iconos-Lucide-F56565?style=flat&logo=lucide&logoColor=white"/>
+</p>
-## Qué trae
+<p align="center">
+ <img src="docs/capturas/inicio-oscuro.webp" alt="Portada de Megalodon: un megalodón 3D nada entre rayos de luz detrás del título; a la izquierda, la barra lateral con los ocho módulos y su progreso; arriba, el buscador y los interruptores de idioma y tema" width="880"/>
+</p>
-| | |
-|---|---|
-| **8 módulos** | Saludo TCP, HTTP, cookies y credenciales, DNS, TLS, ataques web, Directorio Activo (Kerberos, SMB2, NTLM) y caza en el SOC (ARP spoofing, beacon de C2, exfiltración por DNS) |
-| **32 lecciones · 58 retos** | Escribir filtros, seleccionar paquetes, responder y tests. Cada reto tiene pistas y se comprueba contra la captura al instante |
-| **8 capturas, 578 paquetes** | Construidas byte a byte (Ethernet, ARP, IPv4, ICMP, UDP, TCP, DNS, DHCP, HTTP, TLS, SMB2, NTLMSSP, Kerberos v5) con semilla fija: siempre idénticas |
-| **Espacio tipo Wireshark** | Lista virtualizada, árbol de detalle con rangos de bytes, volcado hexadecimal, reglas de color, Seguir flujo TCP y UDP, estadísticas (conversaciones, endpoints, jerarquía, E/S) y diagrama de escalera |
-| **Herramientas de analista** | Información experta con los mensajes y severidades de Wireshark, Exportar objetos HTTP (ver y guardar), Credenciales (HTTP Basic, FTP, NTLMSSP), Buscar paquete por filtro, cadena o hex (`Ctrl F`), Ir al paquete (`Ctrl G`) y formato de tiempo (desde el inicio, desde el anterior capturado o mostrado, hora UTC) |
-| **Filtros de visualización** | 136 campos con la semántica de Wireshark 4.x (`==` sobre cualquier valor, `in {80, 443}`, rangos, `contains`, `matches`, funciones), errores en español con posición y «¿Querías decir…?» |
-| **Exportar** | Cada captura en `.pcapng` para repetir el reto en tu Wireshark de verdad; también lee `.pcap` y `.pcapng` |
-| **Chuleta y glosario** | 41 términos y los filtros de uso diario, con búsqueda global `Ctrl K` |
-
-## Herramientas de analista
-
-| Información experta | Objetos HTTP |
-|---|---|
-| ![Información experta del módulo 6](docs/capturas/experto.webp) | ![Exportar objetos HTTP con vista previa](docs/capturas/objetos-http.webp) |
+Para leer tráfico con soltura hay que haber mirado muchas capturas, y las de verdad no explican nada ni dicen si lo has entendido. Megalodon reúne **8 capturas sintéticas (578 paquetes)** de un pentest de laboratorio sobre **tienda.ewpt.local** y la red de **MEGACORP** (inventadas) y te sienta delante de un espacio que se comporta como Wireshark. Con él practicas:
+
+- filtros de visualización con la semántica de Wireshark 4.x, que se ponen verdes o rojos mientras escribes;
+- el saludo TCP, HTTP, cookies y credenciales en claro, DNS y lo que TLS deja ver;
+- ataques web en el tráfico: escaneo SYN, fuerza bruta, SQLi y XSS;
+- Directorio Activo (Kerberos, SMB2 y NTLM) y caza en el SOC (ARP spoofing, beacon de C2 y exfiltración por DNS);
+- las herramientas de analista: información experta, objetos HTTP, credenciales, seguir flujo, estadísticas, buscar e ir al paquete.
+
+Son **32 lecciones y 58 retos** que se comprueban contra los paquetes al instante. Funciona en el navegador, sin servidor, sin cuenta y sin conexión: es **un solo archivo HTML**, y tu progreso no sale del equipo. Cada captura se exporta en `.pcapng` para repetir el reto en tu Wireshark de verdad.
+
+<div align="center">
+
+## `$ cat megalodon.yaml`
+
+<table>
+ <thead>
+ <tr>
+ <th colspan="2" align="left"><code>megalodon:~$ cat megalodon.yaml</code></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td width="50%" valign="top"><code>├─ ◈ curso:</code><br><br>
+ <img src="docs/assets/stack/modulos.svg" height="48" alt="Módulos">
+ <img src="docs/assets/stack/retos.svg" height="48" alt="Retos">
+ <img src="docs/assets/stack/capturas.svg" height="48" alt="Capturas">
+ <img src="docs/assets/stack/filtros.svg" height="48" alt="Filtros"><br>
+ <sub><code>8 módulos · 32 lecciones · 58 retos · 60 «Pruébalo» · 578 paquetes · 136 campos · 41 términos</code></sub>
+ </td>
+ <td width="50%" valign="top"><code>├─ ⌕ analista:</code><br><br>
+ <img src="docs/assets/stack/experto.svg" height="48" alt="Información experta">
+ <img src="docs/assets/stack/flujos.svg" height="48" alt="Seguir flujo">
+ <img src="docs/assets/stack/estadisticas.svg" height="48" alt="Estadísticas"><br>
+ <sub><code>información experta · objetos HTTP · credenciales · seguir flujo TCP/UDP · conversaciones · endpoints · E/S</code></sub>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top"><code>├─ ✦ aplicacion:</code><br><br>
+ <img src="docs/assets/stack/javascript.svg" height="48" alt="JavaScript">
+ <img src="docs/assets/stack/html.svg" height="48" alt="HTML">
+ <img src="docs/assets/stack/css.svg" height="48" alt="CSS">
+ <img src="docs/assets/stack/webgl.svg" height="48" alt="WebGL2">
+ <img src="docs/assets/stack/idiomas.svg" height="48" alt="ES / EN">
+ <img src="docs/assets/stack/lucide.svg" height="48" alt="Lucide"><br>
+ <sub><code>JavaScript · HTML · CSS · WebGL2 · ES/EN · Lucide</code></sub>
+ </td>
+ <td valign="top"><code>├─ ⚙ build_ci_cd:</code><br><br>
+ <img src="docs/assets/stack/nodejs.svg" height="48" alt="Node.js">
+ <img src="docs/assets/stack/git.svg" height="48" alt="Git">
+ <img src="docs/assets/stack/githubactions.svg" height="48" alt="GitHub Actions">
+ <img src="docs/assets/stack/githubpages.svg" height="48" alt="GitHub Pages"><br>
+ <sub><code>Node.js · Git · GitHub Actions · GitHub Pages</code></sub>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top"><code>├─ ◉ pruebas:</code><br><br>
+ <img src="docs/assets/stack/pruebas.svg" height="48" alt="node:test">
+ <img src="docs/assets/stack/navegador.svg" height="48" alt="Playwright">
+ <img src="docs/assets/stack/accesibilidad.svg" height="48" alt="axe-core"><br>
+ <sub><code>node:test 18 · Playwright 22 · axe-core 0 violaciones</code></sub>
+ </td>
+ <td valign="top"><code>╰─ ⌁ seguridad:</code><br><br>
+ <img src="docs/assets/stack/csp.svg" height="48" alt="CSP">
+ <img src="docs/assets/stack/sin-terceros.svg" height="48" alt="Sin terceros"><br>
+ <sub><code>CSP con hashes · connect-src 'none' · cero peticiones de red</code></sub>
+ </td>
+ </tr>
+ </tbody>
+ <tfoot>
+ <tr>
+ <td colspan="2"><code>version: 1.3.0&nbsp;&nbsp;·&nbsp;&nbsp;filtros: Wireshark 4.x&nbsp;&nbsp;·&nbsp;&nbsp;pruebas: 40 ok&nbsp;&nbsp;·&nbsp;&nbsp;licencia: MIT</code></td>
+ </tr>
+ </tfoot>
+</table>
+
+</div>
+
+---
+
+## <img src="docs/assets/icons/sparkles.svg" width="20" height="20" valign="middle"/> Novedades
+
+### 1.3.0 · noviembre de 2026 · Armazón nuevo y todo en inglés
+
+- **Barra lateral a la izquierda**, como en BlueJr y RiskManager-Jr. Muestra los ocho módulos con su progreso: un punto gris si no lo has empezado, ámbar si está a medias y verde si está terminado, y los retos resueltos. Abajo van el nivel y la XP, y un indicador se desliza hasta la sección activa.
+- **Se pliega** con el botón de la barra superior o con `[`, y recuerda el estado. Plegada queda un carril de iconos que se despliega por encima al pasar el ratón o al llegar con el teclado.
+- **En el móvil, barra de pestañas abajo** (Inicio, Módulos, Laboratorio, Chuleta y Más). «Más» abre una hoja con Glosario, Ajustes, Ayuda y Atajos.
+- **Interruptores de idioma (ES|EN) y de tema (claro|oscuro)** en la barra superior, con el mismo dibujo que en las demás herramientas. El pomo del tema se estira al pulsarlo.
+- **Interfaz completa en inglés**. El árbol de detalle usa las etiquetas reales de Wireshark (`Frame 1: 77 bytes on wire`, `Sequence Number`, `Request Method`). También están en inglés los mensajes de los retos, los errores del filtro, los diálogos, la ayuda, los niveles y los títulos e insignias de los módulos. Una prueba recorre los 578 paquetes y falla si queda una etiqueta en español.
+
+### 1.2.0 · noviembre de 2026 · Herramientas de analista
+
+- **Información experta** (`E`), **objetos HTTP**, **credenciales**, **buscar paquete** (`Ctrl F`) por filtro, cadena o hex, **ir al paquete** (`Ctrl G`), **formato de tiempo**, **seguir flujo UDP** y **endpoints**.
+- Cinco retos nuevos que obligan a usarlas, y un recorrido e2e que resuelve el curso entero desde la interfaz.
+
+### 1.1.0 · noviembre de 2026 · El megalodón 3D
+
+- Megalodón en tiempo real con **WebGL2 puro** en la portada, con la boca modelada según la anatomía documentada y el mordisco de Tricas (1985). Incluye la vista **Plano técnico** con cotas.
+- Pruebas del motor, e2e con axe-core, CI y publicación en GitHub Pages.
-![Beacon de C2 con el formato de tiempo «desde el anterior mostrado»](docs/capturas/beacon.webp)
+### 1.0.0
-Las mismas funciones que usa un pentester o un analista de SOC en Wireshark, con su comportamiento real:
+- El laboratorio original: 8 módulos, capturas construidas byte a byte, filtros de visualización y retos.
-- **Información experta** (`E`): mensajes en inglés tal como los emite Wireshark y su severidad (por ejemplo, `Connection reset (RST)` es *Warning* y `Connection establish request (SYN): server port 80` es *Chat*), con salto a cada paquete y botón para filtrarlos.
-- **Objetos HTTP**: cada cuerpo reconstruido con host, tipo, tamaño y nombre seguro; vista previa como texto (nunca se interpreta el HTML de la captura) y descarga.
-- **Credenciales**: paquete, protocolo, usuario e información, y salto al campo exacto del árbol.
-- **Buscar** por filtro, cadena o hex desde el paquete seleccionado y dando la vuelta, como Wireshark; **Ir al paquete** avisa si el paquete está oculto por el filtro.
-- **Formato de tiempo**: con «desde el anterior mostrado» el intervalo de un beacon salta a la vista (60 s en el módulo 8).
+## Índice
-Cinco retos nuevos obligan a usarlas: los avisos de la información experta, el fichero que esconde `robots.txt`, la firma ZIP `50 4b 03 04` buscada en hexadecimal, el intervalo del beacon y la contraseña exfiltrada por DNS en Base64.
+- [Novedades](#-novedades)
+- [Cómo se usa](#-cómo-se-usa)
+- [Mapa mental](#-mapa-mental)
+- [Vistas](#-vistas)
+- [Cómo se corrige](#-cómo-se-corrige)
+- [Herramientas de analista](#-herramientas-de-analista)
+- [Capturas](#-capturas)
+- [El megalodón 3D](#-el-megalodón-3d)
+- [Movimiento y diseño](#-movimiento-y-diseño)
+- [Arranque rápido](#-arranque-rápido)
+- [Arquitectura](#-arquitectura)
+- [Privacidad y seguridad](#-privacidad-y-seguridad)
+- [Pruebas](#-pruebas)
+- [Hoja de ruta](#-hoja-de-ruta)
+- [Limitaciones conocidas](#-limitaciones-conocidas)
+- [Estructura](#-estructura)
+- [Licencia](#-licencia)
+- [Autor](#-autor)
-## El megalodón 3D
+---
-El hero de inicio es un megalodón en tiempo real hecho con **WebGL2 puro**, sin librerías ni modelos externos: toda la malla (≈ 60 000 vértices) se genera con código.
+## <img src="docs/assets/icons/route.svg" width="20" height="20" valign="middle"/> Cómo se usa
-| Boca abierta | Protrusión de la mandíbula superior |
+1. **Elige un módulo** en la barra lateral (o en la barra de pestañas del móvil). Empieza por el 1 si nunca has abierto Wireshark.
+2. **Lee la lección.** Es corta y trae botones «Pruébalo» que aplican el filtro en la captura. En el módulo 1, un diagrama de escalera anima el saludo TCP; cada flecha abre su paquete.
+3. **Investiga en la captura.** Filtra, sigue flujos, abre la información experta o las estadísticas. La barra de filtros te dice al momento si el filtro es válido y, si no, por qué.
+4. **Resuelve los retos.** Escribe el filtro, elige el paquete o responde. Si te atascas, tienes hasta tres pistas por reto.
+5. **Llévatelo.** Exporta la captura en `.pcapng` o `.pcap`, completa o solo lo filtrado, y repite el reto en Wireshark. En el laboratorio libre puedes abrir tus propias capturas.
+
+## <img src="docs/assets/icons/brain-circuit.svg" width="20" height="20" valign="middle"/> Mapa mental
+
+```mermaid
+mindmap
+ root((Megalodon))
+ Capturas sintéticas
+ 8 escenarios y 578 paquetes
+ Construidas byte a byte
+ Semilla fija y deterministas
+ Contrastadas con tshark
+ Ruta de 8 módulos
+ El saludo TCP
+ HTTP al desnudo
+ Cookies y credenciales
+ DNS
+ TLS
+ Ataques web
+ Directorio Activo
+ Caza en el SOC
+ Espacio tipo Wireshark
+ Lista, árbol y bytes
+ Filtros de Wireshark 4.x
+ Validación al escribir
+ Autocompletado
+ ¿Querías decir…?
+ Reglas de color
+ Exportar pcapng y pcap
+ Herramientas de analista
+ Información experta
+ Objetos HTTP
+ Credenciales
+ Seguir flujo TCP y UDP
+ Estadísticas
+ Buscar e ir al paquete
+ Formato de tiempo
+ Aprender
+ 32 lecciones
+ 58 retos con pistas
+ XP, niveles e insignias
+ Chuleta y glosario
+ Garantías
+ Un solo HTML sin conexión
+ CSP por hashes
+ WCAG 2.2 AA con axe
+ Español e inglés
+```
+
+## <img src="docs/assets/icons/list-checks.svg" width="20" height="20" valign="middle"/> Vistas
+
+| | Vista | Contenido |
+|---|---|---|
+| <img src="docs/assets/icons/house.svg" width="18"/> | **Inicio** | Megalodón 3D, siguiente módulo recomendado, XP, nivel, retos resueltos, insignias, los ocho módulos y cómo funciona. |
+| <img src="docs/assets/icons/layers.svg" width="18"/> | **Módulo** | Lección con «Pruébalo» y retos a la izquierda; captura del módulo a la derecha. En el móvil, pestañas Lección, Retos y Wireshark. |
+| <img src="docs/assets/icons/flask-conical.svg" width="18"/> | **Laboratorio libre** | Cualquiera de las ocho capturas, o la tuya en `.pcap` o `.pcapng` (arrastrándola o con «Abrir captura»). |
+| <img src="docs/assets/icons/book-open.svg" width="18"/> | **Chuleta** | Los filtros de uso diario, con copiar y probar en el laboratorio, y la tabla de los 136 campos. |
+| <img src="docs/assets/icons/languages.svg" width="18"/> | **Glosario** | 41 términos de redes y pentesting, con buscador. |
+| <img src="docs/assets/icons/terminal.svg" width="18"/> | **Búsqueda** (`Ctrl K`) | Páginas, módulos, lecciones, retos, glosario, filtros, campos y acciones (tema, idioma, barra lateral). |
+| <img src="docs/assets/icons/settings.svg" width="18"/> | **Ajustes, ayuda y atajos** | Tema, idioma, números de secuencia relativos, colores y borrar el progreso; guía de las tres zonas y de las herramientas; atajos (`?`). |
+
+## <img src="docs/assets/icons/target.svg" width="20" height="20" valign="middle"/> Cómo se corrige
+
+Cada reto se comprueba contra la captura en el navegador, sin servidor:
+
+| Tipo | Se da por bueno cuando… |
|---|---|
-| ![Boca abierta en herradura](docs/capturas/mordisco.webp) | ![Palatocuadrado protruido](docs/capturas/protrusion.webp) |
+| **Filtro** | El filtro muestra exactamente los paquetes de la solución. Si no, te dice cuántos muestra, cuántos faltan y cuántos sobran, con un ejemplo. En algunos retos basta con cubrir un conjunto permitido. |
+| **Paquete** | El paquete seleccionado cumple la condición del reto (por ejemplo, ser el `SYN, ACK` del saludo). |
+| **Respuesta** | La respuesta coincide sin tener en cuenta mayúsculas ni tildes. Las contraseñas tienen que ser exactas, y las listas de números valen en cualquier orden. |
+| **Test** | La opción es la correcta. Las fallidas se descartan. |
-- **Boca documentada:** dos arcos en herradura con banda de encía, 13 dientes superiores anchos y 12 inferiores estrechos por lado, el intermedio superior más pequeño, inclinación distal creciente y una fila de reemplazo tumbada detrás.
-- **Mordisco real a cámara lenta:** elevación del hocico y descenso de la mandíbula, protrusión del palatocuadrado al cerrar, sacudida lateral y bajada del hocico, con los tiempos de Tricas (1985). El ojo rota hacia atrás mientras muerde.
-- **Piel y agua:** contrasombreado irregular, dentículos, branquias, ampollas de Lorenzini y cicatrices; cáusticas, absorción del agua por canal, rayos de luz con la sombra del tiburón, nieve marina y bloom.
-- **Plano técnico:** un escaneo de la cabeza a la cola convierte el modelo en plano con cotas anatómicas que siguen al animal mientras nada.
+| Puntos | Valor |
+|---|---|
+| Reto sin pistas | 10 XP |
+| Con 1, 2 o 3 pistas | 8, 6 o 5 XP |
+| Módulo terminado | Insignia y 20 XP de bonus |
+| Niveles | Alevín (0), Tintorera (80), Tiburón martillo (200), Gran blanco (380) y Megalodón (600) |
-![Vista de plano técnico](docs/capturas/plano-tecnico.webp)
+Una prueba resuelve cada reto con su solución de referencia contra su captura. Otra lo hace desde la interfaz, reto a reto, hasta ganar las 8 insignias.
-Fuentes y decisiones de modelado en [docs/megalodon-3d.md](docs/megalodon-3d.md). Sin WebGL2 se muestra el póster original; con «reducir movimiento» se ve un fotograma fijo con la boca abierta y un botón para animarlo.
+## <img src="docs/assets/icons/compass.svg" width="20" height="20" valign="middle"/> Herramientas de analista
-| Claro | Móvil | Módulo 1 |
+| | Herramienta | Comportamiento |
|---|---|---|
-| ![Tema claro](docs/capturas/inicio-claro.webp) | ![Móvil](docs/capturas/movil.webp) | ![Módulo 1](docs/capturas/modulo-1.webp) |
+| <img src="docs/assets/icons/flask-conical.svg" width="18"/> | **Filtros de visualización** | 136 campos con la semántica de Wireshark 4.x: `==` sobre cualquier valor, `in {80, 443}`, rangos, `contains`, `matches` y funciones. Autocompletado con `Tab`. Si el filtro falla, explica el error, marca su posición y sugiere el campo que quizá querías («¿Querías decir…?»). |
+| <img src="docs/assets/icons/sparkles.svg" width="18"/> | **Información experta** (`E`) | Mensajes y severidades de Wireshark: `Connection reset (RST)` es *Warning* y `Connection establish request (SYN)` es *Chat*. Salta a cada paquete y permite filtrarlos. |
+| <img src="docs/assets/icons/book-open.svg" width="18"/> | **Objetos HTTP** | Cuerpos reconstruidos con host, tipo, tamaño y nombre seguro. La vista previa muestra texto (nunca interpreta el HTML de la captura) y permite descargar. |
+| <img src="docs/assets/icons/lock-keyhole.svg" width="18"/> | **Credenciales** | HTTP Basic, FTP y NTLMSSP, con salto al campo exacto del árbol. |
+| <img src="docs/assets/icons/waypoints.svg" width="18"/> | **Seguir flujo** (`F`) | TCP o UDP según el paquete, con cliente y servidor en colores y paso al flujo anterior o siguiente. |
+| <img src="docs/assets/icons/network.svg" width="18"/> | **Estadísticas** (`S`) | Conversaciones (Ethernet, IPv4, TCP, UDP), endpoints IPv4, jerarquía de protocolos y gráfico de E/S que compara el filtro con el total. |
+| <img src="docs/assets/icons/target.svg" width="18"/> | **Buscar e ir al paquete** | `Ctrl F` busca por filtro, cadena o hex desde el paquete seleccionado y da la vuelta al llegar al final. `Ctrl G` lleva al paquete y avisa si el filtro lo oculta. |
+| <img src="docs/assets/icons/telescope.svg" width="18"/> | **Formato de tiempo** | Desde el inicio, desde el anterior capturado, desde el anterior mostrado u hora UTC. Con «desde el anterior mostrado» el beacon de 60 s del módulo 8 salta a la vista. |
+
+## <img src="docs/assets/icons/image.svg" width="20" height="20" valign="middle"/> Capturas
+
+<table>
+<tr>
+<td width="50%"><img src="docs/capturas/modulo-1.webp" alt="Módulo 1 con la lección, el diagrama de escalera y Wireshark al lado"/><br/><sub><b>Módulo 1</b> · lección con diagrama de escalera y Wireshark al lado</sub></td>
+<td width="50%"><img src="docs/capturas/experto.webp" alt="Información experta del módulo 6"/><br/><sub><b>Información experta</b> · avisos y severidades del módulo 6</sub></td>
+</tr>
+<tr>
+<td><img src="docs/capturas/objetos-http.webp" alt="Objetos HTTP con la vista previa de robots.txt"/><br/><sub><b>Objetos HTTP</b> · el robots.txt que delata la copia de seguridad</sub></td>
+<td><img src="docs/capturas/beacon.webp" alt="Peticiones al C2 con el formato de tiempo desde el anterior mostrado"/><br/><sub><b>Beacon de C2</b> · «desde el anterior mostrado» marca los 60 s</sub></td>
+</tr>
+<tr>
+<td><img src="docs/capturas/lateral-plegado.webp" alt="Barra lateral plegada desplegándose por encima al pasar el ratón"/><br/><sub><b>Barra lateral plegada</b> · el carril se despliega por encima al pasar el ratón</sub></td>
+<td><img src="docs/capturas/ingles-claro.webp" alt="Laboratorio libre en inglés y en modo claro"/><br/><sub><b>Inglés y modo claro</b> · interruptores ES|EN y claro|oscuro</sub></td>
+</tr>
+<tr>
+<td colspan="2"><img src="docs/capturas/inicio-claro.webp" alt="Inicio en modo claro, página completa"/><br/><sub><b>Inicio en modo claro</b> · progreso, módulos y cómo funciona</sub></td>
+</tr>
+</table>
+
+<p align="center">
+ <img src="docs/capturas/movil-pestanas.webp" alt="Módulo 1 en el móvil con la barra de pestañas abajo" width="260"/>
+ &nbsp;&nbsp;
+ <img src="docs/capturas/movil-mas.webp" alt="Hoja Más con glosario, ajustes, ayuda y atajos" width="260"/>
+ &nbsp;&nbsp;
+ <img src="docs/capturas/movil.webp" alt="Inicio en el móvil" width="260"/>
+ <br/><sub><b>Móvil</b> · barra de pestañas abajo y hoja «Más» con glosario, ajustes, ayuda y atajos</sub>
+</p>
+
+## <img src="docs/assets/icons/award.svg" width="20" height="20" valign="middle"/> El megalodón 3D
+
+La portada es un megalodón en tiempo real hecho con **WebGL2 puro**, sin librerías ni modelos externos: toda la malla (≈ 60 000 vértices) se genera con código.
+
+<table>
+<tr>
+<td width="50%"><img src="docs/capturas/mordisco.webp" alt="Boca abierta en herradura"/><br/><sub><b>Boca abierta</b> · arcos en herradura con encía</sub></td>
+<td width="50%"><img src="docs/capturas/protrusion.webp" alt="Palatocuadrado protruido"/><br/><sub><b>Protrusión</b> · la mandíbula superior avanza al cerrar</sub></td>
+</tr>
+<tr>
+<td colspan="2"><img src="docs/capturas/plano-tecnico.webp" alt="Vista de plano técnico con cotas"/><br/><sub><b>Plano técnico</b> · escaneo con cotas anatómicas que siguen al animal</sub></td>
+</tr>
+</table>
-## Privacidad y seguridad
+- **Boca documentada:** 13 dientes superiores anchos y 12 inferiores estrechos por lado, el intermedio superior más pequeño, inclinación distal creciente y una fila de reemplazo detrás.
+- **Mordisco:** elevación del hocico, descenso de la mandíbula, protrusión del palatocuadrado y sacudida lateral, con los tiempos de Tricas (1985).
+- **Piel y agua:** contrasombreado, dentículos, branquias, ampollas de Lorenzini, cáusticas, rayos de luz, nieve marina y bloom.
-- Un único HTML autocontenido. Sin CDN, sin fuentes externas, sin analítica, sin peticiones de red.
-- CSP estricta por hashes: `default-src 'none'`, `script-src` y `style-src` con los `sha256` del código incrustado, `connect-src 'none'`. La compilación falla si el HTML carga algo externo y las e2e bloquean cualquier petición que no sea `file:`, `data:` o `blob:`.
-- El progreso se guarda solo en tu navegador (`localStorage`, clave `megalodon.v1`).
-- Las capturas son sintéticas: direcciones de laboratorio y dominios de prueba. Ver [SECURITY.md](SECURITY.md).
+Las fuentes y las decisiones de modelado están en [docs/megalodon-3d.md](docs/megalodon-3d.md).
-## Desarrollo
+## <img src="docs/assets/icons/wand-sparkles.svg" width="20" height="20" valign="middle"/> Movimiento y diseño
+
+Siguiendo los principios de Emil Kowalski y el diseño de Apple:
+
+| Pieza | Comportamiento |
+|---|---|
+| Barra lateral | Se pliega en 320 ms con la curva de cajón de iOS (`cubic-bezier(0.32, 0.72, 0, 1)`). Plegada, se despliega por encima sin mover el contenido. El indicador de la sección activa se desliza en 340 ms. |
+| Entrada del lateral | Los elementos entran escalonados 25 ms (300 ms cada uno), solo en la primera carga. |
+| Interruptor de tema | El pomo se desliza en 280 ms y se estira al pulsarlo, como en iOS. Al cambiar de tema, los colores se funden en 300 ms. |
+| Botones | Se hunden al pulsarlos, entre el 94 % y el 98,5 % de su tamaño según la pieza (los pequeños, más). |
+| Cambio de vista | El contenido entra en 240 ms con `ease-out`. |
+| Nivel y XP | El nivel da un pequeño salto con muelle (450 ms) cada vez que sumas XP. |
+| Megalodón | Se pausa si la pestaña no está visible o la portada sale de la pantalla. |
+| Movimiento reducido | Sin desplazamientos ni bucles. Las transiciones del lateral y del tema son instantáneas, y el megalodón queda en un fotograma fijo con un botón para animarlo. |
+
+Oscuro casi negro frío (`#0b0d11` / `#12151b`) o claro gris perla (`#f3f5f8` / `#ffffff`), con un solo acento azul (`#6cb2ff` en oscuro y `#143f94` en claro). Tipografía del sistema (SF Pro en Apple) y monoespaciada del sistema para paquetes, bytes y filtros. Iconos solo de **Lucide**.
+
+## <img src="docs/assets/icons/rocket.svg" width="20" height="20" valign="middle"/> Arranque rápido
+
+**En línea:** [heindall92.github.io/megalodon](https://heindall92.github.io/megalodon/). Se publica con cada cambio en `main`.
+
+**En local, sin instalar nada:** descarga [`megalodon.html`](megalodon.html) y ábrelo en el navegador. Es la aplicación completa en un fichero.
+
+**Para desarrollar** (Node.js 20 o superior):
```bash
-npm install # Playwright y axe-core, solo para las pruebas
-npm run build # src/ → dist/index.html y megalodon.html
-./run_tests.sh # compilación al día, motor y e2e con axe
+git clone https://github.com/heindall92/megalodon.git
+cd megalodon
+npm install # Playwright y axe-core, solo para las pruebas
+npm run build # src/ → dist/index.html y megalodon.html
+./run_tests.sh # compilación al día, motor, idioma y e2e con axe
```
-| Carpeta | Contenido |
+| Comando | Qué hace |
|---|---|
-| `src/engine/` | Motor sin DOM: constructores de paquetes, escenarios, disector, filtros y estadísticas |
-| `src/content/` | Módulos, lecciones, retos, chuleta y glosario |
-| `src/app/` | Interfaz: estado, espacio de trabajo, diálogos, diagrama de escalera, megalodón 3D, vistas y armazón |
-| `scripts/build.mjs` | Concatena en un ámbito compartido, incrusta CSS y JS y calcula la CSP |
+| `npm run build` | Genera `dist/index.html` y `megalodon.html` (idénticos) con la CSP calculada. |
+| `node scripts/build.mjs --check` | Falla si los HTML no corresponden a `src/` (lo usa la CI). |
+| `npm run test:engine` | Motor e idioma (`node:test`, sin navegador). |
+| `npm run test:e2e` | Aplicación en Chromium: curso completo, herramientas, armazón, CSP y accesibilidad. |
+| `npm test` | Todo lo anterior. |
+| `node scripts/capturas.mjs` | Regenera las capturas de este README a partir de `dist/`. |
+
+## <img src="docs/assets/icons/network.svg" width="20" height="20" valign="middle"/> Arquitectura
+
+```mermaid
+flowchart LR
+ subgraph SRC[src/]
+ T[index.html<br/>plantilla]
+ C[styles.css<br/>tokens, claro y oscuro]
+ E[engine/*.js<br/>paquetes, escenarios,<br/>disector, filtros, análisis]
+ K[(content/*.js<br/>módulos, lecciones,<br/>retos, glosario)]
+ A[app/00…90-*.js<br/>interfaz, ES/EN,<br/>megalodón 3D]
+ I[assets/<br/>póster AVIF y WebP]
+ end
+ T & C & E & K & A & I --> B[scripts/build.mjs<br/>un ámbito compartido,<br/>CSP con hashes]
+ B --> H[dist/index.html<br/>megalodon.html]
+ H --> N((Navegador))
+ N <--> LS[(localStorage<br/>megalodon.v1)]
+ E & K --> TN[node:test]
+ H --> PW[Playwright + axe-core]
+ H --> GP[GitHub Pages]
+```
+
+- **Sin framework ni dependencias en ejecución.** JavaScript sin compilar, concatenado en orden en un solo ámbito.
+- **Motor independiente de la interfaz.** Los constructores de paquetes, el disector, los filtros, las estadísticas y el análisis no tocan el DOM. Las pruebas los cargan en Node con el mismo ámbito que el navegador.
+- **Capturas deterministas.** Con la semilla fija, los retos se comprueban contra los mismos bytes en el navegador, en las pruebas y en el `.pcapng` exportado.
+- **Idioma en la capa de presentación.** El motor genera sus textos en español. La interfaz traduce los errores del filtro y las etiquetas del árbol, y una prueba garantiza que no se escapa ninguno.
+
+## <img src="docs/assets/icons/lock-keyhole.svg" width="20" height="20" valign="middle"/> Privacidad y seguridad
+
+- **Un único HTML autocontenido.** Sin CDN, sin fuentes externas, sin analítica y sin peticiones de red.
+- **CSP** generada en el build: `default-src 'none'`, `script-src` y `style-src` solo por hash, `connect-src 'none'`. La compilación falla si el HTML carga algo externo, y las e2e bloquean cualquier petición que no sea `file:`, `data:` o `blob:`.
+- **El contenido de las capturas se trata como texto.** Toda salida al DOM pasa por `esc()`. Los objetos HTTP se previsualizan con `textContent`, nunca como HTML.
+- **Tus capturas no salen del equipo.** Los `.pcap` y `.pcapng` que abres se leen en el navegador, con un límite de 64 MB.
+- **Progreso local.** Solo se guarda en `localStorage`, con la clave `megalodon.v1`.
+- **Capturas sintéticas.** Usan direcciones de laboratorio y dominios de prueba. Ver [SECURITY.md](SECURITY.md).
+
+## <img src="docs/assets/icons/flask-conical.svg" width="20" height="20" valign="middle"/> Pruebas
+
+| Suite | Pruebas | Qué comprueba |
+|---|---|---|
+| Motor (`engine.test.mjs`) | 13 | Las 8 capturas se generan, se disecan y son deterministas. Exportar a pcap/pcapng y releer conserva cada byte. **Los 58 retos tienen solución comprobable** contra su captura, y las respuestas derivadas (avisos, intervalo del beacon, Base64 exfiltrado, firma ZIP) se recalculan desde los paquetes. Los 60 «Pruébalo» compilan y muestran paquetes. También comprueba la sintaxis de filtros de Wireshark 4.x, la información experta, los objetos HTTP, las credenciales, el flujo UDP y el checksum RFC 1071. |
+| Idioma (`i18n.test.mjs`) | 5 | Español e inglés tienen las mismas claves. Los ocho módulos tienen título, subtítulo e insignia en inglés. **Cada error del motor de filtros** y **cada etiqueta del árbol de detalle de los 578 paquetes** están traducidos, sin restos en español. |
+| E2E (`e2e.mjs`) | 22 | **El curso completo se resuelve desde la interfaz** (58 retos y 8 insignias). También cubre: <ul><li>herramientas de analista, buscar e ir al paquete, formato de tiempo y flujo UDP;</li><li>búsqueda `Ctrl K`;</li><li>megalodón 3D: pausa, plano técnico, desmontaje, movimiento reducido y sin WebGL2;</li><li>barra lateral plegable (`[`, ratón y estado guardado);</li><li>interruptores de idioma y de tema;</li><li>móvil con la hoja «Más»;</li><li>CSP estricta y red bloqueada.</li></ul> |
+| Accesibilidad (dentro de `e2e.mjs`) | — | axe-core (WCAG 2.2 A/AA) da **cero violaciones** en: <ul><li>6 vistas, a 1280 y 390 px, en claro y oscuro;</li><li>los diálogos de análisis;</li><li>la barra lateral plegada;</li><li>la interfaz en inglés;</li><li>la hoja «Más».</li></ul> |
+
+La [integración continua](.github/workflows/tests.yml) ejecuta todo en cada *push* y *pull request* y comprueba que los HTML están al día.
+
+## <img src="docs/assets/icons/calendar-clock.svg" width="20" height="20" valign="middle"/> Hoja de ruta
+
+Detalle en [ROADMAP.md](ROADMAP.md).
+
+- [x] 1.0.0 · El laboratorio: 8 módulos, capturas byte a byte, filtros y retos
+- [x] 1.1.0 · Megalodón 3D, pruebas, CI y GitHub Pages
+- [x] 1.2.0 · Herramientas de analista y recorrido del curso completo
+- [x] 1.3.0 · Barra lateral plegable, barra de pestañas en el móvil, interruptores e interfaz en inglés
+- [ ] 1.3.x · Lecciones, retos, glosario y campos en inglés, revisados a mano
+- [ ] 1.4.0 · Más capturas: SMB y movimiento lateral, VoIP/SIP y DHCP spoofing
+
+## <img src="docs/assets/icons/triangle-alert.svg" width="20" height="20" valign="middle"/> Limitaciones conocidas
+
+- **Contenido en español.** La interfaz está entera en inglés, con el árbol de detalle con las etiquetas de Wireshark. Pero las lecciones, los enunciados, las pistas, el glosario y las descripciones de los campos siguen en español, y la interfaz lo avisa.
+- **Subconjunto de Wireshark.** Hay 136 campos y los protocolos de las capturas del curso. Una captura propia con otros protocolos se ve hasta la capa que el disector conoce.
+- **Sin captura en vivo.** El navegador no puede escuchar la interfaz de red; para eso está Wireshark.
+- **El progreso vive en el navegador.** Si borras sus datos, se pierde.
+
+## <img src="docs/assets/icons/folder-tree.svg" width="20" height="20" valign="middle"/> Estructura
+
+```
+megalodon/
+│
+├── 🧩 src/
+│ ├── index.html Plantilla
+│ ├── styles.css Tokens, claro y oscuro, barra lateral, móvil y movimiento
+│ ├── engine/ Motor sin DOM
+│ │ ├── net.js Constructores de tramas y checksums
+│ │ ├── scenarios.js Las 8 capturas, con semilla fija
+│ │ ├── fields.js 136 campos de filtro
+│ │ ├── dissect.js Disector, árbol de detalle y rangos de bytes
+│ │ ├── filter.js Filtros de visualización y autocompletado
+│ │ ├── stats.js Conversaciones, endpoints, jerarquía, E/S y flujos
+│ │ └── analyze.js Información experta, objetos HTTP, credenciales y flujo UDP
+│ ├── content/ Módulos, lecciones y retos; chuleta, glosario y atajos
+│ ├── app/ Interfaz
+│ │ ├── 00-iconos.js Iconos Lucide en línea
+│ │ ├── 05-i18n.js Textos en español e inglés
+│ │ ├── 10-state.js Progreso, XP, niveles e insignias
+│ │ ├── 20-ui.js Diálogos, avisos y portapapeles
+│ │ ├── 30-workspace.js Espacio tipo Wireshark y árbol en inglés
+│ │ ├── 40-dialogs.js Seguir flujo, estadísticas y herramientas de analista
+│ │ ├── 45-ladder.js Diagrama de escalera del saludo TCP
+│ │ ├── 48-shark.js Megalodón 3D en WebGL2
+│ │ ├── 50-views.js Inicio, módulos, laboratorio, chuleta y glosario
+│ │ └── 90-shell.js Barra lateral, barra superior, pestañas, búsqueda y ajustes
+│ └── assets/ Póster de la portada (AVIF y WebP)
+│
+├── 📦 dist/index.html La aplicación generada (igual que megalodon.html)
+├── 🛠️ scripts/ build.mjs · capturas.mjs
+├── 🧪 tests/ engine · i18n · e2e · load
+├── 📄 docs/ Capturas, cabecera e iconos del README y notas del megalodón 3D
+└── ⚙️ .github/workflows/ tests.yml · pages.yml
+```
+
+## <img src="docs/assets/icons/scale.svg" width="20" height="20" valign="middle"/> Licencia
+
+Distribuido bajo licencia [MIT](LICENSE) · © 2026 Yoandy Ramírez Delgado.
+
+Megalodon es un proyecto independiente, sin relación con la Wireshark Foundation ni con INE/eLearnSecurity (eWPT). Wireshark es una marca de la Wireshark Foundation. El contenido es de redacción propia y se apoya en la [documentación pública de Wireshark](https://www.wireshark.org/docs/).
+
+Componentes de terceros:
+
+- iconos de [Lucide](https://lucide.dev) (ISC);
+- logotipos de [Simple Icons](https://simpleicons.org) (CC0) en la tabla `megalodon.yaml`, cuyas marcas pertenecen a sus titulares;
+- [Playwright](https://playwright.dev) y [axe-core](https://github.com/dequelabs/axe-core), solo para las pruebas.
-## Pruebas
+## <img src="docs/assets/icons/user-round.svg" width="20" height="20" valign="middle"/> Autor
-- **Motor (13 pruebas, `node --test`):** las 8 capturas se generan y disecan; son deterministas; exportar a pcap/pcapng y releer conserva cada byte; **los 58 retos tienen solución comprobable** contra su captura y las respuestas derivadas (avisos, intervalo del beacon, Base64 exfiltrado, firma ZIP) se recalculan desde los paquetes; los 60 botones «Pruébalo» compilan y muestran paquetes; sintaxis de filtros de Wireshark 4.x; información experta, objetos HTTP, credenciales y flujo UDP; checksum RFC 1071.
-- **E2E (17 pruebas, Chromium real):** **el curso completo se resuelve desde la interfaz** (58 retos y 8 insignias); herramientas de analista; CSP; megalodón 3D; búsqueda `Ctrl K`; y **axe-core con 0 infracciones WCAG 2.2 AA** en 6 vistas y en los diálogos nuevos, a 1280 y 390 px, en oscuro y claro.
+<table>
+<tr>
+<td align="center" width="100%" valign="top">
+<img src="https://avatars.githubusercontent.com/u/238087465?v=4" alt="Yoandy Ramírez Delgado" width="110"/><br/>
+<b>Yoandy Ramírez Delgado</b><br/>
+<sub><b>Diseño y desarrollo de Megalodon</b></sub><br/>
+<sub>Junior Pentester · eJPTv2 · AI Governance (ISO 42001) · SysAdmin</sub><br/><br/>
+<a href="https://www.linkedin.com/in/yoandyrd92/"><img alt="LinkedIn" src="https://img.shields.io/badge/LinkedIn-0A66C2?style=flat&logo=linkedin&logoColor=white"/></a>
+<a href="https://github.com/heindall92"><img alt="GitHub" src="https://img.shields.io/badge/GitHub-181717?style=flat&logo=github&logoColor=white"/></a>
+<a href="https://yoandyramirez.com"><img alt="Portafolio" src="https://img.shields.io/badge/Portafolio-3B8BFF?style=flat&logo=googlechrome&logoColor=white"/></a>
+<a href="https://profile.hackthebox.com/profile/019c5812-b4ca-7315-b12f-14db6d2b42fa"><img alt="HackTheBox" src="https://img.shields.io/badge/HackTheBox-9FEF00?style=flat&logo=hackthebox&logoColor=black"/></a>
+</td>
+</tr>
+</table>
-## Avisos
+Otras herramientas del autor:
-Megalodon es un proyecto independiente, sin relación con la Wireshark Foundation ni con INE/eLearnSecurity (eWPT). Wireshark es una marca de la Wireshark Foundation. El contenido es de redacción propia y se apoya en la [documentación pública de Wireshark](https://www.wireshark.org/docs/). Iconos de [Lucide](https://lucide.dev) (ISC).
+- [Blue-Jr](https://github.com/heindall92/Blue-Jr): simulador de SOC de nivel 1.
+- [WhiteFox](https://github.com/heindall92/WhiteFox): laboratorio de Nessus.
+- [RiskManager-Jr](https://github.com/heindall92/RiskManager-Jr): auditar IA y SaaS.
+- [Rosetta](https://github.com/heindall92/rosetta_multinorma): mapa multinorma.
+- [CTEM-Nexus](https://github.com/heindall92/ctem-nexus): exposición y rutas de ataque.
+- [Astrolabio](https://github.com/heindall92/astrolabio): entrevistas con el método STAR.
-## Licencia y autor
+Para errores o propuestas, abre una *issue* o escribe a <a href="mailto:[email protected]">[email protected]</a>.
-MIT · Yoandy Ramírez Delgado · Huelva, España
+<p align="center">
+ <img src="docs/assets/footer.svg" alt="Megalodon · lee la red como un pentester" width="100%"/>
+</p>
diff --git a/ROADMAP.md b/ROADMAP.md
index 3e61ca5..1b94928 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -10,9 +10,14 @@
- [x] Retos que obligan a usarlas, con respuestas recalculadas desde los paquetes en las pruebas
- [x] Recorrido e2e del curso completo y axe en los diálogos nuevos
-## 1.3.0 · Interfaz en inglés completa
-- [ ] El laboratorio ya tiene diccionario ES/EN para la interfaz; falta traducir lecciones y retos
-- [ ] Prueba de paridad de claves y recorrido e2e en inglés sin restos en español
+## 1.3.0 · Armazón nuevo e interfaz en inglés ✅
+- [x] Barra lateral plegable (carril que se despliega al pasar el ratón), barra de pestañas en móvil y hoja «Más»
+- [x] Interruptores ES|EN y claro|oscuro al estilo de BlueJr y RiskManager-Jr
+- [x] Toda la interfaz en inglés, con prueba de paridad de claves y traducción de cada error del filtro
+- [x] e2e del lateral, idioma, tema y móvil, y axe en el lateral plegado, el inglés y la hoja «Más»
+
+## 1.3.x · Contenido en inglés
+- [ ] Lecciones, enunciados, pistas, glosario y descripciones de campos en inglés (revisados a mano, no traducción automática)
## 1.4.0 · Más capturas
- [ ] Módulo de SMB y movimiento lateral (PsExec visto en el tráfico)
diff --git a/dist/index.html b/dist/index.html
index 6e9e91f..4ff8a83 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
-<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-pn2vRYCetiqbn/L+xmzndCqqTk9YXQtcQKAXQiHqi8k='; style-src 'sha256-rmkrZDF7Hk+AyhUGvb2gHXy962h26YoGG4S+4cFIZVk='; img-src data: blob:; connect-src 'none'; font-src 'none'; object-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'">
+<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-y/5U0uCLqnyYytoYMQTZnUNyh772yvAzk5feC5A9+xI='; style-src 'sha256-C96SuEnKUh+J8kkbNV7gTpU17KM0Edca82DmDD9F5Sw='; img-src data: blob:; connect-src 'none'; font-src 'none'; object-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'">
<meta name="referrer" content="no-referrer">
<meta name="color-scheme" content="dark light">
<meta name="description" content="Megalodon: laboratorio de Wireshark sin conexión. Capturas de un pentest, filtros con validación al instante y retos guiados del saludo TCP a los ataques web.">
@@ -654,12 +654,127 @@ li[aria-level='1'] > .tn .tl { font-weight: 650; font-family: var(--font-sans);
.tbl.ex td.mono { word-break: normal; overflow-wrap: anywhere; min-width: 14ch; }
.tbl.ex th:nth-child(3), .tbl.ex td:nth-child(3) { display: none; } /* el protocolo ya va en el mensaje */
}
+
+/* ========== Armazón 1.3: barra lateral plegable, barra superior flotante y pestañas en el móvil ==========
+ Mismo lenguaje que BlueJr y RiskManager-Jr. Movimiento: muelle sin rebote al plegar, indicador que se desliza,
+ :active a 0,97 y entrada escalonada solo en la primera carga. Con movimiento reducido, sin desplazamientos. */
+:root { --top-h: 80px; --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); --hair: rgb(255 255 255 / 0.07); --hair-2: rgb(255 255 255 / 0.12); --sidebar: rgb(18 21 27 / 0.92); --tint: rgb(108 178 255 / 0.12); }
+[data-theme='light'] { --hair: rgb(15 23 42 / 0.08); --hair-2: rgb(15 23 42 / 0.13); --sidebar: rgb(255 255 255 / 0.94); --tint: rgb(20 63 148 / 0.08); }
+.app { --sw: 264px; display: grid; grid-template-columns: calc(var(--sw) + 12px) minmax(0, 1fr); min-height: 100dvh; transition: grid-template-columns 320ms var(--ease-drawer); }
+body.side-mini .app { --sw: 68px; }
+.col { min-width: 0; padding: 0 16px 40px; }
+
+/* Lateral */
+.side { --w: var(--sw); position: sticky; top: 0; z-index: 35; height: 100dvh; width: calc(var(--w) + 12px); padding: 12px 0 12px 12px; display: flex; flex-direction: column; overflow: hidden; transition: width 320ms var(--ease-drawer); }
+.side::before { content: ''; position: absolute; inset: 12px 0 12px 12px; z-index: -1; border-radius: 24px; background: var(--sidebar); box-shadow: 0 0 0 1px var(--hair), var(--sh-panel); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); transition: box-shadow 320ms var(--ease-out); }
+.side > * { width: var(--w); transition: width 320ms var(--ease-drawer); }
+body.side-mini .side:is(:hover, :focus-within) { --w: 264px; }
+body.side-mini .side:is(:hover, :focus-within)::before { box-shadow: 0 0 0 1px var(--hair), var(--sh-overlay); }
+body.side-mini .side :is(.txt, .cnt, .brand-txt, .lvl-txt) { opacity: 0; transition: opacity 140ms var(--ease-out); }
+body.side-mini .side:is(:hover, :focus-within) :is(.txt, .cnt, .brand-txt, .lvl-txt) { opacity: 1; transition-delay: 90ms; }
+.side-brand { display: flex; align-items: center; gap: 12px; padding: 18px 15px 12px; color: var(--ink); text-decoration: none; white-space: nowrap; }
+.side-brand .logo, .brand-m .logo { width: 38px; height: 38px; border-radius: 12px; flex: none; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #1fd38a)); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
+.brand-txt { display: grid; min-width: 0; }
+.brand-txt b { font-size: 17px; font-weight: 720; letter-spacing: -0.02em; }
+.brand-txt small { font: 500 11px/1.3 var(--font-mono); letter-spacing: 0.06em; color: var(--ink-3); text-transform: uppercase; }
+.side-nav { position: relative; flex: 1; padding: 6px 10px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
+.side-nav ul { list-style: none; margin: 2px 0 6px; padding: 0; }
+.side-ind { position: absolute; left: 10px; right: 10px; top: 0; height: 40px; border-radius: 12px; background: var(--tint); opacity: 0; pointer-events: none; transition: transform 340ms var(--ease-out), height 340ms var(--ease-out), opacity 200ms; }
+.side-ind::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
+.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 14.5px; white-space: nowrap; transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 140ms var(--ease-out); }
+.side-nav a:active { transform: scale(0.97); }
+.side-nav a[aria-current='page'] { color: var(--ink); }
+.side-nav a[aria-current='page'] > .i { color: var(--accent); }
+.side-nav a.sub { min-height: 36px; padding-left: 13px; font-size: 13.5px; font-weight: 500; }
+.side-nav .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
+.side-nav .cnt { font: 500 12px var(--font-mono); color: var(--ink-3); }
+.dotn { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 7px; border: 1.5px solid var(--ink-4); transition: transform 220ms var(--ease-out); }
+.dotn b { font: 600 11px var(--font-mono); color: var(--ink-2); }
+.dotn.mid { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
+.dotn.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); }
+@media (hover: hover) and (pointer: fine) {
+ .side-nav a:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); color: var(--ink); }
+ .side-nav a:hover .dotn { transform: scale(1.12); }
+}
+body.ready .side-nav > a, body.ready .side-nav li { animation: none; }
+.side-nav > a, .side-nav li { animation: side-in 300ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 25ms + 40ms); }
+@keyframes side-in { from { opacity: 0; transform: translateX(-8px); } }
+.side-foot { padding: 12px 10px 14px; border-top: 1px solid var(--hair); }
+.lvl { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; color: var(--ink); text-decoration: none; white-space: nowrap; transition: background-color 160ms var(--ease-out); }
+.lvl:active { transform: scale(0.98); }
+.lvl-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--ok-soft); color: var(--ok); }
+.lvl-txt { display: grid; gap: 6px; min-width: 0; flex: 1; font-size: 13px; }
+.lvl-txt b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
+.lvl.bump .lvl-ic { animation: bump 0.45s var(--spring); }
+@media (hover: hover) and (pointer: fine) { .lvl:hover { background: var(--surface-2); } }
+
+/* Barra superior flotante */
+.top { position: sticky; top: 0; z-index: 30; padding-top: 12px; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
+.top-in { display: flex; align-items: center; gap: 8px; height: auto; min-height: 56px; width: 100%; padding: 8px 10px; border-radius: 999px; background: var(--glass); box-shadow: 0 0 0 1px var(--hair), var(--sh-panel); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
+.top-in > :not(.grow) { flex-shrink: 0; }
+.top .ibtn { border-radius: 50%; width: 40px; height: 40px; }
+.brand-m { display: none; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 720; letter-spacing: -0.02em; }
+.brand-m .logo { width: 32px; height: 32px; border-radius: 10px; }
+.top .search-btn { min-width: 230px; width: auto; height: 40px; padding: 0 8px 0 14px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair-2); justify-content: flex-start; color: var(--ink-3); }
+.top .search-btn .sb-t { flex: 1; text-align: left; display: inline; }
+.top .search-btn kbd { display: inline-block; }
+@media (hover: hover) and (pointer: fine) { .top .search-btn:hover { box-shadow: inset 0 0 0 1px var(--accent); } }
+/* Interruptores del mismo tamaño: 80 × 40, relleno 3 y dos huecos de 36 × 32 */
+.lang-sw { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); }
+.lang-sw button { min-width: 36px; height: 32px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font: 650 12px var(--font-mono); transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), box-shadow 200ms var(--ease-out); }
+.lang-sw button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--hair-2), var(--sh-raise); }
+.lang-sw button:active { transform: scale(0.94); }
+.theme-sw { position: relative; display: inline-flex; width: 80px; height: 40px; padding: 3px; border: 0; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); cursor: pointer; }
+.theme-sw .track { position: relative; z-index: 1; display: grid; grid-template-columns: 36px 36px; width: 100%; height: 100%; place-items: center; color: var(--ink-3); pointer-events: none; }
+.theme-sw .track .i { width: 15px; height: 15px; transition: color 200ms var(--ease-out); }
+.theme-sw[aria-checked='false'] .track .i:first-child, .theme-sw[aria-checked='true'] .track .i:last-child { color: var(--ink); }
+.theme-sw .knob { position: absolute; top: 3px; left: 3px; width: 36px; height: 34px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--hair-2), var(--sh-raise); transition: transform 280ms var(--ease-out); }
+.theme-sw[aria-checked='true'] .knob { transform: translateX(38px); }
+.theme-sw:active .knob { width: 40px; }
+.theme-sw[aria-checked='true']:active .knob { transform: translateX(34px); }
+
+/* Pestañas del móvil */
+.tabbar { display: none; }
+.more-list { display: grid; gap: 4px; }
+.more-list a, .more-list button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 550; text-decoration: none; text-align: left; }
+.more-list span { flex: 1; }
+.more-list a:active, .more-list button:active { transform: scale(0.98); }
+
+.hero { border-radius: 24px; margin-top: 14px; }
+html { scroll-padding-top: calc(var(--top-h) + 16px); }
+
+@media (max-width: 1100px) { .top .search-btn { min-width: 0; width: 40px; padding: 0; justify-content: center; } .top .search-btn .sb-t, .top .search-btn kbd { display: none; } }
+@media (max-width: 900px) {
+ .app, body.side-mini .app { grid-template-columns: minmax(0, 1fr); }
+ .side, .only-desk { display: none !important; }
+ .brand-m { display: inline-flex; }
+ .col { padding: 0 max(12px, env(safe-area-inset-left)) calc(96px + env(safe-area-inset-bottom)); }
+ .top .search-btn { background: none; box-shadow: none; color: var(--ink-2); }
+ .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; padding: 6px; border-radius: 24px; background: var(--glass-thick); box-shadow: 0 0 0 1px var(--hair), var(--sh-overlay); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
+ .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; min-height: 48px; padding: 7px 2px 5px; border: 0; border-radius: 18px; background: none; color: var(--ink-2); text-decoration: none; font: inherit; font-size: 11px; font-weight: 550; transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 140ms var(--ease-out); }
+ .tabbar a:active, .tabbar button:active { transform: scale(0.94); }
+ .tabbar [aria-current='page'] { background: var(--tint); color: var(--ink); }
+ .tabbar [aria-current='page'] .i { color: var(--accent); }
+ .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
+ .hero { margin-inline: -12px; border-radius: 0 0 24px 24px; margin-top: 10px; }
+}
+@media (max-width: 420px) { .brand-m b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } .top-in { gap: 4px; padding: 6px 8px; } }
+@media (prefers-reduced-motion: reduce) {
+ .app, .side, .side > *, .side-ind, .theme-sw .knob { transition: none !important; }
+ .side-nav > a, .side-nav li { animation: none; }
+}
</style>
</head>
<body>
<a class="skip" href="#main" id="skip">Saltar al contenido</a>
-<header id="top" class="top"></header>
-<main id="main" tabindex="-1"></main>
+<div class="app">
+ <aside id="side" class="side"></aside>
+ <div class="col">
+ <header id="top" class="top"></header>
+ <main id="main" tabindex="-1"></main>
+ </div>
+</div>
+<nav id="tabbar" class="tabbar"></nav>
<dialog id="dlg" class="dlg"></dialog>
<div id="toasts" class="toasts" role="status" aria-live="polite"></div>
<noscript><p class="noscript">Megalodon necesita JavaScript. Todo funciona en tu navegador, sin conexión.</p></noscript>
@@ -690,6 +805,8 @@ const ICONS={"handshake":"<path d=\"m11 17 2 2a1 1 0 1 0 3-3\" /><path d=\"m14 1
"ok":"<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m16 9-5.5 5.5L8 12\" />",
"hint":"<path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\" /><path d=\"M9 18h6\" /><path d=\"M10 22h4\" />",
"filter":"<path d=\"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z\" />",
+"panel":"<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" /><path d=\"M9 3v18\" />",
+"more":"<circle cx=\"12\" cy=\"12\" r=\"1\" /><circle cx=\"19\" cy=\"12\" r=\"1\" /><circle cx=\"5\" cy=\"12\" r=\"1\" />",
"pause":"<rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" /><rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />",
"play":"<path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\" />",
"chevR":"<path d=\"m9 18 6-6-6-6\" />",
@@ -2314,6 +2431,7 @@ const MODULES = [
id: 'm1', n: 1, cap: 'm1', icon: 'handshake', mins: 25,
title: 'El saludo TCP', sub: 'Handshake de tres pasos, puertos, flags, Seq/Ack y cierre',
badge: 'Domador del handshake',
+ title_en: 'The TCP handshake', sub_en: 'Three-way handshake, ports, flags, Seq/Ack and teardown', badge_en: 'Handshake tamer',
intro: 'Kali (192.168.56.10) visita la web del laboratorio (192.168.56.20). Antes de que viaje un solo byte de HTTP, las dos máquinas se saludan. Aquí aprendes a leer ese saludo como lo hace un pentester.',
lessons: [
{ h: 'Las tres zonas de Wireshark', p: ['Arriba está la **lista de paquetes**: una fila por paquete, con número, tiempo, origen, destino, protocolo, longitud e información resumida.', 'En medio, el **árbol de detalle**: el mismo paquete abierto por capas (Ethernet → IP → TCP → HTTP). Abajo, los **bytes** en hexadecimal. Si pulsas un campo del árbol, sus bytes se iluminan; si pulsas un byte, se abre su campo.', 'Los colores no son decoración: violeta claro es TCP, verde es HTTP, gris oscuro con letras rojas es un problema TCP y rojo es un RST.'], try: [['tcp', 'Solo TCP'], ['arp', 'Solo ARP: quién tiene esta IP']] },
@@ -2337,6 +2455,7 @@ const MODULES = [
id: 'm2', n: 2, cap: 'm2', icon: 'globe', mins: 30,
title: 'HTTP al desnudo', sub: 'Peticiones, cabeceras, métodos, códigos de estado y Follow Stream',
badge: 'Lector de HTTP',
+ title_en: 'HTTP laid bare', sub_en: 'Requests, headers, methods, status codes and Follow Stream', badge_en: 'HTTP reader',
intro: 'Marta entra en la tienda tienda.ewpt.local, inicia sesión y navega por su panel. Todo va por HTTP sin cifrar, así que lo puedes leer entero.',
lessons: [
{ h: 'Petición y respuesta', p: ['Una petición HTTP empieza con la **línea de petición**: método, ruta y versión, por ejemplo `GET /login HTTP/1.1`. Debajo van las cabeceras y, tras una línea vacía, el cuerpo (si lo hay).', 'La respuesta empieza con la **línea de estado**: `HTTP/1.1 200 OK`. Wireshark enlaza cada respuesta con su petición: en el árbol verás «Petición en la trama» y la URI pedida.'], try: [['http.request', 'Solo peticiones'], ['http.response', 'Solo respuestas']] },
@@ -2360,6 +2479,7 @@ const MODULES = [
id: 'm3', n: 3, cap: 'm3', icon: 'cookie', mins: 30,
title: 'Cookies y credenciales en claro', sub: 'Sesiones, Basic Auth, formularios y FTP',
badge: 'Cazador de credenciales',
+ title_en: 'Cookies and cleartext credentials', sub_en: 'Sessions, Basic Auth, forms and FTP', badge_en: 'Credential hunter',
intro: 'En la intranet de una empresa, un equipo Windows (192.168.56.40) entra en un panel con Basic Auth, inicia sesión en un formulario y se conecta por FTP. Ninguno de los tres protocolos cifra nada.',
lessons: [
{ h: 'Cookies: la memoria de la web', p: ['HTTP no recuerda quién eres entre peticiones. Tras el login, el servidor te da una **cookie de sesión** con `Set-Cookie` y tu navegador la devuelve en cada petición con `Cookie`. Quien tenga esa cookie **es** tú para el servidor.', 'Los atributos de la cookie importan: **HttpOnly** impide que JavaScript la lea (frena el robo por XSS), **Secure** obliga a enviarla solo por HTTPS y **SameSite** limita los envíos desde otras webs.'], try: [['http.set_cookie', 'El servidor reparte cookies'], ['http.cookie contains "PHPSESSID"', 'El cliente las devuelve']] },
@@ -2382,6 +2502,7 @@ const MODULES = [
id: 'm4', n: 4, cap: 'm4', icon: 'signpost', mins: 20,
title: 'DNS: la guía de teléfonos', sub: 'Consultas, respuestas, tipos de registro y NXDOMAIN',
badge: 'Rastreador de nombres',
+ title_en: 'DNS: the phone book', sub_en: 'Queries, answers, record types and NXDOMAIN', badge_en: 'Name tracker',
intro: 'Antes de visitar una web, el equipo pregunta su IP al DNS. Esa conversación cuenta mucho: qué servicios existen, dónde están alojados y qué nombres no existen.',
lessons: [
{ h: 'Pregunta y respuesta', p: ['DNS suele ir por **UDP al puerto 53**. El cliente pregunta («¿qué IP tiene www.ewpt.local?») y el servidor responde con el mismo **ID de transacción**, así se emparejan.', '`dns.flags.response == 0` son preguntas y `== 1` respuestas. El nombre preguntado está en `dns.qry.name`.'], try: [['dns.flags.response == 0', 'Solo preguntas'], ['dns.qry.name contains "ewpt"', 'Nombres del laboratorio']] },
@@ -2401,6 +2522,7 @@ const MODULES = [
id: 'm5', n: 5, cap: 'm5', icon: 'lock', mins: 25,
title: 'TLS: lo que el cifrado deja ver', sub: 'Client Hello, SNI, ALPN, TLS 1.3 y HTTP sin cifrar',
badge: 'Ojo de cerradura',
+ title_en: 'TLS: what encryption still shows', sub_en: 'Client Hello, SNI, ALPN, TLS 1.3 and unencrypted HTTP', badge_en: 'Keyhole eye',
intro: 'Kali abre dos webs por HTTPS y, por despiste, envía un login por HTTP normal. Vas a comprobar qué esconde TLS y qué no.',
lessons: [
{ h: 'El saludo TLS', p: ['Tras el saludo TCP llega el saludo TLS. El cliente envía **Client Hello** (versiones y cifrados que acepta, y el nombre del sitio) y el servidor responde **Server Hello** con lo elegido. En TLS 1.3, casi todo lo que viene después ya va cifrado.', 'El tipo de mensaje está en `tls.handshake.type`: 1 es Client Hello y 2 Server Hello.'], try: [['tls.handshake.type == 1', 'Client Hello'], ['tls.handshake.type == 2', 'Server Hello']] },
@@ -2421,6 +2543,7 @@ const MODULES = [
id: 'm6', n: 6, cap: 'm6', icon: 'swords', mins: 40,
title: 'Ataques web en el tráfico', sub: 'Escaneo SYN, fuerza bruta de directorios y de login, SQLi y XSS',
badge: 'Ojo de halcón',
+ title_en: 'Web attacks on the wire', sub_en: 'SYN scan, directory and login brute force, SQLi and XSS', badge_en: 'Hawk eye',
intro: 'Desde Kali alguien escanea el servidor, busca directorios ocultos, prueba contraseñas en bucle e inyecta SQL y JavaScript. Todo queda en la captura; aprende a reconocer cada firma.',
lessons: [
{ h: 'Escaneo SYN (nmap -sS)', p: ['El atacante envía un **SYN** a muchos puertos desde el **mismo puerto de origen** y con ventana pequeña (1024). Si responde **SYN, ACK**, el puerto está abierto y el atacante corta enseguida con **RST** (por eso se llama «medio abierto»). Si responde **RST, ACK**, está cerrado.', 'Para ver los puertos abiertos: `tcp.flags.syn==1 && tcp.flags.ack==1 && tcp.srcport < 1024`. Y en Estadísticas → Conversaciones verás decenas de conversaciones de 2 paquetes.'], try: [['tcp.flags.syn==1 && tcp.flags.ack==0 && tcp.window_size_value == 1024', 'Los SYN del escaneo'], ['tcp.flags.syn==1 && tcp.flags.ack==1 && tcp.srcport < 1024', 'Puertos que dicen «abierto»']] },
@@ -2447,6 +2570,7 @@ const MODULES = [
id: 'm7', n: 7, cap: 'm7', icon: 'network', mins: 25, extra: true,
title: 'Directorio Activo: Kerberos, SMB y NTLM', sub: 'Tickets, SPN, RC4 y autenticación NTLM sobre SMB',
badge: 'Guardián del dominio',
+ title_en: 'Active Directory: Kerberos, SMB and NTLM', sub_en: 'Tickets, SPNs, RC4 and NTLM authentication over SMB', badge_en: 'Domain guardian',
intro: 'En el dominio MEGACORP.LOCAL, un usuario pide tickets Kerberos y un equipo intruso se autentica por SMB con NTLM contra el controlador de dominio.',
lessons: [
{ h: 'Kerberos en cuatro mensajes', p: ['**AS-REQ / AS-REP**: el usuario pide al controlador de dominio su TGT (el «pase general»). **TGS-REQ / TGS-REP**: con el TGT pide tickets para servicios concretos, identificados por su **SPN** (por ejemplo `cifs/DC01.megacorp.local`).', 'Campos útiles: `kerberos.CNameString` (usuario), `kerberos.SNameString` (servicio), `kerberos.realm` (dominio) y `kerberos.etype` (cifrado).'], try: [['kerberos', 'Todo Kerberos'], ['kerberos.msg_type == 13', 'Tickets de servicio (TGS-REP)']] },
@@ -2465,6 +2589,7 @@ const MODULES = [
id: 'm8', n: 8, cap: 'm8', icon: 'radar', mins: 25, extra: true,
title: 'Caza en el SOC', sub: 'ARP spoofing, beacons de C2 y exfiltración por DNS',
badge: 'Cazador del SOC',
+ title_en: 'SOC hunting', sub_en: 'ARP spoofing, C2 beacons and DNS exfiltration', badge_en: 'SOC hunter',
intro: 'Un analista del SOC recibe esta captura de la estación WS-0412 (192.168.56.40). Hay tres cosas raras. Encuéntralas.',
lessons: [
{ h: 'ARP spoofing', p: ['ARP traduce IP a MAC y no tiene autenticación. Un atacante puede gritar «la puerta de enlace soy yo» con respuestas ARP no pedidas y ponerse en medio (MITM).', 'Señal: varias respuestas ARP para la **misma IP con otra MAC**. Wireshark lo marca como «duplicate IP address».'], try: [['arp.opcode == 2', 'Respuestas ARP'], ['arp.src.proto_ipv4 == 192.168.56.1', 'Quién dice ser la puerta de enlace']] },
@@ -2485,7 +2610,7 @@ const MODULES = [
/* src/content/reference.js */
/* Megalodon · chuleta de filtros y glosario. */
const CHEATS = [
- { h: 'Lo básico', items: [
+ { h: 'Lo básico', h_en: 'The basics', items: [
['tcp', 'Solo TCP (escribe el nombre de cualquier protocolo: udp, dns, http, tls, arp…)'],
['!arp', 'Todo menos ARP (también vale «not arp»)'],
['ip.addr == 192.168.56.20', 'Paquetes donde esa IP es origen o destino'],
@@ -2516,7 +2641,7 @@ const CHEATS = [
['http.authbasic', 'Credenciales Basic decodificadas'],
['urlencoded-form', 'Formularios enviados por POST'],
] },
- { h: 'DNS, TLS y más', items: [
+ { h: 'DNS, TLS y más', h_en: 'DNS, TLS and more', items: [
['dns.qry.name contains "ewpt"', 'Consultas a un dominio'],
['dns.flags.rcode == 3', 'Nombres que no existen (NXDOMAIN)'],
['len(dns.qry.name) > 30', 'Nombres larguísimos (posible exfiltración)'],
@@ -2526,7 +2651,7 @@ const CHEATS = [
['kerberos.etype == 23', 'Tickets Kerberos con RC4'],
['ntlmssp.auth.username', 'Usuarios que se autentican por NTLM'],
] },
- { h: 'Operadores', items: [
+ { h: 'Operadores', h_en: 'Operators', items: [
['== != > < >= <=', 'Comparar (también eq, ne, gt, lt, ge, le)'],
['&& || !', 'Y, o, no (también and, or, not)'],
['http.host contains "admin"', 'contains: contiene ese texto (distingue mayúsculas)'],
@@ -2615,6 +2740,7 @@ const STRINGS = {
progress: 'Progreso', resetProgress: 'Borrar mi progreso', resetConfirm: 'Sí, borrar', theme: 'Tema', light: 'Claro', dark: 'Oscuro', system: 'Sistema',
language: 'Idioma', copy: 'Copiar', copied: 'Copiado', lessonsInSpanish: '', importDrop: 'Suelta aquí un .pcap o .pcapng', captures: 'Captura',
expert: 'Información experta', objects: 'Objetos HTTP', creds: 'Credenciales', endpoints: 'Endpoints', gotoPkt: 'Ir al paquete', findPkt: 'Buscar paquete', timeFmt: 'Formato de tiempo', followUdp: 'Seguir flujo UDP',
+ sideToggle: 'Mostrar u ocultar la barra lateral', brandSub: 'Laboratorio de Wireshark', more: 'Más', navMain: 'Secciones', navMobile: 'Secciones (móvil)', themeSwitch: 'Modo oscuro', langSwitch: 'Idioma', allModules: 'Todos los módulos', levelProg: 'Progreso de nivel',
conv: 'Conversaciones', hier: 'Jerarquía de protocolos', io: 'Gráfico de E/S', interval: 'Intervalo', filterThis: 'Filtrar esto', filterStream: 'Filtrar este flujo',
prevStream: 'Flujo anterior', nextStream: 'Flujo siguiente', client: 'Cliente', server: 'Servidor', allPackets: 'Todos los paquetes', matching: 'Cumplen el filtro',
moduleDone: '¡Módulo completado!', badgeEarned: 'Has ganado la insignia', next: 'Siguiente módulo', back: 'Volver', notFound: 'Esta página no existe.',
@@ -2633,6 +2759,7 @@ const STRINGS = {
progress: 'Progress', resetProgress: 'Reset my progress', resetConfirm: 'Yes, reset', theme: 'Theme', light: 'Light', dark: 'Dark', system: 'System',
language: 'Language', copy: 'Copy', copied: 'Copied', lessonsInSpanish: 'Lessons and challenges are written in Spanish.', importDrop: 'Drop a .pcap or .pcapng here', captures: 'Capture',
expert: 'Expert Information', objects: 'HTTP Objects', creds: 'Credentials', endpoints: 'Endpoints', gotoPkt: 'Go to Packet', findPkt: 'Find Packet', timeFmt: 'Time Display Format', followUdp: 'Follow UDP Stream',
+ sideToggle: 'Show or hide the sidebar', brandSub: 'Wireshark lab', more: 'More', navMain: 'Sections', navMobile: 'Sections (mobile)', themeSwitch: 'Dark mode', langSwitch: 'Language', allModules: 'All modules', levelProg: 'Level progress',
conv: 'Conversations', hier: 'Protocol Hierarchy', io: 'I/O Graph', interval: 'Interval', filterThis: 'Filter this', filterStream: 'Filter this stream',
prevStream: 'Previous stream', nextStream: 'Next stream', client: 'Client', server: 'Server', allPackets: 'All packets', matching: 'Match the filter',
moduleDone: 'Module complete!', badgeEarned: 'You earned the badge', next: 'Next module', back: 'Back', notFound: 'This page does not exist.',
@@ -2640,11 +2767,17 @@ const STRINGS = {
};
let LANG = 'es';
const t = k => (STRINGS[LANG] && STRINGS[LANG][k]) ?? STRINGS.es[k] ?? k;
+/* Texto en línea para lo que solo aparece una vez: L('español', 'English') */
+const L = (es, en) => LANG === 'en' ? en : es;
+/* Campos de módulo con su versión inglesa (title, sub, badge) */
+const mT = (m, k) => (LANG === 'en' && m[`${k}_en`]) || m[k];
/* src/app/10-state.js */
/* Megalodon · estado y progreso guardados en localStorage («megalodon.v1»). */
const STORE_KEY = 'megalodon.v1';
const LEVELS = [[0, 'Alevín'], [80, 'Tintorera'], [200, 'Tiburón martillo'], [380, 'Gran blanco'], [600, 'Megalodón']];
+const LEVELS_EN = ['Shark pup', 'Blue shark', 'Hammerhead', 'Great white', 'Megalodon'];
+const lvName = lv => (LANG === 'en' ? LEVELS_EN[lv.i] : lv.name);
const XP_BY_HINTS = [10, 8, 6, 5];
const BONUS_MODULE = 20;
const S = (() => {
@@ -2748,7 +2881,7 @@ async function copyText(txt, btn) {
try { ok = document.execCommand('copy'); } catch { ok = false; } ta.remove();
}
if (btn) { btn.classList.add('done'); btn.innerHTML = ic(ok ? 'copied' : 'ko'); btn.setAttribute('aria-label', ok ? t('copied') : 'Error'); setTimeout(() => { btn.classList.remove('done'); btn.innerHTML = ic('copy'); btn.setAttribute('aria-label', t('copy')); }, 1400); }
- toast(ok ? `${t('copied')}: <code>${esc(txt)}</code>` : 'No se pudo copiar', ok ? 'ok' : 'err', ok ? 'copied' : 'ko');
+ toast(ok ? `${t('copied')}: <code>${esc(txt)}</code>` : L('No se pudo copiar', 'Could not copy'), ok ? 'ok' : 'err', ok ? 'copied' : 'ko');
}
function download(bytes, name, type = 'application/octet-stream') {
@@ -2773,6 +2906,78 @@ function filterFor(node) {
if (node.field === 'tcp.flags') return `tcp.flags == 0x${Number(v).toString(16).padStart(3, '0')}`;
return `${node.field} == ${v}`;
}
+/* Los mensajes del motor de filtros están en español; en inglés se traducen aquí, sin tocar el motor. */
+const FERR_EN = [
+ [/^Falta cerrar las comillas de la cadena$/, 'Missing closing quote in the string'],
+ [/^Un solo «=» no vale: para comparar usa «==»$/, 'A single “=” is not valid: use “==” to compare'],
+ [/^«(.)» suelto no vale: usa «(..)»$/, '“$1” on its own is not valid: use “$2”'],
+ [/^Carácter inesperado «(.*)»$/, 'Unexpected character “$1”'],
+ [/^Se esperaba una expresión regular entre comillas tras «matches»$/, 'Expected a quoted regular expression after “matches”'],
+ [/^Se esperaba un campo dentro de la función$/, 'Expected a field inside the function'],
+ [/^Se esperaba «\)» para cerrar la función$/, 'Expected “)” to close the function'],
+ [/^Se esperaba «\)» para cerrar el paréntesis$/, 'Expected “)” to close the parenthesis'],
+ [/^Se esperaba «\{» después de «in»$/, 'Expected “{” after “in”'],
+ [/^Se esperaba (.*)$/, 'Expected $1'],
+ [/^El filtro termina antes de tiempo: falta un valor$/, 'The filter ends too early: a value is missing'],
+ [/^El filtro termina antes de tiempo$/, 'The filter ends too early'],
+ [/^No se esperaba «(.*)» aquí$/, '“$1” was not expected here'],
+ [/^«(.*)» no es un campo ni un protocolo conocido\. ¿Querías decir «(.*)»\?$/, '“$1” is not a known field or protocol. Did you mean “$2”?'],
+ [/^«(.*)» no es un campo ni un protocolo conocido$/, '“$1” is not a known field or protocol'],
+ [/^«(.*)» necesita algo a su izquierda$/, '“$1” needs something on its left'],
+ [/^Falta «}» para cerrar el conjunto$/, 'Missing “}” to close the set'],
+ [/^Separa los valores del conjunto con comas: \{80, 443\}$/, 'Separate set values with commas: {80, 443}'],
+ [/^El conjunto de «in» está vacío$/, 'The “in” set is empty'],
+ [/^«(.*)» solo funciona con campos de texto; (.*) es numérico$/, '“$1” only works with text fields; $2 is numeric'],
+ [/^La expresión regular no es válida$/, 'The regular expression is not valid'],
+ [/^Falta el texto a buscar tras «contains»$/, 'Missing the text to search for after “contains”'],
+ [/^Falta el valor con el que comparar ?(.*)$/, 'Missing the value to compare $1 with'],
+ [/^«(.*)» no es un número válido para este campo$/, '“$1” is not a valid number for this field'],
+ [/^«(.*)» no es una dirección IPv4 válida \(p\. ej\. (.*) o (.*)\)$/, '“$1” is not a valid IPv4 address (e.g. $2 or $3)'],
+ [/^«(.*)» no es una MAC válida \(p\. ej\. (.*)\)$/, '“$1” is not a valid MAC (e.g. $2)'],
+ [/^Un protocolo no se compara con un valor: escribe solo su nombre, p\. ej\. «http»$/, 'A protocol is not compared with a value: write just its name, e.g. “http”'],
+ [/^Falta un operador lógico \(«&&» o «\|\|»\) antes de «(.*)»$/, 'Missing a logical operator (“&&” or “||”) before “$1”'],
+];
+const fErr = m => { if (LANG !== 'en' || !m) return m; for (const [re, en] of FERR_EN) if (re.test(m)) return m.replace(re, en); return m; };
+/* Árbol de detalle en inglés con las etiquetas que muestra Wireshark (el disector las genera en español). */
+const TREE_EN = [
+ [/^Frame (\d+): (\d+) bytes en el cable \((\d+) bits\), (\d+) bytes capturados$/, 'Frame $1: $2 bytes on wire ($3 bits), $4 bytes captured'],
+ [/^Hora de llegada \(epoch\): /, 'Epoch Arrival Time: '], [/^Longitud de la trama: (.*) bytes$/, 'Frame Length: $1 bytes'], [/^Número de trama: /, 'Frame Number: '],
+ [/^\[Tiempo desde el paquete anterior: /, '[Time delta from previous captured frame: '], [/^\[Tiempo desde el primer paquete: /, '[Time since reference or first frame: '],
+ [/^\[Protocolos en la trama: /, '[Protocols in frame: '], [/^\[Respuesta en la trama: /, '[Response in frame: '],
+ [/^Tipo de contenido: /, 'Content Type: '], [/^Tipo opaco: (.*) ← en TLS (\S+) el tipo real va cifrado dentro$/, 'Opaque Type: $1 ← in TLS $2 the real type is encrypted inside'],
+ [/^Destino: /, 'Destination: '], [/^Origen: /, 'Source: '], [/^Tipo: (.*)Desconocido/, 'Type: $1Unknown'], [/^Tipo: (.*)\(otro\)$/, 'Type: $1(other)'], [/^Tipo: /, 'Type: '],
+ [/= Versión: /, '= Version: '], [/= Longitud de cabecera: /, '= Header Length: '], [/^Longitud total: /, 'Total Length: '], [/^Identificación: /, 'Identification: '],
+ [/^Tiempo de vida \(TTL\): /, 'Time to Live: '], [/^Protocolo: /, 'Protocol: '], [/^Checksum de cabecera: /, 'Header Checksum: '],
+ [/^Dirección de origen: /, 'Source Address: '], [/^Dirección de destino: /, 'Destination Address: '],
+ [/^Puerto de origen: /, 'Source Port: '], [/^Puerto de destino: /, 'Destination Port: '], [/^\[Índice de flujo: /, '[Stream index: '],
+ [/^\[Longitud del segmento TCP: /, '[TCP Segment Len: '], [/^Número de secuencia \(bruto\): /, 'Sequence Number (raw): '],
+ [/^Número de secuencia: (\d+) {4}\(número relativo\)$/, 'Sequence Number: $1 (relative sequence number)'], [/^Número de secuencia: /, 'Sequence Number: '],
+ [/^\[Siguiente número de secuencia: (\d+) {4}\(relativo\)\]$/, '[Next Sequence Number: $1 (relative sequence number)]'], [/^\[Siguiente número de secuencia: /, '[Next Sequence Number: '],
+ [/^Número de acuse \(bruto\): /, 'Acknowledgment number (raw): '], [/^Número de acuse: (\d+) {4}\(relativo\)$/, 'Acknowledgment Number: $1 (relative ack number)'], [/^Número de acuse: /, 'Acknowledgment Number: '],
+ [/<ninguno>/, '<None>'], [/^Ventana: /, 'Window: '], [/^\[Ventana calculada: /, '[Calculated window size: '], [/^Opciones: \((.*) bytes\)$/, 'Options: ($1 bytes)'],
+ [/^SACK permitido$/, 'SACK permitted'], [/\(multiplicar por (\d+)\)$/, '(multiply by $1)'], [/^\[Análisis SEQ\/ACK\]$/, '[SEQ/ACK analysis]'],
+ [/^\[Este segmento es una retransmisión\]$/, '[This frame is a (suspected) retransmission]'], [/^Datos TCP \((.*) bytes\)$/, 'TCP payload ($1 bytes)'],
+ [/^Longitud: /, 'Length: '], [/^Código: /, 'Code: '],
+ [/^Tipo de hardware: /, 'Hardware type: '], [/^Tipo de protocolo: /, 'Protocol type: '], [/^MAC del emisor: /, 'Sender MAC address: '], [/^IP del emisor: /, 'Sender IP address: '],
+ [/^MAC de destino: /, 'Target MAC address: '], [/^IP de destino: /, 'Target IP address: '],
+ [/^ID de transacción: /, 'Transaction ID: '], [/^Flags: Respuesta$/, 'Flags: Response'], [/^Flags: Petición$/, 'Flags: Request'],
+ [/^Preguntas: /, 'Questions: '], [/^Respuestas: /, 'Answer RRs: '], [/^Nombre: /, 'Name: '], [/^TTL: (\d+) \((\d+) segundos\)$/, 'Time to live: $1 ($2 seconds)'],
+ [/^MAC del cliente: /, 'Client MAC address: '], [/^Tu IP \(yiaddr\): /, 'Your (client) IP address: '],
+ [/^Opción \(53\) Tipo de mensaje DHCP: /, 'Option: (53) DHCP Message Type: '], [/^Opción \(50\) IP solicitada: /, 'Option: (50) Requested IP Address: '],
+ [/^Opción \(54\) Servidor DHCP: /, 'Option: (54) DHCP Server Identifier: '], [/^Opción \(12\) Nombre del equipo: /, 'Option: (12) Host Name: '],
+ [/^Opción \((\d+)\)$/, 'Option: ($1)'], [/^Opción (\d+)$/, 'Option $1'], [/^Fin de la lista de opciones \(EOL\)$/, 'End of Option List (EOL)'],
+ [/^Método: /, 'Request Method: '], [/^URI: /, 'Request URI: '], [/^Versión: /, 'Version: '], [/^Código de estado: /, 'Status Code: '], [/^Frase: /, 'Response Phrase: '],
+ [/^\[URI completa pedida: /, '[Full request URI: '], [/^\[URI completa: /, '[Full request URI: '], [/^\[URI pedida: /, '[Request URI: '],
+ [/^\[Petición en la trama: /, '[Request in frame: '], [/^\[Tiempo desde la petición: /, '[Time since request: '], [/^Credenciales: /, 'Credentials: '],
+ [/^Par de cookie: /, 'Cookie pair: '], [/^Cuerpo \((.*) bytes\)$/, 'File Data: $1 bytes'], [/^Elemento del formulario: /, 'Form item: '], [/^Clave: /, 'Key: '], [/^Valor: /, 'Value: '],
+ [/^Orden: ([A-Z]+)$/, 'Request command: $1'], [/^Orden: /, 'Command: '], [/^Argumento: /, 'Request arg: '], [/^Código de respuesta: /, 'Response code: '],
+ [/^Tipo de handshake: /, 'Handshake Type: '], [/^Longitud del Session ID: /, 'Session ID Length: '], [/\(len=(\d+)\)$/, '(len=$1)'], [/^Extension: tipo /, 'Extension: type '],
+ [/^Mensaje Change Cipher Spec$/, 'Change Cipher Spec Message'], [/^Datos de aplicación cifrados: /, 'Encrypted Application Data: '],
+ [/^NetBIOS Session Service \(longitud (\d+)\)$/, 'NetBIOS Session Service (length $1)'], [/^Cabecera SMB2$/, 'SMB2 Header'], [/^Estado NT: /, 'NT Status: '],
+ [/^Identificador NTLMSSP: /, 'NTLMSSP identifier: '], [/^Tipo de mensaje: /, 'NTLM Message Type: '], [/^Dominio: /, 'Domain name: '], [/^Usuario: /, 'User name: '], [/^Equipo: /, 'Host name: '],
+ [/^ENCTYPE \(que acepta el cliente\): /, 'ENCTYPE: '], [/^etype del ticket: /, 'etype (ticket): '], [/^etype de enc-part: /, 'etype (enc-part): '],
+];
+const treeLabel = l => { if (LANG !== 'en') return l; let out = l; for (const [re, en] of TREE_EN) out = out.replace(re, en); return out; };
const treeKey = (node, depth) => depth + ':' + node.label.split(/[,:(\[]/)[0].trim();
class Workspace {
@@ -2791,22 +2996,22 @@ class Workspace {
<div class="ws-bar">
<div class="fbar" data-state="empty">
<span class="fbar-ic" aria-hidden="true">${ic('filter')}</span>
- <label class="vh" for="${id}-f">Filtro de visualización</label>
+ <label class="vh" for="${id}-f">${L('Filtro de visualización', 'Display filter')}</label>
<input id="${id}-f" class="finput mono" type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-controls="${id}-ac" aria-describedby="${id}-msg" autocomplete="off" autocapitalize="off" spellcheck="false" placeholder="${esc(t('filterPh'))}">
<button class="ibtn sm" data-clear type="button" aria-label="${t('clear')}">${ic('x')}</button>
<button class="btn sm primary" data-apply type="button" aria-label="${t('apply')}">${ic('enter')}<span>${t('apply')}</span></button>
- <ul class="ac" id="${id}-ac" role="listbox" aria-label="Sugerencias" hidden></ul>
+ <ul class="ac" id="${id}-ac" role="listbox" aria-label="${L('Sugerencias', 'Suggestions')}" hidden></ul>
</div>
- <div class="ws-tools" role="toolbar" aria-label="Herramientas">
+ <div class="ws-tools" role="toolbar" aria-label="${L('Herramientas', 'Tools')}">
<button class="tbtn" data-follow type="button" title="${t('follow')} (F)">${ic('follow')}<span>${t('follow')}</span></button>
<button class="tbtn" data-stats type="button" title="${t('stats')} (S)">${ic('stats')}<span>${t('stats')}</span></button>
- <button class="tbtn" data-expert type="button" title="${t('expert')} (E)">${ic('alert')}<span>Experto</span></button>
- <button class="tbtn" data-objects type="button" title="Archivo › Exportar objetos › HTTP">${ic('file')}<span>${t('objects')}</span></button>
- <button class="tbtn" data-creds type="button" title="Herramientas › Credenciales">${ic('lock')}<span>${t('creds')}</span></button>
- <button class="tbtn" data-find type="button" title="${t('findPkt')} (Ctrl F) · ${t('gotoPkt')} (Ctrl G)">${ic('search')}<span>Buscar</span></button>
+ <button class="tbtn" data-expert type="button" title="${t('expert')} (E)">${ic('alert')}<span>${L('Experto', 'Expert')}</span></button>
+ <button class="tbtn" data-objects type="button" title="${L('Archivo › Exportar objetos › HTTP', 'File › Export Objects › HTTP')}">${ic('file')}<span>${t('objects')}</span></button>
+ <button class="tbtn" data-creds type="button" title="${L('Herramientas › Credenciales', 'Tools › Credentials')}">${ic('lock')}<span>${t('creds')}</span></button>
+ <button class="tbtn" data-find type="button" title="${t('findPkt')} (Ctrl F) · ${t('gotoPkt')} (Ctrl G)">${ic('search')}<span>${t('search')}</span></button>
<button class="tbtn" data-color type="button" aria-pressed="true">${ic('sparkles')}<span>${t('colorize')}</span></button>
${imp ? `<button class="tbtn" data-open type="button">${ic('upload')}<span>${t('open')}</span></button><input type="file" class="vh" data-file accept=".pcap,.pcapng,.cap,application/vnd.tcpdump.pcap" tabindex="-1" aria-hidden="true">` : ''}
- <button class="tbtn" data-export type="button">${ic('download')}<span>Exportar</span></button>
+ <button class="tbtn" data-export type="button">${ic('download')}<span>${L('Exportar', 'Export')}</span></button>
</div>
</div>
<p class="fmsg" id="${id}-msg" aria-live="polite"></p>
@@ -2820,7 +3025,7 @@ class Workspace {
<div class="pane ptree" aria-label="${t('detail')}" role="region"><ul class="tree" role="tree" aria-label="${t('detail')}" tabindex="0"></ul><p class="pane-empty">${t('noPacket')}</p></div>
<div class="pane phex" role="region" aria-label="${t('hexView')}" tabindex="0"><div class="hex mono"></div></div>
</div>
- <div class="ws-status"><span data-count></span><span class="dot" aria-hidden="true"></span><label class="tfmt"><span>${t('time')}:</span><select data-tfmt aria-label="${t('timeFmt')}"><option value="rel">desde el inicio</option><option value="delta">desde el anterior capturado</option><option value="dview">desde el anterior mostrado</option><option value="abs">hora UTC</option></select></label><span class="dot" aria-hidden="true"></span><span data-name class="mono"></span><span class="grow"></span><span data-legend class="legend"></span></div>
+ <div class="ws-status"><span data-count></span><span class="dot" aria-hidden="true"></span><label class="tfmt"><span>${t('time')}:</span><select data-tfmt aria-label="${t('timeFmt')}"><option value="rel">${L('desde el inicio', 'since beginning of capture')}</option><option value="delta">${L('desde el anterior capturado', 'since previous captured packet')}</option><option value="dview">${L('desde el anterior mostrado', 'since previous displayed packet')}</option><option value="abs">${L('hora UTC', 'UTC time of day')}</option></select></label><span class="dot" aria-hidden="true"></span><span data-name class="mono"></span><span class="grow"></span><span data-legend class="legend"></span></div>
${imp ? `<div class="drop" hidden>${ic('upload')}<span>${t('importDrop')}</span></div>` : ''}
</section>`;
const r = this.host;
@@ -2884,27 +3089,27 @@ class Workspace {
}
async importFile(f) {
try {
- if (f.size > 64 * 1024 * 1024) throw new Error('El archivo pesa más de 64 MB; este laboratorio está pensado para capturas pequeñas.');
+ if (f.size > 64 * 1024 * 1024) throw new Error(L('El archivo pesa más de 64 MB; este laboratorio está pensado para capturas pequeñas.', 'The file is over 64 MB; this lab is meant for small captures.'));
const raw = readCapture(new Uint8Array(await f.arrayBuffer()));
- if (!raw.length) throw new Error('La captura no tiene paquetes Ethernet que pueda leer.');
+ if (!raw.length) throw new Error(L('La captura no tiene paquetes Ethernet que pueda leer.', 'The capture has no Ethernet packets I can read.'));
this.load(raw, f.name, '');
- toast(`Abierta <strong>${esc(f.name)}</strong>: ${fmtNum(raw.length)} paquetes`, 'ok', 'file');
+ toast(`${L('Abierta', 'Opened')} <strong>${esc(f.name)}</strong>: ${fmtNum(raw.length)} ${L('paquetes', 'packets')}`, 'ok', 'file');
if (this.opts.onImport) this.opts.onImport(f.name);
- } catch (err) { toast(esc(err.message || 'No se pudo leer la captura'), 'err'); }
+ } catch (err) { toast(esc(err.message || L('No se pudo leer la captura', 'Could not read the capture')), 'err'); }
}
exportDialog() {
const base = this.name.replace(/\.(pcapng|pcap|cap)$/i, '');
- const d = openDialog({ title: 'Exportar captura', cls: 'narrow', body: `<p class="muted">Se descarga a tu equipo y la abres tal cual en Wireshark.</p>
+ const d = openDialog({ title: L('Exportar captura', 'Export capture'), cls: 'narrow', body: `<p class="muted">${L('Se descarga a tu equipo y la abres tal cual en Wireshark.', 'It downloads to your device and opens as is in Wireshark.')}</p>
<div class="stack-sm">
- <button class="choice" data-k="all-ng">${ic('download')}<span><strong>Captura completa · .pcapng</strong><small>${fmtNum(this.pkts.length)} paquetes, formato moderno</small></span></button>
- <button class="choice" data-k="all-pcap">${ic('download')}<span><strong>Captura completa · .pcap</strong><small>Formato clásico, lo abre cualquier herramienta</small></span></button>
- <button class="choice" data-k="view-ng" ${this.view.length === this.pkts.length ? 'disabled' : ''}>${ic('filter')}<span><strong>Solo los mostrados · .pcapng</strong><small>${fmtNum(this.view.length)} paquetes con el filtro actual</small></span></button>
+ <button class="choice" data-k="all-ng">${ic('download')}<span><strong>${L('Captura completa', 'Full capture')} · .pcapng</strong><small>${fmtNum(this.pkts.length)} ${L('paquetes, formato moderno', 'packets, modern format')}</small></span></button>
+ <button class="choice" data-k="all-pcap">${ic('download')}<span><strong>${L('Captura completa', 'Full capture')} · .pcap</strong><small>${L('Formato clásico, lo abre cualquier herramienta', 'Classic format, any tool opens it')}</small></span></button>
+ <button class="choice" data-k="view-ng" ${this.view.length === this.pkts.length ? 'disabled' : ''}>${ic('filter')}<span><strong>${L('Solo los mostrados', 'Displayed only')} · .pcapng</strong><small>${fmtNum(this.view.length)} ${L('paquetes con el filtro actual', 'packets with the current filter')}</small></span></button>
</div>` });
$$('[data-k]', d).forEach(b => b.onclick = () => {
const k = b.dataset.k, subset = k.startsWith('view') ? this.view.map(p => this.raw[p.no - 1]) : this.raw;
const ng = k.endsWith('ng');
download(ng ? writePcapng(subset, `Megalodon · ${base}`) : writePcap(subset), `${base}${k.startsWith('view') ? '-filtrado' : ''}.${ng ? 'pcapng' : 'pcap'}`, 'application/vnd.tcpdump.pcap');
- closeDialog(); toast('Captura exportada', 'ok', 'download');
+ closeDialog(); toast(L('Captura exportada', 'Capture exported'), 'ok', 'download');
});
}
@@ -2914,7 +3119,7 @@ class Workspace {
this.$.fbar.dataset.state = r.empty ? 'empty' : r.ok ? 'ok' : 'bad';
this.$.input.setAttribute('aria-invalid', String(!r.ok));
this.$.msg.className = 'fmsg ' + (r.ok ? '' : 'bad');
- this.$.msg.innerHTML = r.ok ? '' : `${ic('ko', 'sm')}<span>${esc(r.error)}</span>`;
+ this.$.msg.innerHTML = r.ok ? '' : `${ic('ko', 'sm')}<span>${esc(fErr(r.error))}</span>`;
return r;
}
apply(silent) {
@@ -3047,7 +3252,7 @@ class Workspace {
this.flat.push({ id, node: n, depth, key, parentId, kids, open });
const f = filterFor(n);
return `<li role="treeitem" id="${id}" aria-level="${depth + 1}" aria-selected="false" ${kids ? `aria-expanded="${open}"` : ''}>
- <div class="tn" data-id="${id}">${kids ? `<span class="tw" aria-hidden="true">${ic('chevR', 'sm')}</span>` : '<span class="tw"></span>'}<span class="tl">${esc(n.label)}</span>${f ? `<button class="tf" type="button" tabindex="-1" data-f="${esc(f)}" aria-label="${t('applyAsFilter')}: ${esc(f)}" title="${t('applyAsFilter')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</div>
+ <div class="tn" data-id="${id}">${kids ? `<span class="tw" aria-hidden="true">${ic('chevR', 'sm')}</span>` : '<span class="tw"></span>'}<span class="tl">${esc(treeLabel(n.label))}</span>${f ? `<button class="tf" type="button" tabindex="-1" data-f="${esc(f)}" aria-label="${t('applyAsFilter')}: ${esc(f)}" title="${t('applyAsFilter')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</div>
${kids ? `<ul role="group"${open ? '' : ' hidden'}>${walk(n.kids, depth + 1, id)}</ul>` : ''}</li>`;
}).join('');
this.$.tree.innerHTML = walk(p.tree, 0, null);
@@ -3120,7 +3325,7 @@ class Workspace {
const p = this.selected();
if (stream === undefined && p && p.tcpStream === undefined && p.f['udp.stream']) return openFollow(this, p.f['udp.stream'][0], 'udp');
const st = stream ?? (p && p.tcpStream);
- if (st === undefined || st === null) { toast('Selecciona un paquete TCP o UDP para seguir su flujo.', 'info', 'follow'); return; }
+ if (st === undefined || st === null) { toast(L('Selecciona un paquete TCP o UDP para seguir su flujo.', 'Select a TCP or UDP packet to follow its stream.'), 'info', 'follow'); return; }
openFollow(this, st);
}
destroy() { this.unsub && this.unsub(); this.host.innerHTML = ''; }
@@ -3141,8 +3346,8 @@ function openFollow(ws, stream, kind = 'tcp') {
<div class="fs-ends"><span class="who cli">${ic('arrowR', 'sm')}${t('client')} <code>${esc(fs.client)}</code></span><span class="who srv">${ic('arrowL', 'sm')}${t('server')} <code>${esc(fs.server)}</code></span></div>
<div class="row"><button class="ibtn" data-prev ${idx <= 0 ? 'disabled' : ''} aria-label="${t('prevStream')}">${ic('chevL')}</button><span class="mono sm">${kind}.stream eq ${cur}</span><button class="ibtn" data-next ${idx >= streams.length - 1 ? 'disabled' : ''} aria-label="${t('nextStream')}">${ic('chevR')}</button></div>
</div>
- <div class="fs-body mono" tabindex="0" aria-label="Contenido del flujo">${fs.chunks.length ? fs.chunks.map(c => `<pre class="${c.client ? 'cli' : 'srv'}"><span class="vh">${c.client ? t('client') : t('server')}: </span>${esc(c.text)}</pre>`).join('') : `<p class="muted">${udp ? 'Este flujo UDP no lleva datos.' : 'Este flujo no lleva datos: solo saludo y cierre (o un RST).'}</p>`}</div>
- <p class="sm muted fs-sum">${t('client')} → ${t('server')}: <strong>${fmtNum(fs.cBytes)}</strong> bytes · ${t('server')} → ${t('client')}: <strong>${fmtNum(fs.sBytes)}</strong> bytes · ${fs.chunks.length} bloques</p>`;
+ <div class="fs-body mono" tabindex="0" aria-label="${L('Contenido del flujo', 'Stream content')}">${fs.chunks.length ? fs.chunks.map(c => `<pre class="${c.client ? 'cli' : 'srv'}"><span class="vh">${c.client ? t('client') : t('server')}: </span>${esc(c.text)}</pre>`).join('') : `<p class="muted">${udp ? L('Este flujo UDP no lleva datos.', 'This UDP stream carries no data.') : L('Este flujo no lleva datos: solo saludo y cierre (o un RST).', 'This stream carries no data: just handshake and teardown (or an RST).')}</p>`}</div>
+ <p class="sm muted fs-sum">${t('client')} → ${t('server')}: <strong>${fmtNum(fs.cBytes)}</strong> bytes · ${t('server')} → ${t('client')}: <strong>${fmtNum(fs.sBytes)}</strong> bytes · ${fs.chunks.length} ${L('bloques', 'chunks')}</p>`;
$('[data-prev]', body).onclick = () => { cur = streams[idx - 1]; render(); };
$('[data-next]', body).onclick = () => { cur = streams[idx + 1]; render(); };
};
@@ -3180,10 +3385,10 @@ function convPanel(ws, panel) {
const draw = () => {
const rows = c[k], ports = k === 'tcp' || k === 'udp';
const fl = r => k === 'tcp' ? `tcp.stream eq ${r.stream}` : k === 'udp' ? `udp.stream eq ${r.stream}` : k === 'ip' ? `ip.addr == ${r.a} && ip.addr == ${r.b}` : `eth.addr == ${r.a} && eth.addr == ${r.b}`;
- panel.innerHTML = `<div class="chips" role="group" aria-label="Tipo de conversación">${kinds.map(([x, l]) => `<button class="chip ${x === k ? 'on' : ''}" aria-pressed="${x === k}" data-k="${x}">${l} <span class="num">${c[x].length}</span></button>`).join('')}</div>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl"><caption class="vh">Conversaciones ${k}</caption><thead><tr><th scope="col">${k === 'eth' ? 'Dirección A' : 'IP A'}</th>${ports ? '<th scope="col" class="n">Puerto A</th>' : ''}<th scope="col">${k === 'eth' ? 'Dirección B' : 'IP B'}</th>${ports ? '<th scope="col" class="n">Puerto B</th>' : ''}<th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">A → B</th><th scope="col" class="n">B → A</th><th scope="col" class="n">Inicio</th><th scope="col" class="n">Duración</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="chips" role="group" aria-label="${L('Tipo de conversación', 'Conversation type')}">${kinds.map(([x, l]) => `<button class="chip ${x === k ? 'on' : ''}" aria-pressed="${x === k}" data-k="${x}">${l} <span class="num">${c[x].length}</span></button>`).join('')}</div>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl"><caption class="vh">${t('conv')} ${k}</caption><thead><tr><th scope="col">${k === 'eth' ? L('Dirección A', 'Address A') : 'IP A'}</th>${ports ? `<th scope="col" class="n">${L('Puerto A', 'Port A')}</th>` : ''}<th scope="col">${k === 'eth' ? L('Dirección B', 'Address B') : 'IP B'}</th>${ports ? `<th scope="col" class="n">${L('Puerto B', 'Port B')}</th>` : ''}<th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">A → B</th><th scope="col" class="n">B → A</th><th scope="col" class="n">${L('Inicio', 'Start')}</th><th scope="col" class="n">${L('Duración', 'Duration')}</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map((r, i) => `<tr><td class="mono">${esc(r.a)}</td>${ports ? `<td class="n mono">${r.pa}</td>` : ''}<td class="mono">${esc(r.b)}</td>${ports ? `<td class="n mono">${r.pb}</td>` : ''}<td class="n">${r.pkts}</td><td class="n">${fmtNum(r.bytes)}</td><td class="n">${r.ab}</td><td class="n">${r.ba}</td><td class="n mono">${r.start.toFixed(3)}</td><td class="n mono">${r.dur.toFixed(3)}</td><td><button class="ibtn sm" data-f="${esc(fl(r))}" aria-label="${t('filterThis')}: ${esc(fl(r))}" title="${t('filterThis')}">${ic('filter', 'sm')}</button></td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Pista: en un escaneo verás muchas conversaciones TCP de 2 o 3 paquetes desde el mismo origen.</p>`;
+ <p class="sm muted">${L('Pista: en un escaneo verás muchas conversaciones TCP de 2 o 3 paquetes desde el mismo origen.', 'Hint: in a scan you will see many 2- or 3-packet TCP conversations from the same source.')}</p>`;
$$('[data-k]', panel).forEach(b => b.onclick = () => { k = b.dataset.k; draw(); });
$$('[data-f]', panel).forEach(b => b.onclick = () => { ws.setFilter(b.dataset.f); closeDialog(); });
};
@@ -3194,7 +3399,7 @@ function hierPanel(ws, panel) {
const h = protocolHierarchy(ws.pkts), rows = [];
const walk = n => { rows.push(n); n.kids.forEach(walk); };
walk(h);
- panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl hier"><caption class="vh">${t('hier')}</caption><thead><tr><th scope="col">Protocolo</th><th scope="col" class="n">% paquetes</th><th scope="col" class="bar-col"><span class="vh">Barra</span></th><th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl hier"><caption class="vh">${t('hier')}</caption><thead><tr><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col" class="n">${L('% paquetes', '% packets')}</th><th scope="col" class="bar-col"><span class="vh">${L('Barra', 'Bar')}</span></th><th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map(r => { const name = r.name === 'frame' ? 'Frame' : r.name; const f = r.name === 'frame' ? '' : r.name; return `<tr><td><span class="ind" data-d="${Math.min(r.depth, 8)}">${esc(name)}</span></td><td class="n">${r.pct.toFixed(1)} %</td><td class="bar-col"><span class="bar" data-w="${r.pct}"></span></td><td class="n">${r.pkts}</td><td class="n">${fmtNum(r.bytes)}</td><td>${f && FIELDS[f] ? `<button class="ibtn sm" data-f="${esc(f)}" aria-label="${t('filterThis')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</td></tr>`; }).join('')}</tbody></table></div>`;
$$('.bar', panel).forEach(b => { b.style.width = `${b.dataset.w}%`; });
$$('.ind', panel).forEach(s => { s.style.paddingInlineStart = `${s.dataset.d * 16}px`; });
@@ -3212,13 +3417,13 @@ function ioPanel(ws, panel) {
const y = v => H - pb - (v / max) * (H - pb - 10);
const ticks = [0, Math.ceil(max / 2), max];
const xl = Math.max(1, Math.ceil(g.buckets.length / 8));
- panel.innerHTML = `<div class="row between"><div class="row sm"><span class="lgd all"><i></i>${t('allPackets')}</span>${test ? `<span class="lgd hit"><i></i>${t('matching')}: <code>${esc(ws.filterText)}</code></span>` : '<span class="muted">Aplica un filtro para compararlo con el total.</span>'}</div>
+ panel.innerHTML = `<div class="row between"><div class="row sm"><span class="lgd all"><i></i>${t('allPackets')}</span>${test ? `<span class="lgd hit"><i></i>${t('matching')}: <code>${esc(ws.filterText)}</code></span>` : `<span class="muted">${L('Aplica un filtro para compararlo con el total.', 'Apply a filter to compare it with the total.')}</span>`}</div>
<label class="row sm">${t('interval')} <select data-iv>${(opts.length ? opts : [iv]).map(o => `<option value="${o}" ${o === iv ? 'selected' : ''}>${o} s</option>`).join('')}</select></label></div>
- <svg class="io" viewBox="0 0 ${W} ${H}" role="img" aria-label="Paquetes por intervalo de ${iv} segundos: máximo ${max}">
+ <svg class="io" viewBox="0 0 ${W} ${H}" role="img" aria-label="${L(`Paquetes por intervalo de ${iv} segundos: máximo ${max}`, `Packets per ${iv}-second interval: maximum ${max}`)}">
${ticks.map(v => `<line class="gl" x1="${pl}" x2="${W - 4}" y1="${y(v)}" y2="${y(v)}"/><text class="ax" x="${pl - 6}" y="${y(v) + 4}" text-anchor="end">${v}</text>`).join('')}
- ${g.buckets.map((b, i) => `<rect class="b-all" x="${pl + i * bw + bw * 0.12}" y="${y(b.all)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.all)}" rx="${Math.min(3, bw / 4)}"><title>${b.t} s: ${b.all} paquetes${test ? `, ${b.hit} cumplen el filtro` : ''}</title></rect>${test && b.hit ? `<rect class="b-hit" x="${pl + i * bw + bw * 0.12}" y="${y(b.hit)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.hit)}" rx="${Math.min(3, bw / 4)}"/>` : ''}`).join('')}
+ ${g.buckets.map((b, i) => `<rect class="b-all" x="${pl + i * bw + bw * 0.12}" y="${y(b.all)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.all)}" rx="${Math.min(3, bw / 4)}"><title>${b.t} s: ${b.all} ${L('paquetes', 'packets')}${test ? `, ${b.hit} ${L('cumplen el filtro', 'match the filter')}` : ''}</title></rect>${test && b.hit ? `<rect class="b-hit" x="${pl + i * bw + bw * 0.12}" y="${y(b.hit)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.hit)}" rx="${Math.min(3, bw / 4)}"/>` : ''}`).join('')}
${g.buckets.map((b, i) => i % xl === 0 ? `<text class="ax" x="${pl + i * bw + bw / 2}" y="${H - 8}" text-anchor="middle">${+b.t.toFixed(2)}</text>` : '').join('')}
- </svg><p class="sm muted">Eje horizontal: segundos desde el primer paquete. Un pico que se repite a intervalos fijos puede ser un beacon.</p>`;
+ </svg><p class="sm muted">${L('Eje horizontal: segundos desde el primer paquete. Un pico que se repite a intervalos fijos puede ser un beacon.', 'Horizontal axis: seconds since the first packet. A spike that repeats at fixed intervals may be a beacon.')}</p>`;
$('[data-iv]', panel).onchange = e => { iv = +e.target.value; draw(); };
};
draw();
@@ -3228,22 +3433,23 @@ function ioPanel(ws, panel) {
/* ---------- Endpoints (Estadísticas › Endpoints › IPv4) ---------- */
function endsPanel(ws, panel) {
const rows = endpoints(ws.pkts);
- panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('endpoints')}"><table class="tbl"><caption class="vh">${t('endpoints')} IPv4</caption><thead><tr><th scope="col">Dirección</th><th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">Enviados</th><th scope="col" class="n">Recibidos</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('endpoints')}"><table class="tbl"><caption class="vh">${t('endpoints')} IPv4</caption><thead><tr><th scope="col">${L('Dirección', 'Address')}</th><th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">${L('Enviados', 'Sent')}</th><th scope="col" class="n">${L('Recibidos', 'Received')}</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map(e => `<tr><td class="mono">${esc(e.addr)}</td><td class="n">${fmtNum(e.pkts)}</td><td class="n">${fmtNum(e.bytes)}</td><td class="n">${fmtNum(e.tx)}</td><td class="n">${fmtNum(e.rx)}</td><td><button class="btn sm ghost" type="button" data-f="ip.addr == ${esc(e.addr)}">${ic('filter', 'sm')}${t('filterThis')}</button></td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Cada IP que aparece en la captura. Un equipo que solo recibe, o uno que habla con muchos, suele ser el primer hilo del que tirar.</p>`;
+ <p class="sm muted">${L('Cada IP que aparece en la captura. Un equipo que solo recibe, o uno que habla con muchos, suele ser el primer hilo del que tirar.', 'Every IP in the capture. A host that only receives, or one that talks to many, is usually the first thread to pull.')}</p>`;
$$('[data-f]', panel).forEach(b => b.onclick = () => { ws.setFilter(b.dataset.f); closeDialog(); });
}
/* ---------- Analizar › Información experta ---------- */
-const SEV_LABEL = { error: 'Error', warn: 'Aviso', note: 'Nota', chat: 'Conversación' };
+const SEV_LABELS = { es: { error: 'Error', warn: 'Aviso', note: 'Nota', chat: 'Conversación' }, en: { error: 'Error', warn: 'Warning', note: 'Note', chat: 'Chat' } };
+const sevLabel = k => SEV_LABELS[LANG === 'en' ? 'en' : 'es'][k];
function openExpert(ws) {
const ex = expertInfo(ws.pkts), body = document.createElement('div');
- body.innerHTML = `<p class="muted sm">Wireshark resume aquí lo que le llama la atención de cada paquete, de más grave a más rutinario. Los mensajes se muestran en inglés, como en Wireshark, para que los reconozcas.</p>
- <div class="ex-sum">${EXPERT_SEV.map(([k, en]) => `<span class="ex-chip sev-${k}"><strong>${fmtNum(ex.count[k])}</strong> ${SEV_LABEL[k]} <small>(${en})</small></span>`).join('')}</div>
- ${ex.items.length ? `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('expert')}"><table class="tbl ex"><caption class="vh">${t('expert')}</caption><thead><tr><th scope="col">Severidad</th><th scope="col">Resumen</th><th scope="col">Protocolo</th><th scope="col" class="n">Cantidad</th><th scope="col">Paquetes</th></tr></thead>
- <tbody>${ex.items.map((it, i) => `<tr><td><span class="ex-chip sev-${it.sev}">${SEV_LABEL[it.sev]}</span></td><td class="mono">${esc(it.summary)}</td><td>${esc(it.proto)}</td><td class="n">${fmtNum(it.nos.length)}</td>
- <td><div class="ex-nos">${it.nos.slice(0, 8).map(n => `<button class="btn sm ghost mono" type="button" data-no="${n}" aria-label="Ir al paquete ${n}">${n}</button>`).join('')}${it.nos.length > 1 ? `<button class="btn sm ghost" type="button" data-show="${i}">${ic('filter', 'sm')}Mostrar</button>` : ''}</div></td></tr>`).join('')}</tbody></table></div>`
- : '<p class="muted">No hay entradas: esta captura no tiene TCP ni HTTP que comentar.</p>'}`;
+ body.innerHTML = `<p class="muted sm">${L('Wireshark resume aquí lo que le llama la atención de cada paquete, de más grave a más rutinario. Los mensajes se muestran en inglés, como en Wireshark, para que los reconozcas.', 'Wireshark sums up here what catches its eye in each packet, from most serious to most routine.')}</p>
+ <div class="ex-sum">${EXPERT_SEV.map(([k, en]) => `<span class="ex-chip sev-${k}"><strong>${fmtNum(ex.count[k])}</strong> ${sevLabel(k)}${LANG === 'en' ? '' : ` <small>(${en})</small>`}</span>`).join('')}</div>
+ ${ex.items.length ? `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('expert')}"><table class="tbl ex"><caption class="vh">${t('expert')}</caption><thead><tr><th scope="col">${L('Severidad', 'Severity')}</th><th scope="col">${L('Resumen', 'Summary')}</th><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col" class="n">${L('Cantidad', 'Count')}</th><th scope="col">${L('Paquetes', 'Packets')}</th></tr></thead>
+ <tbody>${ex.items.map((it, i) => `<tr><td><span class="ex-chip sev-${it.sev}">${sevLabel(it.sev)}</span></td><td class="mono">${esc(it.summary)}</td><td>${esc(it.proto)}</td><td class="n">${fmtNum(it.nos.length)}</td>
+ <td><div class="ex-nos">${it.nos.slice(0, 8).map(n => `<button class="btn sm ghost mono" type="button" data-no="${n}" aria-label="${L('Ir al paquete', 'Go to packet')} ${n}">${n}</button>`).join('')}${it.nos.length > 1 ? `<button class="btn sm ghost" type="button" data-show="${i}">${ic('filter', 'sm')}${L('Mostrar', 'Show')}</button>` : ''}</div></td></tr>`).join('')}</tbody></table></div>`
+ : `<p class="muted">${L('No hay entradas: esta captura no tiene TCP ni HTTP que comentar.', 'No entries: this capture has no TCP or HTTP worth commenting on.')}</p>`}`;
openDialog({ title: `${ic('alert')} ${t('expert')}`, body, wide: true });
$$('[data-no]', body).forEach(b => b.onclick = () => { closeDialog(); ws.select(+b.dataset.no, { focusList: true }); });
$$('[data-show]', body).forEach(b => b.onclick = () => { closeDialog(); ws.setFilter(`frame.number in {${ex.items[+b.dataset.show].nos.join(', ')}}`); });
@@ -3253,18 +3459,18 @@ function openExpert(ws) {
function openObjects(ws) {
const objs = httpObjects(ws.pkts), body = document.createElement('div');
const isText = o => /^(text\/|application\/(json|javascript|xml|x-www-form-urlencoded))/i.test(o.type);
- body.innerHTML = objs.length ? `<p class="muted sm">Los cuerpos HTTP reconstruidos de la captura: páginas, scripts, JSON, formularios y ficheros. Así se recupera lo que se descargó (o se robó) por HTTP sin cifrar.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('objects')}"><table class="tbl"><caption class="vh">${t('objects')}</caption><thead><tr><th scope="col" class="n">Paquete</th><th scope="col">Host</th><th scope="col">Tipo de contenido</th><th scope="col" class="n">Tamaño</th><th scope="col">Nombre</th><th scope="col"><span class="vh">Acciones</span></th></tr></thead>
- <tbody>${objs.map((o, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-no="${o.no}" aria-label="Ir al paquete ${o.no}">${o.no}</button></td><td class="mono">${esc(o.host)}</td><td class="mono sm">${esc(o.type || '—')}</td><td class="n">${fmtNum(o.size)} B</td><td class="mono">${esc(o.name)}</td>
- <td><div class="row">${isText(o) ? `<button class="btn sm ghost" type="button" data-view="${i}" aria-label="Ver ${esc(o.name)}">${ic('eye', 'sm')}Ver</button>` : ''}<button class="btn sm ghost" type="button" data-save="${i}" aria-label="Guardar ${esc(o.name)}">${ic('download', 'sm')}Guardar</button></div></td></tr>`).join('')}</tbody></table></div>
+ body.innerHTML = objs.length ? `<p class="muted sm">${L('Los cuerpos HTTP reconstruidos de la captura: páginas, scripts, JSON, formularios y ficheros. Así se recupera lo que se descargó (o se robó) por HTTP sin cifrar.', 'HTTP bodies rebuilt from the capture: pages, scripts, JSON, forms and files. This is how you recover what was downloaded (or stolen) over plain HTTP.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('objects')}"><table class="tbl"><caption class="vh">${t('objects')}</caption><thead><tr><th scope="col" class="n">${L('Paquete', 'Packet')}</th><th scope="col">Host</th><th scope="col">${L('Tipo de contenido', 'Content type')}</th><th scope="col" class="n">${L('Tamaño', 'Size')}</th><th scope="col">${L('Nombre', 'Filename')}</th><th scope="col"><span class="vh">${L('Acciones', 'Actions')}</span></th></tr></thead>
+ <tbody>${objs.map((o, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-no="${o.no}" aria-label="${L('Ir al paquete', 'Go to packet')} ${o.no}">${o.no}</button></td><td class="mono">${esc(o.host)}</td><td class="mono sm">${esc(o.type || '—')}</td><td class="n">${fmtNum(o.size)} B</td><td class="mono">${esc(o.name)}</td>
+ <td><div class="row">${isText(o) ? `<button class="btn sm ghost" type="button" data-view="${i}" aria-label="${L('Ver', 'View')} ${esc(o.name)}">${ic('eye', 'sm')}${L('Ver', 'View')}</button>` : ''}<button class="btn sm ghost" type="button" data-save="${i}" aria-label="${L('Guardar', 'Save')} ${esc(o.name)}">${ic('download', 'sm')}${L('Guardar', 'Save')}</button></div></td></tr>`).join('')}</tbody></table></div>
<div class="ob-prev" hidden><p class="sm"><strong data-pn></strong></p><pre class="mono" tabindex="0"></pre></div>`
- : '<p class="muted">Esta captura no lleva objetos HTTP. Prueba con los módulos 2, 3 o 6.</p>';
+ : `<p class="muted">${L('Esta captura no lleva objetos HTTP. Prueba con los módulos 2, 3 o 6.', 'This capture carries no HTTP objects. Try modules 2, 3 or 6.')}</p>`;
openDialog({ title: `${ic('file')} ${t('objects')}`, body, wide: true });
$$('[data-no]', body).forEach(b => b.onclick = () => { closeDialog(); ws.select(+b.dataset.no, { focusList: true }); });
- $$('[data-save]', body).forEach(b => b.onclick = () => { const o = objs[+b.dataset.save]; download(o.data, o.name, 'application/octet-stream'); toast(`Guardado: <code>${esc(o.name)}</code>`, 'ok', 'download'); });
+ $$('[data-save]', body).forEach(b => b.onclick = () => { const o = objs[+b.dataset.save]; download(o.data, o.name, 'application/octet-stream'); toast(`${L('Guardado', 'Saved')}: <code>${esc(o.name)}</code>`, 'ok', 'download'); });
$$('[data-view]', body).forEach(b => b.onclick = () => {
const o = objs[+b.dataset.view], pv = $('.ob-prev', body);
- pv.hidden = false; $('[data-pn]', pv).textContent = `${o.name} · paquete ${o.no}`;
+ pv.hidden = false; $('[data-pn]', pv).textContent = `${o.name} · ${L('paquete', 'packet')} ${o.no}`;
$('pre', pv).textContent = new TextDecoder().decode(o.data); // texto, nunca HTML interpretado
$('pre', pv).focus();
});
@@ -3273,11 +3479,11 @@ function openObjects(ws) {
/* ---------- Herramientas › Credenciales ---------- */
function openCreds(ws) {
const cr = credentials(ws.pkts), body = document.createElement('div');
- body.innerHTML = cr.length ? `<p class="muted sm">Usuarios que viajan por protocolos que Wireshark sabe leer (HTTP Basic, FTP, NTLMSSP). Pulsa el paquete para ir al campo exacto del árbol.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('creds')}"><table class="tbl"><caption class="vh">${t('creds')}</caption><thead><tr><th scope="col" class="n">Paquete</th><th scope="col">Protocolo</th><th scope="col">Usuario</th><th scope="col">Información</th></tr></thead>
- <tbody>${cr.map((c, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-i="${i}" aria-label="Ir al paquete ${c.no}">${c.no}</button></td><td>${esc(c.proto)}</td><td class="mono">${esc(c.user)}</td><td class="sm">${esc(c.info)}</td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Wireshark no muestra aquí los formularios POST: esos los buscas tú con <code>http.request.method == "POST"</code>.</p>`
- : '<p class="muted">No hay credenciales en esta captura. Las encontrarás en los módulos 3 (HTTP Basic y FTP) y 7 (NTLMSSP).</p>';
+ body.innerHTML = cr.length ? `<p class="muted sm">${L('Usuarios que viajan por protocolos que Wireshark sabe leer (HTTP Basic, FTP, NTLMSSP). Pulsa el paquete para ir al campo exacto del árbol.', 'Usernames carried by protocols Wireshark can read (HTTP Basic, FTP, NTLMSSP). Click the packet to jump to the exact field in the tree.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('creds')}"><table class="tbl"><caption class="vh">${t('creds')}</caption><thead><tr><th scope="col" class="n">${L('Paquete', 'Packet')}</th><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col">${L('Usuario', 'Username')}</th><th scope="col">${L('Información', 'Info')}</th></tr></thead>
+ <tbody>${cr.map((c, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-i="${i}" aria-label="${L('Ir al paquete', 'Go to packet')} ${c.no}">${c.no}</button></td><td>${esc(c.proto)}</td><td class="mono">${esc(c.user)}</td><td class="sm">${esc(c.info)}</td></tr>`).join('')}</tbody></table></div>
+ <p class="sm muted">${L('Wireshark no muestra aquí los formularios POST: esos los buscas tú con', 'Wireshark does not list POST forms here: find those yourself with')} <code>http.request.method == "POST"</code>.</p>`
+ : `<p class="muted">${L('No hay credenciales en esta captura. Las encontrarás en los módulos 3 (HTTP Basic y FTP) y 7 (NTLMSSP).', 'No credentials in this capture. You will find them in modules 3 (HTTP Basic and FTP) and 7 (NTLMSSP).')}</p>`;
openDialog({ title: `${ic('lock')} ${t('creds')}`, body, wide: true });
$$('[data-i]', body).forEach(b => b.onclick = () => { const c = cr[+b.dataset.i]; closeDialog(); ws.revealField(c.no, c.field); });
}
@@ -3287,14 +3493,14 @@ function openFind(ws, mode = 'find') {
const body = document.createElement('div');
body.innerHTML = `<div class="seg" role="tablist" aria-label="${t('findPkt')}"><button role="tab" id="fd-find" aria-selected="${mode === 'find'}" data-m="find">${ic('search', 'sm')}${t('findPkt')}</button><button role="tab" id="fd-goto" aria-selected="${mode === 'goto'}" data-m="goto">${ic('target', 'sm')}${t('gotoPkt')}</button></div>
<form class="fd" data-p="find" ${mode === 'find' ? '' : 'hidden'} aria-labelledby="fd-find">
- <div class="row wrap"><label class="sm" for="fd-k">Buscar por</label><select id="fd-k" class="sel"><option value="filter">Filtro de visualización</option><option value="str">Cadena en los bytes</option><option value="hex">Valor hexadecimal</option></select>
- <label class="row sm"><input type="checkbox" id="fd-c"> Distinguir mayúsculas</label></div>
- <label class="vh" for="fd-q">Qué buscar</label><input id="fd-q" class="tinput mono" type="text" autocomplete="off" spellcheck="false" placeholder="p. ej. http.cookie, password o 50 4b 03 04">
- <div class="row"><button class="btn primary sm" type="submit">${ic('search', 'sm')}Buscar siguiente</button><span class="sm" data-msg aria-live="polite"></span></div>
+ <div class="row wrap"><label class="sm" for="fd-k">${L('Buscar por', 'Search by')}</label><select id="fd-k" class="sel"><option value="filter">${L('Filtro de visualización', 'Display filter')}</option><option value="str">${L('Cadena en los bytes', 'String in bytes')}</option><option value="hex">${L('Valor hexadecimal', 'Hex value')}</option></select>
+ <label class="row sm"><input type="checkbox" id="fd-c"> ${L('Distinguir mayúsculas', 'Case sensitive')}</label></div>
+ <label class="vh" for="fd-q">${L('Qué buscar', 'What to find')}</label><input id="fd-q" class="tinput mono" type="text" autocomplete="off" spellcheck="false" placeholder="${L('p. ej. http.cookie, password o 50 4b 03 04', 'e.g. http.cookie, password or 50 4b 03 04')}">
+ <div class="row"><button class="btn primary sm" type="submit">${ic('search', 'sm')}${L('Buscar siguiente', 'Find next')}</button><span class="sm" data-msg aria-live="polite"></span></div>
</form>
<form class="fd" data-p="goto" ${mode === 'goto' ? '' : 'hidden'} aria-labelledby="fd-goto">
- <label class="sm" for="fd-n">Número de paquete (1 a ${fmtNum(ws.pkts.length)})</label><input id="fd-n" class="tinput mono" type="number" min="1" max="${ws.pkts.length}" inputmode="numeric">
- <div class="row"><button class="btn primary sm" type="submit">${ic('target', 'sm')}Ir</button><span class="sm" data-msg2 aria-live="polite"></span></div>
+ <label class="sm" for="fd-n">${L('Número de paquete', 'Packet number')} (1 ${L('a', 'to')} ${fmtNum(ws.pkts.length)})</label><input id="fd-n" class="tinput mono" type="number" min="1" max="${ws.pkts.length}" inputmode="numeric">
+ <div class="row"><button class="btn primary sm" type="submit">${ic('target', 'sm')}${L('Ir', 'Go')}</button><span class="sm" data-msg2 aria-live="polite"></span></div>
</form>`;
openDialog({ title: `${ic('search')} ${t('findPkt')}`, body, cls: 'narrow' });
const show = m => { $$('[role=tab]', body).forEach(b => b.setAttribute('aria-selected', String(b.dataset.m === m))); $$('form', body).forEach(f => { f.hidden = f.dataset.p !== m; }); $(m === 'find' ? '#fd-q' : '#fd-n', body).focus(); };
@@ -3309,20 +3515,20 @@ function openFind(ws, mode = 'find') {
$('[data-p=goto]', body).onsubmit = e => {
e.preventDefault();
const n = +$('#fd-n', body).value, m2 = $('[data-msg2]', body);
- if (!ws.byNo.has(n)) { m2.className = 'sm bad'; m2.textContent = `No existe el paquete ${n}.`; return; }
- if (!ws.view.some(p => p.no === n)) { m2.className = 'sm bad'; m2.textContent = `El paquete ${n} está oculto por el filtro actual. Bórralo para verlo.`; return; }
+ if (!ws.byNo.has(n)) { m2.className = 'sm bad'; m2.textContent = L(`No existe el paquete ${n}.`, `Packet ${n} does not exist.`); return; }
+ if (!ws.view.some(p => p.no === n)) { m2.className = 'sm bad'; m2.textContent = L(`El paquete ${n} está oculto por el filtro actual. Bórralo para verlo.`, `Packet ${n} is hidden by the current filter. Clear it to see it.`); return; }
closeDialog(); ws.select(n, { focusList: true });
};
}
/* Busca el siguiente paquete mostrado, tras el seleccionado y dando la vuelta, como Wireshark. */
function findPacket(ws, kind, q, cs) {
q = String(q || '');
- if (!q.trim()) return { ok: false, msg: 'Escribe qué buscar.' };
+ if (!q.trim()) return { ok: false, msg: L('Escribe qué buscar.', 'Type what to find.') };
let test;
- if (kind === 'filter') { const r = parseFilter(q); if (!r.ok) return { ok: false, msg: r.error || 'El filtro no es válido.' }; test = r.test; }
+ if (kind === 'filter') { const r = parseFilter(q); if (!r.ok) return { ok: false, msg: fErr(r.error) || L('El filtro no es válido.', 'The filter is not valid.') }; test = r.test; }
else if (kind === 'hex') {
const h = q.replace(/0x|[\s:.-]/gi, '');
- if (!/^([0-9a-f]{2})+$/i.test(h)) return { ok: false, msg: 'Escribe bytes en hexadecimal, por pares: 50 4b 03 04' };
+ if (!/^([0-9a-f]{2})+$/i.test(h)) return { ok: false, msg: L('Escribe bytes en hexadecimal, por pares: 50 4b 03 04', 'Type bytes in hex, in pairs: 50 4b 03 04') };
const nd = h.match(/../g).map(x => parseInt(x, 16));
test = p => { const b = p.b; outer: for (let i = 0; i + nd.length <= b.length; i++) { for (let j = 0; j < nd.length; j++) if (b[i + j] !== nd[j]) continue outer; return true; } return false; };
} else {
@@ -3332,31 +3538,31 @@ function findPacket(ws, kind, q, cs) {
const v = ws.view, start = Math.max(-1, v.findIndex(p => p.no === ws.sel));
for (let k = 1; k <= v.length; k++) {
const p = v[(start + k) % v.length];
- if (test(p)) { ws.select(p.no); return { ok: true, msg: `Encontrado en el paquete ${p.no}${(start + k) >= v.length && start >= 0 ? ' (se ha dado la vuelta)' : ''}.` }; }
+ if (test(p)) { ws.select(p.no); return { ok: true, msg: `${L('Encontrado en el paquete', 'Found in packet')} ${p.no}${(start + k) >= v.length && start >= 0 ? L(' (se ha dado la vuelta)', ' (wrapped around)') : ''}.` }; }
}
- return { ok: false, msg: 'No aparece en ningún paquete mostrado.' };
+ return { ok: false, msg: L('No aparece en ningún paquete mostrado.', 'Not found in any displayed packet.') };
}
/* src/app/45-ladder.js */
/* Megalodon · diagrama de escalera animado de un flujo TCP (módulo 1). Cada flecha es un paquete; al pulsarla se selecciona en Wireshark. */
function ladderSVG(pkts, stream, onPick) {
- const L = flowLadder(pkts, stream); if (!L) return document.createElement('div');
- const W = 560, ax = 150, bx = 470, top = 64, rh = 40, H = top + L.steps.length * rh + 16;
- const phase = s => s.flags.includes('SYN') ? 'hs' : s.flags.includes('FIN') || s.flags.includes('RST') || (s.len === 0 && L.steps.some(x => x.flags.includes('FIN') && x.no < s.no)) ? 'fin' : 'data';
- const names = { hs: 'Saludo', data: 'Datos', fin: 'Cierre' };
+ const LD = flowLadder(pkts, stream); if (!LD) return document.createElement('div');
+ const W = 560, ax = 150, bx = 470, top = 64, rh = 40, H = top + LD.steps.length * rh + 16;
+ const phase = s => s.flags.includes('SYN') ? 'hs' : s.flags.includes('FIN') || s.flags.includes('RST') || (s.len === 0 && LD.steps.some(x => x.flags.includes('FIN') && x.no < s.no)) ? 'fin' : 'data';
+ const names = LANG === 'en' ? { hs: 'Handshake', data: 'Data', fin: 'Teardown' } : { hs: 'Saludo', data: 'Datos', fin: 'Cierre' };
const groups = [];
- L.steps.forEach((s, i) => { const ph = phase(s); if (!groups.length || groups[groups.length - 1].ph !== ph) groups.push({ ph, a: i, b: i }); else groups[groups.length - 1].b = i; });
+ LD.steps.forEach((s, i) => { const ph = phase(s); if (!groups.length || groups[groups.length - 1].ph !== ph) groups.push({ ph, a: i, b: i }); else groups[groups.length - 1].b = i; });
const wrap = document.createElement('figure');
wrap.className = 'ladder';
- wrap.innerHTML = `<svg viewBox="0 0 ${W} ${H}" role="group" aria-label="Diagrama del flujo TCP ${stream}: ${L.steps.length} paquetes entre ${L.a}:${L.pa} y ${L.b}:${L.pb}">
- <text class="lh" x="${ax}" y="20" text-anchor="middle">Kali</text><text class="lh2" x="${ax}" y="38" text-anchor="middle">${L.a}:${L.pa}</text>
- <text class="lh" x="${bx}" y="20" text-anchor="middle">Servidor web</text><text class="lh2" x="${bx}" y="38" text-anchor="middle">${L.b}:${L.pb}</text>
+ wrap.innerHTML = `<svg viewBox="0 0 ${W} ${H}" role="group" aria-label="${L(`Diagrama del flujo TCP ${stream}: ${LD.steps.length} paquetes entre ${LD.a}:${LD.pa} y ${LD.b}:${LD.pb}`, `TCP stream ${stream} diagram: ${LD.steps.length} packets between ${LD.a}:${LD.pa} and ${LD.b}:${LD.pb}`)}">
+ <text class="lh" x="${ax}" y="20" text-anchor="middle">Kali</text><text class="lh2" x="${ax}" y="38" text-anchor="middle">${LD.a}:${LD.pa}</text>
+ <text class="lh" x="${bx}" y="20" text-anchor="middle">${L('Servidor web', 'Web server')}</text><text class="lh2" x="${bx}" y="38" text-anchor="middle">${LD.b}:${LD.pb}</text>
<line class="life" x1="${ax}" x2="${ax}" y1="48" y2="${H - 6}"/><line class="life" x1="${bx}" x2="${bx}" y1="48" y2="${H - 6}"/>
${groups.map(g => `<g class="ph ph-${g.ph}"><rect x="8" y="${top + g.a * rh - 12}" width="74" height="${(g.b - g.a + 1) * rh - 8}" rx="8"/><text x="45" y="${top + ((g.a + g.b) / 2) * rh + 8}" text-anchor="middle">${names[g.ph]}</text></g>`).join('')}
- ${L.steps.map((s, i) => {
+ ${LD.steps.map((s, i) => {
const y = top + i * rh, x1 = s.fromA ? ax : bx, x2 = s.fromA ? bx : ax, dir = s.fromA ? 1 : -1, mid = (ax + bx) / 2;
const lab = s.flags.join(', ') + (s.app ? ` · ${s.app}` : '');
- return `<g class="step ${s.flags.includes('RST') ? 'rst' : ''} ${s.app ? 'app' : ''}" data-no="${s.no}" data-i="${i}" tabindex="0" role="button" aria-label="Paquete ${s.no}: ${esc(lab)}, Seq ${s.seq}, Ack ${s.ack}, Len ${s.len}">
+ return `<g class="step ${s.flags.includes('RST') ? 'rst' : ''} ${s.app ? 'app' : ''}" data-no="${s.no}" data-i="${i}" tabindex="0" role="button" aria-label="${L('Paquete', 'Packet')} ${s.no}: ${esc(lab)}, Seq ${s.seq}, Ack ${s.ack}, Len ${s.len}">
<line class="ar" x1="${x1}" y1="${y}" x2="${x2 - dir * 7}" y2="${y + 12}" pathLength="1"/>
<path class="hd" d="M ${x2} ${y + 12.3} l ${-dir * 10} -7 l 0 9 z"/>
<text class="sl" x="${mid}" y="${y - 3}" text-anchor="middle">${esc(lab)}</text>
@@ -3364,7 +3570,7 @@ function ladderSVG(pkts, stream, onPick) {
</g>`;
}).join('')}
</svg>
- <figcaption class="row between"><span class="sm muted">Pulsa una flecha para abrir ese paquete en Wireshark.</span><button class="btn sm ghost" type="button" data-replay>${ic('reset', 'sm')}Repetir animación</button></figcaption>`;
+ <figcaption class="row between"><span class="sm muted">${L('Pulsa una flecha para abrir ese paquete en Wireshark.', 'Click an arrow to open that packet in Wireshark.')}</span><button class="btn sm ghost" type="button" data-replay>${ic('reset', 'sm')}${L('Repetir animación', 'Replay animation')}</button></figcaption>`;
const steps = $$('.step', wrap);
steps.forEach((g, i) => { g.style.setProperty('--d', `${i * 110}ms`); });
const play = () => { if (REDUCED.matches) return; wrap.classList.remove('play'); void wrap.offsetWidth; wrap.classList.add('play'); };
@@ -3688,12 +3894,12 @@ const tD0 = u => ZC(u) + HT(u);
const ANCHORS = [
{ id: 'hoc', p: bodyPt(.03, 1.75), w: 0, t: ['Hocico', 'ampollas de Lorenzini'] },
{ id: 'ojo', p: bodyPt(.088, 1.03), w: 0, t: ['Ojo', 'tapetum lucidum'] },
- { id: 'die', p: lerp3(bodyPt(.1, phiM(.1)), center(.1), .1), w: 1, t: ['Dientes aserrados', '2 filas · reemplazo continuo'] },
- { id: 'bra', p: bodyPt(.215, 1.45), w: 0, t: ['Hendiduras branquiales', '5 por lado'] },
- { id: 'dor', p: [X(.445), tD0(.445) + .122, 0], w: 0, t: ['Primera dorsal', 'estabiliza el balanceo'] },
- { id: 'pec', p: add(inward(.258, 2.16, .86), [-.14, -.095, .15]), w: 0, t: ['Aleta pectoral', 'sustentación y giro'] },
- { id: 'qui', p: bodyPt(.875, Math.PI / 2), w: 0, t: ['Quilla del pedúnculo', 'reduce la resistencia'] },
- { id: 'cau', p: [X(1.105), .205, 0], w: 0, t: ['Caudal semilunar', 'nado carangiforme'] },
+ { id: 'die', p: lerp3(bodyPt(.1, phiM(.1)), center(.1), .1), w: 1, t: ['Dientes aserrados', '2 filas · reemplazo continuo'], te: ['Serrated teeth', '2 rows · constant replacement'] },
+ { id: 'bra', p: bodyPt(.215, 1.45), w: 0, t: ['Hendiduras branquiales', '5 por lado'], te: ['Gill slits', '5 per side'] },
+ { id: 'dor', p: [X(.445), tD0(.445) + .122, 0], w: 0, t: ['Primera dorsal', 'estabiliza el balanceo'], te: ['First dorsal', 'steadies the roll'] },
+ { id: 'pec', p: add(inward(.258, 2.16, .86), [-.14, -.095, .15]), w: 0, t: ['Aleta pectoral', 'sustentación y giro'], te: ['Pectoral fin', 'lift and turning'] },
+ { id: 'qui', p: bodyPt(.875, Math.PI / 2), w: 0, t: ['Quilla del pedúnculo', 'reduce la resistencia'], te: ['Caudal keel', 'cuts drag'] },
+ { id: 'cau', p: [X(1.105), .205, 0], w: 0, t: ['Caudal semilunar', 'nado carangiforme'], te: ['Lunate tail', 'carangiform swimming'] },
];
@@ -4295,8 +4501,8 @@ function callouts(s) {
const pl = document.createElementNS(NS_SVG, 'polyline'); pl.setAttribute('class', 'ld');
const rc = document.createElementNS(NS_SVG, 'rect'); rc.setAttribute('class', 'plate'); rc.setAttribute('rx', 6);
const dt = document.createElementNS(NS_SVG, 'circle'); dt.setAttribute('class', 'dot'); dt.setAttribute('r', 3);
- const t1 = document.createElementNS(NS_SVG, 'text'); t1.setAttribute('class', 'k'); t1.textContent = a.t[0];
- const t2 = document.createElementNS(NS_SVG, 'text'); t2.textContent = a.t[1];
+ const t1 = document.createElementNS(NS_SVG, 'text'); t1.setAttribute('class', 'k'); t1.textContent = (LANG === 'en' ? a.te : a.t)[0];
+ const t2 = document.createElementNS(NS_SVG, 'text'); t2.textContent = (LANG === 'en' ? a.te : a.t)[1];
g.append(pl, rc, dt, t1, t2); svg.append(g);
return { a, g, pl, rc, dt, t1, t2, w: 0 };
});
@@ -4362,7 +4568,7 @@ function ensureGL() {
cv = document.createElement('canvas');
cv.className = 'shark-cv';
cv.setAttribute('role', 'img');
- cv.setAttribute('aria-label', 'Un megalodón realista nada entre rayos de luz. Cada pocos segundos muerde: eleva el hocico, abre la boca en herradura y adelanta la mandíbula superior enseñando la encía y los dientes aserrados.');
+ cv.setAttribute('aria-label', LANG === 'en' ? 'A realistic megalodon swims through shafts of light. Every few seconds it bites: it lifts its snout, opens its horseshoe mouth and thrusts the upper jaw forward, showing the gum and the serrated teeth.' : 'Un megalodón realista nada entre rayos de luz. Cada pocos segundos muerde: eleva el hocico, abre la boca en herradura y adelanta la mandíbula superior enseñando la encía y los dientes aserrados.');
gl = cv.getContext('webgl2', { antialias: false, alpha: false, depth: false, stencil: false, powerPreference: 'high-performance', preserveDrawingBuffer: false });
if (!gl) return (glOk = false);
try {
@@ -4383,14 +4589,14 @@ function mount(slot) {
const hud = document.createElement('div');
hud.className = 'shark-hud';
hud.setAttribute('role', 'group');
- hud.setAttribute('aria-label', 'Megalodón 3D');
- hud.innerHTML = `<button type="button" class="btn ghost sm" data-shark-mode aria-pressed="false">${ic('layers', 'sm')}Plano técnico</button><button type="button" class="ibtn" data-shark-pause>${ic('pause')}</button>`;
+ hud.setAttribute('aria-label', LANG === 'en' ? '3D megalodon' : 'Megalodón 3D');
+ hud.innerHTML = `<button type="button" class="btn ghost sm" data-shark-mode aria-pressed="false">${ic('layers', 'sm')}${LANG === 'en' ? 'Blueprint' : 'Plano técnico'}</button><button type="button" class="ibtn" data-shark-pause>${ic('pause')}</button>`;
host.append(hud);
const modeBtn = hud.querySelector('[data-shark-mode]'), pauseBtn = hud.querySelector('[data-shark-pause]');
const sync = () => {
const still = isStill();
pauseBtn.innerHTML = ic(still ? 'play' : 'pause');
- pauseBtn.setAttribute('aria-label', still ? 'Reanudar la animación del megalodón' : 'Pausar la animación del megalodón');
+ pauseBtn.setAttribute('aria-label', LANG === 'en' ? (still ? 'Resume the megalodon animation' : 'Pause the megalodon animation') : (still ? 'Reanudar la animación del megalodón' : 'Pausar la animación del megalodón'));
modeBtn.setAttribute('aria-pressed', String(st.blueTo > .5));
};
modeBtn.onclick = () => { st.blueTo = st.blueTo > .5 ? 0 : 1; sync(); if (!running) settle(); };
@@ -4435,7 +4641,7 @@ let CUR_WS = null;
const CAP_CACHE = {};
const capPkts = k => CAP_CACHE[k] || (CAP_CACHE[k] = dissectAll(SCENARIOS[k]()).pkts);
const capName = k => `${SCENARIO_FILES[k] || k}.pcapng`;
-const TASK_TYPES = { filter: ['Filtro', 'filter'], packet: ['Paquete', 'target'], text: ['Respuesta', 'terminal'], choice: ['Test', 'list'] };
+const TASK_TYPES = { filter: [['Filtro', 'Filter'], 'filter'], packet: [['Paquete', 'Packet'], 'target'], text: [['Respuesta', 'Answer'], 'terminal'], choice: [['Test', 'Quiz'], 'list'] };
const norm = s => String(s).normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().replace(/\s+/g, ' ').trim();
const plain = s => String(s).replace(/[`*]/g, '');
const isNarrow = () => matchMedia('(max-width: 1023px)').matches;
@@ -4448,35 +4654,35 @@ function viewHome(main) {
main.innerHTML = `
<section class="hero" aria-labelledby="hero-t">
<div class="hero-art" id="hero-slot">
- <picture><source type="image/avif" srcset="${HERO_IMG.avif}"><img class="hero-img" src="${HERO_IMG.webp}" width="${HERO_IMG.w}" height="${HERO_IMG.h}" alt="Megalodón dibujado como un plano técnico azul" decoding="async" fetchpriority="high"></picture>
+ <picture><source type="image/avif" srcset="${HERO_IMG.avif}"><img class="hero-img" src="${HERO_IMG.webp}" width="${HERO_IMG.w}" height="${HERO_IMG.h}" alt="${L('Megalodón dibujado como un plano técnico azul', 'Megalodon drawn as a blue technical blueprint')}" decoding="async" fetchpriority="high"></picture>
</div>
<div class="hero-copy">
- <p class="eyebrow">Laboratorio de Wireshark · eWPT</p>
+ <p class="eyebrow">${L('Laboratorio de Wireshark', 'Wireshark lab')} · eWPT</p>
<h1 id="hero-t">Megalodon</h1>
- <p class="lead">Aprende a leer la red como un pentester: capturas de un ataque real en miniatura, filtros que se validan mientras escribes y retos guiados desde el saludo TCP hasta la inyección SQL.</p>
+ <p class="lead">${L('Aprende a leer la red como un pentester: capturas de un ataque real en miniatura, filtros que se validan mientras escribes y retos guiados desde el saludo TCP hasta la inyección SQL.', 'Learn to read the network like a pentester: miniature captures of a real attack, filters validated as you type and guided challenges from the TCP handshake to SQL injection.')}</p>
<div class="row cta">
- <a class="btn primary lg" href="#/m/${next.id}">${ic('play')}${started ? `${t('continue')}: módulo ${next.n}` : 'Empezar por el módulo 1'}</a>
- <a class="btn ghost lg" href="#/lab">${ic('flask')}Laboratorio libre</a>
+ <a class="btn primary lg" href="#/m/${next.id}">${ic('play')}${started ? `${t('continue')}: ${L('módulo', 'module')} ${next.n}` : L('Empezar por el módulo 1', 'Start with module 1')}</a>
+ <a class="btn ghost lg" href="#/lab">${ic('flask')}${L('Laboratorio libre', 'Free lab')}</a>
</div>
</div>
</section>
<section class="wrap stats3" aria-label="${t('progress')}">
- <div class="stat card"><span class="stat-ic ok">${ic('trophy')}</span><div><p class="stat-v"><span class="num">${xp}</span> XP</p><p class="stat-l">${t('level')}: <strong>${lv.name}</strong>${lv.next ? ` · ${lv.next - xp} XP para el siguiente` : ''}</p>${lv.next ? `<div class="meter" role="progressbar" aria-label="Progreso de nivel" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(100 * (xp - lv.min) / (lv.next - lv.min))}"><i data-w="${100 * (xp - lv.min) / (lv.next - lv.min)}"></i></div>` : ''}</div></div>
- <div class="stat card"><span class="stat-ic">${ic('target')}</span><div><p class="stat-v"><span class="num">${solved}</span> / ${total}</p><p class="stat-l">retos resueltos</p></div></div>
- <div class="stat card"><span class="stat-ic">${ic('award')}</span><div><p class="stat-v"><span class="num">${badges}</span> / ${MODULES.length}</p><p class="stat-l">insignias</p></div></div>
+ <div class="stat card"><span class="stat-ic ok">${ic('trophy')}</span><div><p class="stat-v"><span class="num">${xp}</span> XP</p><p class="stat-l">${t('level')}: <strong>${lvName(lv)}</strong>${lv.next ? ` · ${lv.next - xp} XP ${L('para el siguiente', 'to the next one')}` : ''}</p>${lv.next ? `<div class="meter" role="progressbar" aria-label="${t('levelProg')}" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(100 * (xp - lv.min) / (lv.next - lv.min))}"><i data-w="${100 * (xp - lv.min) / (lv.next - lv.min)}"></i></div>` : ''}</div></div>
+ <div class="stat card"><span class="stat-ic">${ic('target')}</span><div><p class="stat-v"><span class="num">${solved}</span> / ${total}</p><p class="stat-l">${L('retos resueltos', 'challenges solved')}</p></div></div>
+ <div class="stat card"><span class="stat-ic">${ic('award')}</span><div><p class="stat-v"><span class="num">${badges}</span> / ${MODULES.length}</p><p class="stat-l">${L('insignias', 'badges')}</p></div></div>
</section>
<section class="wrap" aria-labelledby="mods-t">
- <div class="sec-h"><h2 id="mods-t">Módulos</h2><p class="muted">Del primer SYN a los ataques web. Cada módulo trae su captura, una lección corta y retos con pistas.</p></div>
+ <div class="sec-h"><h2 id="mods-t">${t('modules')}</h2><p class="muted">${L('Del primer SYN a los ataques web. Cada módulo trae su captura, una lección corta y retos con pistas.', 'From the first SYN to web attacks. Every module brings its own capture, a short lesson and challenges with hints.')}</p></div>
<div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
- <div class="sec-h sub"><h3>${t('extra')}: SOC, DFIR y Directorio Activo</h3><p class="muted">Para cuando termines los seis primeros.</p></div>
+ <div class="sec-h sub"><h3>${t('extra')}: ${L('SOC, DFIR y Directorio Activo', 'SOC, DFIR and Active Directory')}</h3><p class="muted">${L('Para cuando termines los seis primeros.', 'For when you finish the first six.')}</p></div>
<div class="mgrid">${MODULES.filter(m => m.extra).map(modCard).join('')}</div>
</section>
<section class="wrap how" aria-labelledby="how-t">
- <h2 id="how-t">Cómo funciona</h2>
+ <h2 id="how-t">${L('Cómo funciona', 'How it works')}</h2>
<ol class="steps3">
- <li class="card"><span class="stepn">1</span><h3>Lee y prueba</h3><p>Cada lección es corta y trae botones «Pruébalo» que aplican el filtro en la captura.</p></li>
- <li class="card"><span class="stepn">2</span><h3>Resuelve</h3><p>Escribe filtros, selecciona paquetes o responde. Se comprueba contra la captura al instante.</p></li>
- <li class="card"><span class="stepn">3</span><h3>Llévatelo</h3><p>Exporta cada captura en .pcapng y repite el reto en tu Wireshark de verdad.</p></li>
+ <li class="card"><span class="stepn">1</span><h3>${L('Lee y prueba', 'Read and try')}</h3><p>${L('Cada lección es corta y trae botones «Pruébalo» que aplican el filtro en la captura.', 'Each lesson is short and has “Try it” buttons that apply the filter to the capture.')}</p></li>
+ <li class="card"><span class="stepn">2</span><h3>${L('Resuelve', 'Solve')}</h3><p>${L('Escribe filtros, selecciona paquetes o responde. Se comprueba contra la captura al instante.', 'Write filters, pick packets or answer. It is checked against the capture instantly.')}</p></li>
+ <li class="card"><span class="stepn">3</span><h3>${L('Llévatelo', 'Take it with you')}</h3><p>${L('Exporta cada captura en .pcapng y repite el reto en tu Wireshark de verdad.', 'Export each capture as .pcapng and repeat the challenge in your real Wireshark.')}</p></li>
</ol>
</section>
${siteFooter()}`;
@@ -4487,17 +4693,17 @@ function viewHome(main) {
function modCard(m) {
const p = modProgress(m), earned = S.get().badges[m.id];
return `<a class="mcard card" href="#/m/${m.id}">
- <div class="row between"><span class="mic">${ic(m.icon)}</span>${earned ? `<span class="pill ok">${ic('award', 'sm')}${esc(m.badge)}</span>` : `<span class="pill">${m.mins} ${t('minutes')}</span>`}</div>
- <p class="eyebrow">Módulo ${m.n}</p><h3>${esc(m.title)}</h3><p class="muted sm">${esc(m.sub)}</p>
- <div class="mfoot"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="Retos de ${esc(m.title)}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm ${p.done === p.total ? 'okt' : 'muted'}">${p.done}/${p.total}</span></div>
+ <div class="row between"><span class="mic">${ic(m.icon)}</span>${earned ? `<span class="pill ok">${ic('award', 'sm')}${esc(mT(m, 'badge'))}</span>` : `<span class="pill">${m.mins} ${t('minutes')}</span>`}</div>
+ <p class="eyebrow">${L('Módulo', 'Module')} ${m.n}</p><h3>${esc(mT(m, 'title'))}</h3><p class="muted sm">${esc(mT(m, 'sub'))}</p>
+ <div class="mfoot"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="${L('Retos de', 'Challenges in')} ${esc(mT(m, 'title'))}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm ${p.done === p.total ? 'okt' : 'muted'}">${p.done}/${p.total}</span></div>
</a>`;
}
function siteFooter() {
- return `<footer class="foot wrap"><p>Megalodon · laboratorio de Wireshark sin conexión. Contenido basado en la <a href="https://www.wireshark.org/docs/" target="_blank" rel="noopener noreferrer">documentación pública de Wireshark</a>; las capturas son sintéticas y los dominios, de prueba.</p><p>Yoandy Ramírez Delgado · Huelva, España</p></footer>`;
+ return `<footer class="foot wrap"><p>${L('Megalodon · laboratorio de Wireshark sin conexión. Contenido basado en la', 'Megalodon · offline Wireshark lab. Content based on the')} <a href="https://www.wireshark.org/docs/" target="_blank" rel="noopener noreferrer">${L('documentación pública de Wireshark', 'public Wireshark documentation')}</a>${L('; las capturas son sintéticas y los dominios, de prueba.', '; captures are synthetic and domains are test domains.')}</p><p>Yoandy Ramírez Delgado · Huelva, ${L('España', 'Spain')}</p></footer>`;
}
function viewModules(main) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('modules')}</p><h1>Ruta de aprendizaje</h1><p class="muted">Seis módulos principales para el eWPT y dos extra de SOC y Directorio Activo.</p></div>
- <h2 class="vh">Módulos principales</h2><div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('modules')}</p><h1>${L('Ruta de aprendizaje', 'Learning path')}</h1><p class="muted">${L('Seis módulos principales para el eWPT y dos extra de SOC y Directorio Activo.', 'Six core modules for the eWPT and two extra ones on SOC and Active Directory.')}</p></div>
+ <h2 class="vh">${L('Módulos principales', 'Core modules')}</h2><div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
<div class="sec-h sub"><h2>${t('extra')}</h2></div><div class="mgrid">${MODULES.filter(m => m.extra).map(modCard).join('')}</div></div>${siteFooter()}`;
}
@@ -4510,12 +4716,12 @@ function viewModule(main, { id, q }) {
main.innerHTML = `<div class="mod">
<header class="mod-h wrap-wide">
<a class="back sm" href="#/modulos">${ic('chevL', 'sm')}${t('modules')}</a>
- <div class="mod-title"><span class="mic lg">${ic(m.icon)}</span><div><p class="eyebrow">Módulo ${m.n}${m.extra ? ` · ${t('extra')}` : ''} · ${m.mins} ${t('minutes')}</p><h1>${esc(m.title)}</h1></div></div>
- <div class="mod-prog"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="Retos resueltos" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm" data-prog>${p.done}/${p.total} ${t('tasks').toLowerCase()}</span><span class="pill ${S.get().badges[m.id] ? 'ok' : ''}" data-badge>${ic('award', 'sm')}${esc(m.badge)}</span></div>
+ <div class="mod-title"><span class="mic lg">${ic(m.icon)}</span><div><p class="eyebrow">${L('Módulo', 'Module')} ${m.n}${m.extra ? ` · ${t('extra')}` : ''} · ${m.mins} ${t('minutes')}</p><h1>${esc(mT(m, 'title'))}</h1></div></div>
+ <div class="mod-prog"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="${L('Retos resueltos', 'Challenges solved')}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm" data-prog>${p.done}/${p.total} ${t('tasks').toLowerCase()}</span><span class="pill ${S.get().badges[m.id] ? 'ok' : ''}" data-badge>${ic('award', 'sm')}${esc(mT(m, 'badge'))}</span></div>
</header>
<div class="mod-grid wrap-wide">
<div class="mod-side">
- <div class="seg" role="tablist" aria-label="Secciones del módulo">
+ <div class="seg" role="tablist" aria-label="${L('Secciones del módulo', 'Module sections')}">
<button role="tab" id="tab-lesson" aria-controls="pan-lesson" data-tab="lesson">${ic('book', 'sm')}${t('lesson')}</button>
<button role="tab" id="tab-tasks" aria-controls="pan-tasks" data-tab="tasks">${ic('target', 'sm')}${t('tasks')} <span class="num" data-tc>${p.done}/${p.total}</span></button>
<button role="tab" id="tab-ws" aria-controls="pan-ws" data-tab="ws" class="only-narrow">${ic('rows', 'sm')}${t('wireshark')}</button>
@@ -4524,11 +4730,11 @@ function viewModule(main, { id, q }) {
${t('lessonsInSpanish') ? `<p class="note sm">${ic('lang', 'sm')}${t('lessonsInSpanish')}</p>` : ''}
<p class="intro">${md(m.intro)}</p>
${m.lessons.map((l, i) => `<section class="lcard card" id="l-${i}" aria-labelledby="lh-${i}"><h2 id="lh-${i}"><span class="ln">${i + 1}</span>${esc(l.h)}</h2>${l.p.map(x => `<p>${md(x)}</p>`).join('')}${l.ladder !== undefined ? `<div class="ladder-slot" data-stream="${l.ladder}"></div>` : ''}${l.try ? `<div class="tries"><p class="tries-h">${ic('play', 'sm')}${t('tryIt')}</p>${l.try.map(([f, d]) => `<button class="try" type="button" data-f="${esc(f)}"><code>${esc(f)}</code><span>${esc(d)}</span></button>`).join('')}</div>` : ''}</section>`).join('')}
- <button class="btn primary" data-go-tasks type="button">${ic('target')}Ir a los retos</button>
+ <button class="btn primary" data-go-tasks type="button">${ic('target')}${L('Ir a los retos', 'Go to the challenges')}</button>
</div>
<div id="pan-tasks" role="tabpanel" aria-labelledby="tab-tasks" class="pan tasks" tabindex="-1">
${m.tasks.map((x, i) => taskCard(x, i)).join('')}
- <div class="mod-end card ${p.done === p.total ? '' : 'hide'}" data-end>${ic('award')}<div><h2>${t('moduleDone')}</h2><p>${t('badgeEarned')} <strong class="okt">${esc(m.badge)}</strong>.</p></div>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}">${t('next')}${ic('arrowR')}</a>` : ''}</div>
+ <div class="mod-end card ${p.done === p.total ? '' : 'hide'}" data-end>${ic('award')}<div><h2>${t('moduleDone')}</h2><p>${t('badgeEarned')} <strong class="okt">${esc(mT(m, 'badge'))}</strong>.</p></div>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}">${t('next')}${ic('arrowR')}</a>` : ''}</div>
</div>
</div>
<div class="mod-ws" id="pan-ws" role="tabpanel" aria-labelledby="tab-ws"></div>
@@ -4564,8 +4770,8 @@ function viewModule(main, { id, q }) {
if (q.get('t')) { const el = $(`#task-${q.get('t')}`, main); if (el) setTimeout(() => el.scrollIntoView({ block: 'center' }), 30); }
/* retos */
- refreshFilterPreview = () => $$('[data-curf]', main).forEach(el => { el.innerHTML = ws.filterText ? `<code>${esc(ws.filterText)}</code> · ${ws.view.length} paquetes` : `<span class="muted">${t('none')}</span>`; });
- refreshSelPreview = () => { const p = ws.selected(); $$('[data-cursel]', main).forEach(el => { el.innerHTML = p ? `<strong>n.º ${p.no}</strong> · <span class="mono">${esc(p.info.slice(0, 64))}</span>` : `<span class="muted">${t('none')}</span>`; }); };
+ refreshFilterPreview = () => $$('[data-curf]', main).forEach(el => { el.innerHTML = ws.filterText ? `<code>${esc(ws.filterText)}</code> · ${ws.view.length} ${L('paquetes', 'packets')}` : `<span class="muted">${t('none')}</span>`; });
+ refreshSelPreview = () => { const p = ws.selected(); $$('[data-cursel]', main).forEach(el => { el.innerHTML = p ? `<strong>${L('n.º', 'No.')} ${p.no}</strong> · <span class="mono">${esc(p.info.slice(0, 64))}</span>` : `<span class="muted">${t('none')}</span>`; }); };
refreshFilterPreview(); refreshSelPreview();
const fb = (card, kind, html) => { const el = $('.task-fb', card); el.className = `task-fb ${kind}`; el.innerHTML = html; if (kind === 'bad') { card.classList.remove('nope'); void card.offsetWidth; card.classList.add('nope'); } };
const succeed = (task, card) => {
@@ -4594,36 +4800,36 @@ function viewModule(main, { id, q }) {
hintBtn.onclick = () => { S.useHint(task.id); renderHints(); const last = $$('.hint', card).pop(); if (last) last.classList.add('new'); };
renderHints();
if (task.type === 'filter') $('[data-check]', card).onclick = () => {
- if (!ws.filterText) return fb(card, 'bad', `${ic('info')}<span>Escribe un filtro en la barra de Wireshark y pulsa ${t('apply')} (o Enter).</span>`);
+ if (!ws.filterText) return fb(card, 'bad', `${ic('info')}<span>${L('Escribe un filtro en la barra de Wireshark y pulsa', 'Type a filter in the Wireshark bar and press')} ${t('apply')} ${L('(o Enter).', '(or Enter).')}</span>`);
const mine = new Set(ws.view.map(p => p.no)), ref = new Set(applyFilter(ws.pkts, task.ref).map(p => p.no));
const allow = task.mode === 'covers' ? new Set(applyFilter(ws.pkts, task.allow).map(p => p.no)) : ref;
const missing = [...ref].filter(n => !mine.has(n)), extra = [...mine].filter(n => !allow.has(n));
if (!missing.length && !extra.length) return succeed(task, card);
- const parts = [`Tu filtro muestra <strong>${mine.size}</strong> paquetes${task.mode === 'covers' ? '' : `; la solución, <strong>${ref.size}</strong>`}.`];
- if (missing.length) parts.push(`Te faltan ${missing.length}.`);
- if (extra.length) parts.push(`Te sobran ${extra.length} (por ejemplo, el n.º ${extra[0]}).`);
+ const parts = [L(`Tu filtro muestra <strong>${mine.size}</strong> paquetes${task.mode === 'covers' ? '' : `; la solución, <strong>${ref.size}</strong>`}.`, `Your filter shows <strong>${mine.size}</strong> packets${task.mode === 'covers' ? '' : `; the solution, <strong>${ref.size}</strong>`}.`)];
+ if (missing.length) parts.push(L(`Te faltan ${missing.length}.`, `${missing.length} missing.`));
+ if (extra.length) parts.push(L(`Te sobran ${extra.length} (por ejemplo, el n.º ${extra[0]}).`, `${extra.length} too many (for example, No. ${extra[0]}).`));
fb(card, 'bad', `${ic('ko')}<span>${parts.join(' ')}</span>`);
};
if (task.type === 'packet') $('[data-check]', card).onclick = () => {
const p = ws.selected();
- if (!p) return fb(card, 'bad', `${ic('info')}<span>Selecciona un paquete en la lista.</span>`);
+ if (!p) return fb(card, 'bad', `${ic('info')}<span>${L('Selecciona un paquete en la lista.', 'Select a packet in the list.')}</span>`);
const r = parseFilter(task.match);
- if (r.test(p)) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>El n.º ${p.no} no es el que buscamos. Fíjate en la columna Info.</span>`);
+ if (r.test(p)) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${L(`El n.º ${p.no} no es el que buscamos. Fíjate en la columna Info.`, `No. ${p.no} is not the one we are after. Look at the Info column.`)}</span>`);
};
if (task.type === 'text') {
const inp = $('input', card);
const check = () => {
const v = inp.value.trim();
- if (!v) return fb(card, 'bad', `${ic('info')}<span>Escribe tu respuesta.</span>`);
+ if (!v) return fb(card, 'bad', `${ic('info')}<span>${L('Escribe tu respuesta.', 'Type your answer.')}</span>`);
const ok = task.ans.some(a => task.list ? v.split(/[\s,;]+/).filter(Boolean).map(Number).sort((x, y) => x - y).join(',') === a : task.exact ? v === a : norm(v) === norm(a));
- if (ok) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${task.exact && task.ans.some(a => norm(a) === norm(v)) ? 'Casi: revisa mayúsculas y símbolos, las contraseñas se copian exactas.' : 'No es eso. Vuelve a mirar la captura o pide una pista.'}</span>`);
+ if (ok) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${task.exact && task.ans.some(a => norm(a) === norm(v)) ? L('Casi: revisa mayúsculas y símbolos, las contraseñas se copian exactas.', 'Almost: check case and symbols, passwords are copied exactly.') : L('No es eso. Vuelve a mirar la captura o pide una pista.', 'Not quite. Look at the capture again or ask for a hint.')}</span>`);
};
$('[data-check]', card).onclick = check;
inp.addEventListener('keydown', e => { if (e.key === 'Enter') { e.preventDefault(); check(); } });
}
if (task.type === 'choice') $$('[data-opt]', card).forEach(b => b.onclick = () => {
if (+b.dataset.opt === task.ans) { b.classList.add('right'); b.setAttribute('aria-checked', 'true'); succeed(task, card); }
- else { b.classList.add('wrong'); b.disabled = true; fb(card, 'bad', `${ic('ko')}<span>No es esa. Descártala y prueba otra.</span>`); }
+ else { b.classList.add('wrong'); b.disabled = true; fb(card, 'bad', `${ic('ko')}<span>${L('No es esa. Descártala y prueba otra.', 'Not that one. Rule it out and try another.')}</span>`); }
});
if (S.isDone(task.id)) { $$('input, .task-act button', card).forEach(el => { el.disabled = true; }); if (task.type === 'choice') { const r = $(`[data-opt="${task.ans}"]`, card); r.classList.add('right'); r.setAttribute('aria-checked', 'true'); } }
});
@@ -4639,8 +4845,8 @@ function taskCard(x, i) {
: `<div class="opts" role="radiogroup" aria-labelledby="q-${x.id}">${x.opts.map((o, j) => `<button class="opt" type="button" role="radio" aria-checked="false" data-opt="${j}"><span class="ob" aria-hidden="true"></span>${esc(o)}</button>`).join('')}</div>`;
const xp = done ? S.get().done[x.id].xp : XP_BY_HINTS[Math.min(3, S.hintsUsed(x.id))];
return `<article class="task card" id="task-${x.id}" data-id="${x.id}" data-state="${done ? 'done' : 'todo'}" aria-labelledby="q-${x.id}">
- <div class="task-h"><span class="tnum" aria-hidden="true"><span class="tn-n">${i + 1}</span><span class="tn-ok">${ic('check', 'sm')}</span></span><span class="ttype">${ic(ti, 'sm')}${tl}</span><span class="txp">${done ? `${ic('check', 'sm')}+${xp} XP` : `+${xp} XP`}</span></div>
- <p class="tq" id="q-${x.id}"><span class="vh">Reto ${i + 1}${done ? ', resuelto' : ''}: </span>${md(x.q)}</p>
+ <div class="task-h"><span class="tnum" aria-hidden="true"><span class="tn-n">${i + 1}</span><span class="tn-ok">${ic('check', 'sm')}</span></span><span class="ttype">${ic(ti, 'sm')}${L(...tl)}</span><span class="txp">${done ? `${ic('check', 'sm')}+${xp} XP` : `+${xp} XP`}</span></div>
+ <p class="tq" id="q-${x.id}"><span class="vh">${L('Reto', 'Challenge')} ${i + 1}${done ? L(', resuelto', ', solved') : ''}: </span>${md(x.q)}</p>
<div class="task-act">${act}</div>
<div class="task-fb ${done ? 'ok' : ''}" aria-live="polite">${done ? `${ic('ok')}<span>${md(x.ok)}</span>` : ''}</div>
<div class="task-hints"></div>
@@ -4648,7 +4854,7 @@ function taskCard(x, i) {
</article>`;
}
function celebrate(m, nextM) {
- const d = openDialog({ title: t('moduleDone'), cls: 'narrow celebrate', body: `<div class="badge-big" aria-hidden="true">${ic('award')}</div><p class="center">${t('badgeEarned')}</p><p class="center badge-name">${esc(m.badge)}</p><p class="center muted sm">+${BONUS_MODULE} XP de bonus · ${S.xp()} XP en total · ${t('level')}: ${S.level().name}</p>`,
+ const d = openDialog({ title: t('moduleDone'), cls: 'narrow celebrate', body: `<div class="badge-big" aria-hidden="true">${ic('award')}</div><p class="center">${t('badgeEarned')}</p><p class="center badge-name">${esc(mT(m, 'badge'))}</p><p class="center muted sm">+${BONUS_MODULE} XP ${L('de bonus', 'bonus')} · ${S.xp()} XP ${L('en total', 'in total')} · ${t('level')}: ${lvName(S.level())}</p>`,
footer: `<button class="btn ghost" data-close>${t('close')}</button>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}" data-next>${t('next')}${ic('arrowR')}</a>` : ''}` });
$('[data-close]', d).onclick = () => closeDialog();
const n = $('[data-next]', d); if (n) n.onclick = () => closeDialog(true);
@@ -4660,13 +4866,13 @@ function viewLab(main, { q }) {
const f = q.get('f') || '';
if (f && !q.get('cap')) { const r = parseFilter(f); if (r.ok) cap = Object.keys(SCENARIOS).find(k => capPkts(k).some(r.test)) || cap; }
main.innerHTML = `<div class="lab">
- <div class="lab-h wrap-wide"><div><p class="eyebrow">${t('lab')}</p><h1>Laboratorio libre</h1></div>
- <div class="row"><label class="sm" for="lab-cap">${t('captures')}</label><select id="lab-cap" class="sel">${MODULES.map(m => `<option value="${m.cap}" ${m.cap === cap ? 'selected' : ''}>${m.n}. ${esc(m.title)} (${capName(m.cap)})</option>`).join('')}<option value="__own" hidden>Tu captura</option></select></div>
+ <div class="lab-h wrap-wide"><div><p class="eyebrow">${t('lab')}</p><h1>${L('Laboratorio libre', 'Free lab')}</h1></div>
+ <div class="row"><label class="sm" for="lab-cap">${t('captures')}</label><select id="lab-cap" class="sel">${MODULES.map(m => `<option value="${m.cap}" ${m.cap === cap ? 'selected' : ''}>${m.n}. ${esc(mT(m, 'title'))} (${capName(m.cap)})</option>`).join('')}<option value="__own" hidden>${L('Tu captura', 'Your capture')}</option></select></div>
</div>
<div class="lab-ws wrap-wide"></div>
</div>`;
const sel = $('#lab-cap', main);
- const ws = new Workspace($('.lab-ws', main), { raw: SCENARIOS[cap](), name: capName(cap), filter: f, allowImport: true, onImport: name => { const o = sel.querySelector('[value=__own]'); o.hidden = false; o.textContent = `Tu captura: ${name}`; sel.value = '__own'; } });
+ const ws = new Workspace($('.lab-ws', main), { raw: SCENARIOS[cap](), name: capName(cap), filter: f, allowImport: true, onImport: name => { const o = sel.querySelector('[value=__own]'); o.hidden = false; o.textContent = `${L('Tu captura', 'Your capture')}: ${name}`; sel.value = '__own'; } });
CUR_WS = ws;
sel.onchange = () => { if (sel.value !== '__own') { ws.load(SCENARIOS[sel.value](), capName(sel.value)); history.replaceState(null, '', `#/lab?cap=${sel.value}`); } };
return () => { ws.destroy(); CUR_WS = null; };
@@ -4674,25 +4880,25 @@ function viewLab(main, { q }) {
/* ---------- Chuleta ---------- */
function viewCheat(main) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('cheat')}</p><h1>Chuleta de filtros</h1><p class="muted">Los filtros de visualización que más vas a usar. Cópialos o pruébalos directamente en el laboratorio.</p></div>
- <div class="cgrid">${CHEATS.map(g => `<section class="card cs" aria-labelledby="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}"><h2 id="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}">${esc(g.h)}</h2><ul>${g.items.map(([f, d]) => {
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('cheat')}</p><h1>${L('Chuleta de filtros', 'Filter cheat sheet')}</h1><p class="muted">${L('Los filtros de visualización que más vas a usar. Cópialos o pruébalos directamente en el laboratorio.', 'The display filters you will use most. Copy them or try them straight in the lab.')}${LANG === 'en' ? ' Descriptions are in Spanish.' : ''}</p></div>
+ <div class="cgrid">${CHEATS.map(g => `<section class="card cs" aria-labelledby="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}"><h2 id="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}">${esc(mT(g, 'h'))}</h2><ul>${g.items.map(([f, d]) => {
const real = !/\s{3}| vs /.test(f);
- return `<li><div class="cs-f"><code>${esc(f)}</code><p>${esc(d)}</p></div><div class="cs-a">${real ? `<button class="ibtn sm" type="button" data-copy="${esc(f)}" aria-label="${t('copy')}: ${esc(f)}">${ic('copy')}</button><a class="ibtn sm" href="#/lab?f=${encodeURIComponent(f)}" aria-label="Probar en el laboratorio: ${esc(f)}">${ic('play')}</a>` : ''}</div></li>`;
+ return `<li><div class="cs-f"><code>${esc(f)}</code><p>${esc(d)}</p></div><div class="cs-a">${real ? `<button class="ibtn sm" type="button" data-copy="${esc(f)}" aria-label="${t('copy')}: ${esc(f)}">${ic('copy')}</button><a class="ibtn sm" href="#/lab?f=${encodeURIComponent(f)}" aria-label="${L('Probar en el laboratorio', 'Try in the lab')}: ${esc(f)}">${ic('play')}</a>` : ''}</div></li>`;
}).join('')}</ul></section>`).join('')}</div>
- <section class="card cs fields"><h2>Todos los campos del laboratorio</h2><p class="muted sm">Escribe cualquiera en la barra de filtros: el autocompletado los conoce todos.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="Campos de filtro"><table class="tbl"><caption class="vh">Campos de filtro</caption><thead><tr><th scope="col">Campo</th><th scope="col">Tipo</th><th scope="col">Qué es</th></tr></thead><tbody>${FIELD_DEFS.map(([n, ty, d]) => `<tr><td><code>${n}</code></td><td class="sm muted">${({ p: 'protocolo', u: 'número', b: 'booleano', s: 'texto', ip: 'IPv4', mac: 'MAC', f: 'decimal' })[ty]}</td><td>${esc(d)}</td></tr>`).join('')}</tbody></table></div></section>
+ <section class="card cs fields"><h2>${L('Todos los campos del laboratorio', 'Every field in the lab')}</h2><p class="muted sm">${L('Escribe cualquiera en la barra de filtros: el autocompletado los conoce todos.', 'Type any of them in the filter bar: autocomplete knows them all.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${L('Campos de filtro', 'Filter fields')}"><table class="tbl"><caption class="vh">${L('Campos de filtro', 'Filter fields')}</caption><thead><tr><th scope="col">${L('Campo', 'Field')}</th><th scope="col">${L('Tipo', 'Type')}</th><th scope="col">${L('Qué es', 'What it is')}</th></tr></thead><tbody>${FIELD_DEFS.map(([n, ty, d]) => `<tr><td><code>${n}</code></td><td class="sm muted">${(LANG === 'en' ? { p: 'protocol', u: 'number', b: 'boolean', s: 'text', ip: 'IPv4', mac: 'MAC', f: 'decimal' } : { p: 'protocolo', u: 'número', b: 'booleano', s: 'texto', ip: 'IPv4', mac: 'MAC', f: 'decimal' })[ty]}</td><td>${esc(d)}</td></tr>`).join('')}</tbody></table></div></section>
</div>${siteFooter()}`;
$$('[data-copy]', main).forEach(b => b.onclick = () => copyText(b.dataset.copy, b));
}
/* ---------- Glosario ---------- */
function viewGlossary(main, { q }) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('glossary')}</p><h1>Glosario</h1><p class="muted">${GLOSSARY.length} términos de redes y pentesting explicados sin rodeos.</p></div>
- <div class="gsearch"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="g-q">Buscar en el glosario</label><input id="g-q" type="search" class="tinput" placeholder="Filtra términos…" autocomplete="off"></div>
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('glossary')}</p><h1>${t('glossary')}</h1><p class="muted">${L(`${GLOSSARY.length} términos de redes y pentesting explicados sin rodeos.`, `${GLOSSARY.length} networking and pentesting terms explained plainly (in Spanish).`)}</p></div>
+ <div class="gsearch"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="g-q">${L('Buscar en el glosario', 'Search the glossary')}</label><input id="g-q" type="search" class="tinput" placeholder="${L('Filtra términos…', 'Filter terms…')}" autocomplete="off"></div>
<p class="sm muted" id="g-n" aria-live="polite"></p>
<dl class="gl">${GLOSSARY.map(([term, d]) => `<div class="card gi" id="g-${esc(norm(term).replace(/\W+/g, '-'))}"><dt>${esc(term)}</dt><dd>${esc(d)}</dd></div>`).join('')}</dl></div>${siteFooter()}`;
const inp = $('#g-q', main), items = $$('.gi', main);
- const run = () => { const v = norm(inp.value); let n = 0; items.forEach((el, i) => { const hit = !v || norm(GLOSSARY[i][0] + ' ' + GLOSSARY[i][1]).includes(v); el.hidden = !hit; n += hit; }); $('#g-n', main).textContent = v ? `${n} de ${GLOSSARY.length} términos` : ''; };
+ const run = () => { const v = norm(inp.value); let n = 0; items.forEach((el, i) => { const hit = !v || norm(GLOSSARY[i][0] + ' ' + GLOSSARY[i][1]).includes(v); el.hidden = !hit; n += hit; }); $('#g-n', main).textContent = v ? L(`${n} de ${GLOSSARY.length} términos`, `${n} of ${GLOSSARY.length} terms`) : ''; };
inp.addEventListener('input', run);
if (q.get('q')) { inp.value = q.get('q'); run(); const first = items.find(x => !x.hidden); if (first) first.classList.add('flash'); }
}
@@ -4712,41 +4918,122 @@ function applyTheme(animate) {
const th = resolvedTheme(), root = document.documentElement;
if (animate && !REDUCED.matches) { root.classList.add('theming'); clearTimeout(applyTheme.tm); applyTheme.tm = setTimeout(() => root.classList.remove('theming'), 320); }
root.dataset.theme = th;
- const b = $('[data-theme-btn]'); if (b) b.setAttribute('aria-label', th === 'light' ? t('themeToDark') : t('themeToLight'));
+ const b = $('[data-theme-btn]'); if (b) b.setAttribute('aria-checked', String(th === 'dark'));
}
function applyLang() { LANG = S.get().settings.lang; document.documentElement.lang = LANG; $('#skip').textContent = t('skip'); }
-function renderTop() {
+/* Armazón al estilo de BlueJr y RiskManager-Jr: barra lateral plegable (carril de iconos que se despliega
+ por encima al pasar el ratón o con el teclado), barra superior flotante con buscador, interruptores ES|EN
+ y claro|oscuro, y barra de pestañas abajo en el móvil. */
+const MOBILE_MQ = matchMedia('(max-width: 900px)');
+let CUR_MOD = null, indY = null;
+function sideOpen() { return S.get().settings.side !== false; }
+function renderShell() { renderSide(); renderTop(); renderTabbar(); applyTheme(false); markNav(); }
+function renderSide() {
+ indY = null; // tras repintar, el indicador se coloca sin animar
const xp = S.xp(), lv = S.level();
+ const mods = MODULES.map((m, i) => {
+ const p = modProgress(m), st = p.done === p.total ? 'ok' : p.done ? 'mid' : '';
+ return `<li data-i="${i + 2}"><a href="#/m/${m.id}" class="sub" data-mod="${m.id}" title="${esc(`${m.n}. ${mT(m, 'title')}`)}"><span class="dotn ${st}" aria-hidden="true"><b>${m.n}</b></span><span class="txt">${esc(mT(m, 'title'))}</span><span class="cnt num">${p.done}/${p.total}</span></a></li>`;
+ }).join('');
+ const item = ([k, h, i], n) => `<a href="${h}" data-nav="${k}" data-i="${n}" title="${esc(t(k))}">${ic(i)}<span class="txt">${t(k)}</span></a>`;
+ const pct = lv.next ? Math.round(100 * (xp - lv.min) / (lv.next - lv.min)) : 100;
+ $('#side').setAttribute('aria-label', t('navMain'));
+ $('#side').innerHTML = `
+ <a class="side-brand" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><span class="brand-txt"><b>Megalodon</b><small>${t('brandSub')}</small></span></a>
+ <nav class="side-nav" aria-label="${t('navMain')}">
+ <span class="side-ind" aria-hidden="true"></span>
+ ${item(NAV[0], 0)}${item(NAV[1], 1)}
+ <ul aria-label="${t('modules')}">${mods}</ul>
+ ${NAV.slice(2).map((n, k) => item(n, 10 + k)).join('')}
+ </nav>
+ <div class="side-foot">
+ <a class="lvl" href="#/modulos" title="${t('level')}: ${esc(lvName(lv))}"><span class="lvl-ic" aria-hidden="true">${ic('trophy')}</span><span class="lvl-txt"><b>${esc(lvName(lv))} · <span class="num" data-xp>${xp}</span> XP</b><span class="meter" role="progressbar" aria-label="${t('levelProg')}" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${pct}"><i data-w="${Math.max(3, pct)}"></i></span></span></a>
+ </div>`;
+ $$('[data-i]', $('#side')).forEach(el => el.style.setProperty('--i', el.dataset.i)); // la CSP prohíbe style en línea
+ $$('[data-w]', $('#side')).forEach(el => { el.style.width = `${el.dataset.w}%`; });
+ document.body.classList.toggle('side-mini', !sideOpen());
+}
+/* Progreso en su sitio: no se repinta el lateral, así el indicador y el foco no se mueven */
+function updateSide() {
+ MODULES.forEach(m => {
+ const a = $(`.side-nav [data-mod="${m.id}"]`); if (!a) return;
+ const p = modProgress(m);
+ $('.cnt', a).textContent = `${p.done}/${p.total}`;
+ $('.dotn', a).className = `dotn ${p.done === p.total ? 'ok' : p.done ? 'mid' : ''}`;
+ });
+ const xp = S.xp(), lv = S.level(), pct = lv.next ? Math.round(100 * (xp - lv.min) / (lv.next - lv.min)) : 100;
+ const l = $('.lvl'); if (!l) return;
+ $('.lvl-txt b', l).innerHTML = `${esc(lvName(lv))} · <span class="num" data-xp>${xp}</span> XP`;
+ l.title = `${t('level')}: ${lvName(lv)}`;
+ const m = $('.meter', l); m.setAttribute('aria-valuenow', String(pct)); $('i', m).style.width = `${Math.max(3, pct)}%`;
+}
+function renderTop() {
+ const th = resolvedTheme();
$('#top').innerHTML = `<div class="top-in">
- <a class="brand" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><span class="brand-t">Megalodon</span></a>
- <nav class="nav" aria-label="Principal">${NAV.map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i, 'sm')}<span>${t(k)}</span></a>`).join('')}</nav>
- <div class="top-acts">
+ <button class="ibtn only-desk" type="button" data-side aria-label="${t('sideToggle')}" aria-expanded="${sideOpen()}" title="${t('sideToggle')} ( [ )">${ic('panel')}</button>
+ <a class="brand-m" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><b>Megalodon</b></a>
+ <span class="grow"></span>
<button class="search-btn" type="button" data-search aria-label="${t('search')} (Ctrl K)">${ic('search')}<span class="sb-t">${t('search')}…</span><kbd>Ctrl K</kbd></button>
- <a class="xp-chip" href="#/modulos" title="${t('level')}: ${lv.name}" aria-label="${xp} XP, ${t('level')} ${lv.name}">${ic('trophy', 'sm')}<span class="num" data-xp>${xp}</span><span class="xp-u">XP</span></a>
- <button class="ibtn hide-narrow" type="button" data-help aria-label="${t('help')}" title="${t('help')}">${ic('help')}</button>
- <button class="ibtn hide-narrow" type="button" data-keys aria-label="${t('shortcuts')}" title="${t('shortcuts')} (?)">${ic('keyboard')}</button>
- <button class="ibtn" type="button" data-settings aria-label="${t('settings')}" title="${t('settings')}">${ic('settings')}</button>
- <button class="ibtn theme-btn" type="button" data-theme-btn aria-label="${t('themeToLight')}"><span class="sun">${ic('sun')}</span><span class="moon">${ic('moon')}</span></button>
- <button class="ibtn" type="button" data-menu aria-label="${t('menu')}" aria-expanded="false" aria-controls="mnav">${ic('menu')}</button>
- </div>
- </div>
- <nav id="mnav" class="mnav" aria-label="Principal (móvil)" hidden>${NAV.map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i)}<span>${t(k)}</span></a>`).join('')}<button type="button" data-help>${ic('help')}<span>${t('help')}</span></button><button type="button" data-keys>${ic('keyboard')}<span>${t('shortcuts')}</span></button></nav>`;
+ <div class="lang-sw" role="group" aria-label="${t('langSwitch')}"><button type="button" data-lang="es" aria-pressed="${LANG === 'es'}" lang="es" aria-label="Español">ES</button><button type="button" data-lang="en" aria-pressed="${LANG === 'en'}" lang="en" aria-label="English">EN</button></div>
+ <button class="theme-sw" type="button" role="switch" data-theme-btn aria-checked="${th === 'dark'}" aria-label="${t('themeSwitch')}"><span class="track" aria-hidden="true">${ic('sun')}${ic('moon')}</span><span class="knob" aria-hidden="true"></span></button>
+ <button class="ibtn only-desk" type="button" data-help aria-label="${t('help')}" title="${t('help')}">${ic('help')}</button>
+ <button class="ibtn only-desk" type="button" data-keys aria-label="${t('shortcuts')}" title="${t('shortcuts')} (?)">${ic('keyboard')}</button>
+ <button class="ibtn only-desk" type="button" data-settings aria-label="${t('settings')}" title="${t('settings')}">${ic('settings')}</button>
+ </div>`;
const top = $('#top');
- $$('[data-search]', top).forEach(b => b.onclick = openSearch);
- $$('[data-help]', top).forEach(b => b.onclick = () => { closeMenu(); openHelp(); });
- $$('[data-keys]', top).forEach(b => b.onclick = () => { closeMenu(); openKeys(); });
+ $('[data-search]', top).onclick = openSearch;
+ $('[data-help]', top).onclick = openHelp;
+ $('[data-keys]', top).onclick = openKeys;
$('[data-settings]', top).onclick = openSettings;
$('[data-theme-btn]', top).onclick = toggleTheme;
- const mb = $('[data-menu]', top), mn = $('#mnav');
- mb.onclick = () => { const open = mn.hidden; mn.hidden = !open; mb.setAttribute('aria-expanded', String(open)); if (open) $('a', mn).focus(); };
- $$('a', mn).forEach(a => a.addEventListener('click', closeMenu));
- applyTheme(false); markNav();
+ $('[data-side]', top).onclick = toggleSide;
+ $$('[data-lang]', top).forEach(b => b.onclick = () => setLang(b.dataset.lang));
+}
+function renderTabbar() {
+ const tb = $('#tabbar');
+ tb.setAttribute('aria-label', t('navMobile'));
+ tb.innerHTML = NAV.slice(0, 4).map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i)}<span>${t(k)}</span></a>`).join('') + `<button type="button" data-more aria-haspopup="dialog">${ic('more')}<span>${t('more')}</span></button>`;
+ $('[data-more]', tb).onclick = openMore;
}
-function closeMenu() { const mn = $('#mnav'); if (mn && !mn.hidden) { mn.hidden = true; $('[data-menu]').setAttribute('aria-expanded', 'false'); } }
+function openMore() {
+ const d = openDialog({ title: `${ic('more')} ${t('more')}`, cls: 'narrow sheet', body: `<div class="more-list">
+ <a href="#/glosario" data-go>${ic('glossary')}<span>${t('glossary')}</span>${ic('chevR', 'sm')}</a>
+ <button type="button" data-a="settings">${ic('settings')}<span>${t('settings')}</span>${ic('chevR', 'sm')}</button>
+ <button type="button" data-a="help">${ic('help')}<span>${t('help')}</span>${ic('chevR', 'sm')}</button>
+ <button type="button" data-a="keys">${ic('keyboard')}<span>${t('shortcuts')}</span>${ic('chevR', 'sm')}</button>
+ </div>` });
+ $('[data-go]', d).onclick = () => closeDialog(true);
+ $$('[data-a]', d).forEach(b => b.onclick = () => { closeDialog(true); ({ settings: openSettings, help: openHelp, keys: openKeys })[b.dataset.a](); });
+}
+function toggleSide() {
+ S.set('side', !sideOpen());
+ document.body.classList.toggle('side-mini', !sideOpen());
+ const b = $('[data-side]'); if (b) b.setAttribute('aria-expanded', String(sideOpen()));
+ setTimeout(moveIndicator, 340);
+}
+function setLang(l) {
+ if (l === LANG) return;
+ S.set('lang', l); applyLang(); SEARCH_INDEX = null; renderShell(); route();
+ toast(l === 'en' ? 'Interface in English. Lessons stay in Spanish.' : 'Interfaz en español.', 'info', 'lang');
+}
+/* Indicador del lateral: se desliza hasta el elemento activo (solo transform, sin mover la página) */
+function moveIndicator() {
+ const nav = $('.side-nav'), ind = $('.side-ind'), act = nav && $('a[aria-current="page"]', nav);
+ if (!ind) return;
+ if (!act) { ind.style.opacity = '0'; return; }
+ const y = act.getBoundingClientRect().top - nav.getBoundingClientRect().top + nav.scrollTop, h = act.offsetHeight; // no offsetTop: los <li> no son el padre de referencia
+ if (indY === null || REDUCED.matches) { ind.style.transition = 'none'; ind.style.transform = `translateY(${y}px)`; ind.style.height = `${h}px`; ind.style.opacity = '1'; indY = y; requestAnimationFrame(() => { ind.style.transition = ''; }); return; }
+ ind.style.height = `${h}px`; ind.style.opacity = '1'; ind.style.transform = `translateY(${y}px)`; indY = y;
+}
+function closeMenu() {}
function toggleTheme() { S.set('theme', resolvedTheme() === 'light' ? 'dark' : 'light'); applyTheme(true); }
let CUR_NAV = 'home';
-function markNav() { $$('[data-nav]').forEach(a => { if (a.dataset.nav === CUR_NAV) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); }); }
+function markNav() {
+ $$('[data-nav]').forEach(a => { const on = a.dataset.nav === CUR_NAV && !(CUR_MOD && a.closest('.side-nav')); if (on) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); });
+ $$('[data-mod]').forEach(a => { if (a.dataset.mod === CUR_MOD) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); });
+ requestAnimationFrame(moveIndicator);
+}
function route() {
const raw = location.hash.replace(/^#/, '') || '/';
@@ -4757,13 +5044,13 @@ function route() {
const main = $('#main');
let hit = null;
for (const [re, fn, nav] of ROUTES) { const m = path.match(re); if (m) { hit = { fn, nav, id: m[1] }; break; } }
- CUR_NAV = hit ? hit.nav : '';
+ CUR_NAV = hit ? hit.nav : ''; CUR_MOD = hit && hit.fn === viewModule ? hit.id : null;
main.classList.remove('enter'); void main.offsetWidth; main.classList.add('enter');
cleanup = hit ? hit.fn(main, { id: hit.id, q }) || null : (viewNotFound(main), null);
$$('.meter[aria-valuemax]', main).forEach(mt => { const i = mt.firstElementChild; if (i && !i.style.width) i.style.width = `${Math.max(2, 100 * (+mt.getAttribute('aria-valuenow')) / (+mt.getAttribute('aria-valuemax')))}%`; });
markNav();
const h1 = $('h1', main);
- document.title = `${h1 && hit && hit.nav !== 'home' ? h1.textContent + ' · ' : ''}Megalodon · Laboratorio de Wireshark`;
+ document.title = `${h1 && hit && hit.nav !== 'home' ? h1.textContent + ' · ' : ''}Megalodon · ${L('Laboratorio de Wireshark', 'Wireshark lab')}`;
if (!firstRoute) { window.scrollTo(0, 0); main.focus({ preventScroll: true }); }
firstRoute = false;
}
@@ -4773,31 +5060,33 @@ let SEARCH_INDEX = null;
function searchIndex() {
if (SEARCH_INDEX) return SEARCH_INDEX;
const ix = [];
- NAV.forEach(([k, h, i]) => ix.push({ k: 'Página', i, title: t(k), go: h }));
+ const K = { page: L('Página', 'Page'), mod: L('Módulo', 'Module'), les: L('Lección', 'Lesson'), task: L('Reto', 'Challenge'), glo: t('glossary'), flt: L('Filtro', 'Filter'), fld: L('Campo', 'Field'), act: L('Acción', 'Action') };
+ NAV.forEach(([k, h, i]) => ix.push({ ty: 'page', i, title: t(k), go: h }));
MODULES.forEach(m => {
- ix.push({ k: 'Módulo', i: m.icon, title: `${m.n}. ${m.title}`, d: m.sub, go: `#/m/${m.id}` });
- m.lessons.forEach((l, j) => ix.push({ k: 'Lección', i: 'book', title: l.h, d: `Módulo ${m.n} · ${plain(l.p[0]).slice(0, 90)}`, go: `#/m/${m.id}?l=${j}`, body: plain(l.p.join(' ')) }));
- m.tasks.forEach(x => ix.push({ k: 'Reto', i: 'target', title: plain(x.q), d: `Módulo ${m.n} · ${m.title}`, go: `#/m/${m.id}?t=${x.id}` }));
+ ix.push({ ty: 'mod', i: m.icon, title: `${m.n}. ${mT(m, 'title')}`, d: mT(m, 'sub'), go: `#/m/${m.id}`, body: LANG === 'en' ? `${m.title} ${m.sub}` : '' });
+ m.lessons.forEach((l, j) => ix.push({ ty: 'les', i: 'book', title: l.h, d: `${K.mod} ${m.n} · ${plain(l.p[0]).slice(0, 90)}`, go: `#/m/${m.id}?l=${j}`, body: plain(l.p.join(' ')) }));
+ m.tasks.forEach(x => ix.push({ ty: 'task', i: 'target', title: plain(x.q), d: `${K.mod} ${m.n} · ${mT(m, 'title')}`, go: `#/m/${m.id}?t=${x.id}` }));
});
- GLOSSARY.forEach(([term, d]) => ix.push({ k: 'Glosario', i: 'glossary', title: term, d, go: `#/glosario?q=${encodeURIComponent(term)}` }));
- CHEATS.forEach(g => g.items.forEach(([f, d]) => { if (!/\s{3}| vs /.test(f)) ix.push({ k: 'Filtro', i: 'filter', title: f, d, go: `#/lab?f=${encodeURIComponent(f)}`, mono: true }); }));
- FIELD_DEFS.forEach(([n, , d]) => ix.push({ k: 'Campo', i: 'tree', title: n, d, go: `#/lab?f=${encodeURIComponent(n)}`, mono: true }));
- ix.push({ k: 'Acción', i: 'sun', title: 'Cambiar tema claro u oscuro', act: toggleTheme }, { k: 'Acción', i: 'settings', title: t('settings'), act: openSettings }, { k: 'Acción', i: 'keyboard', title: t('shortcuts'), act: openKeys }, { k: 'Acción', i: 'help', title: t('help'), act: openHelp });
+ GLOSSARY.forEach(([term, d]) => ix.push({ ty: 'glo', i: 'glossary', title: term, d, go: `#/glosario?q=${encodeURIComponent(term)}` }));
+ CHEATS.forEach(g => g.items.forEach(([f, d]) => { if (!/\s{3}| vs /.test(f)) ix.push({ ty: 'flt', i: 'filter', title: f, d, go: `#/lab?f=${encodeURIComponent(f)}`, mono: true }); }));
+ FIELD_DEFS.forEach(([n, , d]) => ix.push({ ty: 'fld', i: 'tree', title: n, d, go: `#/lab?f=${encodeURIComponent(n)}`, mono: true }));
+ ix.push({ ty: 'act', i: 'sun', title: L('Cambiar tema claro u oscuro', 'Toggle light or dark theme'), act: toggleTheme }, { ty: 'act', i: 'lang', title: L('Interfaz en inglés', 'Interface in Spanish'), act: () => setLang(LANG === 'en' ? 'es' : 'en') }, { ty: 'act', i: 'panel', title: t('sideToggle'), act: toggleSide }, { ty: 'act', i: 'settings', title: t('settings'), act: openSettings }, { ty: 'act', i: 'keyboard', title: t('shortcuts'), act: openKeys }, { ty: 'act', i: 'help', title: t('help'), act: openHelp });
+ ix.forEach(x => { x.k = K[x.ty]; });
ix.forEach(x => { x.nt = norm(x.title); x.nd = norm((x.d || '') + ' ' + (x.body || '')); });
return (SEARCH_INDEX = ix);
}
function openSearch() {
const body = document.createElement('div');
- body.innerHTML = `<div class="sbox"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="s-q">${t('search')}</label><input id="s-q" type="text" role="combobox" aria-expanded="true" aria-controls="s-r" aria-autocomplete="list" autocomplete="off" spellcheck="false" placeholder="${esc(t('searchPh'))}"></div><ul id="s-r" class="sres" role="listbox" aria-label="Resultados"></ul><p class="sm muted s-foot"><kbd>↑</kbd><kbd>↓</kbd> moverte · <kbd>Enter</kbd> abrir · <kbd>Esc</kbd> cerrar</p>`;
+ body.innerHTML = `<div class="sbox"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="s-q">${t('search')}</label><input id="s-q" type="text" role="combobox" aria-expanded="true" aria-controls="s-r" aria-autocomplete="list" autocomplete="off" spellcheck="false" placeholder="${esc(t('searchPh'))}"></div><ul id="s-r" class="sres" role="listbox" aria-label="${L('Resultados', 'Results')}"></ul><p class="sm muted s-foot"><kbd>↑</kbd><kbd>↓</kbd> ${L('moverte', 'move')} · <kbd>Enter</kbd> ${L('abrir', 'open')} · <kbd>Esc</kbd> ${L('cerrar', 'close')}</p>`;
openDialog({ title: `${ic('search')} ${t('search')}`, body, cls: 'search' });
const inp = $('#s-q'), list = $('#s-r');
let res = [], idx = 0;
const draw = () => {
const v = norm(inp.value), ix = searchIndex();
- if (!v) res = ix.filter(x => x.k === 'Módulo' || x.k === 'Página').slice(0, 14);
+ if (!v) res = ix.filter(x => x.ty === 'mod' || x.ty === 'page').slice(0, 14);
else res = ix.map(x => ({ x, s: x.nt.startsWith(v) ? 3 : x.nt.includes(v) ? 2 : x.nd.includes(v) ? 1 : 0 })).filter(r => r.s).sort((a, b) => b.s - a.s || a.x.title.length - b.x.title.length).slice(0, 30).map(r => r.x);
idx = 0;
- list.innerHTML = res.length ? res.map((x, i) => `<li role="option" id="s-o${i}" aria-selected="${i === idx}" data-i="${i}"><span class="s-ic">${ic(x.i, 'sm')}</span><span class="s-t"><span class="${x.mono ? 'mono' : ''}">${esc(x.title.length > 110 ? x.title.slice(0, 108) + '…' : x.title)}</span>${x.d ? `<small>${esc(x.d.length > 100 ? x.d.slice(0, 98) + '…' : x.d)}</small>` : ''}</span><span class="s-k">${x.k}</span></li>`).join('') : `<li class="s-none" role="option" aria-disabled="true">Nada por aquí. Prueba con «syn», «cookie» o «dns».</li>`;
+ list.innerHTML = res.length ? res.map((x, i) => `<li role="option" id="s-o${i}" aria-selected="${i === idx}" data-i="${i}"><span class="s-ic">${ic(x.i, 'sm')}</span><span class="s-t"><span class="${x.mono ? 'mono' : ''}">${esc(x.title.length > 110 ? x.title.slice(0, 108) + '…' : x.title)}</span>${x.d ? `<small>${esc(x.d.length > 100 ? x.d.slice(0, 98) + '…' : x.d)}</small>` : ''}</span><span class="s-k">${x.k}</span></li>`).join('') : `<li class="s-none" role="option" aria-disabled="true">${L('Nada por aquí. Prueba con «syn», «cookie» o «dns».', 'Nothing here. Try “syn”, “cookie” or “dns”.')}</li>`;
inp.setAttribute('aria-activedescendant', res.length ? 's-o0' : '');
};
const go = i => { const x = res[i]; if (!x) return; closeDialog(true); if (x.act) x.act(); else if (location.hash === x.go) route(); else location.hash = x.go; };
@@ -4820,34 +5109,44 @@ function openSettings() {
const solved = Object.keys(S.get().done).length;
const d = openDialog({ title: `${ic('settings')} ${t('settings')}`, body: `
<div class="set-row"><div><p>${t('theme')}</p></div><div data-set="theme">${seg(t('theme'), st.theme, [['light', t('light'), 'sun'], ['dark', t('dark'), 'moon'], ['system', t('system'), null]])}</div></div>
- <div class="set-row"><div><p>${t('language')}</p><p class="sm muted">Interfaz en español o inglés. Las lecciones están en español.</p></div><div data-set="lang">${seg(t('language'), st.lang, [['es', 'Español'], ['en', 'English']])}</div></div>
- ${sw('relative', 'Números de secuencia relativos', 'Como Wireshark por defecto: Seq y Ack empiezan en 0. Desactívalo para ver los valores reales.')}
- ${sw('colorize', 'Colorear paquetes', 'Reglas de color de Wireshark: TCP, HTTP, RST, problemas…')}
- <div class="set-row danger-zone"><div><p>${t('resetProgress')}</p><p class="sm muted">${solved} retos y ${S.xp()} XP guardados en este navegador.</p></div><button type="button" class="btn danger sm" data-reset ${solved || S.xp() ? '' : 'disabled'}>${ic('reset', 'sm')}${t('resetProgress')}</button></div>` });
+ <div class="set-row"><div><p>${t('language')}</p><p class="sm muted">${L('Interfaz en español o inglés. Las lecciones están en español.', 'Interface in Spanish or English. Lessons are in Spanish.')}</p></div><div data-set="lang">${seg(t('language'), st.lang, [['es', 'Español'], ['en', 'English']])}</div></div>
+ ${sw('relative', L('Números de secuencia relativos', 'Relative sequence numbers'), L('Como Wireshark por defecto: Seq y Ack empiezan en 0. Desactívalo para ver los valores reales.', 'Wireshark’s default: Seq and Ack start at 0. Turn it off to see the real values.'))}
+ ${sw('colorize', L('Colorear paquetes', 'Colorize packets'), L('Reglas de color de Wireshark: TCP, HTTP, RST, problemas…', 'Wireshark coloring rules: TCP, HTTP, RST, problems…'))}
+ <div class="set-row danger-zone"><div><p>${t('resetProgress')}</p><p class="sm muted">${L(`${solved} retos y ${S.xp()} XP guardados en este navegador.`, `${solved} challenges and ${S.xp()} XP saved in this browser.`)}</p></div><button type="button" class="btn danger sm" data-reset ${solved || S.xp() ? '' : 'disabled'}>${ic('reset', 'sm')}${t('resetProgress')}</button></div>` });
$$('[data-set]', d).forEach(g => g.addEventListener('click', e => {
const b = e.target.closest('[data-v]'); if (!b) return;
$$('[role=radio]', g).forEach(x => x.setAttribute('aria-checked', String(x === b)));
const k = g.dataset.set; S.set(k, b.dataset.v);
if (k === 'theme') applyTheme(true);
- if (k === 'lang') { applyLang(); SEARCH_INDEX = null; renderTop(); closeDialog(true); route(); openSettings(); }
+ if (k === 'lang') { applyLang(); SEARCH_INDEX = null; renderShell(); closeDialog(true); route(); openSettings(); }
+ if (k === 'theme') renderTop();
}));
$$('[data-sw]', d).forEach(b => b.onclick = () => { const v = b.getAttribute('aria-checked') !== 'true'; b.setAttribute('aria-checked', String(v)); S.set(b.dataset.sw, v); });
$('[data-reset]', d).onclick = async () => {
- const ok = await confirmDialog({ title: '¿Borrar todo tu progreso?', text: `Se borrarán <strong>${Object.keys(S.get().done).length} retos</strong>, <strong>${Object.keys(S.get().badges).length} insignias</strong> y <strong>${S.xp()} XP</strong>. Tus ajustes se mantienen. No se puede deshacer.`, ok: t('resetConfirm') });
- if (ok) { S.reset(); toast('Progreso borrado. A empezar de cero.', 'info', 'reset'); route(); }
+ const nd = Object.keys(S.get().done).length, nb = Object.keys(S.get().badges).length;
+ const ok = await confirmDialog({ title: L('¿Borrar todo tu progreso?', 'Reset all your progress?'), text: L(`Se borrarán <strong>${nd} retos</strong>, <strong>${nb} insignias</strong> y <strong>${S.xp()} XP</strong>. Tus ajustes se mantienen. No se puede deshacer.`, `This deletes <strong>${nd} challenges</strong>, <strong>${nb} badges</strong> and <strong>${S.xp()} XP</strong>. Your settings stay. It cannot be undone.`), ok: t('resetConfirm') });
+ if (ok) { S.reset(); toast(L('Progreso borrado. A empezar de cero.', 'Progress reset. Back to square one.'), 'info', 'reset'); route(); }
};
}
function openHelp() {
- openDialog({ title: `${ic('help')} ${t('help')}`, wide: true, body: `<div class="help">
+ openDialog({ title: `${ic('help')} ${t('help')}`, wide: true, body: LANG === 'en' ? `<div class="help">
+ <section><h3>${ic('rows', 'sm')}The three panes</h3><p>At the top, the <strong>packet list</strong>. In the middle, the layered <strong>detail tree</strong>. At the bottom, the <strong>bytes</strong>. Clicking a field highlights its bytes, and clicking a byte opens its field.</p></section>
+ <section><h3>${ic('filter', 'sm')}The filter bar</h3><p>It turns <span class="okt">green</span> when the filter is valid and <span class="badt">red</span> when it is not, with the reason below. <kbd>Tab</kbd> accepts the suggestion and <kbd>Enter</kbd> applies. In the tree, each field’s ${ic('filter', 'sm')} button turns it into a filter (“Apply as Filter”).</p></section>
+ <section><h3>${ic('target', 'sm')}Challenges</h3><p>Four kinds: write a <strong>filter</strong> (it must show exactly the solution’s packets), pick a <strong>packet</strong>, type an <strong>answer</strong> or choose an option. Each challenge gives 10 XP; each hint takes a little off. Finishing a module gives a badge and 20 extra XP.</p></section>
+ <section><h3>${ic('flask', 'sm')}Analyst tools</h3><p>Expert Information (<kbd>E</kbd>), HTTP objects, cleartext credentials, Statistics (<kbd>S</kbd>) with conversations, endpoints and I/O graph, Follow TCP/UDP stream (<kbd>F</kbd>), Find Packet (<kbd>Ctrl F</kbd>), Go to Packet (<kbd>Ctrl G</kbd>) and the time display format, as in Wireshark.</p></section>
+ <section><h3>${ic('upload', 'sm')}Your captures</h3><p>In the Free lab you can open your own .pcap or .pcapng files (or drag them in). Everything is processed in your browser: nothing leaves your device.</p></section>
+ <section><h3>${ic('book', 'sm')}Sources</h3><p>Field names, coloring rules and the Info column follow Wireshark 4.x; the engine was checked packet by packet against tshark. Official guide: <a href="https://www.wireshark.org/docs/wsug_html_chunked/" target="_blank" rel="noopener noreferrer">Wireshark User's Guide</a> · <a href="https://www.wireshark.org/docs/man-pages/wireshark-filter.html" target="_blank" rel="noopener noreferrer">wireshark-filter(4)</a>.</p></section>
+ </div>` : `<div class="help">
<section><h3>${ic('rows', 'sm')}Las tres zonas</h3><p>Arriba, la <strong>lista de paquetes</strong>. En medio, el <strong>árbol de detalle</strong> por capas. Abajo, los <strong>bytes</strong>. Al pulsar un campo se iluminan sus bytes, y al pulsar un byte se abre su campo.</p></section>
<section><h3>${ic('filter', 'sm')}La barra de filtros</h3><p>Se pone <span class="okt">verde</span> si el filtro es válido y <span class="badt">roja</span> si no, con el motivo debajo. <kbd>Tab</kbd> acepta la sugerencia y <kbd>Enter</kbd> aplica. En el árbol, el botón ${ic('filter', 'sm')} de cada campo lo convierte en filtro («Aplicar como filtro»).</p></section>
<section><h3>${ic('target', 'sm')}Retos</h3><p>Hay cuatro tipos: escribir un <strong>filtro</strong> (debe mostrar exactamente los paquetes de la solución), elegir un <strong>paquete</strong>, escribir una <strong>respuesta</strong> o elegir una opción. Cada reto da 10 XP; cada pista resta un poco. Completar un módulo da una insignia y 20 XP extra.</p></section>
+ <section><h3>${ic('flask', 'sm')}Herramientas de analista</h3><p>Información experta (<kbd>E</kbd>), objetos HTTP, credenciales en claro, Estadísticas (<kbd>S</kbd>) con conversaciones, endpoints y gráfico de E/S, seguir flujo TCP/UDP (<kbd>F</kbd>), Buscar paquete (<kbd>Ctrl F</kbd>), Ir al paquete (<kbd>Ctrl G</kbd>) y formato de tiempo, como en Wireshark.</p></section>
<section><h3>${ic('upload', 'sm')}Tus capturas</h3><p>En el Laboratorio libre puedes abrir tus .pcap o .pcapng (o arrastrarlos). Todo se procesa en tu navegador: nada sale de tu equipo.</p></section>
<section><h3>${ic('book', 'sm')}Fuentes</h3><p>Nombres de campos, reglas de color y formato de la columna Info siguen a Wireshark 4.x; el motor se ha comprobado paquete a paquete contra tshark. Guía oficial: <a href="https://www.wireshark.org/docs/wsug_html_chunked/" target="_blank" rel="noopener noreferrer">Wireshark User's Guide</a> · <a href="https://www.wireshark.org/docs/man-pages/wireshark-filter.html" target="_blank" rel="noopener noreferrer">wireshark-filter(4)</a>.</p></section>
</div>` });
}
function openKeys() {
- openDialog({ title: `${ic('keyboard')} ${t('shortcuts')}`, cls: 'narrow', body: `<table class="tbl keys"><caption class="vh">${t('shortcuts')}</caption><tbody>${SHORTCUTS.map(([k, es, en]) => `<tr><th scope="row">${k.split(' ').map(x => `<kbd>${x}</kbd>`).join(' ')}</th><td>${LANG === 'en' ? en : es}</td></tr>`).join('')}</tbody></table>` });
+ openDialog({ title: `${ic('keyboard')} ${t('shortcuts')}`, cls: 'narrow', body: `<table class="tbl keys"><caption class="vh">${t('shortcuts')}</caption><tbody>${SHORTCUTS.map(([k, es, en]) => `<tr><th scope="row">${k.split(' ').map(x => `<kbd>${LANG === 'en' ? ({ Inicio: 'Home', Fin: 'End', 'Mayús': 'Shift' })[x] || x : x}</kbd>`).join(' ')}</th><td>${LANG === 'en' ? en : es}</td></tr>`).join('')}</tbody></table>` });
}
function onKey(e) {
@@ -4857,6 +5156,7 @@ function onKey(e) {
if (typing || $('#dlg').open || e.ctrlKey || e.metaKey || e.altKey) return;
if (e.key === '/' && CUR_WS) { e.preventDefault(); CUR_WS.focusFilter(); }
else if (e.key === '?') { e.preventDefault(); openKeys(); }
+ else if (e.key === '[' && !MOBILE_MQ.matches) { e.preventDefault(); toggleSide(); }
else if (e.key === 'T' && e.shiftKey) toggleTheme();
else if ((e.key === 'f' || e.key === 'F') && !e.shiftKey && CUR_WS) CUR_WS.follow();
else if ((e.key === 's' || e.key === 'S') && !e.shiftKey && CUR_WS) openStats(CUR_WS);
@@ -4864,11 +5164,17 @@ function onKey(e) {
}
function boot() {
- applyLang(); renderTop(); route();
+ applyLang(); renderShell(); route();
+ setTimeout(() => document.body.classList.add('ready'), 700); // la entrada escalonada solo en la primera carga
addEventListener('hashchange', route);
addEventListener('keydown', onKey);
matchMedia('(prefers-color-scheme: light)').addEventListener('change', () => { if (S.get().settings.theme === 'system') applyTheme(true); });
- S.on(() => { const el = $('[data-xp]'); if (el && +el.textContent !== S.xp()) { el.textContent = S.xp(); const chip = el.closest('.xp-chip'); chip.classList.remove('bump'); void chip.offsetWidth; chip.classList.add('bump'); chip.setAttribute('aria-label', `${S.xp()} XP, ${t('level')} ${S.level().name}`); } });
+ let lastXp = S.xp();
+ S.on(() => { // el lateral refleja al momento retos, insignias y XP
+ updateSide();
+ if (S.xp() > lastXp) { const l = $('.lvl'); if (l) { l.classList.remove('bump'); void l.offsetWidth; l.classList.add('bump'); } }
+ lastXp = S.xp();
+ });
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); else boot();
</script>
diff --git a/docs/assets/footer.svg b/docs/assets/footer.svg
new file mode 100644
index 0000000..90d1199
--- /dev/null
+++ b/docs/assets/footer.svg
@@ -0,0 +1,21 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="170" viewBox="0 0 1280 170" role="img" aria-labelledby="t">
+ <title id="t">Megalodon · lee la red como un pentester</title>
+ <defs>
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="0"><stop offset="0" stop-color="#041634"/><stop offset=".55" stop-color="#082A5C"/><stop offset="1" stop-color="#0B3A7A"/></linearGradient>
+ <clipPath id="frame"><rect width="1280" height="170"/></clipPath>
+ </defs>
+ <style>
+ .ico { fill: none; stroke: #9FD0FF; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
+ .t { font: 600 18px -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; fill: rgba(255,255,255,.92); }
+ .s { font: 500 13px ui-monospace, 'SF Mono', Menlo, Consolas, monospace; fill: rgba(159,208,255,.85); letter-spacing: .04em; }
+ @media (prefers-reduced-motion: reduce) { animate, animateTransform { display: none } }
+ </style>
+ <g clip-path="url(#frame)">
+ <path fill="url(#bg)" d="M0 40C140 10 260 4 400 22C540 40 640 58 780 44C920 30 1060 6 1280 30V170H0Z"/>
+ <path fill="#fff" fill-opacity=".06" d="M0 60C160 30 300 26 440 44C580 62 700 76 840 62C980 48 1100 30 1280 50V70C1100 50 980 68 840 82C700 96 580 82 440 64C300 46 160 50 0 80Z"/>
+ <g transform="translate(96 112)"><path class="ico" d="M-24 0h18l6-12 8 24 6-12h18"><animate attributeName="stroke-opacity" values=".3;1;.3" dur="3s" repeatCount="indefinite"/></path></g>
+ <text class="t" x="640" y="106" text-anchor="middle">Megalodon · lee la red como un pentester</text>
+ <text class="s" x="640" y="132" text-anchor="middle">tcp.flags.syn == 1 &amp;&amp; tcp.flags.ack == 0</text>
+ <g transform="translate(1180 112)" class="ico"><circle r="6"/><circle r="6"><animate attributeName="r" values="6;30" dur="2.8s" repeatCount="indefinite"/><animate attributeName="stroke-opacity" values=".8;0" dur="2.8s" repeatCount="indefinite"/></circle></g>
+ </g>
+</svg>
diff --git a/docs/assets/header.svg b/docs/assets/header.svg
new file mode 100644
index 0000000..8acdcae
--- /dev/null
+++ b/docs/assets/header.svg
@@ -0,0 +1,10 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="220" viewBox="0 0 1200 220" role="img" aria-label="Megalodon · Laboratorio de Wireshark"><title>Megalodon · Laboratorio de Wireshark</title><defs><linearGradient id="g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#0B3A7A"/><stop offset=".6" stop-color="#082A5C"/><stop offset="1" stop-color="#041634"/></linearGradient><linearGradient id="r" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#9FD0FF" stop-opacity=".35"/><stop offset="1" stop-color="#9FD0FF" stop-opacity="0"/></linearGradient></defs><style>@media (prefers-reduced-motion: reduce){animate,animateTransform{display:none}}</style>
+<path fill="url(#g)" d="M0 0H1200V170C1100 205 1000 215 880 196C760 177 680 150 560 162C440 174 360 212 240 208C140 205 60 186 0 170Z"/>
+<g fill="url(#r)"><path d="M780 0h60L700 190h-40Z"><animate attributeName="opacity" values=".5;1;.5" dur="5s" repeatCount="indefinite"/></path><path d="M880 0h34L820 180h-22Z"><animate attributeName="opacity" values="1;.4;1" dur="6.5s" repeatCount="indefinite"/></path><path d="M320 0h40L280 170h-26Z"><animate attributeName="opacity" values=".4;.9;.4" dur="7s" repeatCount="indefinite"/></path></g>
+<path fill="#fff" fill-opacity=".07" d="M0 140C120 175 230 186 360 170C500 152 600 128 760 150C900 170 1040 196 1200 150V170C1100 205 1000 215 880 196C760 177 680 150 560 162C440 174 360 212 240 208C140 205 60 186 0 170Z"/>
+<g transform="translate(1060 70)" fill="none" stroke="#9FD0FF" stroke-width="2"><circle r="8" stroke-opacity=".9"/><circle r="8"><animate attributeName="r" values="8;46" dur="2.8s" repeatCount="indefinite"/><animate attributeName="stroke-opacity" values=".8;0" dur="2.8s" repeatCount="indefinite"/></circle><circle r="8"><animate attributeName="r" values="8;46" dur="2.8s" begin="1.4s" repeatCount="indefinite"/><animate attributeName="stroke-opacity" values=".8;0" dur="2.8s" begin="1.4s" repeatCount="indefinite"/></circle></g>
+<g fill="none" stroke="#9FD0FF" stroke-opacity=".55" stroke-width="2" stroke-linecap="round"><path d="M70 70h40l8-16 10 32 8-16h40"><animate attributeName="stroke-opacity" values=".25;.8;.25" dur="3s" repeatCount="indefinite"/></path></g>
+<circle cx="693" cy="98" r="2.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="156;36" dur="5s" begin="0.00s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="5s" begin="0.00s" repeatCount="indefinite"/></circle><circle cx="778" cy="209" r="1.4" fill="#fff" opacity=".0"><animate attributeName="cy" values="214;94" dur="6s" begin="0.45s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="5s" begin="0.45s" repeatCount="indefinite"/></circle><circle cx="206" cy="171" r="2.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="158;38" dur="6s" begin="0.90s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="5s" begin="0.90s" repeatCount="indefinite"/></circle><circle cx="1158" cy="168" r="1.4" fill="#fff" opacity=".0"><animate attributeName="cy" values="165;45" dur="6s" begin="1.35s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="5s" begin="1.35s" repeatCount="indefinite"/></circle><circle cx="842" cy="72" r="1.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="155;35" dur="6s" begin="1.80s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="7s" begin="1.80s" repeatCount="indefinite"/></circle><circle cx="888" cy="96" r="1.4" fill="#fff" opacity=".0"><animate attributeName="cy" values="189;69" dur="6s" begin="2.25s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="5s" begin="2.25s" repeatCount="indefinite"/></circle><circle cx="414" cy="155" r="1.4" fill="#fff" opacity=".0"><animate attributeName="cy" values="158;38" dur="5s" begin="2.70s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="6s" begin="2.70s" repeatCount="indefinite"/></circle><circle cx="1046" cy="196" r="2.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="190;70" dur="8s" begin="3.15s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="8s" begin="3.15s" repeatCount="indefinite"/></circle><circle cx="770" cy="136" r="1.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="173;53" dur="6s" begin="3.60s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="5s" begin="3.60s" repeatCount="indefinite"/></circle><circle cx="644" cy="194" r="2.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="193;73" dur="8s" begin="4.05s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="7s" begin="4.05s" repeatCount="indefinite"/></circle><circle cx="179" cy="90" r="2.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="171;51" dur="7s" begin="4.50s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="6s" begin="4.50s" repeatCount="indefinite"/></circle><circle cx="1031" cy="167" r="1.4" fill="#fff" opacity=".0"><animate attributeName="cy" values="159;39" dur="7s" begin="4.95s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="7s" begin="4.95s" repeatCount="indefinite"/></circle><circle cx="747" cy="187" r="2.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="158;38" dur="5s" begin="5.40s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="7s" begin="5.40s" repeatCount="indefinite"/></circle><circle cx="1000" cy="76" r="1.4" fill="#fff" opacity=".0"><animate attributeName="cy" values="189;69" dur="8s" begin="5.85s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="7s" begin="5.85s" repeatCount="indefinite"/></circle><circle cx="820" cy="148" r="1.4" fill="#fff" opacity=".0"><animate attributeName="cy" values="209;89" dur="7s" begin="6.30s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="6s" begin="6.30s" repeatCount="indefinite"/></circle><circle cx="269" cy="186" r="1.4" fill="#fff" opacity=".0"><animate attributeName="cy" values="177;57" dur="7s" begin="6.75s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="6s" begin="6.75s" repeatCount="indefinite"/></circle><circle cx="537" cy="161" r="2.8" fill="#fff" opacity=".0"><animate attributeName="cy" values="213;93" dur="5s" begin="7.20s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="6s" begin="7.20s" repeatCount="indefinite"/></circle><circle cx="949" cy="162" r="2.2" fill="#fff" opacity=".0"><animate attributeName="cy" values="167;47" dur="8s" begin="7.65s" repeatCount="indefinite"/><animate attributeName="opacity" values="0;.7;0" dur="7s" begin="7.65s" repeatCount="indefinite"/></circle>
+<text x="600" y="92" text-anchor="middle" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif" font-weight="800" font-size="60" letter-spacing="2" fill="#fff">Megalodon</text>
+<text x="600" y="132" text-anchor="middle" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif" font-weight="500" font-size="20" fill="#fff" fill-opacity=".92">Laboratorio de Wireshark · eWPT · SOC · Directorio Activo</text>
+</svg>
diff --git a/docs/assets/icons/award.svg b/docs/assets/icons/award.svg
new file mode 100644
index 0000000..497aa21
--- /dev/null
+++ b/docs/assets/icons/award.svg
@@ -0,0 +1,2 @@
+<!-- Lucide 0.460.0 (ISC) -->
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6CB2FF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526" /><circle cx="12" cy="8" r="6" /></svg>
diff --git a/docs/assets/icons/book-open.svg b/docs/assets/icons/book-open.svg
new file mode 100644
index 0000000..4f864d9
--- /dev/null
+++ b/docs/assets/icons/book-open.svg
@@ -0,0 +1,2 @@
+<!-- Lucide 0.460.0 (ISC) -->
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6CB2FF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 7v14" /><path d="M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z" /></svg>
diff --git a/docs/assets/icons/brain-circuit.svg b/docs/assets/icons/brain-circuit.svg
new file mode 100644
index 0000000..eb12ccc
--- /dev/null
+++ b/docs/assets/icons/brain-circuit.svg
@@ -0,0 +1,27 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-brain-circuit"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z" />
+ <path d="M9 13a4.5 4.5 0 0 0 3-4" />
+ <path d="M6.003 5.125A3 3 0 0 0 6.401 6.5" />
+ <path d="M3.477 10.896a4 4 0 0 1 .585-.396" />
+ <path d="M6 18a4 4 0 0 1-1.967-.516" />
+ <path d="M12 13h4" />
+ <path d="M12 18h6a2 2 0 0 1 2 2v1" />
+ <path d="M12 8h8" />
+ <path d="M16 8V5a2 2 0 0 1 2-2" />
+ <circle cx="16" cy="13" r=".5" />
+ <circle cx="18" cy="3" r=".5" />
+ <circle cx="20" cy="21" r=".5" />
+ <circle cx="20" cy="8" r=".5" />
+</svg>
diff --git a/docs/assets/icons/calendar-clock.svg b/docs/assets/icons/calendar-clock.svg
new file mode 100644
index 0000000..9d7aaa5
--- /dev/null
+++ b/docs/assets/icons/calendar-clock.svg
@@ -0,0 +1,20 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-calendar-clock"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" />
+ <path d="M16 2v4" />
+ <path d="M8 2v4" />
+ <path d="M3 10h5" />
+ <path d="M17.5 17.5 16 16.3V14" />
+ <circle cx="16" cy="16" r="6" />
+</svg>
diff --git a/docs/assets/icons/compass.svg b/docs/assets/icons/compass.svg
new file mode 100644
index 0000000..b9c0d74
--- /dev/null
+++ b/docs/assets/icons/compass.svg
@@ -0,0 +1,16 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-compass"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z" />
+ <circle cx="12" cy="12" r="10" />
+</svg>
diff --git a/docs/assets/icons/flask-conical.svg b/docs/assets/icons/flask-conical.svg
new file mode 100644
index 0000000..697e331
--- /dev/null
+++ b/docs/assets/icons/flask-conical.svg
@@ -0,0 +1,17 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-flask-conical"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2" />
+ <path d="M6.453 15h11.094" />
+ <path d="M8.5 2h7" />
+</svg>
diff --git a/docs/assets/icons/folder-tree.svg b/docs/assets/icons/folder-tree.svg
new file mode 100644
index 0000000..fdfa3fc
--- /dev/null
+++ b/docs/assets/icons/folder-tree.svg
@@ -0,0 +1,18 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-folder-tree"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z" />
+ <path d="M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z" />
+ <path d="M3 5a2 2 0 0 0 2 2h3" />
+ <path d="M3 3v13a2 2 0 0 0 2 2h3" />
+</svg>
diff --git a/docs/assets/icons/gauge.svg b/docs/assets/icons/gauge.svg
new file mode 100644
index 0000000..3a6188e
--- /dev/null
+++ b/docs/assets/icons/gauge.svg
@@ -0,0 +1,16 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-gauge"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="m12 14 4-4" />
+ <path d="M3.34 19a10 10 0 1 1 17.32 0" />
+</svg>
diff --git a/docs/assets/icons/house.svg b/docs/assets/icons/house.svg
new file mode 100644
index 0000000..4d00112
--- /dev/null
+++ b/docs/assets/icons/house.svg
@@ -0,0 +1,2 @@
+<!-- Lucide 0.460.0 (ISC) -->
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6CB2FF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8" /><path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" /></svg>
diff --git a/docs/assets/icons/image.svg b/docs/assets/icons/image.svg
new file mode 100644
index 0000000..ba152b4
--- /dev/null
+++ b/docs/assets/icons/image.svg
@@ -0,0 +1,17 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-image"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
+ <circle cx="9" cy="9" r="2" />
+ <path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
+</svg>
diff --git a/docs/assets/icons/languages.svg b/docs/assets/icons/languages.svg
new file mode 100644
index 0000000..c65f385
--- /dev/null
+++ b/docs/assets/icons/languages.svg
@@ -0,0 +1,20 @@
+<!-- @license lucide-static v1.49.0 - ISC -->
+<svg
+ class="lucide lucide-languages"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="m5 8 6 6" />
+ <path d="m4 14 6-6 2-3" />
+ <path d="M2 5h12" />
+ <path d="M7 2h1" />
+ <path d="m22 22-5-10-5 10" />
+ <path d="M14 18h6" />
+</svg>
diff --git a/docs/assets/icons/layers.svg b/docs/assets/icons/layers.svg
new file mode 100644
index 0000000..45874b4
--- /dev/null
+++ b/docs/assets/icons/layers.svg
@@ -0,0 +1,17 @@
+<!-- @license lucide-static v1.49.0 - ISC -->
+<svg
+ class="lucide lucide-layers"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" />
+ <path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12" />
+ <path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17" />
+</svg>
diff --git a/docs/assets/icons/list-checks.svg b/docs/assets/icons/list-checks.svg
new file mode 100644
index 0000000..354f678
--- /dev/null
+++ b/docs/assets/icons/list-checks.svg
@@ -0,0 +1,19 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-list-checks"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="m3 17 2 2 4-4" />
+ <path d="m3 7 2 2 4-4" />
+ <path d="M13 6h8" />
+ <path d="M13 12h8" />
+ <path d="M13 18h8" />
+</svg>
diff --git a/docs/assets/icons/lock-keyhole.svg b/docs/assets/icons/lock-keyhole.svg
new file mode 100644
index 0000000..f435c08
--- /dev/null
+++ b/docs/assets/icons/lock-keyhole.svg
@@ -0,0 +1,17 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-lock-keyhole"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <circle cx="12" cy="16" r="1" />
+ <rect x="3" y="10" width="18" height="12" rx="2" />
+ <path d="M7 10V7a5 5 0 0 1 10 0v3" />
+</svg>
diff --git a/docs/assets/icons/network.svg b/docs/assets/icons/network.svg
new file mode 100644
index 0000000..1bc827f
--- /dev/null
+++ b/docs/assets/icons/network.svg
@@ -0,0 +1,19 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-network"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <rect x="16" y="16" width="6" height="6" rx="1" />
+ <rect x="2" y="16" width="6" height="6" rx="1" />
+ <rect x="9" y="2" width="6" height="6" rx="1" />
+ <path d="M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3" />
+ <path d="M12 12V8" />
+</svg>
diff --git a/docs/assets/icons/rocket.svg b/docs/assets/icons/rocket.svg
new file mode 100644
index 0000000..d8625dd
--- /dev/null
+++ b/docs/assets/icons/rocket.svg
@@ -0,0 +1,18 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-rocket"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z" />
+ <path d="m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z" />
+ <path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0" />
+ <path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5" />
+</svg>
diff --git a/docs/assets/icons/route.svg b/docs/assets/icons/route.svg
new file mode 100644
index 0000000..6331b74
--- /dev/null
+++ b/docs/assets/icons/route.svg
@@ -0,0 +1,17 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-route"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <circle cx="6" cy="19" r="3" />
+ <path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15" />
+ <circle cx="18" cy="5" r="3" />
+</svg>
diff --git a/docs/assets/icons/scale.svg b/docs/assets/icons/scale.svg
new file mode 100644
index 0000000..b21f005
--- /dev/null
+++ b/docs/assets/icons/scale.svg
@@ -0,0 +1,19 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-scale"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z" />
+ <path d="m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z" />
+ <path d="M7 21h10" />
+ <path d="M12 3v18" />
+ <path d="M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2" />
+</svg>
diff --git a/docs/assets/icons/settings.svg b/docs/assets/icons/settings.svg
new file mode 100644
index 0000000..27b0083
--- /dev/null
+++ b/docs/assets/icons/settings.svg
@@ -0,0 +1,2 @@
+<!-- Lucide 0.460.0 (ISC) -->
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6CB2FF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></svg>
diff --git a/docs/assets/icons/shield-check.svg b/docs/assets/icons/shield-check.svg
new file mode 100644
index 0000000..25a89ca
--- /dev/null
+++ b/docs/assets/icons/shield-check.svg
@@ -0,0 +1,2 @@
+<!-- Lucide 0.460.0 (ISC) -->
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6CB2FF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" /><path d="m9 12 2 2 4-4" /></svg>
diff --git a/docs/assets/icons/sparkles.svg b/docs/assets/icons/sparkles.svg
new file mode 100644
index 0000000..6741254
--- /dev/null
+++ b/docs/assets/icons/sparkles.svg
@@ -0,0 +1,19 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-sparkles"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" />
+ <path d="M20 3v4" />
+ <path d="M22 5h-4" />
+ <path d="M4 17v2" />
+ <path d="M5 18H3" />
+</svg>
diff --git a/docs/assets/icons/target.svg b/docs/assets/icons/target.svg
new file mode 100644
index 0000000..e510f7d
--- /dev/null
+++ b/docs/assets/icons/target.svg
@@ -0,0 +1,17 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-target"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <circle cx="12" cy="12" r="10" />
+ <circle cx="12" cy="12" r="6" />
+ <circle cx="12" cy="12" r="2" />
+</svg>
diff --git a/docs/assets/icons/telescope.svg b/docs/assets/icons/telescope.svg
new file mode 100644
index 0000000..bb35e1a
--- /dev/null
+++ b/docs/assets/icons/telescope.svg
@@ -0,0 +1,2 @@
+<!-- Lucide 0.460.0 (ISC) -->
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#6CB2FF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44" /><path d="m13.56 11.747 4.332-.924" /><path d="m16 21-3.105-6.21" /><path d="M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z" /><path d="m6.158 8.633 1.114 4.456" /><path d="m8 21 3.105-6.21" /><circle cx="12" cy="13" r="2" /></svg>
diff --git a/docs/assets/icons/terminal.svg b/docs/assets/icons/terminal.svg
new file mode 100644
index 0000000..eed8d90
--- /dev/null
+++ b/docs/assets/icons/terminal.svg
@@ -0,0 +1,16 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-terminal"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <polyline points="4 17 10 11 4 5" />
+ <line x1="12" x2="20" y1="19" y2="19" />
+</svg>
diff --git a/docs/assets/icons/triangle-alert.svg b/docs/assets/icons/triangle-alert.svg
new file mode 100644
index 0000000..659f985
--- /dev/null
+++ b/docs/assets/icons/triangle-alert.svg
@@ -0,0 +1,17 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-triangle-alert"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" />
+ <path d="M12 9v4" />
+ <path d="M12 17h.01" />
+</svg>
diff --git a/docs/assets/icons/user-round.svg b/docs/assets/icons/user-round.svg
new file mode 100644
index 0000000..409e97f
--- /dev/null
+++ b/docs/assets/icons/user-round.svg
@@ -0,0 +1,16 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-user-round"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <circle cx="12" cy="8" r="5" />
+ <path d="M20 21a8 8 0 0 0-16 0" />
+</svg>
diff --git a/docs/assets/icons/wand-sparkles.svg b/docs/assets/icons/wand-sparkles.svg
new file mode 100644
index 0000000..b4e3560
--- /dev/null
+++ b/docs/assets/icons/wand-sparkles.svg
@@ -0,0 +1,22 @@
+<!-- @license lucide-static v0.469.0 - ISC -->
+<svg
+ class="lucide lucide-wand-sparkles"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72" />
+ <path d="m14 7 3 3" />
+ <path d="M5 6v4" />
+ <path d="M19 14v4" />
+ <path d="M10 2v2" />
+ <path d="M7 8H3" />
+ <path d="M21 16h-4" />
+ <path d="M11 3H9" />
+</svg>
diff --git a/docs/assets/icons/waypoints.svg b/docs/assets/icons/waypoints.svg
new file mode 100644
index 0000000..e8e20ed
--- /dev/null
+++ b/docs/assets/icons/waypoints.svg
@@ -0,0 +1,21 @@
+<!-- @license lucide-static v1.49.0 - ISC -->
+<svg
+ class="lucide lucide-waypoints"
+ xmlns="http://www.w3.org/2000/svg"
+ width="24"
+ height="24"
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="#6CB2FF"
+ stroke-width="2"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+>
+ <path d="m10.586 5.414-5.172 5.172" />
+ <path d="m18.586 13.414-5.172 5.172" />
+ <path d="M6 12h12" />
+ <circle cx="12" cy="20" r="2" />
+ <circle cx="12" cy="4" r="2" />
+ <circle cx="20" cy="12" r="2" />
+ <circle cx="4" cy="12" r="2" />
+</svg>
diff --git a/docs/assets/stack/accesibilidad.svg b/docs/assets/stack/accesibilidad.svg
new file mode 100644
index 0000000..b2aea10
--- /dev/null
+++ b/docs/assets/stack/accesibilidad.svg
@@ -0,0 +1,7 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="accesibilidad"><title>accesibilidad</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#9B7BEA" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <circle cx="16" cy="4" r="1" />
+ <path d="m18 19 1-7-6 1" />
+ <path d="m5 8 3-3 5.5 3-2.36 3.5" />
+ <path d="M4.24 14.5a5 5 0 0 0 6.88 6" />
+ <path d="M13.76 17.5a5 5 0 0 0-6.88-6" />
+</g></svg>
diff --git a/docs/assets/stack/capturas.svg b/docs/assets/stack/capturas.svg
new file mode 100644
index 0000000..ae125bc
--- /dev/null
+++ b/docs/assets/stack/capturas.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Capturas"><title>Capturas</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#3DBE95" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <rect x="14" y="14" width="4" height="6" rx="2" /><rect x="6" y="4" width="4" height="6" rx="2" /><path d="M6 20h4" /><path d="M14 10h4" /><path d="M6 14h2v6" /><path d="M14 4h2v6" />
+</g></svg>
diff --git a/docs/assets/stack/csp.svg b/docs/assets/stack/csp.svg
new file mode 100644
index 0000000..6d2d190
--- /dev/null
+++ b/docs/assets/stack/csp.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="csp"><title>csp</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#3DBE95" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" />
+ <path d="m9 12 2 2 4-4" />
+</g></svg>
diff --git a/docs/assets/stack/css.svg b/docs/assets/stack/css.svg
new file mode 100644
index 0000000..3c37e94
--- /dev/null
+++ b/docs/assets/stack/css.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="css"><title>css</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#663399" d="M0 0v20.16A3.84 3.84 0 0 0 3.84 24h16.32A3.84 3.84 0 0 0 24 20.16V3.84A3.84 3.84 0 0 0 20.16 0Zm14.256 13.08c1.56 0 2.28 1.08 2.304 2.64h-1.608c.024-.288-.048-.6-.144-.84-.096-.192-.288-.264-.552-.264-.456 0-.696.264-.696.84-.024.576.288.888.768 1.08.72.288 1.608.744 1.92 1.296q.432.648.432 1.656c0 1.608-.912 2.592-2.496 2.592-1.656 0-2.4-1.032-2.424-2.688h1.68c0 .792.264 1.176.792 1.176.264 0 .456-.072.552-.24.192-.312.24-1.176-.048-1.512-.312-.408-.912-.6-1.32-.816q-.828-.396-1.224-.936c-.24-.36-.36-.888-.36-1.536 0-1.44.936-2.472 2.424-2.448m5.4 0c1.584 0 2.304 1.08 2.328 2.64h-1.608c0-.288-.048-.6-.168-.84-.096-.192-.264-.264-.528-.264-.48 0-.72.264-.72.84s.288.888.792 1.08c.696.288 1.608.744 1.92 1.296.264.432.408.984.408 1.656.024 1.608-.888 2.592-2.472 2.592-1.68 0-2.424-1.056-2.448-2.688h1.68c0 .744.264 1.176.792 1.176.264 0 .456-.072.552-.24.216-.312.264-1.176-.048-1.512-.288-.408-.888-.6-1.32-.816-.552-.264-.96-.576-1.2-.936s-.36-.888-.36-1.536c-.024-1.44.912-2.472 2.4-2.448m-11.031.018c.711-.006 1.419.198 1.839.63.432.432.672 1.128.648 1.992H9.336c.024-.456-.096-.792-.432-.96-.312-.144-.768-.048-.888.24-.12.264-.192.576-.168.864v3.504c0 .744.264 1.128.768 1.128a.65.65 0 0 0 .552-.264c.168-.24.192-.552.168-.84h1.776c.096 1.632-.984 2.712-2.568 2.688-1.536 0-2.496-.864-2.472-2.472v-4.032c0-.816.24-1.44.696-1.848.432-.408 1.146-.624 1.857-.63"/></g></svg>
diff --git a/docs/assets/stack/estadisticas.svg b/docs/assets/stack/estadisticas.svg
new file mode 100644
index 0000000..9d30760
--- /dev/null
+++ b/docs/assets/stack/estadisticas.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Estadísticas"><title>Estadísticas</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#4FC3F7" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M3 3v16a2 2 0 0 0 2 2h16" /><path d="M18 17V9" /><path d="M13 17V5" /><path d="M8 17v-3" />
+</g></svg>
diff --git a/docs/assets/stack/experto.svg b/docs/assets/stack/experto.svg
new file mode 100644
index 0000000..c9a710e
--- /dev/null
+++ b/docs/assets/stack/experto.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Información experta"><title>Información experta</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#FFB020" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" /><path d="M12 9v4" /><path d="M12 17h.01" />
+</g></svg>
diff --git a/docs/assets/stack/filtros.svg b/docs/assets/stack/filtros.svg
new file mode 100644
index 0000000..c339179
--- /dev/null
+++ b/docs/assets/stack/filtros.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Filtros"><title>Filtros</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#F7B955" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z" />
+</g></svg>
diff --git a/docs/assets/stack/flujos.svg b/docs/assets/stack/flujos.svg
new file mode 100644
index 0000000..9d8a9aa
--- /dev/null
+++ b/docs/assets/stack/flujos.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Seguir flujo"><title>Seguir flujo</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#9B8CFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <circle cx="6" cy="19" r="3" /><path d="M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15" /><circle cx="18" cy="5" r="3" />
+</g></svg>
diff --git a/docs/assets/stack/git.svg b/docs/assets/stack/git.svg
new file mode 100644
index 0000000..6b9d432
--- /dev/null
+++ b/docs/assets/stack/git.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="git"><title>git</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#F05032" d="M13.09 23.549a1.54 1.54 0 0 1-2.18 0L.451 13.089a1.54 1.54 0 0 1 0-2.179l7.191-7.19 2.733 2.733a1.85 1.85 0 0 0 .964 2.326v6.66a1.849 1.849 0 1 0 1.54 0V8.957l2.508 2.508a1.85 1.85 0 1 0 1.09-1.09l-2.634-2.634a1.85 1.85 0 0 0-2.378-2.377L8.73 2.63 10.91.451a1.54 1.54 0 0 1 2.179 0l10.459 10.46a1.54 1.54 0 0 1 0 2.179z"/></g></svg>
diff --git a/docs/assets/stack/githubactions.svg b/docs/assets/stack/githubactions.svg
new file mode 100644
index 0000000..04a6dee
--- /dev/null
+++ b/docs/assets/stack/githubactions.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="githubactions"><title>githubactions</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#2088FF" d="M10.984 13.836a.5.5 0 0 1-.353-.146l-.745-.743a.5.5 0 1 1 .706-.708l.392.391 1.181-1.18a.5.5 0 0 1 .708.707l-1.535 1.533a.504.504 0 0 1-.354.146zm9.353-.147l1.534-1.532a.5.5 0 0 0-.707-.707l-1.181 1.18-.392-.391a.5.5 0 1 0-.706.708l.746.743a.497.497 0 0 0 .706-.001zM4.527 7.452l2.557-1.585A1 1 0 0 0 7.09 4.17L4.533 2.56A1 1 0 0 0 3 3.406v3.196a1.001 1.001 0 0 0 1.527.85zm2.03-2.436L4 6.602V3.406l2.557 1.61zM24 12.5c0 1.93-1.57 3.5-3.5 3.5a3.503 3.503 0 0 1-3.46-3h-2.08a3.503 3.503 0 0 1-3.46 3 3.502 3.502 0 0 1-3.46-3h-.558c-.972 0-1.85-.399-2.482-1.042V17c0 1.654 1.346 3 3 3h.04c.244-1.693 1.7-3 3.46-3 1.93 0 3.5 1.57 3.5 3.5S13.43 24 11.5 24a3.502 3.502 0 0 1-3.46-3H8c-2.206 0-4-1.794-4-4V9.899A5.008 5.008 0 0 1 0 5c0-2.757 2.243-5 5-5s5 2.243 5 5a5.005 5.005 0 0 1-4.952 4.998A2.482 2.482 0 0 0 7.482 12h.558c.244-1.693 1.7-3 3.46-3a3.502 3.502 0 0 1 3.46 3h2.08a3.503 3.503 0 0 1 3.46-3c1.93 0 3.5 1.57 3.5 3.5zm-15 8c0 1.378 1.122 2.5 2.5 2.5s2.5-1.122 2.5-2.5-1.122-2.5-2.5-2.5S9 19.122 9 20.5zM5 9c2.206 0 4-1.794 4-4S7.206 1 5 1 1 2.794 1 5s1.794 4 4 4zm9 3.5c0-1.378-1.122-2.5-2.5-2.5S9 11.122 9 12.5s1.122 2.5 2.5 2.5 2.5-1.122 2.5-2.5zm9 0c0-1.378-1.122-2.5-2.5-2.5S18 11.122 18 12.5s1.122 2.5 2.5 2.5 2.5-1.122 2.5-2.5zm-13 8a.5.5 0 1 0 1 0 .5.5 0 0 0-1 0zm2 0a.5.5 0 1 0 1 0 .5.5 0 0 0-1 0zm12 0c0 1.93-1.57 3.5-3.5 3.5a3.503 3.503 0 0 1-3.46-3.002c-.007.001-.013.005-.021.005l-.506.017h-.017a.5.5 0 0 1-.016-.999l.506-.017c.018-.002.035.006.052.007A3.503 3.503 0 0 1 20.5 17c1.93 0 3.5 1.57 3.5 3.5zm-1 0c0-1.378-1.122-2.5-2.5-2.5S18 19.122 18 20.5s1.122 2.5 2.5 2.5 2.5-1.122 2.5-2.5z"/></g></svg>
diff --git a/docs/assets/stack/githubpages.svg b/docs/assets/stack/githubpages.svg
new file mode 100644
index 0000000..7b2f85c
--- /dev/null
+++ b/docs/assets/stack/githubpages.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="githubpages"><title>githubpages</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#FFFFFF" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/></g></svg>
diff --git a/docs/assets/stack/html.svg b/docs/assets/stack/html.svg
new file mode 100644
index 0000000..2d938df
--- /dev/null
+++ b/docs/assets/stack/html.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="html"><title>html</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#E34F26" d="M1.5 0h21l-1.91 21.563L11.977 24l-8.564-2.438L1.5 0zm7.031 9.75l-.232-2.718 10.059.003.23-2.622L5.412 4.41l.698 8.01h9.126l-.326 3.426-2.91.804-2.955-.81-.188-2.11H6.248l.33 4.171L12 19.351l5.379-1.443.744-8.157H8.531z"/></g></svg>
diff --git a/docs/assets/stack/idiomas.svg b/docs/assets/stack/idiomas.svg
new file mode 100644
index 0000000..71a756e
--- /dev/null
+++ b/docs/assets/stack/idiomas.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="ES / EN"><title>ES / EN</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#3DBE95" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="m5 8 6 6" /><path d="m4 14 6-6 2-3" /><path d="M2 5h12" /><path d="M7 2h1" /><path d="m22 22-5-10-5 10" /><path d="M14 18h6" />
+</g></svg>
diff --git a/docs/assets/stack/javascript.svg b/docs/assets/stack/javascript.svg
new file mode 100644
index 0000000..7f6dd88
--- /dev/null
+++ b/docs/assets/stack/javascript.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="javascript"><title>javascript</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#F7DF1E" d="M0 0h24v24H0V0zm22.034 18.276c-.175-1.095-.888-2.015-3.003-2.873-.736-.345-1.554-.585-1.797-1.14-.091-.33-.105-.51-.046-.705.15-.646.915-.84 1.515-.66.39.12.75.42.976.9 1.034-.676 1.034-.676 1.755-1.125-.27-.42-.404-.601-.586-.78-.63-.705-1.469-1.065-2.834-1.034l-.705.089c-.676.165-1.32.525-1.71 1.005-1.14 1.291-.811 3.541.569 4.471 1.365 1.02 3.361 1.244 3.616 2.205.24 1.17-.87 1.545-1.966 1.41-.811-.18-1.26-.586-1.755-1.336l-1.83 1.051c.21.48.45.689.81 1.109 1.74 1.756 6.09 1.666 6.871-1.004.029-.09.24-.705.074-1.65l.046.067zm-8.983-7.245h-2.248c0 1.938-.009 3.864-.009 5.805 0 1.232.063 2.363-.138 2.711-.33.689-1.18.601-1.566.48-.396-.196-.597-.466-.83-.855-.063-.105-.11-.196-.127-.196l-1.825 1.125c.305.63.75 1.172 1.324 1.517.855.51 2.004.675 3.207.405.783-.226 1.458-.691 1.811-1.411.51-.93.402-2.07.397-3.346.012-2.054 0-4.109 0-6.179l.004-.056z"/></g></svg>
diff --git a/docs/assets/stack/json.svg b/docs/assets/stack/json.svg
new file mode 100644
index 0000000..64fd784
--- /dev/null
+++ b/docs/assets/stack/json.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="json"><title>json</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#FFFFFF" d="M12.043 23.968c.479-.004.953-.029 1.426-.094a11.805 11.805 0 003.146-.863 12.404 12.404 0 003.793-2.542 11.977 11.977 0 002.44-3.427 11.794 11.794 0 001.02-3.476c.149-1.16.135-2.346-.045-3.499a11.96 11.96 0 00-.793-2.788 11.197 11.197 0 00-.854-1.617c-1.168-1.837-2.861-3.314-4.81-4.3a12.835 12.835 0 00-2.172-.87h-.005c.119.063.24.132.345.201.12.074.239.146.351.225a8.93 8.93 0 011.559 1.33c1.063 1.145 1.797 2.548 2.218 4.041.284.982.434 1.998.495 3.017.044.743.044 1.491-.047 2.229-.149 1.27-.554 2.51-1.228 3.596a7.475 7.475 0 01-1.903 2.084c-1.244.928-2.877 1.482-4.436 1.114a3.916 3.916 0 01-.748-.258 4.692 4.692 0 01-.779-.45 6.08 6.08 0 01-1.244-1.105 6.507 6.507 0 01-1.049-1.747 7.366 7.366 0 01-.494-2.54c-.03-1.273.225-2.553.854-3.67a6.43 6.43 0 011.663-1.918c.225-.178.464-.333.704-.479l.016-.007a5.121 5.121 0 00-1.441-.12 4.963 4.963 0 00-1.228.24c-.359.12-.704.27-1.019.45a6.146 6.146 0 00-.733.494c-.211.18-.42.36-.615.555-1.123 1.153-1.768 2.682-2.022 4.256-.15.973-.15 1.96-.091 2.95.105 1.395.391 2.787.945 4.062a8.518 8.518 0 001.348 2.173 8.14 8.14 0 003.132 2.23 7.934 7.934 0 002.113.54c.074.015.149.015.209.015zm-2.934-.398a4.102 4.102 0 01-.45-.228 8.5 8.5 0 01-2.038-1.534c-1.094-1.137-1.827-2.566-2.247-4.08a15.184 15.184 0 01-.495-3.172 12.14 12.14 0 01.046-2.082c.135-1.257.495-2.501 1.124-3.58a6.889 6.889 0 011.783-2.053 6.23 6.23 0 011.633-.9 5.363 5.363 0 013.522-.045c.029 0 .029 0 .045.03.015.015.045.015.06.03.045.016.104.045.165.074.239.12.479.271.704.42a6.294 6.294 0 012.097 2.502c.42.914.615 1.934.631 2.938.014 1.079-.18 2.157-.645 3.146a6.42 6.42 0 01-2.638 2.832c.09.03.18.045.271.075.225.044.449.074.688.074 1.468.045 2.892-.66 3.94-1.647.195-.18.375-.375.54-.585.225-.27.435-.54.614-.823.239-.375.435-.75.614-1.154a8.112 8.112 0 00.509-1.664c.196-1.004.211-2.022.149-3.026-.135-2.022-.673-4.045-1.842-5.724a9.054 9.054 0 00-.555-.719 9.868 9.868 0 00-1.063-1.034 8.477 8.477 0 00-1.363-.915 9.927 9.927 0 00-1.692-.598l-.3-.06c-.209-.03-.42-.044-.634-.06a8.453 8.453 0 00-1.015.016c-.704.045-1.412.16-2.112.337C5.799 1.227 2.863 3.566 1.3 6.67A11.834 11.834 0 00.238 9.801a11.81 11.81 0 00-.104 3.775c.12 1.02.374 2.023.778 2.977.227.57.511 1.124.825 1.648 1.094 1.783 2.683 3.236 4.51 4.24.688.39 1.408.69 2.157.944.226.074.45.15.689.21z"/></g></svg>
diff --git a/docs/assets/stack/lucide.svg b/docs/assets/stack/lucide.svg
new file mode 100644
index 0000000..cb5dbdb
--- /dev/null
+++ b/docs/assets/stack/lucide.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="lucide"><title>lucide</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#F56565" d="M18.483 1.123a1.09 1.09 0 0 0-.752.362 1.09 1.09 0 0 0 .088 1.54 11.956 11.956 0 0 1 4 8.946 7.62 7.62 0 0 1-7.637 7.636 7.62 7.62 0 0 1-7.637-7.636 3.255 3.255 0 0 1 3.273-3.273c1.82 0 3.273 1.45 3.273 3.273a1.09 1.09 0 0 0 1.09 1.09 1.09 1.09 0 0 0 1.092-1.09c0-3-2.455-5.455-5.455-5.455s-5.454 2.455-5.454 5.455c0 5.408 4.408 9.818 9.818 9.818 5.41 0 9.818-4.41 9.818-9.818A14.16 14.16 0 0 0 19.272 1.4a1.09 1.09 0 0 0-.789-.277ZM9.818 2.15C4.408 2.151 0 6.561 0 11.97a14.16 14.16 0 0 0 4.8 10.637 1.09 1.09 0 0 0 1.54-.096 1.09 1.09 0 0 0-.095-1.54 11.957 11.957 0 0 1-4.063-9 7.62 7.62 0 0 1 7.636-7.637 7.62 7.62 0 0 1 7.637 7.636 3.256 3.256 0 0 1-3.273 3.273 3.256 3.256 0 0 1-3.273-3.273 1.09 1.09 0 0 0-1.09-1.09 1.09 1.09 0 0 0-1.092 1.09c0 3 2.455 5.455 5.455 5.455s5.454-2.455 5.454-5.455c0-5.408-4.408-9.818-9.818-9.818z"/></g></svg>
diff --git a/docs/assets/stack/modulos.svg b/docs/assets/stack/modulos.svg
new file mode 100644
index 0000000..0e7b833
--- /dev/null
+++ b/docs/assets/stack/modulos.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Módulos"><title>Módulos</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#6CB2FF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z" /><path d="M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12" /><path d="M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17" />
+</g></svg>
diff --git a/docs/assets/stack/navegador.svg b/docs/assets/stack/navegador.svg
new file mode 100644
index 0000000..fecbbb0
--- /dev/null
+++ b/docs/assets/stack/navegador.svg
@@ -0,0 +1,6 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="navegador"><title>navegador</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#2EAD33" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="m9 10 2 2 4-4" />
+ <rect width="20" height="14" x="2" y="3" rx="2" />
+ <path d="M12 17v4" />
+ <path d="M8 21h8" />
+</g></svg>
diff --git a/docs/assets/stack/nodejs.svg b/docs/assets/stack/nodejs.svg
new file mode 100644
index 0000000..a57da51
--- /dev/null
+++ b/docs/assets/stack/nodejs.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="nodejs"><title>nodejs</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)"><path fill="#5FA04E" d="M11.998,24c-0.321,0-0.641-0.084-0.922-0.247l-2.936-1.737c-0.438-0.245-0.224-0.332-0.08-0.383 c0.585-0.203,0.703-0.25,1.328-0.604c0.065-0.037,0.151-0.023,0.218,0.017l2.256,1.339c0.082,0.045,0.197,0.045,0.272,0l8.795-5.076 c0.082-0.047,0.134-0.141,0.134-0.238V6.921c0-0.099-0.053-0.192-0.137-0.242l-8.791-5.072c-0.081-0.047-0.189-0.047-0.271,0 L3.075,6.68C2.99,6.729,2.936,6.825,2.936,6.921v10.15c0,0.097,0.054,0.189,0.139,0.235l2.409,1.392 c1.307,0.654,2.108-0.116,2.108-0.89V7.787c0-0.142,0.114-0.253,0.256-0.253h1.115c0.139,0,0.255,0.112,0.255,0.253v10.021 c0,1.745-0.95,2.745-2.604,2.745c-0.508,0-0.909,0-2.026-0.551L2.28,18.675c-0.57-0.329-0.922-0.945-0.922-1.604V6.921 c0-0.659,0.353-1.275,0.922-1.603l8.795-5.082c0.557-0.315,1.296-0.315,1.848,0l8.794,5.082c0.57,0.329,0.924,0.944,0.924,1.603 v10.15c0,0.659-0.354,1.273-0.924,1.604l-8.794,5.078C12.643,23.916,12.324,24,11.998,24z M19.099,13.993 c0-1.9-1.284-2.406-3.987-2.763c-2.731-0.361-3.009-0.548-3.009-1.187c0-0.528,0.235-1.233,2.258-1.233 c1.807,0,2.473,0.389,2.747,1.607c0.024,0.115,0.129,0.199,0.247,0.199h1.141c0.071,0,0.138-0.031,0.186-0.081 c0.048-0.054,0.074-0.123,0.067-0.196c-0.177-2.098-1.571-3.076-4.388-3.076c-2.508,0-4.004,1.058-4.004,2.833 c0,1.925,1.488,2.457,3.895,2.695c2.88,0.282,3.103,0.703,3.103,1.269c0,0.983-0.789,1.402-2.642,1.402 c-2.327,0-2.839-0.584-3.011-1.742c-0.02-0.124-0.126-0.215-0.253-0.215h-1.137c-0.141,0-0.254,0.112-0.254,0.253 c0,1.482,0.806,3.248,4.655,3.248C17.501,17.007,19.099,15.91,19.099,13.993z"/></g></svg>
diff --git a/docs/assets/stack/pruebas.svg b/docs/assets/stack/pruebas.svg
new file mode 100644
index 0000000..7818868
--- /dev/null
+++ b/docs/assets/stack/pruebas.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="pruebas"><title>pruebas</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#5FA04E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2" />
+ <path d="M6.453 15h11.094" />
+ <path d="M8.5 2h7" />
+</g></svg>
diff --git a/docs/assets/stack/retos.svg b/docs/assets/stack/retos.svg
new file mode 100644
index 0000000..79df121
--- /dev/null
+++ b/docs/assets/stack/retos.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Retos"><title>Retos</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#FF6B8B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <circle cx="12" cy="12" r="10" /><circle cx="12" cy="12" r="6" /><circle cx="12" cy="12" r="2" />
+</g></svg>
diff --git a/docs/assets/stack/sin-terceros.svg b/docs/assets/stack/sin-terceros.svg
new file mode 100644
index 0000000..f4883fb
--- /dev/null
+++ b/docs/assets/stack/sin-terceros.svg
@@ -0,0 +1,9 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="sin-terceros"><title>sin-terceros</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#E0457B" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M12 20h.01" />
+ <path d="M8.5 16.429a5 5 0 0 1 7 0" />
+ <path d="M5 12.859a10 10 0 0 1 5.17-2.69" />
+ <path d="M19 12.859a10 10 0 0 0-2.007-1.523" />
+ <path d="M2 8.82a15 15 0 0 1 4.177-2.643" />
+ <path d="M22 8.82a15 15 0 0 0-11.288-3.764" />
+ <path d="m2 2 20 20" />
+</g></svg>
diff --git a/docs/assets/stack/webgl.svg b/docs/assets/stack/webgl.svg
new file mode 100644
index 0000000..6c8fea5
--- /dev/null
+++ b/docs/assets/stack/webgl.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256" role="img" aria-label="Megalodón 3D"><title>Megalodón 3D</title><rect width="256" height="256" rx="60" fill="#242938"/><g transform="translate(58 58) scale(5.8333)" fill="none" stroke="#6CB2FF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z" /><path d="M18 12v.5" /><path d="M16 17.93a9.77 9.77 0 0 1 0-11.86" /><path d="M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33" /><path d="M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4" /><path d="m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98" />
+</g></svg>
diff --git a/docs/capturas/beacon.webp b/docs/capturas/beacon.webp
index 8eac955..5e5fdbe 100644
Binary files a/docs/capturas/beacon.webp and b/docs/capturas/beacon.webp differ
diff --git a/docs/capturas/experto.webp b/docs/capturas/experto.webp
index 980742b..3f09d09 100644
Binary files a/docs/capturas/experto.webp and b/docs/capturas/experto.webp differ
diff --git a/docs/capturas/ingles-claro.webp b/docs/capturas/ingles-claro.webp
new file mode 100644
index 0000000..0906b72
Binary files /dev/null and b/docs/capturas/ingles-claro.webp differ
diff --git a/docs/capturas/inicio-claro.webp b/docs/capturas/inicio-claro.webp
index afe530b..ac4e317 100644
Binary files a/docs/capturas/inicio-claro.webp and b/docs/capturas/inicio-claro.webp differ
diff --git a/docs/capturas/inicio-oscuro.webp b/docs/capturas/inicio-oscuro.webp
index d82133c..b245cea 100644
Binary files a/docs/capturas/inicio-oscuro.webp and b/docs/capturas/inicio-oscuro.webp differ
diff --git a/docs/capturas/lateral-plegado.webp b/docs/capturas/lateral-plegado.webp
new file mode 100644
index 0000000..e39765d
Binary files /dev/null and b/docs/capturas/lateral-plegado.webp differ
diff --git a/docs/capturas/modulo-1.webp b/docs/capturas/modulo-1.webp
index 8c69d78..eb6f486 100644
Binary files a/docs/capturas/modulo-1.webp and b/docs/capturas/modulo-1.webp differ
diff --git a/docs/capturas/mordisco.webp b/docs/capturas/mordisco.webp
index 6e0b755..b4484fc 100644
Binary files a/docs/capturas/mordisco.webp and b/docs/capturas/mordisco.webp differ
diff --git a/docs/capturas/movil-mas.webp b/docs/capturas/movil-mas.webp
new file mode 100644
index 0000000..67413f2
Binary files /dev/null and b/docs/capturas/movil-mas.webp differ
diff --git a/docs/capturas/movil-pestanas.webp b/docs/capturas/movil-pestanas.webp
new file mode 100644
index 0000000..e1051b9
Binary files /dev/null and b/docs/capturas/movil-pestanas.webp differ
diff --git a/docs/capturas/movil.webp b/docs/capturas/movil.webp
index 6467063..08c2df3 100644
Binary files a/docs/capturas/movil.webp and b/docs/capturas/movil.webp differ
diff --git a/docs/capturas/objetos-http.webp b/docs/capturas/objetos-http.webp
index a9ed61f..966d6f7 100644
Binary files a/docs/capturas/objetos-http.webp and b/docs/capturas/objetos-http.webp differ
diff --git a/docs/capturas/plano-tecnico.webp b/docs/capturas/plano-tecnico.webp
index 19df7fe..abe81c9 100644
Binary files a/docs/capturas/plano-tecnico.webp and b/docs/capturas/plano-tecnico.webp differ
diff --git a/docs/capturas/protrusion.webp b/docs/capturas/protrusion.webp
index 637f267..115c393 100644
Binary files a/docs/capturas/protrusion.webp and b/docs/capturas/protrusion.webp differ
diff --git a/megalodon.html b/megalodon.html
index 6e9e91f..4ff8a83 100644
--- a/megalodon.html
+++ b/megalodon.html
@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
-<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-pn2vRYCetiqbn/L+xmzndCqqTk9YXQtcQKAXQiHqi8k='; style-src 'sha256-rmkrZDF7Hk+AyhUGvb2gHXy962h26YoGG4S+4cFIZVk='; img-src data: blob:; connect-src 'none'; font-src 'none'; object-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'">
+<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'sha256-y/5U0uCLqnyYytoYMQTZnUNyh772yvAzk5feC5A9+xI='; style-src 'sha256-C96SuEnKUh+J8kkbNV7gTpU17KM0Edca82DmDD9F5Sw='; img-src data: blob:; connect-src 'none'; font-src 'none'; object-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'">
<meta name="referrer" content="no-referrer">
<meta name="color-scheme" content="dark light">
<meta name="description" content="Megalodon: laboratorio de Wireshark sin conexión. Capturas de un pentest, filtros con validación al instante y retos guiados del saludo TCP a los ataques web.">
@@ -654,12 +654,127 @@ li[aria-level='1'] > .tn .tl { font-weight: 650; font-family: var(--font-sans);
.tbl.ex td.mono { word-break: normal; overflow-wrap: anywhere; min-width: 14ch; }
.tbl.ex th:nth-child(3), .tbl.ex td:nth-child(3) { display: none; } /* el protocolo ya va en el mensaje */
}
+
+/* ========== Armazón 1.3: barra lateral plegable, barra superior flotante y pestañas en el móvil ==========
+ Mismo lenguaje que BlueJr y RiskManager-Jr. Movimiento: muelle sin rebote al plegar, indicador que se desliza,
+ :active a 0,97 y entrada escalonada solo en la primera carga. Con movimiento reducido, sin desplazamientos. */
+:root { --top-h: 80px; --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); --hair: rgb(255 255 255 / 0.07); --hair-2: rgb(255 255 255 / 0.12); --sidebar: rgb(18 21 27 / 0.92); --tint: rgb(108 178 255 / 0.12); }
+[data-theme='light'] { --hair: rgb(15 23 42 / 0.08); --hair-2: rgb(15 23 42 / 0.13); --sidebar: rgb(255 255 255 / 0.94); --tint: rgb(20 63 148 / 0.08); }
+.app { --sw: 264px; display: grid; grid-template-columns: calc(var(--sw) + 12px) minmax(0, 1fr); min-height: 100dvh; transition: grid-template-columns 320ms var(--ease-drawer); }
+body.side-mini .app { --sw: 68px; }
+.col { min-width: 0; padding: 0 16px 40px; }
+
+/* Lateral */
+.side { --w: var(--sw); position: sticky; top: 0; z-index: 35; height: 100dvh; width: calc(var(--w) + 12px); padding: 12px 0 12px 12px; display: flex; flex-direction: column; overflow: hidden; transition: width 320ms var(--ease-drawer); }
+.side::before { content: ''; position: absolute; inset: 12px 0 12px 12px; z-index: -1; border-radius: 24px; background: var(--sidebar); box-shadow: 0 0 0 1px var(--hair), var(--sh-panel); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); transition: box-shadow 320ms var(--ease-out); }
+.side > * { width: var(--w); transition: width 320ms var(--ease-drawer); }
+body.side-mini .side:is(:hover, :focus-within) { --w: 264px; }
+body.side-mini .side:is(:hover, :focus-within)::before { box-shadow: 0 0 0 1px var(--hair), var(--sh-overlay); }
+body.side-mini .side :is(.txt, .cnt, .brand-txt, .lvl-txt) { opacity: 0; transition: opacity 140ms var(--ease-out); }
+body.side-mini .side:is(:hover, :focus-within) :is(.txt, .cnt, .brand-txt, .lvl-txt) { opacity: 1; transition-delay: 90ms; }
+.side-brand { display: flex; align-items: center; gap: 12px; padding: 18px 15px 12px; color: var(--ink); text-decoration: none; white-space: nowrap; }
+.side-brand .logo, .brand-m .logo { width: 38px; height: 38px; border-radius: 12px; flex: none; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #1fd38a)); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
+.brand-txt { display: grid; min-width: 0; }
+.brand-txt b { font-size: 17px; font-weight: 720; letter-spacing: -0.02em; }
+.brand-txt small { font: 500 11px/1.3 var(--font-mono); letter-spacing: 0.06em; color: var(--ink-3); text-transform: uppercase; }
+.side-nav { position: relative; flex: 1; padding: 6px 10px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
+.side-nav ul { list-style: none; margin: 2px 0 6px; padding: 0; }
+.side-ind { position: absolute; left: 10px; right: 10px; top: 0; height: 40px; border-radius: 12px; background: var(--tint); opacity: 0; pointer-events: none; transition: transform 340ms var(--ease-out), height 340ms var(--ease-out), opacity 200ms; }
+.side-ind::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
+.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 14.5px; white-space: nowrap; transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 140ms var(--ease-out); }
+.side-nav a:active { transform: scale(0.97); }
+.side-nav a[aria-current='page'] { color: var(--ink); }
+.side-nav a[aria-current='page'] > .i { color: var(--accent); }
+.side-nav a.sub { min-height: 36px; padding-left: 13px; font-size: 13.5px; font-weight: 500; }
+.side-nav .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
+.side-nav .cnt { font: 500 12px var(--font-mono); color: var(--ink-3); }
+.dotn { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 7px; border: 1.5px solid var(--ink-4); transition: transform 220ms var(--ease-out); }
+.dotn b { font: 600 11px var(--font-mono); color: var(--ink-2); }
+.dotn.mid { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
+.dotn.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); }
+@media (hover: hover) and (pointer: fine) {
+ .side-nav a:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); color: var(--ink); }
+ .side-nav a:hover .dotn { transform: scale(1.12); }
+}
+body.ready .side-nav > a, body.ready .side-nav li { animation: none; }
+.side-nav > a, .side-nav li { animation: side-in 300ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 25ms + 40ms); }
+@keyframes side-in { from { opacity: 0; transform: translateX(-8px); } }
+.side-foot { padding: 12px 10px 14px; border-top: 1px solid var(--hair); }
+.lvl { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; color: var(--ink); text-decoration: none; white-space: nowrap; transition: background-color 160ms var(--ease-out); }
+.lvl:active { transform: scale(0.98); }
+.lvl-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--ok-soft); color: var(--ok); }
+.lvl-txt { display: grid; gap: 6px; min-width: 0; flex: 1; font-size: 13px; }
+.lvl-txt b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
+.lvl.bump .lvl-ic { animation: bump 0.45s var(--spring); }
+@media (hover: hover) and (pointer: fine) { .lvl:hover { background: var(--surface-2); } }
+
+/* Barra superior flotante */
+.top { position: sticky; top: 0; z-index: 30; padding-top: 12px; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
+.top-in { display: flex; align-items: center; gap: 8px; height: auto; min-height: 56px; width: 100%; padding: 8px 10px; border-radius: 999px; background: var(--glass); box-shadow: 0 0 0 1px var(--hair), var(--sh-panel); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
+.top-in > :not(.grow) { flex-shrink: 0; }
+.top .ibtn { border-radius: 50%; width: 40px; height: 40px; }
+.brand-m { display: none; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 720; letter-spacing: -0.02em; }
+.brand-m .logo { width: 32px; height: 32px; border-radius: 10px; }
+.top .search-btn { min-width: 230px; width: auto; height: 40px; padding: 0 8px 0 14px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair-2); justify-content: flex-start; color: var(--ink-3); }
+.top .search-btn .sb-t { flex: 1; text-align: left; display: inline; }
+.top .search-btn kbd { display: inline-block; }
+@media (hover: hover) and (pointer: fine) { .top .search-btn:hover { box-shadow: inset 0 0 0 1px var(--accent); } }
+/* Interruptores del mismo tamaño: 80 × 40, relleno 3 y dos huecos de 36 × 32 */
+.lang-sw { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); }
+.lang-sw button { min-width: 36px; height: 32px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font: 650 12px var(--font-mono); transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), box-shadow 200ms var(--ease-out); }
+.lang-sw button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--hair-2), var(--sh-raise); }
+.lang-sw button:active { transform: scale(0.94); }
+.theme-sw { position: relative; display: inline-flex; width: 80px; height: 40px; padding: 3px; border: 0; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); cursor: pointer; }
+.theme-sw .track { position: relative; z-index: 1; display: grid; grid-template-columns: 36px 36px; width: 100%; height: 100%; place-items: center; color: var(--ink-3); pointer-events: none; }
+.theme-sw .track .i { width: 15px; height: 15px; transition: color 200ms var(--ease-out); }
+.theme-sw[aria-checked='false'] .track .i:first-child, .theme-sw[aria-checked='true'] .track .i:last-child { color: var(--ink); }
+.theme-sw .knob { position: absolute; top: 3px; left: 3px; width: 36px; height: 34px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--hair-2), var(--sh-raise); transition: transform 280ms var(--ease-out); }
+.theme-sw[aria-checked='true'] .knob { transform: translateX(38px); }
+.theme-sw:active .knob { width: 40px; }
+.theme-sw[aria-checked='true']:active .knob { transform: translateX(34px); }
+
+/* Pestañas del móvil */
+.tabbar { display: none; }
+.more-list { display: grid; gap: 4px; }
+.more-list a, .more-list button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 550; text-decoration: none; text-align: left; }
+.more-list span { flex: 1; }
+.more-list a:active, .more-list button:active { transform: scale(0.98); }
+
+.hero { border-radius: 24px; margin-top: 14px; }
+html { scroll-padding-top: calc(var(--top-h) + 16px); }
+
+@media (max-width: 1100px) { .top .search-btn { min-width: 0; width: 40px; padding: 0; justify-content: center; } .top .search-btn .sb-t, .top .search-btn kbd { display: none; } }
+@media (max-width: 900px) {
+ .app, body.side-mini .app { grid-template-columns: minmax(0, 1fr); }
+ .side, .only-desk { display: none !important; }
+ .brand-m { display: inline-flex; }
+ .col { padding: 0 max(12px, env(safe-area-inset-left)) calc(96px + env(safe-area-inset-bottom)); }
+ .top .search-btn { background: none; box-shadow: none; color: var(--ink-2); }
+ .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; padding: 6px; border-radius: 24px; background: var(--glass-thick); box-shadow: 0 0 0 1px var(--hair), var(--sh-overlay); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
+ .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; min-height: 48px; padding: 7px 2px 5px; border: 0; border-radius: 18px; background: none; color: var(--ink-2); text-decoration: none; font: inherit; font-size: 11px; font-weight: 550; transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 140ms var(--ease-out); }
+ .tabbar a:active, .tabbar button:active { transform: scale(0.94); }
+ .tabbar [aria-current='page'] { background: var(--tint); color: var(--ink); }
+ .tabbar [aria-current='page'] .i { color: var(--accent); }
+ .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
+ .hero { margin-inline: -12px; border-radius: 0 0 24px 24px; margin-top: 10px; }
+}
+@media (max-width: 420px) { .brand-m b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } .top-in { gap: 4px; padding: 6px 8px; } }
+@media (prefers-reduced-motion: reduce) {
+ .app, .side, .side > *, .side-ind, .theme-sw .knob { transition: none !important; }
+ .side-nav > a, .side-nav li { animation: none; }
+}
</style>
</head>
<body>
<a class="skip" href="#main" id="skip">Saltar al contenido</a>
-<header id="top" class="top"></header>
-<main id="main" tabindex="-1"></main>
+<div class="app">
+ <aside id="side" class="side"></aside>
+ <div class="col">
+ <header id="top" class="top"></header>
+ <main id="main" tabindex="-1"></main>
+ </div>
+</div>
+<nav id="tabbar" class="tabbar"></nav>
<dialog id="dlg" class="dlg"></dialog>
<div id="toasts" class="toasts" role="status" aria-live="polite"></div>
<noscript><p class="noscript">Megalodon necesita JavaScript. Todo funciona en tu navegador, sin conexión.</p></noscript>
@@ -690,6 +805,8 @@ const ICONS={"handshake":"<path d=\"m11 17 2 2a1 1 0 1 0 3-3\" /><path d=\"m14 1
"ok":"<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m16 9-5.5 5.5L8 12\" />",
"hint":"<path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\" /><path d=\"M9 18h6\" /><path d=\"M10 22h4\" />",
"filter":"<path d=\"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z\" />",
+"panel":"<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" /><path d=\"M9 3v18\" />",
+"more":"<circle cx=\"12\" cy=\"12\" r=\"1\" /><circle cx=\"19\" cy=\"12\" r=\"1\" /><circle cx=\"5\" cy=\"12\" r=\"1\" />",
"pause":"<rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" /><rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />",
"play":"<path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\" />",
"chevR":"<path d=\"m9 18 6-6-6-6\" />",
@@ -2314,6 +2431,7 @@ const MODULES = [
id: 'm1', n: 1, cap: 'm1', icon: 'handshake', mins: 25,
title: 'El saludo TCP', sub: 'Handshake de tres pasos, puertos, flags, Seq/Ack y cierre',
badge: 'Domador del handshake',
+ title_en: 'The TCP handshake', sub_en: 'Three-way handshake, ports, flags, Seq/Ack and teardown', badge_en: 'Handshake tamer',
intro: 'Kali (192.168.56.10) visita la web del laboratorio (192.168.56.20). Antes de que viaje un solo byte de HTTP, las dos máquinas se saludan. Aquí aprendes a leer ese saludo como lo hace un pentester.',
lessons: [
{ h: 'Las tres zonas de Wireshark', p: ['Arriba está la **lista de paquetes**: una fila por paquete, con número, tiempo, origen, destino, protocolo, longitud e información resumida.', 'En medio, el **árbol de detalle**: el mismo paquete abierto por capas (Ethernet → IP → TCP → HTTP). Abajo, los **bytes** en hexadecimal. Si pulsas un campo del árbol, sus bytes se iluminan; si pulsas un byte, se abre su campo.', 'Los colores no son decoración: violeta claro es TCP, verde es HTTP, gris oscuro con letras rojas es un problema TCP y rojo es un RST.'], try: [['tcp', 'Solo TCP'], ['arp', 'Solo ARP: quién tiene esta IP']] },
@@ -2337,6 +2455,7 @@ const MODULES = [
id: 'm2', n: 2, cap: 'm2', icon: 'globe', mins: 30,
title: 'HTTP al desnudo', sub: 'Peticiones, cabeceras, métodos, códigos de estado y Follow Stream',
badge: 'Lector de HTTP',
+ title_en: 'HTTP laid bare', sub_en: 'Requests, headers, methods, status codes and Follow Stream', badge_en: 'HTTP reader',
intro: 'Marta entra en la tienda tienda.ewpt.local, inicia sesión y navega por su panel. Todo va por HTTP sin cifrar, así que lo puedes leer entero.',
lessons: [
{ h: 'Petición y respuesta', p: ['Una petición HTTP empieza con la **línea de petición**: método, ruta y versión, por ejemplo `GET /login HTTP/1.1`. Debajo van las cabeceras y, tras una línea vacía, el cuerpo (si lo hay).', 'La respuesta empieza con la **línea de estado**: `HTTP/1.1 200 OK`. Wireshark enlaza cada respuesta con su petición: en el árbol verás «Petición en la trama» y la URI pedida.'], try: [['http.request', 'Solo peticiones'], ['http.response', 'Solo respuestas']] },
@@ -2360,6 +2479,7 @@ const MODULES = [
id: 'm3', n: 3, cap: 'm3', icon: 'cookie', mins: 30,
title: 'Cookies y credenciales en claro', sub: 'Sesiones, Basic Auth, formularios y FTP',
badge: 'Cazador de credenciales',
+ title_en: 'Cookies and cleartext credentials', sub_en: 'Sessions, Basic Auth, forms and FTP', badge_en: 'Credential hunter',
intro: 'En la intranet de una empresa, un equipo Windows (192.168.56.40) entra en un panel con Basic Auth, inicia sesión en un formulario y se conecta por FTP. Ninguno de los tres protocolos cifra nada.',
lessons: [
{ h: 'Cookies: la memoria de la web', p: ['HTTP no recuerda quién eres entre peticiones. Tras el login, el servidor te da una **cookie de sesión** con `Set-Cookie` y tu navegador la devuelve en cada petición con `Cookie`. Quien tenga esa cookie **es** tú para el servidor.', 'Los atributos de la cookie importan: **HttpOnly** impide que JavaScript la lea (frena el robo por XSS), **Secure** obliga a enviarla solo por HTTPS y **SameSite** limita los envíos desde otras webs.'], try: [['http.set_cookie', 'El servidor reparte cookies'], ['http.cookie contains "PHPSESSID"', 'El cliente las devuelve']] },
@@ -2382,6 +2502,7 @@ const MODULES = [
id: 'm4', n: 4, cap: 'm4', icon: 'signpost', mins: 20,
title: 'DNS: la guía de teléfonos', sub: 'Consultas, respuestas, tipos de registro y NXDOMAIN',
badge: 'Rastreador de nombres',
+ title_en: 'DNS: the phone book', sub_en: 'Queries, answers, record types and NXDOMAIN', badge_en: 'Name tracker',
intro: 'Antes de visitar una web, el equipo pregunta su IP al DNS. Esa conversación cuenta mucho: qué servicios existen, dónde están alojados y qué nombres no existen.',
lessons: [
{ h: 'Pregunta y respuesta', p: ['DNS suele ir por **UDP al puerto 53**. El cliente pregunta («¿qué IP tiene www.ewpt.local?») y el servidor responde con el mismo **ID de transacción**, así se emparejan.', '`dns.flags.response == 0` son preguntas y `== 1` respuestas. El nombre preguntado está en `dns.qry.name`.'], try: [['dns.flags.response == 0', 'Solo preguntas'], ['dns.qry.name contains "ewpt"', 'Nombres del laboratorio']] },
@@ -2401,6 +2522,7 @@ const MODULES = [
id: 'm5', n: 5, cap: 'm5', icon: 'lock', mins: 25,
title: 'TLS: lo que el cifrado deja ver', sub: 'Client Hello, SNI, ALPN, TLS 1.3 y HTTP sin cifrar',
badge: 'Ojo de cerradura',
+ title_en: 'TLS: what encryption still shows', sub_en: 'Client Hello, SNI, ALPN, TLS 1.3 and unencrypted HTTP', badge_en: 'Keyhole eye',
intro: 'Kali abre dos webs por HTTPS y, por despiste, envía un login por HTTP normal. Vas a comprobar qué esconde TLS y qué no.',
lessons: [
{ h: 'El saludo TLS', p: ['Tras el saludo TCP llega el saludo TLS. El cliente envía **Client Hello** (versiones y cifrados que acepta, y el nombre del sitio) y el servidor responde **Server Hello** con lo elegido. En TLS 1.3, casi todo lo que viene después ya va cifrado.', 'El tipo de mensaje está en `tls.handshake.type`: 1 es Client Hello y 2 Server Hello.'], try: [['tls.handshake.type == 1', 'Client Hello'], ['tls.handshake.type == 2', 'Server Hello']] },
@@ -2421,6 +2543,7 @@ const MODULES = [
id: 'm6', n: 6, cap: 'm6', icon: 'swords', mins: 40,
title: 'Ataques web en el tráfico', sub: 'Escaneo SYN, fuerza bruta de directorios y de login, SQLi y XSS',
badge: 'Ojo de halcón',
+ title_en: 'Web attacks on the wire', sub_en: 'SYN scan, directory and login brute force, SQLi and XSS', badge_en: 'Hawk eye',
intro: 'Desde Kali alguien escanea el servidor, busca directorios ocultos, prueba contraseñas en bucle e inyecta SQL y JavaScript. Todo queda en la captura; aprende a reconocer cada firma.',
lessons: [
{ h: 'Escaneo SYN (nmap -sS)', p: ['El atacante envía un **SYN** a muchos puertos desde el **mismo puerto de origen** y con ventana pequeña (1024). Si responde **SYN, ACK**, el puerto está abierto y el atacante corta enseguida con **RST** (por eso se llama «medio abierto»). Si responde **RST, ACK**, está cerrado.', 'Para ver los puertos abiertos: `tcp.flags.syn==1 && tcp.flags.ack==1 && tcp.srcport < 1024`. Y en Estadísticas → Conversaciones verás decenas de conversaciones de 2 paquetes.'], try: [['tcp.flags.syn==1 && tcp.flags.ack==0 && tcp.window_size_value == 1024', 'Los SYN del escaneo'], ['tcp.flags.syn==1 && tcp.flags.ack==1 && tcp.srcport < 1024', 'Puertos que dicen «abierto»']] },
@@ -2447,6 +2570,7 @@ const MODULES = [
id: 'm7', n: 7, cap: 'm7', icon: 'network', mins: 25, extra: true,
title: 'Directorio Activo: Kerberos, SMB y NTLM', sub: 'Tickets, SPN, RC4 y autenticación NTLM sobre SMB',
badge: 'Guardián del dominio',
+ title_en: 'Active Directory: Kerberos, SMB and NTLM', sub_en: 'Tickets, SPNs, RC4 and NTLM authentication over SMB', badge_en: 'Domain guardian',
intro: 'En el dominio MEGACORP.LOCAL, un usuario pide tickets Kerberos y un equipo intruso se autentica por SMB con NTLM contra el controlador de dominio.',
lessons: [
{ h: 'Kerberos en cuatro mensajes', p: ['**AS-REQ / AS-REP**: el usuario pide al controlador de dominio su TGT (el «pase general»). **TGS-REQ / TGS-REP**: con el TGT pide tickets para servicios concretos, identificados por su **SPN** (por ejemplo `cifs/DC01.megacorp.local`).', 'Campos útiles: `kerberos.CNameString` (usuario), `kerberos.SNameString` (servicio), `kerberos.realm` (dominio) y `kerberos.etype` (cifrado).'], try: [['kerberos', 'Todo Kerberos'], ['kerberos.msg_type == 13', 'Tickets de servicio (TGS-REP)']] },
@@ -2465,6 +2589,7 @@ const MODULES = [
id: 'm8', n: 8, cap: 'm8', icon: 'radar', mins: 25, extra: true,
title: 'Caza en el SOC', sub: 'ARP spoofing, beacons de C2 y exfiltración por DNS',
badge: 'Cazador del SOC',
+ title_en: 'SOC hunting', sub_en: 'ARP spoofing, C2 beacons and DNS exfiltration', badge_en: 'SOC hunter',
intro: 'Un analista del SOC recibe esta captura de la estación WS-0412 (192.168.56.40). Hay tres cosas raras. Encuéntralas.',
lessons: [
{ h: 'ARP spoofing', p: ['ARP traduce IP a MAC y no tiene autenticación. Un atacante puede gritar «la puerta de enlace soy yo» con respuestas ARP no pedidas y ponerse en medio (MITM).', 'Señal: varias respuestas ARP para la **misma IP con otra MAC**. Wireshark lo marca como «duplicate IP address».'], try: [['arp.opcode == 2', 'Respuestas ARP'], ['arp.src.proto_ipv4 == 192.168.56.1', 'Quién dice ser la puerta de enlace']] },
@@ -2485,7 +2610,7 @@ const MODULES = [
/* src/content/reference.js */
/* Megalodon · chuleta de filtros y glosario. */
const CHEATS = [
- { h: 'Lo básico', items: [
+ { h: 'Lo básico', h_en: 'The basics', items: [
['tcp', 'Solo TCP (escribe el nombre de cualquier protocolo: udp, dns, http, tls, arp…)'],
['!arp', 'Todo menos ARP (también vale «not arp»)'],
['ip.addr == 192.168.56.20', 'Paquetes donde esa IP es origen o destino'],
@@ -2516,7 +2641,7 @@ const CHEATS = [
['http.authbasic', 'Credenciales Basic decodificadas'],
['urlencoded-form', 'Formularios enviados por POST'],
] },
- { h: 'DNS, TLS y más', items: [
+ { h: 'DNS, TLS y más', h_en: 'DNS, TLS and more', items: [
['dns.qry.name contains "ewpt"', 'Consultas a un dominio'],
['dns.flags.rcode == 3', 'Nombres que no existen (NXDOMAIN)'],
['len(dns.qry.name) > 30', 'Nombres larguísimos (posible exfiltración)'],
@@ -2526,7 +2651,7 @@ const CHEATS = [
['kerberos.etype == 23', 'Tickets Kerberos con RC4'],
['ntlmssp.auth.username', 'Usuarios que se autentican por NTLM'],
] },
- { h: 'Operadores', items: [
+ { h: 'Operadores', h_en: 'Operators', items: [
['== != > < >= <=', 'Comparar (también eq, ne, gt, lt, ge, le)'],
['&& || !', 'Y, o, no (también and, or, not)'],
['http.host contains "admin"', 'contains: contiene ese texto (distingue mayúsculas)'],
@@ -2615,6 +2740,7 @@ const STRINGS = {
progress: 'Progreso', resetProgress: 'Borrar mi progreso', resetConfirm: 'Sí, borrar', theme: 'Tema', light: 'Claro', dark: 'Oscuro', system: 'Sistema',
language: 'Idioma', copy: 'Copiar', copied: 'Copiado', lessonsInSpanish: '', importDrop: 'Suelta aquí un .pcap o .pcapng', captures: 'Captura',
expert: 'Información experta', objects: 'Objetos HTTP', creds: 'Credenciales', endpoints: 'Endpoints', gotoPkt: 'Ir al paquete', findPkt: 'Buscar paquete', timeFmt: 'Formato de tiempo', followUdp: 'Seguir flujo UDP',
+ sideToggle: 'Mostrar u ocultar la barra lateral', brandSub: 'Laboratorio de Wireshark', more: 'Más', navMain: 'Secciones', navMobile: 'Secciones (móvil)', themeSwitch: 'Modo oscuro', langSwitch: 'Idioma', allModules: 'Todos los módulos', levelProg: 'Progreso de nivel',
conv: 'Conversaciones', hier: 'Jerarquía de protocolos', io: 'Gráfico de E/S', interval: 'Intervalo', filterThis: 'Filtrar esto', filterStream: 'Filtrar este flujo',
prevStream: 'Flujo anterior', nextStream: 'Flujo siguiente', client: 'Cliente', server: 'Servidor', allPackets: 'Todos los paquetes', matching: 'Cumplen el filtro',
moduleDone: '¡Módulo completado!', badgeEarned: 'Has ganado la insignia', next: 'Siguiente módulo', back: 'Volver', notFound: 'Esta página no existe.',
@@ -2633,6 +2759,7 @@ const STRINGS = {
progress: 'Progress', resetProgress: 'Reset my progress', resetConfirm: 'Yes, reset', theme: 'Theme', light: 'Light', dark: 'Dark', system: 'System',
language: 'Language', copy: 'Copy', copied: 'Copied', lessonsInSpanish: 'Lessons and challenges are written in Spanish.', importDrop: 'Drop a .pcap or .pcapng here', captures: 'Capture',
expert: 'Expert Information', objects: 'HTTP Objects', creds: 'Credentials', endpoints: 'Endpoints', gotoPkt: 'Go to Packet', findPkt: 'Find Packet', timeFmt: 'Time Display Format', followUdp: 'Follow UDP Stream',
+ sideToggle: 'Show or hide the sidebar', brandSub: 'Wireshark lab', more: 'More', navMain: 'Sections', navMobile: 'Sections (mobile)', themeSwitch: 'Dark mode', langSwitch: 'Language', allModules: 'All modules', levelProg: 'Level progress',
conv: 'Conversations', hier: 'Protocol Hierarchy', io: 'I/O Graph', interval: 'Interval', filterThis: 'Filter this', filterStream: 'Filter this stream',
prevStream: 'Previous stream', nextStream: 'Next stream', client: 'Client', server: 'Server', allPackets: 'All packets', matching: 'Match the filter',
moduleDone: 'Module complete!', badgeEarned: 'You earned the badge', next: 'Next module', back: 'Back', notFound: 'This page does not exist.',
@@ -2640,11 +2767,17 @@ const STRINGS = {
};
let LANG = 'es';
const t = k => (STRINGS[LANG] && STRINGS[LANG][k]) ?? STRINGS.es[k] ?? k;
+/* Texto en línea para lo que solo aparece una vez: L('español', 'English') */
+const L = (es, en) => LANG === 'en' ? en : es;
+/* Campos de módulo con su versión inglesa (title, sub, badge) */
+const mT = (m, k) => (LANG === 'en' && m[`${k}_en`]) || m[k];
/* src/app/10-state.js */
/* Megalodon · estado y progreso guardados en localStorage («megalodon.v1»). */
const STORE_KEY = 'megalodon.v1';
const LEVELS = [[0, 'Alevín'], [80, 'Tintorera'], [200, 'Tiburón martillo'], [380, 'Gran blanco'], [600, 'Megalodón']];
+const LEVELS_EN = ['Shark pup', 'Blue shark', 'Hammerhead', 'Great white', 'Megalodon'];
+const lvName = lv => (LANG === 'en' ? LEVELS_EN[lv.i] : lv.name);
const XP_BY_HINTS = [10, 8, 6, 5];
const BONUS_MODULE = 20;
const S = (() => {
@@ -2748,7 +2881,7 @@ async function copyText(txt, btn) {
try { ok = document.execCommand('copy'); } catch { ok = false; } ta.remove();
}
if (btn) { btn.classList.add('done'); btn.innerHTML = ic(ok ? 'copied' : 'ko'); btn.setAttribute('aria-label', ok ? t('copied') : 'Error'); setTimeout(() => { btn.classList.remove('done'); btn.innerHTML = ic('copy'); btn.setAttribute('aria-label', t('copy')); }, 1400); }
- toast(ok ? `${t('copied')}: <code>${esc(txt)}</code>` : 'No se pudo copiar', ok ? 'ok' : 'err', ok ? 'copied' : 'ko');
+ toast(ok ? `${t('copied')}: <code>${esc(txt)}</code>` : L('No se pudo copiar', 'Could not copy'), ok ? 'ok' : 'err', ok ? 'copied' : 'ko');
}
function download(bytes, name, type = 'application/octet-stream') {
@@ -2773,6 +2906,78 @@ function filterFor(node) {
if (node.field === 'tcp.flags') return `tcp.flags == 0x${Number(v).toString(16).padStart(3, '0')}`;
return `${node.field} == ${v}`;
}
+/* Los mensajes del motor de filtros están en español; en inglés se traducen aquí, sin tocar el motor. */
+const FERR_EN = [
+ [/^Falta cerrar las comillas de la cadena$/, 'Missing closing quote in the string'],
+ [/^Un solo «=» no vale: para comparar usa «==»$/, 'A single “=” is not valid: use “==” to compare'],
+ [/^«(.)» suelto no vale: usa «(..)»$/, '“$1” on its own is not valid: use “$2”'],
+ [/^Carácter inesperado «(.*)»$/, 'Unexpected character “$1”'],
+ [/^Se esperaba una expresión regular entre comillas tras «matches»$/, 'Expected a quoted regular expression after “matches”'],
+ [/^Se esperaba un campo dentro de la función$/, 'Expected a field inside the function'],
+ [/^Se esperaba «\)» para cerrar la función$/, 'Expected “)” to close the function'],
+ [/^Se esperaba «\)» para cerrar el paréntesis$/, 'Expected “)” to close the parenthesis'],
+ [/^Se esperaba «\{» después de «in»$/, 'Expected “{” after “in”'],
+ [/^Se esperaba (.*)$/, 'Expected $1'],
+ [/^El filtro termina antes de tiempo: falta un valor$/, 'The filter ends too early: a value is missing'],
+ [/^El filtro termina antes de tiempo$/, 'The filter ends too early'],
+ [/^No se esperaba «(.*)» aquí$/, '“$1” was not expected here'],
+ [/^«(.*)» no es un campo ni un protocolo conocido\. ¿Querías decir «(.*)»\?$/, '“$1” is not a known field or protocol. Did you mean “$2”?'],
+ [/^«(.*)» no es un campo ni un protocolo conocido$/, '“$1” is not a known field or protocol'],
+ [/^«(.*)» necesita algo a su izquierda$/, '“$1” needs something on its left'],
+ [/^Falta «}» para cerrar el conjunto$/, 'Missing “}” to close the set'],
+ [/^Separa los valores del conjunto con comas: \{80, 443\}$/, 'Separate set values with commas: {80, 443}'],
+ [/^El conjunto de «in» está vacío$/, 'The “in” set is empty'],
+ [/^«(.*)» solo funciona con campos de texto; (.*) es numérico$/, '“$1” only works with text fields; $2 is numeric'],
+ [/^La expresión regular no es válida$/, 'The regular expression is not valid'],
+ [/^Falta el texto a buscar tras «contains»$/, 'Missing the text to search for after “contains”'],
+ [/^Falta el valor con el que comparar ?(.*)$/, 'Missing the value to compare $1 with'],
+ [/^«(.*)» no es un número válido para este campo$/, '“$1” is not a valid number for this field'],
+ [/^«(.*)» no es una dirección IPv4 válida \(p\. ej\. (.*) o (.*)\)$/, '“$1” is not a valid IPv4 address (e.g. $2 or $3)'],
+ [/^«(.*)» no es una MAC válida \(p\. ej\. (.*)\)$/, '“$1” is not a valid MAC (e.g. $2)'],
+ [/^Un protocolo no se compara con un valor: escribe solo su nombre, p\. ej\. «http»$/, 'A protocol is not compared with a value: write just its name, e.g. “http”'],
+ [/^Falta un operador lógico \(«&&» o «\|\|»\) antes de «(.*)»$/, 'Missing a logical operator (“&&” or “||”) before “$1”'],
+];
+const fErr = m => { if (LANG !== 'en' || !m) return m; for (const [re, en] of FERR_EN) if (re.test(m)) return m.replace(re, en); return m; };
+/* Árbol de detalle en inglés con las etiquetas que muestra Wireshark (el disector las genera en español). */
+const TREE_EN = [
+ [/^Frame (\d+): (\d+) bytes en el cable \((\d+) bits\), (\d+) bytes capturados$/, 'Frame $1: $2 bytes on wire ($3 bits), $4 bytes captured'],
+ [/^Hora de llegada \(epoch\): /, 'Epoch Arrival Time: '], [/^Longitud de la trama: (.*) bytes$/, 'Frame Length: $1 bytes'], [/^Número de trama: /, 'Frame Number: '],
+ [/^\[Tiempo desde el paquete anterior: /, '[Time delta from previous captured frame: '], [/^\[Tiempo desde el primer paquete: /, '[Time since reference or first frame: '],
+ [/^\[Protocolos en la trama: /, '[Protocols in frame: '], [/^\[Respuesta en la trama: /, '[Response in frame: '],
+ [/^Tipo de contenido: /, 'Content Type: '], [/^Tipo opaco: (.*) ← en TLS (\S+) el tipo real va cifrado dentro$/, 'Opaque Type: $1 ← in TLS $2 the real type is encrypted inside'],
+ [/^Destino: /, 'Destination: '], [/^Origen: /, 'Source: '], [/^Tipo: (.*)Desconocido/, 'Type: $1Unknown'], [/^Tipo: (.*)\(otro\)$/, 'Type: $1(other)'], [/^Tipo: /, 'Type: '],
+ [/= Versión: /, '= Version: '], [/= Longitud de cabecera: /, '= Header Length: '], [/^Longitud total: /, 'Total Length: '], [/^Identificación: /, 'Identification: '],
+ [/^Tiempo de vida \(TTL\): /, 'Time to Live: '], [/^Protocolo: /, 'Protocol: '], [/^Checksum de cabecera: /, 'Header Checksum: '],
+ [/^Dirección de origen: /, 'Source Address: '], [/^Dirección de destino: /, 'Destination Address: '],
+ [/^Puerto de origen: /, 'Source Port: '], [/^Puerto de destino: /, 'Destination Port: '], [/^\[Índice de flujo: /, '[Stream index: '],
+ [/^\[Longitud del segmento TCP: /, '[TCP Segment Len: '], [/^Número de secuencia \(bruto\): /, 'Sequence Number (raw): '],
+ [/^Número de secuencia: (\d+) {4}\(número relativo\)$/, 'Sequence Number: $1 (relative sequence number)'], [/^Número de secuencia: /, 'Sequence Number: '],
+ [/^\[Siguiente número de secuencia: (\d+) {4}\(relativo\)\]$/, '[Next Sequence Number: $1 (relative sequence number)]'], [/^\[Siguiente número de secuencia: /, '[Next Sequence Number: '],
+ [/^Número de acuse \(bruto\): /, 'Acknowledgment number (raw): '], [/^Número de acuse: (\d+) {4}\(relativo\)$/, 'Acknowledgment Number: $1 (relative ack number)'], [/^Número de acuse: /, 'Acknowledgment Number: '],
+ [/<ninguno>/, '<None>'], [/^Ventana: /, 'Window: '], [/^\[Ventana calculada: /, '[Calculated window size: '], [/^Opciones: \((.*) bytes\)$/, 'Options: ($1 bytes)'],
+ [/^SACK permitido$/, 'SACK permitted'], [/\(multiplicar por (\d+)\)$/, '(multiply by $1)'], [/^\[Análisis SEQ\/ACK\]$/, '[SEQ/ACK analysis]'],
+ [/^\[Este segmento es una retransmisión\]$/, '[This frame is a (suspected) retransmission]'], [/^Datos TCP \((.*) bytes\)$/, 'TCP payload ($1 bytes)'],
+ [/^Longitud: /, 'Length: '], [/^Código: /, 'Code: '],
+ [/^Tipo de hardware: /, 'Hardware type: '], [/^Tipo de protocolo: /, 'Protocol type: '], [/^MAC del emisor: /, 'Sender MAC address: '], [/^IP del emisor: /, 'Sender IP address: '],
+ [/^MAC de destino: /, 'Target MAC address: '], [/^IP de destino: /, 'Target IP address: '],
+ [/^ID de transacción: /, 'Transaction ID: '], [/^Flags: Respuesta$/, 'Flags: Response'], [/^Flags: Petición$/, 'Flags: Request'],
+ [/^Preguntas: /, 'Questions: '], [/^Respuestas: /, 'Answer RRs: '], [/^Nombre: /, 'Name: '], [/^TTL: (\d+) \((\d+) segundos\)$/, 'Time to live: $1 ($2 seconds)'],
+ [/^MAC del cliente: /, 'Client MAC address: '], [/^Tu IP \(yiaddr\): /, 'Your (client) IP address: '],
+ [/^Opción \(53\) Tipo de mensaje DHCP: /, 'Option: (53) DHCP Message Type: '], [/^Opción \(50\) IP solicitada: /, 'Option: (50) Requested IP Address: '],
+ [/^Opción \(54\) Servidor DHCP: /, 'Option: (54) DHCP Server Identifier: '], [/^Opción \(12\) Nombre del equipo: /, 'Option: (12) Host Name: '],
+ [/^Opción \((\d+)\)$/, 'Option: ($1)'], [/^Opción (\d+)$/, 'Option $1'], [/^Fin de la lista de opciones \(EOL\)$/, 'End of Option List (EOL)'],
+ [/^Método: /, 'Request Method: '], [/^URI: /, 'Request URI: '], [/^Versión: /, 'Version: '], [/^Código de estado: /, 'Status Code: '], [/^Frase: /, 'Response Phrase: '],
+ [/^\[URI completa pedida: /, '[Full request URI: '], [/^\[URI completa: /, '[Full request URI: '], [/^\[URI pedida: /, '[Request URI: '],
+ [/^\[Petición en la trama: /, '[Request in frame: '], [/^\[Tiempo desde la petición: /, '[Time since request: '], [/^Credenciales: /, 'Credentials: '],
+ [/^Par de cookie: /, 'Cookie pair: '], [/^Cuerpo \((.*) bytes\)$/, 'File Data: $1 bytes'], [/^Elemento del formulario: /, 'Form item: '], [/^Clave: /, 'Key: '], [/^Valor: /, 'Value: '],
+ [/^Orden: ([A-Z]+)$/, 'Request command: $1'], [/^Orden: /, 'Command: '], [/^Argumento: /, 'Request arg: '], [/^Código de respuesta: /, 'Response code: '],
+ [/^Tipo de handshake: /, 'Handshake Type: '], [/^Longitud del Session ID: /, 'Session ID Length: '], [/\(len=(\d+)\)$/, '(len=$1)'], [/^Extension: tipo /, 'Extension: type '],
+ [/^Mensaje Change Cipher Spec$/, 'Change Cipher Spec Message'], [/^Datos de aplicación cifrados: /, 'Encrypted Application Data: '],
+ [/^NetBIOS Session Service \(longitud (\d+)\)$/, 'NetBIOS Session Service (length $1)'], [/^Cabecera SMB2$/, 'SMB2 Header'], [/^Estado NT: /, 'NT Status: '],
+ [/^Identificador NTLMSSP: /, 'NTLMSSP identifier: '], [/^Tipo de mensaje: /, 'NTLM Message Type: '], [/^Dominio: /, 'Domain name: '], [/^Usuario: /, 'User name: '], [/^Equipo: /, 'Host name: '],
+ [/^ENCTYPE \(que acepta el cliente\): /, 'ENCTYPE: '], [/^etype del ticket: /, 'etype (ticket): '], [/^etype de enc-part: /, 'etype (enc-part): '],
+];
+const treeLabel = l => { if (LANG !== 'en') return l; let out = l; for (const [re, en] of TREE_EN) out = out.replace(re, en); return out; };
const treeKey = (node, depth) => depth + ':' + node.label.split(/[,:(\[]/)[0].trim();
class Workspace {
@@ -2791,22 +2996,22 @@ class Workspace {
<div class="ws-bar">
<div class="fbar" data-state="empty">
<span class="fbar-ic" aria-hidden="true">${ic('filter')}</span>
- <label class="vh" for="${id}-f">Filtro de visualización</label>
+ <label class="vh" for="${id}-f">${L('Filtro de visualización', 'Display filter')}</label>
<input id="${id}-f" class="finput mono" type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-controls="${id}-ac" aria-describedby="${id}-msg" autocomplete="off" autocapitalize="off" spellcheck="false" placeholder="${esc(t('filterPh'))}">
<button class="ibtn sm" data-clear type="button" aria-label="${t('clear')}">${ic('x')}</button>
<button class="btn sm primary" data-apply type="button" aria-label="${t('apply')}">${ic('enter')}<span>${t('apply')}</span></button>
- <ul class="ac" id="${id}-ac" role="listbox" aria-label="Sugerencias" hidden></ul>
+ <ul class="ac" id="${id}-ac" role="listbox" aria-label="${L('Sugerencias', 'Suggestions')}" hidden></ul>
</div>
- <div class="ws-tools" role="toolbar" aria-label="Herramientas">
+ <div class="ws-tools" role="toolbar" aria-label="${L('Herramientas', 'Tools')}">
<button class="tbtn" data-follow type="button" title="${t('follow')} (F)">${ic('follow')}<span>${t('follow')}</span></button>
<button class="tbtn" data-stats type="button" title="${t('stats')} (S)">${ic('stats')}<span>${t('stats')}</span></button>
- <button class="tbtn" data-expert type="button" title="${t('expert')} (E)">${ic('alert')}<span>Experto</span></button>
- <button class="tbtn" data-objects type="button" title="Archivo › Exportar objetos › HTTP">${ic('file')}<span>${t('objects')}</span></button>
- <button class="tbtn" data-creds type="button" title="Herramientas › Credenciales">${ic('lock')}<span>${t('creds')}</span></button>
- <button class="tbtn" data-find type="button" title="${t('findPkt')} (Ctrl F) · ${t('gotoPkt')} (Ctrl G)">${ic('search')}<span>Buscar</span></button>
+ <button class="tbtn" data-expert type="button" title="${t('expert')} (E)">${ic('alert')}<span>${L('Experto', 'Expert')}</span></button>
+ <button class="tbtn" data-objects type="button" title="${L('Archivo › Exportar objetos › HTTP', 'File › Export Objects › HTTP')}">${ic('file')}<span>${t('objects')}</span></button>
+ <button class="tbtn" data-creds type="button" title="${L('Herramientas › Credenciales', 'Tools › Credentials')}">${ic('lock')}<span>${t('creds')}</span></button>
+ <button class="tbtn" data-find type="button" title="${t('findPkt')} (Ctrl F) · ${t('gotoPkt')} (Ctrl G)">${ic('search')}<span>${t('search')}</span></button>
<button class="tbtn" data-color type="button" aria-pressed="true">${ic('sparkles')}<span>${t('colorize')}</span></button>
${imp ? `<button class="tbtn" data-open type="button">${ic('upload')}<span>${t('open')}</span></button><input type="file" class="vh" data-file accept=".pcap,.pcapng,.cap,application/vnd.tcpdump.pcap" tabindex="-1" aria-hidden="true">` : ''}
- <button class="tbtn" data-export type="button">${ic('download')}<span>Exportar</span></button>
+ <button class="tbtn" data-export type="button">${ic('download')}<span>${L('Exportar', 'Export')}</span></button>
</div>
</div>
<p class="fmsg" id="${id}-msg" aria-live="polite"></p>
@@ -2820,7 +3025,7 @@ class Workspace {
<div class="pane ptree" aria-label="${t('detail')}" role="region"><ul class="tree" role="tree" aria-label="${t('detail')}" tabindex="0"></ul><p class="pane-empty">${t('noPacket')}</p></div>
<div class="pane phex" role="region" aria-label="${t('hexView')}" tabindex="0"><div class="hex mono"></div></div>
</div>
- <div class="ws-status"><span data-count></span><span class="dot" aria-hidden="true"></span><label class="tfmt"><span>${t('time')}:</span><select data-tfmt aria-label="${t('timeFmt')}"><option value="rel">desde el inicio</option><option value="delta">desde el anterior capturado</option><option value="dview">desde el anterior mostrado</option><option value="abs">hora UTC</option></select></label><span class="dot" aria-hidden="true"></span><span data-name class="mono"></span><span class="grow"></span><span data-legend class="legend"></span></div>
+ <div class="ws-status"><span data-count></span><span class="dot" aria-hidden="true"></span><label class="tfmt"><span>${t('time')}:</span><select data-tfmt aria-label="${t('timeFmt')}"><option value="rel">${L('desde el inicio', 'since beginning of capture')}</option><option value="delta">${L('desde el anterior capturado', 'since previous captured packet')}</option><option value="dview">${L('desde el anterior mostrado', 'since previous displayed packet')}</option><option value="abs">${L('hora UTC', 'UTC time of day')}</option></select></label><span class="dot" aria-hidden="true"></span><span data-name class="mono"></span><span class="grow"></span><span data-legend class="legend"></span></div>
${imp ? `<div class="drop" hidden>${ic('upload')}<span>${t('importDrop')}</span></div>` : ''}
</section>`;
const r = this.host;
@@ -2884,27 +3089,27 @@ class Workspace {
}
async importFile(f) {
try {
- if (f.size > 64 * 1024 * 1024) throw new Error('El archivo pesa más de 64 MB; este laboratorio está pensado para capturas pequeñas.');
+ if (f.size > 64 * 1024 * 1024) throw new Error(L('El archivo pesa más de 64 MB; este laboratorio está pensado para capturas pequeñas.', 'The file is over 64 MB; this lab is meant for small captures.'));
const raw = readCapture(new Uint8Array(await f.arrayBuffer()));
- if (!raw.length) throw new Error('La captura no tiene paquetes Ethernet que pueda leer.');
+ if (!raw.length) throw new Error(L('La captura no tiene paquetes Ethernet que pueda leer.', 'The capture has no Ethernet packets I can read.'));
this.load(raw, f.name, '');
- toast(`Abierta <strong>${esc(f.name)}</strong>: ${fmtNum(raw.length)} paquetes`, 'ok', 'file');
+ toast(`${L('Abierta', 'Opened')} <strong>${esc(f.name)}</strong>: ${fmtNum(raw.length)} ${L('paquetes', 'packets')}`, 'ok', 'file');
if (this.opts.onImport) this.opts.onImport(f.name);
- } catch (err) { toast(esc(err.message || 'No se pudo leer la captura'), 'err'); }
+ } catch (err) { toast(esc(err.message || L('No se pudo leer la captura', 'Could not read the capture')), 'err'); }
}
exportDialog() {
const base = this.name.replace(/\.(pcapng|pcap|cap)$/i, '');
- const d = openDialog({ title: 'Exportar captura', cls: 'narrow', body: `<p class="muted">Se descarga a tu equipo y la abres tal cual en Wireshark.</p>
+ const d = openDialog({ title: L('Exportar captura', 'Export capture'), cls: 'narrow', body: `<p class="muted">${L('Se descarga a tu equipo y la abres tal cual en Wireshark.', 'It downloads to your device and opens as is in Wireshark.')}</p>
<div class="stack-sm">
- <button class="choice" data-k="all-ng">${ic('download')}<span><strong>Captura completa · .pcapng</strong><small>${fmtNum(this.pkts.length)} paquetes, formato moderno</small></span></button>
- <button class="choice" data-k="all-pcap">${ic('download')}<span><strong>Captura completa · .pcap</strong><small>Formato clásico, lo abre cualquier herramienta</small></span></button>
- <button class="choice" data-k="view-ng" ${this.view.length === this.pkts.length ? 'disabled' : ''}>${ic('filter')}<span><strong>Solo los mostrados · .pcapng</strong><small>${fmtNum(this.view.length)} paquetes con el filtro actual</small></span></button>
+ <button class="choice" data-k="all-ng">${ic('download')}<span><strong>${L('Captura completa', 'Full capture')} · .pcapng</strong><small>${fmtNum(this.pkts.length)} ${L('paquetes, formato moderno', 'packets, modern format')}</small></span></button>
+ <button class="choice" data-k="all-pcap">${ic('download')}<span><strong>${L('Captura completa', 'Full capture')} · .pcap</strong><small>${L('Formato clásico, lo abre cualquier herramienta', 'Classic format, any tool opens it')}</small></span></button>
+ <button class="choice" data-k="view-ng" ${this.view.length === this.pkts.length ? 'disabled' : ''}>${ic('filter')}<span><strong>${L('Solo los mostrados', 'Displayed only')} · .pcapng</strong><small>${fmtNum(this.view.length)} ${L('paquetes con el filtro actual', 'packets with the current filter')}</small></span></button>
</div>` });
$$('[data-k]', d).forEach(b => b.onclick = () => {
const k = b.dataset.k, subset = k.startsWith('view') ? this.view.map(p => this.raw[p.no - 1]) : this.raw;
const ng = k.endsWith('ng');
download(ng ? writePcapng(subset, `Megalodon · ${base}`) : writePcap(subset), `${base}${k.startsWith('view') ? '-filtrado' : ''}.${ng ? 'pcapng' : 'pcap'}`, 'application/vnd.tcpdump.pcap');
- closeDialog(); toast('Captura exportada', 'ok', 'download');
+ closeDialog(); toast(L('Captura exportada', 'Capture exported'), 'ok', 'download');
});
}
@@ -2914,7 +3119,7 @@ class Workspace {
this.$.fbar.dataset.state = r.empty ? 'empty' : r.ok ? 'ok' : 'bad';
this.$.input.setAttribute('aria-invalid', String(!r.ok));
this.$.msg.className = 'fmsg ' + (r.ok ? '' : 'bad');
- this.$.msg.innerHTML = r.ok ? '' : `${ic('ko', 'sm')}<span>${esc(r.error)}</span>`;
+ this.$.msg.innerHTML = r.ok ? '' : `${ic('ko', 'sm')}<span>${esc(fErr(r.error))}</span>`;
return r;
}
apply(silent) {
@@ -3047,7 +3252,7 @@ class Workspace {
this.flat.push({ id, node: n, depth, key, parentId, kids, open });
const f = filterFor(n);
return `<li role="treeitem" id="${id}" aria-level="${depth + 1}" aria-selected="false" ${kids ? `aria-expanded="${open}"` : ''}>
- <div class="tn" data-id="${id}">${kids ? `<span class="tw" aria-hidden="true">${ic('chevR', 'sm')}</span>` : '<span class="tw"></span>'}<span class="tl">${esc(n.label)}</span>${f ? `<button class="tf" type="button" tabindex="-1" data-f="${esc(f)}" aria-label="${t('applyAsFilter')}: ${esc(f)}" title="${t('applyAsFilter')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</div>
+ <div class="tn" data-id="${id}">${kids ? `<span class="tw" aria-hidden="true">${ic('chevR', 'sm')}</span>` : '<span class="tw"></span>'}<span class="tl">${esc(treeLabel(n.label))}</span>${f ? `<button class="tf" type="button" tabindex="-1" data-f="${esc(f)}" aria-label="${t('applyAsFilter')}: ${esc(f)}" title="${t('applyAsFilter')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</div>
${kids ? `<ul role="group"${open ? '' : ' hidden'}>${walk(n.kids, depth + 1, id)}</ul>` : ''}</li>`;
}).join('');
this.$.tree.innerHTML = walk(p.tree, 0, null);
@@ -3120,7 +3325,7 @@ class Workspace {
const p = this.selected();
if (stream === undefined && p && p.tcpStream === undefined && p.f['udp.stream']) return openFollow(this, p.f['udp.stream'][0], 'udp');
const st = stream ?? (p && p.tcpStream);
- if (st === undefined || st === null) { toast('Selecciona un paquete TCP o UDP para seguir su flujo.', 'info', 'follow'); return; }
+ if (st === undefined || st === null) { toast(L('Selecciona un paquete TCP o UDP para seguir su flujo.', 'Select a TCP or UDP packet to follow its stream.'), 'info', 'follow'); return; }
openFollow(this, st);
}
destroy() { this.unsub && this.unsub(); this.host.innerHTML = ''; }
@@ -3141,8 +3346,8 @@ function openFollow(ws, stream, kind = 'tcp') {
<div class="fs-ends"><span class="who cli">${ic('arrowR', 'sm')}${t('client')} <code>${esc(fs.client)}</code></span><span class="who srv">${ic('arrowL', 'sm')}${t('server')} <code>${esc(fs.server)}</code></span></div>
<div class="row"><button class="ibtn" data-prev ${idx <= 0 ? 'disabled' : ''} aria-label="${t('prevStream')}">${ic('chevL')}</button><span class="mono sm">${kind}.stream eq ${cur}</span><button class="ibtn" data-next ${idx >= streams.length - 1 ? 'disabled' : ''} aria-label="${t('nextStream')}">${ic('chevR')}</button></div>
</div>
- <div class="fs-body mono" tabindex="0" aria-label="Contenido del flujo">${fs.chunks.length ? fs.chunks.map(c => `<pre class="${c.client ? 'cli' : 'srv'}"><span class="vh">${c.client ? t('client') : t('server')}: </span>${esc(c.text)}</pre>`).join('') : `<p class="muted">${udp ? 'Este flujo UDP no lleva datos.' : 'Este flujo no lleva datos: solo saludo y cierre (o un RST).'}</p>`}</div>
- <p class="sm muted fs-sum">${t('client')} → ${t('server')}: <strong>${fmtNum(fs.cBytes)}</strong> bytes · ${t('server')} → ${t('client')}: <strong>${fmtNum(fs.sBytes)}</strong> bytes · ${fs.chunks.length} bloques</p>`;
+ <div class="fs-body mono" tabindex="0" aria-label="${L('Contenido del flujo', 'Stream content')}">${fs.chunks.length ? fs.chunks.map(c => `<pre class="${c.client ? 'cli' : 'srv'}"><span class="vh">${c.client ? t('client') : t('server')}: </span>${esc(c.text)}</pre>`).join('') : `<p class="muted">${udp ? L('Este flujo UDP no lleva datos.', 'This UDP stream carries no data.') : L('Este flujo no lleva datos: solo saludo y cierre (o un RST).', 'This stream carries no data: just handshake and teardown (or an RST).')}</p>`}</div>
+ <p class="sm muted fs-sum">${t('client')} → ${t('server')}: <strong>${fmtNum(fs.cBytes)}</strong> bytes · ${t('server')} → ${t('client')}: <strong>${fmtNum(fs.sBytes)}</strong> bytes · ${fs.chunks.length} ${L('bloques', 'chunks')}</p>`;
$('[data-prev]', body).onclick = () => { cur = streams[idx - 1]; render(); };
$('[data-next]', body).onclick = () => { cur = streams[idx + 1]; render(); };
};
@@ -3180,10 +3385,10 @@ function convPanel(ws, panel) {
const draw = () => {
const rows = c[k], ports = k === 'tcp' || k === 'udp';
const fl = r => k === 'tcp' ? `tcp.stream eq ${r.stream}` : k === 'udp' ? `udp.stream eq ${r.stream}` : k === 'ip' ? `ip.addr == ${r.a} && ip.addr == ${r.b}` : `eth.addr == ${r.a} && eth.addr == ${r.b}`;
- panel.innerHTML = `<div class="chips" role="group" aria-label="Tipo de conversación">${kinds.map(([x, l]) => `<button class="chip ${x === k ? 'on' : ''}" aria-pressed="${x === k}" data-k="${x}">${l} <span class="num">${c[x].length}</span></button>`).join('')}</div>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl"><caption class="vh">Conversaciones ${k}</caption><thead><tr><th scope="col">${k === 'eth' ? 'Dirección A' : 'IP A'}</th>${ports ? '<th scope="col" class="n">Puerto A</th>' : ''}<th scope="col">${k === 'eth' ? 'Dirección B' : 'IP B'}</th>${ports ? '<th scope="col" class="n">Puerto B</th>' : ''}<th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">A → B</th><th scope="col" class="n">B → A</th><th scope="col" class="n">Inicio</th><th scope="col" class="n">Duración</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="chips" role="group" aria-label="${L('Tipo de conversación', 'Conversation type')}">${kinds.map(([x, l]) => `<button class="chip ${x === k ? 'on' : ''}" aria-pressed="${x === k}" data-k="${x}">${l} <span class="num">${c[x].length}</span></button>`).join('')}</div>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl"><caption class="vh">${t('conv')} ${k}</caption><thead><tr><th scope="col">${k === 'eth' ? L('Dirección A', 'Address A') : 'IP A'}</th>${ports ? `<th scope="col" class="n">${L('Puerto A', 'Port A')}</th>` : ''}<th scope="col">${k === 'eth' ? L('Dirección B', 'Address B') : 'IP B'}</th>${ports ? `<th scope="col" class="n">${L('Puerto B', 'Port B')}</th>` : ''}<th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">A → B</th><th scope="col" class="n">B → A</th><th scope="col" class="n">${L('Inicio', 'Start')}</th><th scope="col" class="n">${L('Duración', 'Duration')}</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map((r, i) => `<tr><td class="mono">${esc(r.a)}</td>${ports ? `<td class="n mono">${r.pa}</td>` : ''}<td class="mono">${esc(r.b)}</td>${ports ? `<td class="n mono">${r.pb}</td>` : ''}<td class="n">${r.pkts}</td><td class="n">${fmtNum(r.bytes)}</td><td class="n">${r.ab}</td><td class="n">${r.ba}</td><td class="n mono">${r.start.toFixed(3)}</td><td class="n mono">${r.dur.toFixed(3)}</td><td><button class="ibtn sm" data-f="${esc(fl(r))}" aria-label="${t('filterThis')}: ${esc(fl(r))}" title="${t('filterThis')}">${ic('filter', 'sm')}</button></td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Pista: en un escaneo verás muchas conversaciones TCP de 2 o 3 paquetes desde el mismo origen.</p>`;
+ <p class="sm muted">${L('Pista: en un escaneo verás muchas conversaciones TCP de 2 o 3 paquetes desde el mismo origen.', 'Hint: in a scan you will see many 2- or 3-packet TCP conversations from the same source.')}</p>`;
$$('[data-k]', panel).forEach(b => b.onclick = () => { k = b.dataset.k; draw(); });
$$('[data-f]', panel).forEach(b => b.onclick = () => { ws.setFilter(b.dataset.f); closeDialog(); });
};
@@ -3194,7 +3399,7 @@ function hierPanel(ws, panel) {
const h = protocolHierarchy(ws.pkts), rows = [];
const walk = n => { rows.push(n); n.kids.forEach(walk); };
walk(h);
- panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl hier"><caption class="vh">${t('hier')}</caption><thead><tr><th scope="col">Protocolo</th><th scope="col" class="n">% paquetes</th><th scope="col" class="bar-col"><span class="vh">Barra</span></th><th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl hier"><caption class="vh">${t('hier')}</caption><thead><tr><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col" class="n">${L('% paquetes', '% packets')}</th><th scope="col" class="bar-col"><span class="vh">${L('Barra', 'Bar')}</span></th><th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map(r => { const name = r.name === 'frame' ? 'Frame' : r.name; const f = r.name === 'frame' ? '' : r.name; return `<tr><td><span class="ind" data-d="${Math.min(r.depth, 8)}">${esc(name)}</span></td><td class="n">${r.pct.toFixed(1)} %</td><td class="bar-col"><span class="bar" data-w="${r.pct}"></span></td><td class="n">${r.pkts}</td><td class="n">${fmtNum(r.bytes)}</td><td>${f && FIELDS[f] ? `<button class="ibtn sm" data-f="${esc(f)}" aria-label="${t('filterThis')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</td></tr>`; }).join('')}</tbody></table></div>`;
$$('.bar', panel).forEach(b => { b.style.width = `${b.dataset.w}%`; });
$$('.ind', panel).forEach(s => { s.style.paddingInlineStart = `${s.dataset.d * 16}px`; });
@@ -3212,13 +3417,13 @@ function ioPanel(ws, panel) {
const y = v => H - pb - (v / max) * (H - pb - 10);
const ticks = [0, Math.ceil(max / 2), max];
const xl = Math.max(1, Math.ceil(g.buckets.length / 8));
- panel.innerHTML = `<div class="row between"><div class="row sm"><span class="lgd all"><i></i>${t('allPackets')}</span>${test ? `<span class="lgd hit"><i></i>${t('matching')}: <code>${esc(ws.filterText)}</code></span>` : '<span class="muted">Aplica un filtro para compararlo con el total.</span>'}</div>
+ panel.innerHTML = `<div class="row between"><div class="row sm"><span class="lgd all"><i></i>${t('allPackets')}</span>${test ? `<span class="lgd hit"><i></i>${t('matching')}: <code>${esc(ws.filterText)}</code></span>` : `<span class="muted">${L('Aplica un filtro para compararlo con el total.', 'Apply a filter to compare it with the total.')}</span>`}</div>
<label class="row sm">${t('interval')} <select data-iv>${(opts.length ? opts : [iv]).map(o => `<option value="${o}" ${o === iv ? 'selected' : ''}>${o} s</option>`).join('')}</select></label></div>
- <svg class="io" viewBox="0 0 ${W} ${H}" role="img" aria-label="Paquetes por intervalo de ${iv} segundos: máximo ${max}">
+ <svg class="io" viewBox="0 0 ${W} ${H}" role="img" aria-label="${L(`Paquetes por intervalo de ${iv} segundos: máximo ${max}`, `Packets per ${iv}-second interval: maximum ${max}`)}">
${ticks.map(v => `<line class="gl" x1="${pl}" x2="${W - 4}" y1="${y(v)}" y2="${y(v)}"/><text class="ax" x="${pl - 6}" y="${y(v) + 4}" text-anchor="end">${v}</text>`).join('')}
- ${g.buckets.map((b, i) => `<rect class="b-all" x="${pl + i * bw + bw * 0.12}" y="${y(b.all)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.all)}" rx="${Math.min(3, bw / 4)}"><title>${b.t} s: ${b.all} paquetes${test ? `, ${b.hit} cumplen el filtro` : ''}</title></rect>${test && b.hit ? `<rect class="b-hit" x="${pl + i * bw + bw * 0.12}" y="${y(b.hit)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.hit)}" rx="${Math.min(3, bw / 4)}"/>` : ''}`).join('')}
+ ${g.buckets.map((b, i) => `<rect class="b-all" x="${pl + i * bw + bw * 0.12}" y="${y(b.all)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.all)}" rx="${Math.min(3, bw / 4)}"><title>${b.t} s: ${b.all} ${L('paquetes', 'packets')}${test ? `, ${b.hit} ${L('cumplen el filtro', 'match the filter')}` : ''}</title></rect>${test && b.hit ? `<rect class="b-hit" x="${pl + i * bw + bw * 0.12}" y="${y(b.hit)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.hit)}" rx="${Math.min(3, bw / 4)}"/>` : ''}`).join('')}
${g.buckets.map((b, i) => i % xl === 0 ? `<text class="ax" x="${pl + i * bw + bw / 2}" y="${H - 8}" text-anchor="middle">${+b.t.toFixed(2)}</text>` : '').join('')}
- </svg><p class="sm muted">Eje horizontal: segundos desde el primer paquete. Un pico que se repite a intervalos fijos puede ser un beacon.</p>`;
+ </svg><p class="sm muted">${L('Eje horizontal: segundos desde el primer paquete. Un pico que se repite a intervalos fijos puede ser un beacon.', 'Horizontal axis: seconds since the first packet. A spike that repeats at fixed intervals may be a beacon.')}</p>`;
$('[data-iv]', panel).onchange = e => { iv = +e.target.value; draw(); };
};
draw();
@@ -3228,22 +3433,23 @@ function ioPanel(ws, panel) {
/* ---------- Endpoints (Estadísticas › Endpoints › IPv4) ---------- */
function endsPanel(ws, panel) {
const rows = endpoints(ws.pkts);
- panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('endpoints')}"><table class="tbl"><caption class="vh">${t('endpoints')} IPv4</caption><thead><tr><th scope="col">Dirección</th><th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">Enviados</th><th scope="col" class="n">Recibidos</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('endpoints')}"><table class="tbl"><caption class="vh">${t('endpoints')} IPv4</caption><thead><tr><th scope="col">${L('Dirección', 'Address')}</th><th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">${L('Enviados', 'Sent')}</th><th scope="col" class="n">${L('Recibidos', 'Received')}</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map(e => `<tr><td class="mono">${esc(e.addr)}</td><td class="n">${fmtNum(e.pkts)}</td><td class="n">${fmtNum(e.bytes)}</td><td class="n">${fmtNum(e.tx)}</td><td class="n">${fmtNum(e.rx)}</td><td><button class="btn sm ghost" type="button" data-f="ip.addr == ${esc(e.addr)}">${ic('filter', 'sm')}${t('filterThis')}</button></td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Cada IP que aparece en la captura. Un equipo que solo recibe, o uno que habla con muchos, suele ser el primer hilo del que tirar.</p>`;
+ <p class="sm muted">${L('Cada IP que aparece en la captura. Un equipo que solo recibe, o uno que habla con muchos, suele ser el primer hilo del que tirar.', 'Every IP in the capture. A host that only receives, or one that talks to many, is usually the first thread to pull.')}</p>`;
$$('[data-f]', panel).forEach(b => b.onclick = () => { ws.setFilter(b.dataset.f); closeDialog(); });
}
/* ---------- Analizar › Información experta ---------- */
-const SEV_LABEL = { error: 'Error', warn: 'Aviso', note: 'Nota', chat: 'Conversación' };
+const SEV_LABELS = { es: { error: 'Error', warn: 'Aviso', note: 'Nota', chat: 'Conversación' }, en: { error: 'Error', warn: 'Warning', note: 'Note', chat: 'Chat' } };
+const sevLabel = k => SEV_LABELS[LANG === 'en' ? 'en' : 'es'][k];
function openExpert(ws) {
const ex = expertInfo(ws.pkts), body = document.createElement('div');
- body.innerHTML = `<p class="muted sm">Wireshark resume aquí lo que le llama la atención de cada paquete, de más grave a más rutinario. Los mensajes se muestran en inglés, como en Wireshark, para que los reconozcas.</p>
- <div class="ex-sum">${EXPERT_SEV.map(([k, en]) => `<span class="ex-chip sev-${k}"><strong>${fmtNum(ex.count[k])}</strong> ${SEV_LABEL[k]} <small>(${en})</small></span>`).join('')}</div>
- ${ex.items.length ? `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('expert')}"><table class="tbl ex"><caption class="vh">${t('expert')}</caption><thead><tr><th scope="col">Severidad</th><th scope="col">Resumen</th><th scope="col">Protocolo</th><th scope="col" class="n">Cantidad</th><th scope="col">Paquetes</th></tr></thead>
- <tbody>${ex.items.map((it, i) => `<tr><td><span class="ex-chip sev-${it.sev}">${SEV_LABEL[it.sev]}</span></td><td class="mono">${esc(it.summary)}</td><td>${esc(it.proto)}</td><td class="n">${fmtNum(it.nos.length)}</td>
- <td><div class="ex-nos">${it.nos.slice(0, 8).map(n => `<button class="btn sm ghost mono" type="button" data-no="${n}" aria-label="Ir al paquete ${n}">${n}</button>`).join('')}${it.nos.length > 1 ? `<button class="btn sm ghost" type="button" data-show="${i}">${ic('filter', 'sm')}Mostrar</button>` : ''}</div></td></tr>`).join('')}</tbody></table></div>`
- : '<p class="muted">No hay entradas: esta captura no tiene TCP ni HTTP que comentar.</p>'}`;
+ body.innerHTML = `<p class="muted sm">${L('Wireshark resume aquí lo que le llama la atención de cada paquete, de más grave a más rutinario. Los mensajes se muestran en inglés, como en Wireshark, para que los reconozcas.', 'Wireshark sums up here what catches its eye in each packet, from most serious to most routine.')}</p>
+ <div class="ex-sum">${EXPERT_SEV.map(([k, en]) => `<span class="ex-chip sev-${k}"><strong>${fmtNum(ex.count[k])}</strong> ${sevLabel(k)}${LANG === 'en' ? '' : ` <small>(${en})</small>`}</span>`).join('')}</div>
+ ${ex.items.length ? `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('expert')}"><table class="tbl ex"><caption class="vh">${t('expert')}</caption><thead><tr><th scope="col">${L('Severidad', 'Severity')}</th><th scope="col">${L('Resumen', 'Summary')}</th><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col" class="n">${L('Cantidad', 'Count')}</th><th scope="col">${L('Paquetes', 'Packets')}</th></tr></thead>
+ <tbody>${ex.items.map((it, i) => `<tr><td><span class="ex-chip sev-${it.sev}">${sevLabel(it.sev)}</span></td><td class="mono">${esc(it.summary)}</td><td>${esc(it.proto)}</td><td class="n">${fmtNum(it.nos.length)}</td>
+ <td><div class="ex-nos">${it.nos.slice(0, 8).map(n => `<button class="btn sm ghost mono" type="button" data-no="${n}" aria-label="${L('Ir al paquete', 'Go to packet')} ${n}">${n}</button>`).join('')}${it.nos.length > 1 ? `<button class="btn sm ghost" type="button" data-show="${i}">${ic('filter', 'sm')}${L('Mostrar', 'Show')}</button>` : ''}</div></td></tr>`).join('')}</tbody></table></div>`
+ : `<p class="muted">${L('No hay entradas: esta captura no tiene TCP ni HTTP que comentar.', 'No entries: this capture has no TCP or HTTP worth commenting on.')}</p>`}`;
openDialog({ title: `${ic('alert')} ${t('expert')}`, body, wide: true });
$$('[data-no]', body).forEach(b => b.onclick = () => { closeDialog(); ws.select(+b.dataset.no, { focusList: true }); });
$$('[data-show]', body).forEach(b => b.onclick = () => { closeDialog(); ws.setFilter(`frame.number in {${ex.items[+b.dataset.show].nos.join(', ')}}`); });
@@ -3253,18 +3459,18 @@ function openExpert(ws) {
function openObjects(ws) {
const objs = httpObjects(ws.pkts), body = document.createElement('div');
const isText = o => /^(text\/|application\/(json|javascript|xml|x-www-form-urlencoded))/i.test(o.type);
- body.innerHTML = objs.length ? `<p class="muted sm">Los cuerpos HTTP reconstruidos de la captura: páginas, scripts, JSON, formularios y ficheros. Así se recupera lo que se descargó (o se robó) por HTTP sin cifrar.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('objects')}"><table class="tbl"><caption class="vh">${t('objects')}</caption><thead><tr><th scope="col" class="n">Paquete</th><th scope="col">Host</th><th scope="col">Tipo de contenido</th><th scope="col" class="n">Tamaño</th><th scope="col">Nombre</th><th scope="col"><span class="vh">Acciones</span></th></tr></thead>
- <tbody>${objs.map((o, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-no="${o.no}" aria-label="Ir al paquete ${o.no}">${o.no}</button></td><td class="mono">${esc(o.host)}</td><td class="mono sm">${esc(o.type || '—')}</td><td class="n">${fmtNum(o.size)} B</td><td class="mono">${esc(o.name)}</td>
- <td><div class="row">${isText(o) ? `<button class="btn sm ghost" type="button" data-view="${i}" aria-label="Ver ${esc(o.name)}">${ic('eye', 'sm')}Ver</button>` : ''}<button class="btn sm ghost" type="button" data-save="${i}" aria-label="Guardar ${esc(o.name)}">${ic('download', 'sm')}Guardar</button></div></td></tr>`).join('')}</tbody></table></div>
+ body.innerHTML = objs.length ? `<p class="muted sm">${L('Los cuerpos HTTP reconstruidos de la captura: páginas, scripts, JSON, formularios y ficheros. Así se recupera lo que se descargó (o se robó) por HTTP sin cifrar.', 'HTTP bodies rebuilt from the capture: pages, scripts, JSON, forms and files. This is how you recover what was downloaded (or stolen) over plain HTTP.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('objects')}"><table class="tbl"><caption class="vh">${t('objects')}</caption><thead><tr><th scope="col" class="n">${L('Paquete', 'Packet')}</th><th scope="col">Host</th><th scope="col">${L('Tipo de contenido', 'Content type')}</th><th scope="col" class="n">${L('Tamaño', 'Size')}</th><th scope="col">${L('Nombre', 'Filename')}</th><th scope="col"><span class="vh">${L('Acciones', 'Actions')}</span></th></tr></thead>
+ <tbody>${objs.map((o, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-no="${o.no}" aria-label="${L('Ir al paquete', 'Go to packet')} ${o.no}">${o.no}</button></td><td class="mono">${esc(o.host)}</td><td class="mono sm">${esc(o.type || '—')}</td><td class="n">${fmtNum(o.size)} B</td><td class="mono">${esc(o.name)}</td>
+ <td><div class="row">${isText(o) ? `<button class="btn sm ghost" type="button" data-view="${i}" aria-label="${L('Ver', 'View')} ${esc(o.name)}">${ic('eye', 'sm')}${L('Ver', 'View')}</button>` : ''}<button class="btn sm ghost" type="button" data-save="${i}" aria-label="${L('Guardar', 'Save')} ${esc(o.name)}">${ic('download', 'sm')}${L('Guardar', 'Save')}</button></div></td></tr>`).join('')}</tbody></table></div>
<div class="ob-prev" hidden><p class="sm"><strong data-pn></strong></p><pre class="mono" tabindex="0"></pre></div>`
- : '<p class="muted">Esta captura no lleva objetos HTTP. Prueba con los módulos 2, 3 o 6.</p>';
+ : `<p class="muted">${L('Esta captura no lleva objetos HTTP. Prueba con los módulos 2, 3 o 6.', 'This capture carries no HTTP objects. Try modules 2, 3 or 6.')}</p>`;
openDialog({ title: `${ic('file')} ${t('objects')}`, body, wide: true });
$$('[data-no]', body).forEach(b => b.onclick = () => { closeDialog(); ws.select(+b.dataset.no, { focusList: true }); });
- $$('[data-save]', body).forEach(b => b.onclick = () => { const o = objs[+b.dataset.save]; download(o.data, o.name, 'application/octet-stream'); toast(`Guardado: <code>${esc(o.name)}</code>`, 'ok', 'download'); });
+ $$('[data-save]', body).forEach(b => b.onclick = () => { const o = objs[+b.dataset.save]; download(o.data, o.name, 'application/octet-stream'); toast(`${L('Guardado', 'Saved')}: <code>${esc(o.name)}</code>`, 'ok', 'download'); });
$$('[data-view]', body).forEach(b => b.onclick = () => {
const o = objs[+b.dataset.view], pv = $('.ob-prev', body);
- pv.hidden = false; $('[data-pn]', pv).textContent = `${o.name} · paquete ${o.no}`;
+ pv.hidden = false; $('[data-pn]', pv).textContent = `${o.name} · ${L('paquete', 'packet')} ${o.no}`;
$('pre', pv).textContent = new TextDecoder().decode(o.data); // texto, nunca HTML interpretado
$('pre', pv).focus();
});
@@ -3273,11 +3479,11 @@ function openObjects(ws) {
/* ---------- Herramientas › Credenciales ---------- */
function openCreds(ws) {
const cr = credentials(ws.pkts), body = document.createElement('div');
- body.innerHTML = cr.length ? `<p class="muted sm">Usuarios que viajan por protocolos que Wireshark sabe leer (HTTP Basic, FTP, NTLMSSP). Pulsa el paquete para ir al campo exacto del árbol.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('creds')}"><table class="tbl"><caption class="vh">${t('creds')}</caption><thead><tr><th scope="col" class="n">Paquete</th><th scope="col">Protocolo</th><th scope="col">Usuario</th><th scope="col">Información</th></tr></thead>
- <tbody>${cr.map((c, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-i="${i}" aria-label="Ir al paquete ${c.no}">${c.no}</button></td><td>${esc(c.proto)}</td><td class="mono">${esc(c.user)}</td><td class="sm">${esc(c.info)}</td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Wireshark no muestra aquí los formularios POST: esos los buscas tú con <code>http.request.method == "POST"</code>.</p>`
- : '<p class="muted">No hay credenciales en esta captura. Las encontrarás en los módulos 3 (HTTP Basic y FTP) y 7 (NTLMSSP).</p>';
+ body.innerHTML = cr.length ? `<p class="muted sm">${L('Usuarios que viajan por protocolos que Wireshark sabe leer (HTTP Basic, FTP, NTLMSSP). Pulsa el paquete para ir al campo exacto del árbol.', 'Usernames carried by protocols Wireshark can read (HTTP Basic, FTP, NTLMSSP). Click the packet to jump to the exact field in the tree.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('creds')}"><table class="tbl"><caption class="vh">${t('creds')}</caption><thead><tr><th scope="col" class="n">${L('Paquete', 'Packet')}</th><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col">${L('Usuario', 'Username')}</th><th scope="col">${L('Información', 'Info')}</th></tr></thead>
+ <tbody>${cr.map((c, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-i="${i}" aria-label="${L('Ir al paquete', 'Go to packet')} ${c.no}">${c.no}</button></td><td>${esc(c.proto)}</td><td class="mono">${esc(c.user)}</td><td class="sm">${esc(c.info)}</td></tr>`).join('')}</tbody></table></div>
+ <p class="sm muted">${L('Wireshark no muestra aquí los formularios POST: esos los buscas tú con', 'Wireshark does not list POST forms here: find those yourself with')} <code>http.request.method == "POST"</code>.</p>`
+ : `<p class="muted">${L('No hay credenciales en esta captura. Las encontrarás en los módulos 3 (HTTP Basic y FTP) y 7 (NTLMSSP).', 'No credentials in this capture. You will find them in modules 3 (HTTP Basic and FTP) and 7 (NTLMSSP).')}</p>`;
openDialog({ title: `${ic('lock')} ${t('creds')}`, body, wide: true });
$$('[data-i]', body).forEach(b => b.onclick = () => { const c = cr[+b.dataset.i]; closeDialog(); ws.revealField(c.no, c.field); });
}
@@ -3287,14 +3493,14 @@ function openFind(ws, mode = 'find') {
const body = document.createElement('div');
body.innerHTML = `<div class="seg" role="tablist" aria-label="${t('findPkt')}"><button role="tab" id="fd-find" aria-selected="${mode === 'find'}" data-m="find">${ic('search', 'sm')}${t('findPkt')}</button><button role="tab" id="fd-goto" aria-selected="${mode === 'goto'}" data-m="goto">${ic('target', 'sm')}${t('gotoPkt')}</button></div>
<form class="fd" data-p="find" ${mode === 'find' ? '' : 'hidden'} aria-labelledby="fd-find">
- <div class="row wrap"><label class="sm" for="fd-k">Buscar por</label><select id="fd-k" class="sel"><option value="filter">Filtro de visualización</option><option value="str">Cadena en los bytes</option><option value="hex">Valor hexadecimal</option></select>
- <label class="row sm"><input type="checkbox" id="fd-c"> Distinguir mayúsculas</label></div>
- <label class="vh" for="fd-q">Qué buscar</label><input id="fd-q" class="tinput mono" type="text" autocomplete="off" spellcheck="false" placeholder="p. ej. http.cookie, password o 50 4b 03 04">
- <div class="row"><button class="btn primary sm" type="submit">${ic('search', 'sm')}Buscar siguiente</button><span class="sm" data-msg aria-live="polite"></span></div>
+ <div class="row wrap"><label class="sm" for="fd-k">${L('Buscar por', 'Search by')}</label><select id="fd-k" class="sel"><option value="filter">${L('Filtro de visualización', 'Display filter')}</option><option value="str">${L('Cadena en los bytes', 'String in bytes')}</option><option value="hex">${L('Valor hexadecimal', 'Hex value')}</option></select>
+ <label class="row sm"><input type="checkbox" id="fd-c"> ${L('Distinguir mayúsculas', 'Case sensitive')}</label></div>
+ <label class="vh" for="fd-q">${L('Qué buscar', 'What to find')}</label><input id="fd-q" class="tinput mono" type="text" autocomplete="off" spellcheck="false" placeholder="${L('p. ej. http.cookie, password o 50 4b 03 04', 'e.g. http.cookie, password or 50 4b 03 04')}">
+ <div class="row"><button class="btn primary sm" type="submit">${ic('search', 'sm')}${L('Buscar siguiente', 'Find next')}</button><span class="sm" data-msg aria-live="polite"></span></div>
</form>
<form class="fd" data-p="goto" ${mode === 'goto' ? '' : 'hidden'} aria-labelledby="fd-goto">
- <label class="sm" for="fd-n">Número de paquete (1 a ${fmtNum(ws.pkts.length)})</label><input id="fd-n" class="tinput mono" type="number" min="1" max="${ws.pkts.length}" inputmode="numeric">
- <div class="row"><button class="btn primary sm" type="submit">${ic('target', 'sm')}Ir</button><span class="sm" data-msg2 aria-live="polite"></span></div>
+ <label class="sm" for="fd-n">${L('Número de paquete', 'Packet number')} (1 ${L('a', 'to')} ${fmtNum(ws.pkts.length)})</label><input id="fd-n" class="tinput mono" type="number" min="1" max="${ws.pkts.length}" inputmode="numeric">
+ <div class="row"><button class="btn primary sm" type="submit">${ic('target', 'sm')}${L('Ir', 'Go')}</button><span class="sm" data-msg2 aria-live="polite"></span></div>
</form>`;
openDialog({ title: `${ic('search')} ${t('findPkt')}`, body, cls: 'narrow' });
const show = m => { $$('[role=tab]', body).forEach(b => b.setAttribute('aria-selected', String(b.dataset.m === m))); $$('form', body).forEach(f => { f.hidden = f.dataset.p !== m; }); $(m === 'find' ? '#fd-q' : '#fd-n', body).focus(); };
@@ -3309,20 +3515,20 @@ function openFind(ws, mode = 'find') {
$('[data-p=goto]', body).onsubmit = e => {
e.preventDefault();
const n = +$('#fd-n', body).value, m2 = $('[data-msg2]', body);
- if (!ws.byNo.has(n)) { m2.className = 'sm bad'; m2.textContent = `No existe el paquete ${n}.`; return; }
- if (!ws.view.some(p => p.no === n)) { m2.className = 'sm bad'; m2.textContent = `El paquete ${n} está oculto por el filtro actual. Bórralo para verlo.`; return; }
+ if (!ws.byNo.has(n)) { m2.className = 'sm bad'; m2.textContent = L(`No existe el paquete ${n}.`, `Packet ${n} does not exist.`); return; }
+ if (!ws.view.some(p => p.no === n)) { m2.className = 'sm bad'; m2.textContent = L(`El paquete ${n} está oculto por el filtro actual. Bórralo para verlo.`, `Packet ${n} is hidden by the current filter. Clear it to see it.`); return; }
closeDialog(); ws.select(n, { focusList: true });
};
}
/* Busca el siguiente paquete mostrado, tras el seleccionado y dando la vuelta, como Wireshark. */
function findPacket(ws, kind, q, cs) {
q = String(q || '');
- if (!q.trim()) return { ok: false, msg: 'Escribe qué buscar.' };
+ if (!q.trim()) return { ok: false, msg: L('Escribe qué buscar.', 'Type what to find.') };
let test;
- if (kind === 'filter') { const r = parseFilter(q); if (!r.ok) return { ok: false, msg: r.error || 'El filtro no es válido.' }; test = r.test; }
+ if (kind === 'filter') { const r = parseFilter(q); if (!r.ok) return { ok: false, msg: fErr(r.error) || L('El filtro no es válido.', 'The filter is not valid.') }; test = r.test; }
else if (kind === 'hex') {
const h = q.replace(/0x|[\s:.-]/gi, '');
- if (!/^([0-9a-f]{2})+$/i.test(h)) return { ok: false, msg: 'Escribe bytes en hexadecimal, por pares: 50 4b 03 04' };
+ if (!/^([0-9a-f]{2})+$/i.test(h)) return { ok: false, msg: L('Escribe bytes en hexadecimal, por pares: 50 4b 03 04', 'Type bytes in hex, in pairs: 50 4b 03 04') };
const nd = h.match(/../g).map(x => parseInt(x, 16));
test = p => { const b = p.b; outer: for (let i = 0; i + nd.length <= b.length; i++) { for (let j = 0; j < nd.length; j++) if (b[i + j] !== nd[j]) continue outer; return true; } return false; };
} else {
@@ -3332,31 +3538,31 @@ function findPacket(ws, kind, q, cs) {
const v = ws.view, start = Math.max(-1, v.findIndex(p => p.no === ws.sel));
for (let k = 1; k <= v.length; k++) {
const p = v[(start + k) % v.length];
- if (test(p)) { ws.select(p.no); return { ok: true, msg: `Encontrado en el paquete ${p.no}${(start + k) >= v.length && start >= 0 ? ' (se ha dado la vuelta)' : ''}.` }; }
+ if (test(p)) { ws.select(p.no); return { ok: true, msg: `${L('Encontrado en el paquete', 'Found in packet')} ${p.no}${(start + k) >= v.length && start >= 0 ? L(' (se ha dado la vuelta)', ' (wrapped around)') : ''}.` }; }
}
- return { ok: false, msg: 'No aparece en ningún paquete mostrado.' };
+ return { ok: false, msg: L('No aparece en ningún paquete mostrado.', 'Not found in any displayed packet.') };
}
/* src/app/45-ladder.js */
/* Megalodon · diagrama de escalera animado de un flujo TCP (módulo 1). Cada flecha es un paquete; al pulsarla se selecciona en Wireshark. */
function ladderSVG(pkts, stream, onPick) {
- const L = flowLadder(pkts, stream); if (!L) return document.createElement('div');
- const W = 560, ax = 150, bx = 470, top = 64, rh = 40, H = top + L.steps.length * rh + 16;
- const phase = s => s.flags.includes('SYN') ? 'hs' : s.flags.includes('FIN') || s.flags.includes('RST') || (s.len === 0 && L.steps.some(x => x.flags.includes('FIN') && x.no < s.no)) ? 'fin' : 'data';
- const names = { hs: 'Saludo', data: 'Datos', fin: 'Cierre' };
+ const LD = flowLadder(pkts, stream); if (!LD) return document.createElement('div');
+ const W = 560, ax = 150, bx = 470, top = 64, rh = 40, H = top + LD.steps.length * rh + 16;
+ const phase = s => s.flags.includes('SYN') ? 'hs' : s.flags.includes('FIN') || s.flags.includes('RST') || (s.len === 0 && LD.steps.some(x => x.flags.includes('FIN') && x.no < s.no)) ? 'fin' : 'data';
+ const names = LANG === 'en' ? { hs: 'Handshake', data: 'Data', fin: 'Teardown' } : { hs: 'Saludo', data: 'Datos', fin: 'Cierre' };
const groups = [];
- L.steps.forEach((s, i) => { const ph = phase(s); if (!groups.length || groups[groups.length - 1].ph !== ph) groups.push({ ph, a: i, b: i }); else groups[groups.length - 1].b = i; });
+ LD.steps.forEach((s, i) => { const ph = phase(s); if (!groups.length || groups[groups.length - 1].ph !== ph) groups.push({ ph, a: i, b: i }); else groups[groups.length - 1].b = i; });
const wrap = document.createElement('figure');
wrap.className = 'ladder';
- wrap.innerHTML = `<svg viewBox="0 0 ${W} ${H}" role="group" aria-label="Diagrama del flujo TCP ${stream}: ${L.steps.length} paquetes entre ${L.a}:${L.pa} y ${L.b}:${L.pb}">
- <text class="lh" x="${ax}" y="20" text-anchor="middle">Kali</text><text class="lh2" x="${ax}" y="38" text-anchor="middle">${L.a}:${L.pa}</text>
- <text class="lh" x="${bx}" y="20" text-anchor="middle">Servidor web</text><text class="lh2" x="${bx}" y="38" text-anchor="middle">${L.b}:${L.pb}</text>
+ wrap.innerHTML = `<svg viewBox="0 0 ${W} ${H}" role="group" aria-label="${L(`Diagrama del flujo TCP ${stream}: ${LD.steps.length} paquetes entre ${LD.a}:${LD.pa} y ${LD.b}:${LD.pb}`, `TCP stream ${stream} diagram: ${LD.steps.length} packets between ${LD.a}:${LD.pa} and ${LD.b}:${LD.pb}`)}">
+ <text class="lh" x="${ax}" y="20" text-anchor="middle">Kali</text><text class="lh2" x="${ax}" y="38" text-anchor="middle">${LD.a}:${LD.pa}</text>
+ <text class="lh" x="${bx}" y="20" text-anchor="middle">${L('Servidor web', 'Web server')}</text><text class="lh2" x="${bx}" y="38" text-anchor="middle">${LD.b}:${LD.pb}</text>
<line class="life" x1="${ax}" x2="${ax}" y1="48" y2="${H - 6}"/><line class="life" x1="${bx}" x2="${bx}" y1="48" y2="${H - 6}"/>
${groups.map(g => `<g class="ph ph-${g.ph}"><rect x="8" y="${top + g.a * rh - 12}" width="74" height="${(g.b - g.a + 1) * rh - 8}" rx="8"/><text x="45" y="${top + ((g.a + g.b) / 2) * rh + 8}" text-anchor="middle">${names[g.ph]}</text></g>`).join('')}
- ${L.steps.map((s, i) => {
+ ${LD.steps.map((s, i) => {
const y = top + i * rh, x1 = s.fromA ? ax : bx, x2 = s.fromA ? bx : ax, dir = s.fromA ? 1 : -1, mid = (ax + bx) / 2;
const lab = s.flags.join(', ') + (s.app ? ` · ${s.app}` : '');
- return `<g class="step ${s.flags.includes('RST') ? 'rst' : ''} ${s.app ? 'app' : ''}" data-no="${s.no}" data-i="${i}" tabindex="0" role="button" aria-label="Paquete ${s.no}: ${esc(lab)}, Seq ${s.seq}, Ack ${s.ack}, Len ${s.len}">
+ return `<g class="step ${s.flags.includes('RST') ? 'rst' : ''} ${s.app ? 'app' : ''}" data-no="${s.no}" data-i="${i}" tabindex="0" role="button" aria-label="${L('Paquete', 'Packet')} ${s.no}: ${esc(lab)}, Seq ${s.seq}, Ack ${s.ack}, Len ${s.len}">
<line class="ar" x1="${x1}" y1="${y}" x2="${x2 - dir * 7}" y2="${y + 12}" pathLength="1"/>
<path class="hd" d="M ${x2} ${y + 12.3} l ${-dir * 10} -7 l 0 9 z"/>
<text class="sl" x="${mid}" y="${y - 3}" text-anchor="middle">${esc(lab)}</text>
@@ -3364,7 +3570,7 @@ function ladderSVG(pkts, stream, onPick) {
</g>`;
}).join('')}
</svg>
- <figcaption class="row between"><span class="sm muted">Pulsa una flecha para abrir ese paquete en Wireshark.</span><button class="btn sm ghost" type="button" data-replay>${ic('reset', 'sm')}Repetir animación</button></figcaption>`;
+ <figcaption class="row between"><span class="sm muted">${L('Pulsa una flecha para abrir ese paquete en Wireshark.', 'Click an arrow to open that packet in Wireshark.')}</span><button class="btn sm ghost" type="button" data-replay>${ic('reset', 'sm')}${L('Repetir animación', 'Replay animation')}</button></figcaption>`;
const steps = $$('.step', wrap);
steps.forEach((g, i) => { g.style.setProperty('--d', `${i * 110}ms`); });
const play = () => { if (REDUCED.matches) return; wrap.classList.remove('play'); void wrap.offsetWidth; wrap.classList.add('play'); };
@@ -3688,12 +3894,12 @@ const tD0 = u => ZC(u) + HT(u);
const ANCHORS = [
{ id: 'hoc', p: bodyPt(.03, 1.75), w: 0, t: ['Hocico', 'ampollas de Lorenzini'] },
{ id: 'ojo', p: bodyPt(.088, 1.03), w: 0, t: ['Ojo', 'tapetum lucidum'] },
- { id: 'die', p: lerp3(bodyPt(.1, phiM(.1)), center(.1), .1), w: 1, t: ['Dientes aserrados', '2 filas · reemplazo continuo'] },
- { id: 'bra', p: bodyPt(.215, 1.45), w: 0, t: ['Hendiduras branquiales', '5 por lado'] },
- { id: 'dor', p: [X(.445), tD0(.445) + .122, 0], w: 0, t: ['Primera dorsal', 'estabiliza el balanceo'] },
- { id: 'pec', p: add(inward(.258, 2.16, .86), [-.14, -.095, .15]), w: 0, t: ['Aleta pectoral', 'sustentación y giro'] },
- { id: 'qui', p: bodyPt(.875, Math.PI / 2), w: 0, t: ['Quilla del pedúnculo', 'reduce la resistencia'] },
- { id: 'cau', p: [X(1.105), .205, 0], w: 0, t: ['Caudal semilunar', 'nado carangiforme'] },
+ { id: 'die', p: lerp3(bodyPt(.1, phiM(.1)), center(.1), .1), w: 1, t: ['Dientes aserrados', '2 filas · reemplazo continuo'], te: ['Serrated teeth', '2 rows · constant replacement'] },
+ { id: 'bra', p: bodyPt(.215, 1.45), w: 0, t: ['Hendiduras branquiales', '5 por lado'], te: ['Gill slits', '5 per side'] },
+ { id: 'dor', p: [X(.445), tD0(.445) + .122, 0], w: 0, t: ['Primera dorsal', 'estabiliza el balanceo'], te: ['First dorsal', 'steadies the roll'] },
+ { id: 'pec', p: add(inward(.258, 2.16, .86), [-.14, -.095, .15]), w: 0, t: ['Aleta pectoral', 'sustentación y giro'], te: ['Pectoral fin', 'lift and turning'] },
+ { id: 'qui', p: bodyPt(.875, Math.PI / 2), w: 0, t: ['Quilla del pedúnculo', 'reduce la resistencia'], te: ['Caudal keel', 'cuts drag'] },
+ { id: 'cau', p: [X(1.105), .205, 0], w: 0, t: ['Caudal semilunar', 'nado carangiforme'], te: ['Lunate tail', 'carangiform swimming'] },
];
@@ -4295,8 +4501,8 @@ function callouts(s) {
const pl = document.createElementNS(NS_SVG, 'polyline'); pl.setAttribute('class', 'ld');
const rc = document.createElementNS(NS_SVG, 'rect'); rc.setAttribute('class', 'plate'); rc.setAttribute('rx', 6);
const dt = document.createElementNS(NS_SVG, 'circle'); dt.setAttribute('class', 'dot'); dt.setAttribute('r', 3);
- const t1 = document.createElementNS(NS_SVG, 'text'); t1.setAttribute('class', 'k'); t1.textContent = a.t[0];
- const t2 = document.createElementNS(NS_SVG, 'text'); t2.textContent = a.t[1];
+ const t1 = document.createElementNS(NS_SVG, 'text'); t1.setAttribute('class', 'k'); t1.textContent = (LANG === 'en' ? a.te : a.t)[0];
+ const t2 = document.createElementNS(NS_SVG, 'text'); t2.textContent = (LANG === 'en' ? a.te : a.t)[1];
g.append(pl, rc, dt, t1, t2); svg.append(g);
return { a, g, pl, rc, dt, t1, t2, w: 0 };
});
@@ -4362,7 +4568,7 @@ function ensureGL() {
cv = document.createElement('canvas');
cv.className = 'shark-cv';
cv.setAttribute('role', 'img');
- cv.setAttribute('aria-label', 'Un megalodón realista nada entre rayos de luz. Cada pocos segundos muerde: eleva el hocico, abre la boca en herradura y adelanta la mandíbula superior enseñando la encía y los dientes aserrados.');
+ cv.setAttribute('aria-label', LANG === 'en' ? 'A realistic megalodon swims through shafts of light. Every few seconds it bites: it lifts its snout, opens its horseshoe mouth and thrusts the upper jaw forward, showing the gum and the serrated teeth.' : 'Un megalodón realista nada entre rayos de luz. Cada pocos segundos muerde: eleva el hocico, abre la boca en herradura y adelanta la mandíbula superior enseñando la encía y los dientes aserrados.');
gl = cv.getContext('webgl2', { antialias: false, alpha: false, depth: false, stencil: false, powerPreference: 'high-performance', preserveDrawingBuffer: false });
if (!gl) return (glOk = false);
try {
@@ -4383,14 +4589,14 @@ function mount(slot) {
const hud = document.createElement('div');
hud.className = 'shark-hud';
hud.setAttribute('role', 'group');
- hud.setAttribute('aria-label', 'Megalodón 3D');
- hud.innerHTML = `<button type="button" class="btn ghost sm" data-shark-mode aria-pressed="false">${ic('layers', 'sm')}Plano técnico</button><button type="button" class="ibtn" data-shark-pause>${ic('pause')}</button>`;
+ hud.setAttribute('aria-label', LANG === 'en' ? '3D megalodon' : 'Megalodón 3D');
+ hud.innerHTML = `<button type="button" class="btn ghost sm" data-shark-mode aria-pressed="false">${ic('layers', 'sm')}${LANG === 'en' ? 'Blueprint' : 'Plano técnico'}</button><button type="button" class="ibtn" data-shark-pause>${ic('pause')}</button>`;
host.append(hud);
const modeBtn = hud.querySelector('[data-shark-mode]'), pauseBtn = hud.querySelector('[data-shark-pause]');
const sync = () => {
const still = isStill();
pauseBtn.innerHTML = ic(still ? 'play' : 'pause');
- pauseBtn.setAttribute('aria-label', still ? 'Reanudar la animación del megalodón' : 'Pausar la animación del megalodón');
+ pauseBtn.setAttribute('aria-label', LANG === 'en' ? (still ? 'Resume the megalodon animation' : 'Pause the megalodon animation') : (still ? 'Reanudar la animación del megalodón' : 'Pausar la animación del megalodón'));
modeBtn.setAttribute('aria-pressed', String(st.blueTo > .5));
};
modeBtn.onclick = () => { st.blueTo = st.blueTo > .5 ? 0 : 1; sync(); if (!running) settle(); };
@@ -4435,7 +4641,7 @@ let CUR_WS = null;
const CAP_CACHE = {};
const capPkts = k => CAP_CACHE[k] || (CAP_CACHE[k] = dissectAll(SCENARIOS[k]()).pkts);
const capName = k => `${SCENARIO_FILES[k] || k}.pcapng`;
-const TASK_TYPES = { filter: ['Filtro', 'filter'], packet: ['Paquete', 'target'], text: ['Respuesta', 'terminal'], choice: ['Test', 'list'] };
+const TASK_TYPES = { filter: [['Filtro', 'Filter'], 'filter'], packet: [['Paquete', 'Packet'], 'target'], text: [['Respuesta', 'Answer'], 'terminal'], choice: [['Test', 'Quiz'], 'list'] };
const norm = s => String(s).normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().replace(/\s+/g, ' ').trim();
const plain = s => String(s).replace(/[`*]/g, '');
const isNarrow = () => matchMedia('(max-width: 1023px)').matches;
@@ -4448,35 +4654,35 @@ function viewHome(main) {
main.innerHTML = `
<section class="hero" aria-labelledby="hero-t">
<div class="hero-art" id="hero-slot">
- <picture><source type="image/avif" srcset="${HERO_IMG.avif}"><img class="hero-img" src="${HERO_IMG.webp}" width="${HERO_IMG.w}" height="${HERO_IMG.h}" alt="Megalodón dibujado como un plano técnico azul" decoding="async" fetchpriority="high"></picture>
+ <picture><source type="image/avif" srcset="${HERO_IMG.avif}"><img class="hero-img" src="${HERO_IMG.webp}" width="${HERO_IMG.w}" height="${HERO_IMG.h}" alt="${L('Megalodón dibujado como un plano técnico azul', 'Megalodon drawn as a blue technical blueprint')}" decoding="async" fetchpriority="high"></picture>
</div>
<div class="hero-copy">
- <p class="eyebrow">Laboratorio de Wireshark · eWPT</p>
+ <p class="eyebrow">${L('Laboratorio de Wireshark', 'Wireshark lab')} · eWPT</p>
<h1 id="hero-t">Megalodon</h1>
- <p class="lead">Aprende a leer la red como un pentester: capturas de un ataque real en miniatura, filtros que se validan mientras escribes y retos guiados desde el saludo TCP hasta la inyección SQL.</p>
+ <p class="lead">${L('Aprende a leer la red como un pentester: capturas de un ataque real en miniatura, filtros que se validan mientras escribes y retos guiados desde el saludo TCP hasta la inyección SQL.', 'Learn to read the network like a pentester: miniature captures of a real attack, filters validated as you type and guided challenges from the TCP handshake to SQL injection.')}</p>
<div class="row cta">
- <a class="btn primary lg" href="#/m/${next.id}">${ic('play')}${started ? `${t('continue')}: módulo ${next.n}` : 'Empezar por el módulo 1'}</a>
- <a class="btn ghost lg" href="#/lab">${ic('flask')}Laboratorio libre</a>
+ <a class="btn primary lg" href="#/m/${next.id}">${ic('play')}${started ? `${t('continue')}: ${L('módulo', 'module')} ${next.n}` : L('Empezar por el módulo 1', 'Start with module 1')}</a>
+ <a class="btn ghost lg" href="#/lab">${ic('flask')}${L('Laboratorio libre', 'Free lab')}</a>
</div>
</div>
</section>
<section class="wrap stats3" aria-label="${t('progress')}">
- <div class="stat card"><span class="stat-ic ok">${ic('trophy')}</span><div><p class="stat-v"><span class="num">${xp}</span> XP</p><p class="stat-l">${t('level')}: <strong>${lv.name}</strong>${lv.next ? ` · ${lv.next - xp} XP para el siguiente` : ''}</p>${lv.next ? `<div class="meter" role="progressbar" aria-label="Progreso de nivel" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(100 * (xp - lv.min) / (lv.next - lv.min))}"><i data-w="${100 * (xp - lv.min) / (lv.next - lv.min)}"></i></div>` : ''}</div></div>
- <div class="stat card"><span class="stat-ic">${ic('target')}</span><div><p class="stat-v"><span class="num">${solved}</span> / ${total}</p><p class="stat-l">retos resueltos</p></div></div>
- <div class="stat card"><span class="stat-ic">${ic('award')}</span><div><p class="stat-v"><span class="num">${badges}</span> / ${MODULES.length}</p><p class="stat-l">insignias</p></div></div>
+ <div class="stat card"><span class="stat-ic ok">${ic('trophy')}</span><div><p class="stat-v"><span class="num">${xp}</span> XP</p><p class="stat-l">${t('level')}: <strong>${lvName(lv)}</strong>${lv.next ? ` · ${lv.next - xp} XP ${L('para el siguiente', 'to the next one')}` : ''}</p>${lv.next ? `<div class="meter" role="progressbar" aria-label="${t('levelProg')}" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(100 * (xp - lv.min) / (lv.next - lv.min))}"><i data-w="${100 * (xp - lv.min) / (lv.next - lv.min)}"></i></div>` : ''}</div></div>
+ <div class="stat card"><span class="stat-ic">${ic('target')}</span><div><p class="stat-v"><span class="num">${solved}</span> / ${total}</p><p class="stat-l">${L('retos resueltos', 'challenges solved')}</p></div></div>
+ <div class="stat card"><span class="stat-ic">${ic('award')}</span><div><p class="stat-v"><span class="num">${badges}</span> / ${MODULES.length}</p><p class="stat-l">${L('insignias', 'badges')}</p></div></div>
</section>
<section class="wrap" aria-labelledby="mods-t">
- <div class="sec-h"><h2 id="mods-t">Módulos</h2><p class="muted">Del primer SYN a los ataques web. Cada módulo trae su captura, una lección corta y retos con pistas.</p></div>
+ <div class="sec-h"><h2 id="mods-t">${t('modules')}</h2><p class="muted">${L('Del primer SYN a los ataques web. Cada módulo trae su captura, una lección corta y retos con pistas.', 'From the first SYN to web attacks. Every module brings its own capture, a short lesson and challenges with hints.')}</p></div>
<div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
- <div class="sec-h sub"><h3>${t('extra')}: SOC, DFIR y Directorio Activo</h3><p class="muted">Para cuando termines los seis primeros.</p></div>
+ <div class="sec-h sub"><h3>${t('extra')}: ${L('SOC, DFIR y Directorio Activo', 'SOC, DFIR and Active Directory')}</h3><p class="muted">${L('Para cuando termines los seis primeros.', 'For when you finish the first six.')}</p></div>
<div class="mgrid">${MODULES.filter(m => m.extra).map(modCard).join('')}</div>
</section>
<section class="wrap how" aria-labelledby="how-t">
- <h2 id="how-t">Cómo funciona</h2>
+ <h2 id="how-t">${L('Cómo funciona', 'How it works')}</h2>
<ol class="steps3">
- <li class="card"><span class="stepn">1</span><h3>Lee y prueba</h3><p>Cada lección es corta y trae botones «Pruébalo» que aplican el filtro en la captura.</p></li>
- <li class="card"><span class="stepn">2</span><h3>Resuelve</h3><p>Escribe filtros, selecciona paquetes o responde. Se comprueba contra la captura al instante.</p></li>
- <li class="card"><span class="stepn">3</span><h3>Llévatelo</h3><p>Exporta cada captura en .pcapng y repite el reto en tu Wireshark de verdad.</p></li>
+ <li class="card"><span class="stepn">1</span><h3>${L('Lee y prueba', 'Read and try')}</h3><p>${L('Cada lección es corta y trae botones «Pruébalo» que aplican el filtro en la captura.', 'Each lesson is short and has “Try it” buttons that apply the filter to the capture.')}</p></li>
+ <li class="card"><span class="stepn">2</span><h3>${L('Resuelve', 'Solve')}</h3><p>${L('Escribe filtros, selecciona paquetes o responde. Se comprueba contra la captura al instante.', 'Write filters, pick packets or answer. It is checked against the capture instantly.')}</p></li>
+ <li class="card"><span class="stepn">3</span><h3>${L('Llévatelo', 'Take it with you')}</h3><p>${L('Exporta cada captura en .pcapng y repite el reto en tu Wireshark de verdad.', 'Export each capture as .pcapng and repeat the challenge in your real Wireshark.')}</p></li>
</ol>
</section>
${siteFooter()}`;
@@ -4487,17 +4693,17 @@ function viewHome(main) {
function modCard(m) {
const p = modProgress(m), earned = S.get().badges[m.id];
return `<a class="mcard card" href="#/m/${m.id}">
- <div class="row between"><span class="mic">${ic(m.icon)}</span>${earned ? `<span class="pill ok">${ic('award', 'sm')}${esc(m.badge)}</span>` : `<span class="pill">${m.mins} ${t('minutes')}</span>`}</div>
- <p class="eyebrow">Módulo ${m.n}</p><h3>${esc(m.title)}</h3><p class="muted sm">${esc(m.sub)}</p>
- <div class="mfoot"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="Retos de ${esc(m.title)}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm ${p.done === p.total ? 'okt' : 'muted'}">${p.done}/${p.total}</span></div>
+ <div class="row between"><span class="mic">${ic(m.icon)}</span>${earned ? `<span class="pill ok">${ic('award', 'sm')}${esc(mT(m, 'badge'))}</span>` : `<span class="pill">${m.mins} ${t('minutes')}</span>`}</div>
+ <p class="eyebrow">${L('Módulo', 'Module')} ${m.n}</p><h3>${esc(mT(m, 'title'))}</h3><p class="muted sm">${esc(mT(m, 'sub'))}</p>
+ <div class="mfoot"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="${L('Retos de', 'Challenges in')} ${esc(mT(m, 'title'))}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm ${p.done === p.total ? 'okt' : 'muted'}">${p.done}/${p.total}</span></div>
</a>`;
}
function siteFooter() {
- return `<footer class="foot wrap"><p>Megalodon · laboratorio de Wireshark sin conexión. Contenido basado en la <a href="https://www.wireshark.org/docs/" target="_blank" rel="noopener noreferrer">documentación pública de Wireshark</a>; las capturas son sintéticas y los dominios, de prueba.</p><p>Yoandy Ramírez Delgado · Huelva, España</p></footer>`;
+ return `<footer class="foot wrap"><p>${L('Megalodon · laboratorio de Wireshark sin conexión. Contenido basado en la', 'Megalodon · offline Wireshark lab. Content based on the')} <a href="https://www.wireshark.org/docs/" target="_blank" rel="noopener noreferrer">${L('documentación pública de Wireshark', 'public Wireshark documentation')}</a>${L('; las capturas son sintéticas y los dominios, de prueba.', '; captures are synthetic and domains are test domains.')}</p><p>Yoandy Ramírez Delgado · Huelva, ${L('España', 'Spain')}</p></footer>`;
}
function viewModules(main) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('modules')}</p><h1>Ruta de aprendizaje</h1><p class="muted">Seis módulos principales para el eWPT y dos extra de SOC y Directorio Activo.</p></div>
- <h2 class="vh">Módulos principales</h2><div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('modules')}</p><h1>${L('Ruta de aprendizaje', 'Learning path')}</h1><p class="muted">${L('Seis módulos principales para el eWPT y dos extra de SOC y Directorio Activo.', 'Six core modules for the eWPT and two extra ones on SOC and Active Directory.')}</p></div>
+ <h2 class="vh">${L('Módulos principales', 'Core modules')}</h2><div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
<div class="sec-h sub"><h2>${t('extra')}</h2></div><div class="mgrid">${MODULES.filter(m => m.extra).map(modCard).join('')}</div></div>${siteFooter()}`;
}
@@ -4510,12 +4716,12 @@ function viewModule(main, { id, q }) {
main.innerHTML = `<div class="mod">
<header class="mod-h wrap-wide">
<a class="back sm" href="#/modulos">${ic('chevL', 'sm')}${t('modules')}</a>
- <div class="mod-title"><span class="mic lg">${ic(m.icon)}</span><div><p class="eyebrow">Módulo ${m.n}${m.extra ? ` · ${t('extra')}` : ''} · ${m.mins} ${t('minutes')}</p><h1>${esc(m.title)}</h1></div></div>
- <div class="mod-prog"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="Retos resueltos" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm" data-prog>${p.done}/${p.total} ${t('tasks').toLowerCase()}</span><span class="pill ${S.get().badges[m.id] ? 'ok' : ''}" data-badge>${ic('award', 'sm')}${esc(m.badge)}</span></div>
+ <div class="mod-title"><span class="mic lg">${ic(m.icon)}</span><div><p class="eyebrow">${L('Módulo', 'Module')} ${m.n}${m.extra ? ` · ${t('extra')}` : ''} · ${m.mins} ${t('minutes')}</p><h1>${esc(mT(m, 'title'))}</h1></div></div>
+ <div class="mod-prog"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="${L('Retos resueltos', 'Challenges solved')}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm" data-prog>${p.done}/${p.total} ${t('tasks').toLowerCase()}</span><span class="pill ${S.get().badges[m.id] ? 'ok' : ''}" data-badge>${ic('award', 'sm')}${esc(mT(m, 'badge'))}</span></div>
</header>
<div class="mod-grid wrap-wide">
<div class="mod-side">
- <div class="seg" role="tablist" aria-label="Secciones del módulo">
+ <div class="seg" role="tablist" aria-label="${L('Secciones del módulo', 'Module sections')}">
<button role="tab" id="tab-lesson" aria-controls="pan-lesson" data-tab="lesson">${ic('book', 'sm')}${t('lesson')}</button>
<button role="tab" id="tab-tasks" aria-controls="pan-tasks" data-tab="tasks">${ic('target', 'sm')}${t('tasks')} <span class="num" data-tc>${p.done}/${p.total}</span></button>
<button role="tab" id="tab-ws" aria-controls="pan-ws" data-tab="ws" class="only-narrow">${ic('rows', 'sm')}${t('wireshark')}</button>
@@ -4524,11 +4730,11 @@ function viewModule(main, { id, q }) {
${t('lessonsInSpanish') ? `<p class="note sm">${ic('lang', 'sm')}${t('lessonsInSpanish')}</p>` : ''}
<p class="intro">${md(m.intro)}</p>
${m.lessons.map((l, i) => `<section class="lcard card" id="l-${i}" aria-labelledby="lh-${i}"><h2 id="lh-${i}"><span class="ln">${i + 1}</span>${esc(l.h)}</h2>${l.p.map(x => `<p>${md(x)}</p>`).join('')}${l.ladder !== undefined ? `<div class="ladder-slot" data-stream="${l.ladder}"></div>` : ''}${l.try ? `<div class="tries"><p class="tries-h">${ic('play', 'sm')}${t('tryIt')}</p>${l.try.map(([f, d]) => `<button class="try" type="button" data-f="${esc(f)}"><code>${esc(f)}</code><span>${esc(d)}</span></button>`).join('')}</div>` : ''}</section>`).join('')}
- <button class="btn primary" data-go-tasks type="button">${ic('target')}Ir a los retos</button>
+ <button class="btn primary" data-go-tasks type="button">${ic('target')}${L('Ir a los retos', 'Go to the challenges')}</button>
</div>
<div id="pan-tasks" role="tabpanel" aria-labelledby="tab-tasks" class="pan tasks" tabindex="-1">
${m.tasks.map((x, i) => taskCard(x, i)).join('')}
- <div class="mod-end card ${p.done === p.total ? '' : 'hide'}" data-end>${ic('award')}<div><h2>${t('moduleDone')}</h2><p>${t('badgeEarned')} <strong class="okt">${esc(m.badge)}</strong>.</p></div>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}">${t('next')}${ic('arrowR')}</a>` : ''}</div>
+ <div class="mod-end card ${p.done === p.total ? '' : 'hide'}" data-end>${ic('award')}<div><h2>${t('moduleDone')}</h2><p>${t('badgeEarned')} <strong class="okt">${esc(mT(m, 'badge'))}</strong>.</p></div>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}">${t('next')}${ic('arrowR')}</a>` : ''}</div>
</div>
</div>
<div class="mod-ws" id="pan-ws" role="tabpanel" aria-labelledby="tab-ws"></div>
@@ -4564,8 +4770,8 @@ function viewModule(main, { id, q }) {
if (q.get('t')) { const el = $(`#task-${q.get('t')}`, main); if (el) setTimeout(() => el.scrollIntoView({ block: 'center' }), 30); }
/* retos */
- refreshFilterPreview = () => $$('[data-curf]', main).forEach(el => { el.innerHTML = ws.filterText ? `<code>${esc(ws.filterText)}</code> · ${ws.view.length} paquetes` : `<span class="muted">${t('none')}</span>`; });
- refreshSelPreview = () => { const p = ws.selected(); $$('[data-cursel]', main).forEach(el => { el.innerHTML = p ? `<strong>n.º ${p.no}</strong> · <span class="mono">${esc(p.info.slice(0, 64))}</span>` : `<span class="muted">${t('none')}</span>`; }); };
+ refreshFilterPreview = () => $$('[data-curf]', main).forEach(el => { el.innerHTML = ws.filterText ? `<code>${esc(ws.filterText)}</code> · ${ws.view.length} ${L('paquetes', 'packets')}` : `<span class="muted">${t('none')}</span>`; });
+ refreshSelPreview = () => { const p = ws.selected(); $$('[data-cursel]', main).forEach(el => { el.innerHTML = p ? `<strong>${L('n.º', 'No.')} ${p.no}</strong> · <span class="mono">${esc(p.info.slice(0, 64))}</span>` : `<span class="muted">${t('none')}</span>`; }); };
refreshFilterPreview(); refreshSelPreview();
const fb = (card, kind, html) => { const el = $('.task-fb', card); el.className = `task-fb ${kind}`; el.innerHTML = html; if (kind === 'bad') { card.classList.remove('nope'); void card.offsetWidth; card.classList.add('nope'); } };
const succeed = (task, card) => {
@@ -4594,36 +4800,36 @@ function viewModule(main, { id, q }) {
hintBtn.onclick = () => { S.useHint(task.id); renderHints(); const last = $$('.hint', card).pop(); if (last) last.classList.add('new'); };
renderHints();
if (task.type === 'filter') $('[data-check]', card).onclick = () => {
- if (!ws.filterText) return fb(card, 'bad', `${ic('info')}<span>Escribe un filtro en la barra de Wireshark y pulsa ${t('apply')} (o Enter).</span>`);
+ if (!ws.filterText) return fb(card, 'bad', `${ic('info')}<span>${L('Escribe un filtro en la barra de Wireshark y pulsa', 'Type a filter in the Wireshark bar and press')} ${t('apply')} ${L('(o Enter).', '(or Enter).')}</span>`);
const mine = new Set(ws.view.map(p => p.no)), ref = new Set(applyFilter(ws.pkts, task.ref).map(p => p.no));
const allow = task.mode === 'covers' ? new Set(applyFilter(ws.pkts, task.allow).map(p => p.no)) : ref;
const missing = [...ref].filter(n => !mine.has(n)), extra = [...mine].filter(n => !allow.has(n));
if (!missing.length && !extra.length) return succeed(task, card);
- const parts = [`Tu filtro muestra <strong>${mine.size}</strong> paquetes${task.mode === 'covers' ? '' : `; la solución, <strong>${ref.size}</strong>`}.`];
- if (missing.length) parts.push(`Te faltan ${missing.length}.`);
- if (extra.length) parts.push(`Te sobran ${extra.length} (por ejemplo, el n.º ${extra[0]}).`);
+ const parts = [L(`Tu filtro muestra <strong>${mine.size}</strong> paquetes${task.mode === 'covers' ? '' : `; la solución, <strong>${ref.size}</strong>`}.`, `Your filter shows <strong>${mine.size}</strong> packets${task.mode === 'covers' ? '' : `; the solution, <strong>${ref.size}</strong>`}.`)];
+ if (missing.length) parts.push(L(`Te faltan ${missing.length}.`, `${missing.length} missing.`));
+ if (extra.length) parts.push(L(`Te sobran ${extra.length} (por ejemplo, el n.º ${extra[0]}).`, `${extra.length} too many (for example, No. ${extra[0]}).`));
fb(card, 'bad', `${ic('ko')}<span>${parts.join(' ')}</span>`);
};
if (task.type === 'packet') $('[data-check]', card).onclick = () => {
const p = ws.selected();
- if (!p) return fb(card, 'bad', `${ic('info')}<span>Selecciona un paquete en la lista.</span>`);
+ if (!p) return fb(card, 'bad', `${ic('info')}<span>${L('Selecciona un paquete en la lista.', 'Select a packet in the list.')}</span>`);
const r = parseFilter(task.match);
- if (r.test(p)) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>El n.º ${p.no} no es el que buscamos. Fíjate en la columna Info.</span>`);
+ if (r.test(p)) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${L(`El n.º ${p.no} no es el que buscamos. Fíjate en la columna Info.`, `No. ${p.no} is not the one we are after. Look at the Info column.`)}</span>`);
};
if (task.type === 'text') {
const inp = $('input', card);
const check = () => {
const v = inp.value.trim();
- if (!v) return fb(card, 'bad', `${ic('info')}<span>Escribe tu respuesta.</span>`);
+ if (!v) return fb(card, 'bad', `${ic('info')}<span>${L('Escribe tu respuesta.', 'Type your answer.')}</span>`);
const ok = task.ans.some(a => task.list ? v.split(/[\s,;]+/).filter(Boolean).map(Number).sort((x, y) => x - y).join(',') === a : task.exact ? v === a : norm(v) === norm(a));
- if (ok) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${task.exact && task.ans.some(a => norm(a) === norm(v)) ? 'Casi: revisa mayúsculas y símbolos, las contraseñas se copian exactas.' : 'No es eso. Vuelve a mirar la captura o pide una pista.'}</span>`);
+ if (ok) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${task.exact && task.ans.some(a => norm(a) === norm(v)) ? L('Casi: revisa mayúsculas y símbolos, las contraseñas se copian exactas.', 'Almost: check case and symbols, passwords are copied exactly.') : L('No es eso. Vuelve a mirar la captura o pide una pista.', 'Not quite. Look at the capture again or ask for a hint.')}</span>`);
};
$('[data-check]', card).onclick = check;
inp.addEventListener('keydown', e => { if (e.key === 'Enter') { e.preventDefault(); check(); } });
}
if (task.type === 'choice') $$('[data-opt]', card).forEach(b => b.onclick = () => {
if (+b.dataset.opt === task.ans) { b.classList.add('right'); b.setAttribute('aria-checked', 'true'); succeed(task, card); }
- else { b.classList.add('wrong'); b.disabled = true; fb(card, 'bad', `${ic('ko')}<span>No es esa. Descártala y prueba otra.</span>`); }
+ else { b.classList.add('wrong'); b.disabled = true; fb(card, 'bad', `${ic('ko')}<span>${L('No es esa. Descártala y prueba otra.', 'Not that one. Rule it out and try another.')}</span>`); }
});
if (S.isDone(task.id)) { $$('input, .task-act button', card).forEach(el => { el.disabled = true; }); if (task.type === 'choice') { const r = $(`[data-opt="${task.ans}"]`, card); r.classList.add('right'); r.setAttribute('aria-checked', 'true'); } }
});
@@ -4639,8 +4845,8 @@ function taskCard(x, i) {
: `<div class="opts" role="radiogroup" aria-labelledby="q-${x.id}">${x.opts.map((o, j) => `<button class="opt" type="button" role="radio" aria-checked="false" data-opt="${j}"><span class="ob" aria-hidden="true"></span>${esc(o)}</button>`).join('')}</div>`;
const xp = done ? S.get().done[x.id].xp : XP_BY_HINTS[Math.min(3, S.hintsUsed(x.id))];
return `<article class="task card" id="task-${x.id}" data-id="${x.id}" data-state="${done ? 'done' : 'todo'}" aria-labelledby="q-${x.id}">
- <div class="task-h"><span class="tnum" aria-hidden="true"><span class="tn-n">${i + 1}</span><span class="tn-ok">${ic('check', 'sm')}</span></span><span class="ttype">${ic(ti, 'sm')}${tl}</span><span class="txp">${done ? `${ic('check', 'sm')}+${xp} XP` : `+${xp} XP`}</span></div>
- <p class="tq" id="q-${x.id}"><span class="vh">Reto ${i + 1}${done ? ', resuelto' : ''}: </span>${md(x.q)}</p>
+ <div class="task-h"><span class="tnum" aria-hidden="true"><span class="tn-n">${i + 1}</span><span class="tn-ok">${ic('check', 'sm')}</span></span><span class="ttype">${ic(ti, 'sm')}${L(...tl)}</span><span class="txp">${done ? `${ic('check', 'sm')}+${xp} XP` : `+${xp} XP`}</span></div>
+ <p class="tq" id="q-${x.id}"><span class="vh">${L('Reto', 'Challenge')} ${i + 1}${done ? L(', resuelto', ', solved') : ''}: </span>${md(x.q)}</p>
<div class="task-act">${act}</div>
<div class="task-fb ${done ? 'ok' : ''}" aria-live="polite">${done ? `${ic('ok')}<span>${md(x.ok)}</span>` : ''}</div>
<div class="task-hints"></div>
@@ -4648,7 +4854,7 @@ function taskCard(x, i) {
</article>`;
}
function celebrate(m, nextM) {
- const d = openDialog({ title: t('moduleDone'), cls: 'narrow celebrate', body: `<div class="badge-big" aria-hidden="true">${ic('award')}</div><p class="center">${t('badgeEarned')}</p><p class="center badge-name">${esc(m.badge)}</p><p class="center muted sm">+${BONUS_MODULE} XP de bonus · ${S.xp()} XP en total · ${t('level')}: ${S.level().name}</p>`,
+ const d = openDialog({ title: t('moduleDone'), cls: 'narrow celebrate', body: `<div class="badge-big" aria-hidden="true">${ic('award')}</div><p class="center">${t('badgeEarned')}</p><p class="center badge-name">${esc(mT(m, 'badge'))}</p><p class="center muted sm">+${BONUS_MODULE} XP ${L('de bonus', 'bonus')} · ${S.xp()} XP ${L('en total', 'in total')} · ${t('level')}: ${lvName(S.level())}</p>`,
footer: `<button class="btn ghost" data-close>${t('close')}</button>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}" data-next>${t('next')}${ic('arrowR')}</a>` : ''}` });
$('[data-close]', d).onclick = () => closeDialog();
const n = $('[data-next]', d); if (n) n.onclick = () => closeDialog(true);
@@ -4660,13 +4866,13 @@ function viewLab(main, { q }) {
const f = q.get('f') || '';
if (f && !q.get('cap')) { const r = parseFilter(f); if (r.ok) cap = Object.keys(SCENARIOS).find(k => capPkts(k).some(r.test)) || cap; }
main.innerHTML = `<div class="lab">
- <div class="lab-h wrap-wide"><div><p class="eyebrow">${t('lab')}</p><h1>Laboratorio libre</h1></div>
- <div class="row"><label class="sm" for="lab-cap">${t('captures')}</label><select id="lab-cap" class="sel">${MODULES.map(m => `<option value="${m.cap}" ${m.cap === cap ? 'selected' : ''}>${m.n}. ${esc(m.title)} (${capName(m.cap)})</option>`).join('')}<option value="__own" hidden>Tu captura</option></select></div>
+ <div class="lab-h wrap-wide"><div><p class="eyebrow">${t('lab')}</p><h1>${L('Laboratorio libre', 'Free lab')}</h1></div>
+ <div class="row"><label class="sm" for="lab-cap">${t('captures')}</label><select id="lab-cap" class="sel">${MODULES.map(m => `<option value="${m.cap}" ${m.cap === cap ? 'selected' : ''}>${m.n}. ${esc(mT(m, 'title'))} (${capName(m.cap)})</option>`).join('')}<option value="__own" hidden>${L('Tu captura', 'Your capture')}</option></select></div>
</div>
<div class="lab-ws wrap-wide"></div>
</div>`;
const sel = $('#lab-cap', main);
- const ws = new Workspace($('.lab-ws', main), { raw: SCENARIOS[cap](), name: capName(cap), filter: f, allowImport: true, onImport: name => { const o = sel.querySelector('[value=__own]'); o.hidden = false; o.textContent = `Tu captura: ${name}`; sel.value = '__own'; } });
+ const ws = new Workspace($('.lab-ws', main), { raw: SCENARIOS[cap](), name: capName(cap), filter: f, allowImport: true, onImport: name => { const o = sel.querySelector('[value=__own]'); o.hidden = false; o.textContent = `${L('Tu captura', 'Your capture')}: ${name}`; sel.value = '__own'; } });
CUR_WS = ws;
sel.onchange = () => { if (sel.value !== '__own') { ws.load(SCENARIOS[sel.value](), capName(sel.value)); history.replaceState(null, '', `#/lab?cap=${sel.value}`); } };
return () => { ws.destroy(); CUR_WS = null; };
@@ -4674,25 +4880,25 @@ function viewLab(main, { q }) {
/* ---------- Chuleta ---------- */
function viewCheat(main) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('cheat')}</p><h1>Chuleta de filtros</h1><p class="muted">Los filtros de visualización que más vas a usar. Cópialos o pruébalos directamente en el laboratorio.</p></div>
- <div class="cgrid">${CHEATS.map(g => `<section class="card cs" aria-labelledby="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}"><h2 id="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}">${esc(g.h)}</h2><ul>${g.items.map(([f, d]) => {
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('cheat')}</p><h1>${L('Chuleta de filtros', 'Filter cheat sheet')}</h1><p class="muted">${L('Los filtros de visualización que más vas a usar. Cópialos o pruébalos directamente en el laboratorio.', 'The display filters you will use most. Copy them or try them straight in the lab.')}${LANG === 'en' ? ' Descriptions are in Spanish.' : ''}</p></div>
+ <div class="cgrid">${CHEATS.map(g => `<section class="card cs" aria-labelledby="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}"><h2 id="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}">${esc(mT(g, 'h'))}</h2><ul>${g.items.map(([f, d]) => {
const real = !/\s{3}| vs /.test(f);
- return `<li><div class="cs-f"><code>${esc(f)}</code><p>${esc(d)}</p></div><div class="cs-a">${real ? `<button class="ibtn sm" type="button" data-copy="${esc(f)}" aria-label="${t('copy')}: ${esc(f)}">${ic('copy')}</button><a class="ibtn sm" href="#/lab?f=${encodeURIComponent(f)}" aria-label="Probar en el laboratorio: ${esc(f)}">${ic('play')}</a>` : ''}</div></li>`;
+ return `<li><div class="cs-f"><code>${esc(f)}</code><p>${esc(d)}</p></div><div class="cs-a">${real ? `<button class="ibtn sm" type="button" data-copy="${esc(f)}" aria-label="${t('copy')}: ${esc(f)}">${ic('copy')}</button><a class="ibtn sm" href="#/lab?f=${encodeURIComponent(f)}" aria-label="${L('Probar en el laboratorio', 'Try in the lab')}: ${esc(f)}">${ic('play')}</a>` : ''}</div></li>`;
}).join('')}</ul></section>`).join('')}</div>
- <section class="card cs fields"><h2>Todos los campos del laboratorio</h2><p class="muted sm">Escribe cualquiera en la barra de filtros: el autocompletado los conoce todos.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="Campos de filtro"><table class="tbl"><caption class="vh">Campos de filtro</caption><thead><tr><th scope="col">Campo</th><th scope="col">Tipo</th><th scope="col">Qué es</th></tr></thead><tbody>${FIELD_DEFS.map(([n, ty, d]) => `<tr><td><code>${n}</code></td><td class="sm muted">${({ p: 'protocolo', u: 'número', b: 'booleano', s: 'texto', ip: 'IPv4', mac: 'MAC', f: 'decimal' })[ty]}</td><td>${esc(d)}</td></tr>`).join('')}</tbody></table></div></section>
+ <section class="card cs fields"><h2>${L('Todos los campos del laboratorio', 'Every field in the lab')}</h2><p class="muted sm">${L('Escribe cualquiera en la barra de filtros: el autocompletado los conoce todos.', 'Type any of them in the filter bar: autocomplete knows them all.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${L('Campos de filtro', 'Filter fields')}"><table class="tbl"><caption class="vh">${L('Campos de filtro', 'Filter fields')}</caption><thead><tr><th scope="col">${L('Campo', 'Field')}</th><th scope="col">${L('Tipo', 'Type')}</th><th scope="col">${L('Qué es', 'What it is')}</th></tr></thead><tbody>${FIELD_DEFS.map(([n, ty, d]) => `<tr><td><code>${n}</code></td><td class="sm muted">${(LANG === 'en' ? { p: 'protocol', u: 'number', b: 'boolean', s: 'text', ip: 'IPv4', mac: 'MAC', f: 'decimal' } : { p: 'protocolo', u: 'número', b: 'booleano', s: 'texto', ip: 'IPv4', mac: 'MAC', f: 'decimal' })[ty]}</td><td>${esc(d)}</td></tr>`).join('')}</tbody></table></div></section>
</div>${siteFooter()}`;
$$('[data-copy]', main).forEach(b => b.onclick = () => copyText(b.dataset.copy, b));
}
/* ---------- Glosario ---------- */
function viewGlossary(main, { q }) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('glossary')}</p><h1>Glosario</h1><p class="muted">${GLOSSARY.length} términos de redes y pentesting explicados sin rodeos.</p></div>
- <div class="gsearch"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="g-q">Buscar en el glosario</label><input id="g-q" type="search" class="tinput" placeholder="Filtra términos…" autocomplete="off"></div>
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('glossary')}</p><h1>${t('glossary')}</h1><p class="muted">${L(`${GLOSSARY.length} términos de redes y pentesting explicados sin rodeos.`, `${GLOSSARY.length} networking and pentesting terms explained plainly (in Spanish).`)}</p></div>
+ <div class="gsearch"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="g-q">${L('Buscar en el glosario', 'Search the glossary')}</label><input id="g-q" type="search" class="tinput" placeholder="${L('Filtra términos…', 'Filter terms…')}" autocomplete="off"></div>
<p class="sm muted" id="g-n" aria-live="polite"></p>
<dl class="gl">${GLOSSARY.map(([term, d]) => `<div class="card gi" id="g-${esc(norm(term).replace(/\W+/g, '-'))}"><dt>${esc(term)}</dt><dd>${esc(d)}</dd></div>`).join('')}</dl></div>${siteFooter()}`;
const inp = $('#g-q', main), items = $$('.gi', main);
- const run = () => { const v = norm(inp.value); let n = 0; items.forEach((el, i) => { const hit = !v || norm(GLOSSARY[i][0] + ' ' + GLOSSARY[i][1]).includes(v); el.hidden = !hit; n += hit; }); $('#g-n', main).textContent = v ? `${n} de ${GLOSSARY.length} términos` : ''; };
+ const run = () => { const v = norm(inp.value); let n = 0; items.forEach((el, i) => { const hit = !v || norm(GLOSSARY[i][0] + ' ' + GLOSSARY[i][1]).includes(v); el.hidden = !hit; n += hit; }); $('#g-n', main).textContent = v ? L(`${n} de ${GLOSSARY.length} términos`, `${n} of ${GLOSSARY.length} terms`) : ''; };
inp.addEventListener('input', run);
if (q.get('q')) { inp.value = q.get('q'); run(); const first = items.find(x => !x.hidden); if (first) first.classList.add('flash'); }
}
@@ -4712,41 +4918,122 @@ function applyTheme(animate) {
const th = resolvedTheme(), root = document.documentElement;
if (animate && !REDUCED.matches) { root.classList.add('theming'); clearTimeout(applyTheme.tm); applyTheme.tm = setTimeout(() => root.classList.remove('theming'), 320); }
root.dataset.theme = th;
- const b = $('[data-theme-btn]'); if (b) b.setAttribute('aria-label', th === 'light' ? t('themeToDark') : t('themeToLight'));
+ const b = $('[data-theme-btn]'); if (b) b.setAttribute('aria-checked', String(th === 'dark'));
}
function applyLang() { LANG = S.get().settings.lang; document.documentElement.lang = LANG; $('#skip').textContent = t('skip'); }
-function renderTop() {
+/* Armazón al estilo de BlueJr y RiskManager-Jr: barra lateral plegable (carril de iconos que se despliega
+ por encima al pasar el ratón o con el teclado), barra superior flotante con buscador, interruptores ES|EN
+ y claro|oscuro, y barra de pestañas abajo en el móvil. */
+const MOBILE_MQ = matchMedia('(max-width: 900px)');
+let CUR_MOD = null, indY = null;
+function sideOpen() { return S.get().settings.side !== false; }
+function renderShell() { renderSide(); renderTop(); renderTabbar(); applyTheme(false); markNav(); }
+function renderSide() {
+ indY = null; // tras repintar, el indicador se coloca sin animar
const xp = S.xp(), lv = S.level();
+ const mods = MODULES.map((m, i) => {
+ const p = modProgress(m), st = p.done === p.total ? 'ok' : p.done ? 'mid' : '';
+ return `<li data-i="${i + 2}"><a href="#/m/${m.id}" class="sub" data-mod="${m.id}" title="${esc(`${m.n}. ${mT(m, 'title')}`)}"><span class="dotn ${st}" aria-hidden="true"><b>${m.n}</b></span><span class="txt">${esc(mT(m, 'title'))}</span><span class="cnt num">${p.done}/${p.total}</span></a></li>`;
+ }).join('');
+ const item = ([k, h, i], n) => `<a href="${h}" data-nav="${k}" data-i="${n}" title="${esc(t(k))}">${ic(i)}<span class="txt">${t(k)}</span></a>`;
+ const pct = lv.next ? Math.round(100 * (xp - lv.min) / (lv.next - lv.min)) : 100;
+ $('#side').setAttribute('aria-label', t('navMain'));
+ $('#side').innerHTML = `
+ <a class="side-brand" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><span class="brand-txt"><b>Megalodon</b><small>${t('brandSub')}</small></span></a>
+ <nav class="side-nav" aria-label="${t('navMain')}">
+ <span class="side-ind" aria-hidden="true"></span>
+ ${item(NAV[0], 0)}${item(NAV[1], 1)}
+ <ul aria-label="${t('modules')}">${mods}</ul>
+ ${NAV.slice(2).map((n, k) => item(n, 10 + k)).join('')}
+ </nav>
+ <div class="side-foot">
+ <a class="lvl" href="#/modulos" title="${t('level')}: ${esc(lvName(lv))}"><span class="lvl-ic" aria-hidden="true">${ic('trophy')}</span><span class="lvl-txt"><b>${esc(lvName(lv))} · <span class="num" data-xp>${xp}</span> XP</b><span class="meter" role="progressbar" aria-label="${t('levelProg')}" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${pct}"><i data-w="${Math.max(3, pct)}"></i></span></span></a>
+ </div>`;
+ $$('[data-i]', $('#side')).forEach(el => el.style.setProperty('--i', el.dataset.i)); // la CSP prohíbe style en línea
+ $$('[data-w]', $('#side')).forEach(el => { el.style.width = `${el.dataset.w}%`; });
+ document.body.classList.toggle('side-mini', !sideOpen());
+}
+/* Progreso en su sitio: no se repinta el lateral, así el indicador y el foco no se mueven */
+function updateSide() {
+ MODULES.forEach(m => {
+ const a = $(`.side-nav [data-mod="${m.id}"]`); if (!a) return;
+ const p = modProgress(m);
+ $('.cnt', a).textContent = `${p.done}/${p.total}`;
+ $('.dotn', a).className = `dotn ${p.done === p.total ? 'ok' : p.done ? 'mid' : ''}`;
+ });
+ const xp = S.xp(), lv = S.level(), pct = lv.next ? Math.round(100 * (xp - lv.min) / (lv.next - lv.min)) : 100;
+ const l = $('.lvl'); if (!l) return;
+ $('.lvl-txt b', l).innerHTML = `${esc(lvName(lv))} · <span class="num" data-xp>${xp}</span> XP`;
+ l.title = `${t('level')}: ${lvName(lv)}`;
+ const m = $('.meter', l); m.setAttribute('aria-valuenow', String(pct)); $('i', m).style.width = `${Math.max(3, pct)}%`;
+}
+function renderTop() {
+ const th = resolvedTheme();
$('#top').innerHTML = `<div class="top-in">
- <a class="brand" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><span class="brand-t">Megalodon</span></a>
- <nav class="nav" aria-label="Principal">${NAV.map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i, 'sm')}<span>${t(k)}</span></a>`).join('')}</nav>
- <div class="top-acts">
+ <button class="ibtn only-desk" type="button" data-side aria-label="${t('sideToggle')}" aria-expanded="${sideOpen()}" title="${t('sideToggle')} ( [ )">${ic('panel')}</button>
+ <a class="brand-m" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><b>Megalodon</b></a>
+ <span class="grow"></span>
<button class="search-btn" type="button" data-search aria-label="${t('search')} (Ctrl K)">${ic('search')}<span class="sb-t">${t('search')}…</span><kbd>Ctrl K</kbd></button>
- <a class="xp-chip" href="#/modulos" title="${t('level')}: ${lv.name}" aria-label="${xp} XP, ${t('level')} ${lv.name}">${ic('trophy', 'sm')}<span class="num" data-xp>${xp}</span><span class="xp-u">XP</span></a>
- <button class="ibtn hide-narrow" type="button" data-help aria-label="${t('help')}" title="${t('help')}">${ic('help')}</button>
- <button class="ibtn hide-narrow" type="button" data-keys aria-label="${t('shortcuts')}" title="${t('shortcuts')} (?)">${ic('keyboard')}</button>
- <button class="ibtn" type="button" data-settings aria-label="${t('settings')}" title="${t('settings')}">${ic('settings')}</button>
- <button class="ibtn theme-btn" type="button" data-theme-btn aria-label="${t('themeToLight')}"><span class="sun">${ic('sun')}</span><span class="moon">${ic('moon')}</span></button>
- <button class="ibtn" type="button" data-menu aria-label="${t('menu')}" aria-expanded="false" aria-controls="mnav">${ic('menu')}</button>
- </div>
- </div>
- <nav id="mnav" class="mnav" aria-label="Principal (móvil)" hidden>${NAV.map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i)}<span>${t(k)}</span></a>`).join('')}<button type="button" data-help>${ic('help')}<span>${t('help')}</span></button><button type="button" data-keys>${ic('keyboard')}<span>${t('shortcuts')}</span></button></nav>`;
+ <div class="lang-sw" role="group" aria-label="${t('langSwitch')}"><button type="button" data-lang="es" aria-pressed="${LANG === 'es'}" lang="es" aria-label="Español">ES</button><button type="button" data-lang="en" aria-pressed="${LANG === 'en'}" lang="en" aria-label="English">EN</button></div>
+ <button class="theme-sw" type="button" role="switch" data-theme-btn aria-checked="${th === 'dark'}" aria-label="${t('themeSwitch')}"><span class="track" aria-hidden="true">${ic('sun')}${ic('moon')}</span><span class="knob" aria-hidden="true"></span></button>
+ <button class="ibtn only-desk" type="button" data-help aria-label="${t('help')}" title="${t('help')}">${ic('help')}</button>
+ <button class="ibtn only-desk" type="button" data-keys aria-label="${t('shortcuts')}" title="${t('shortcuts')} (?)">${ic('keyboard')}</button>
+ <button class="ibtn only-desk" type="button" data-settings aria-label="${t('settings')}" title="${t('settings')}">${ic('settings')}</button>
+ </div>`;
const top = $('#top');
- $$('[data-search]', top).forEach(b => b.onclick = openSearch);
- $$('[data-help]', top).forEach(b => b.onclick = () => { closeMenu(); openHelp(); });
- $$('[data-keys]', top).forEach(b => b.onclick = () => { closeMenu(); openKeys(); });
+ $('[data-search]', top).onclick = openSearch;
+ $('[data-help]', top).onclick = openHelp;
+ $('[data-keys]', top).onclick = openKeys;
$('[data-settings]', top).onclick = openSettings;
$('[data-theme-btn]', top).onclick = toggleTheme;
- const mb = $('[data-menu]', top), mn = $('#mnav');
- mb.onclick = () => { const open = mn.hidden; mn.hidden = !open; mb.setAttribute('aria-expanded', String(open)); if (open) $('a', mn).focus(); };
- $$('a', mn).forEach(a => a.addEventListener('click', closeMenu));
- applyTheme(false); markNav();
+ $('[data-side]', top).onclick = toggleSide;
+ $$('[data-lang]', top).forEach(b => b.onclick = () => setLang(b.dataset.lang));
+}
+function renderTabbar() {
+ const tb = $('#tabbar');
+ tb.setAttribute('aria-label', t('navMobile'));
+ tb.innerHTML = NAV.slice(0, 4).map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i)}<span>${t(k)}</span></a>`).join('') + `<button type="button" data-more aria-haspopup="dialog">${ic('more')}<span>${t('more')}</span></button>`;
+ $('[data-more]', tb).onclick = openMore;
}
-function closeMenu() { const mn = $('#mnav'); if (mn && !mn.hidden) { mn.hidden = true; $('[data-menu]').setAttribute('aria-expanded', 'false'); } }
+function openMore() {
+ const d = openDialog({ title: `${ic('more')} ${t('more')}`, cls: 'narrow sheet', body: `<div class="more-list">
+ <a href="#/glosario" data-go>${ic('glossary')}<span>${t('glossary')}</span>${ic('chevR', 'sm')}</a>
+ <button type="button" data-a="settings">${ic('settings')}<span>${t('settings')}</span>${ic('chevR', 'sm')}</button>
+ <button type="button" data-a="help">${ic('help')}<span>${t('help')}</span>${ic('chevR', 'sm')}</button>
+ <button type="button" data-a="keys">${ic('keyboard')}<span>${t('shortcuts')}</span>${ic('chevR', 'sm')}</button>
+ </div>` });
+ $('[data-go]', d).onclick = () => closeDialog(true);
+ $$('[data-a]', d).forEach(b => b.onclick = () => { closeDialog(true); ({ settings: openSettings, help: openHelp, keys: openKeys })[b.dataset.a](); });
+}
+function toggleSide() {
+ S.set('side', !sideOpen());
+ document.body.classList.toggle('side-mini', !sideOpen());
+ const b = $('[data-side]'); if (b) b.setAttribute('aria-expanded', String(sideOpen()));
+ setTimeout(moveIndicator, 340);
+}
+function setLang(l) {
+ if (l === LANG) return;
+ S.set('lang', l); applyLang(); SEARCH_INDEX = null; renderShell(); route();
+ toast(l === 'en' ? 'Interface in English. Lessons stay in Spanish.' : 'Interfaz en español.', 'info', 'lang');
+}
+/* Indicador del lateral: se desliza hasta el elemento activo (solo transform, sin mover la página) */
+function moveIndicator() {
+ const nav = $('.side-nav'), ind = $('.side-ind'), act = nav && $('a[aria-current="page"]', nav);
+ if (!ind) return;
+ if (!act) { ind.style.opacity = '0'; return; }
+ const y = act.getBoundingClientRect().top - nav.getBoundingClientRect().top + nav.scrollTop, h = act.offsetHeight; // no offsetTop: los <li> no son el padre de referencia
+ if (indY === null || REDUCED.matches) { ind.style.transition = 'none'; ind.style.transform = `translateY(${y}px)`; ind.style.height = `${h}px`; ind.style.opacity = '1'; indY = y; requestAnimationFrame(() => { ind.style.transition = ''; }); return; }
+ ind.style.height = `${h}px`; ind.style.opacity = '1'; ind.style.transform = `translateY(${y}px)`; indY = y;
+}
+function closeMenu() {}
function toggleTheme() { S.set('theme', resolvedTheme() === 'light' ? 'dark' : 'light'); applyTheme(true); }
let CUR_NAV = 'home';
-function markNav() { $$('[data-nav]').forEach(a => { if (a.dataset.nav === CUR_NAV) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); }); }
+function markNav() {
+ $$('[data-nav]').forEach(a => { const on = a.dataset.nav === CUR_NAV && !(CUR_MOD && a.closest('.side-nav')); if (on) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); });
+ $$('[data-mod]').forEach(a => { if (a.dataset.mod === CUR_MOD) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); });
+ requestAnimationFrame(moveIndicator);
+}
function route() {
const raw = location.hash.replace(/^#/, '') || '/';
@@ -4757,13 +5044,13 @@ function route() {
const main = $('#main');
let hit = null;
for (const [re, fn, nav] of ROUTES) { const m = path.match(re); if (m) { hit = { fn, nav, id: m[1] }; break; } }
- CUR_NAV = hit ? hit.nav : '';
+ CUR_NAV = hit ? hit.nav : ''; CUR_MOD = hit && hit.fn === viewModule ? hit.id : null;
main.classList.remove('enter'); void main.offsetWidth; main.classList.add('enter');
cleanup = hit ? hit.fn(main, { id: hit.id, q }) || null : (viewNotFound(main), null);
$$('.meter[aria-valuemax]', main).forEach(mt => { const i = mt.firstElementChild; if (i && !i.style.width) i.style.width = `${Math.max(2, 100 * (+mt.getAttribute('aria-valuenow')) / (+mt.getAttribute('aria-valuemax')))}%`; });
markNav();
const h1 = $('h1', main);
- document.title = `${h1 && hit && hit.nav !== 'home' ? h1.textContent + ' · ' : ''}Megalodon · Laboratorio de Wireshark`;
+ document.title = `${h1 && hit && hit.nav !== 'home' ? h1.textContent + ' · ' : ''}Megalodon · ${L('Laboratorio de Wireshark', 'Wireshark lab')}`;
if (!firstRoute) { window.scrollTo(0, 0); main.focus({ preventScroll: true }); }
firstRoute = false;
}
@@ -4773,31 +5060,33 @@ let SEARCH_INDEX = null;
function searchIndex() {
if (SEARCH_INDEX) return SEARCH_INDEX;
const ix = [];
- NAV.forEach(([k, h, i]) => ix.push({ k: 'Página', i, title: t(k), go: h }));
+ const K = { page: L('Página', 'Page'), mod: L('Módulo', 'Module'), les: L('Lección', 'Lesson'), task: L('Reto', 'Challenge'), glo: t('glossary'), flt: L('Filtro', 'Filter'), fld: L('Campo', 'Field'), act: L('Acción', 'Action') };
+ NAV.forEach(([k, h, i]) => ix.push({ ty: 'page', i, title: t(k), go: h }));
MODULES.forEach(m => {
- ix.push({ k: 'Módulo', i: m.icon, title: `${m.n}. ${m.title}`, d: m.sub, go: `#/m/${m.id}` });
- m.lessons.forEach((l, j) => ix.push({ k: 'Lección', i: 'book', title: l.h, d: `Módulo ${m.n} · ${plain(l.p[0]).slice(0, 90)}`, go: `#/m/${m.id}?l=${j}`, body: plain(l.p.join(' ')) }));
- m.tasks.forEach(x => ix.push({ k: 'Reto', i: 'target', title: plain(x.q), d: `Módulo ${m.n} · ${m.title}`, go: `#/m/${m.id}?t=${x.id}` }));
+ ix.push({ ty: 'mod', i: m.icon, title: `${m.n}. ${mT(m, 'title')}`, d: mT(m, 'sub'), go: `#/m/${m.id}`, body: LANG === 'en' ? `${m.title} ${m.sub}` : '' });
+ m.lessons.forEach((l, j) => ix.push({ ty: 'les', i: 'book', title: l.h, d: `${K.mod} ${m.n} · ${plain(l.p[0]).slice(0, 90)}`, go: `#/m/${m.id}?l=${j}`, body: plain(l.p.join(' ')) }));
+ m.tasks.forEach(x => ix.push({ ty: 'task', i: 'target', title: plain(x.q), d: `${K.mod} ${m.n} · ${mT(m, 'title')}`, go: `#/m/${m.id}?t=${x.id}` }));
});
- GLOSSARY.forEach(([term, d]) => ix.push({ k: 'Glosario', i: 'glossary', title: term, d, go: `#/glosario?q=${encodeURIComponent(term)}` }));
- CHEATS.forEach(g => g.items.forEach(([f, d]) => { if (!/\s{3}| vs /.test(f)) ix.push({ k: 'Filtro', i: 'filter', title: f, d, go: `#/lab?f=${encodeURIComponent(f)}`, mono: true }); }));
- FIELD_DEFS.forEach(([n, , d]) => ix.push({ k: 'Campo', i: 'tree', title: n, d, go: `#/lab?f=${encodeURIComponent(n)}`, mono: true }));
- ix.push({ k: 'Acción', i: 'sun', title: 'Cambiar tema claro u oscuro', act: toggleTheme }, { k: 'Acción', i: 'settings', title: t('settings'), act: openSettings }, { k: 'Acción', i: 'keyboard', title: t('shortcuts'), act: openKeys }, { k: 'Acción', i: 'help', title: t('help'), act: openHelp });
+ GLOSSARY.forEach(([term, d]) => ix.push({ ty: 'glo', i: 'glossary', title: term, d, go: `#/glosario?q=${encodeURIComponent(term)}` }));
+ CHEATS.forEach(g => g.items.forEach(([f, d]) => { if (!/\s{3}| vs /.test(f)) ix.push({ ty: 'flt', i: 'filter', title: f, d, go: `#/lab?f=${encodeURIComponent(f)}`, mono: true }); }));
+ FIELD_DEFS.forEach(([n, , d]) => ix.push({ ty: 'fld', i: 'tree', title: n, d, go: `#/lab?f=${encodeURIComponent(n)}`, mono: true }));
+ ix.push({ ty: 'act', i: 'sun', title: L('Cambiar tema claro u oscuro', 'Toggle light or dark theme'), act: toggleTheme }, { ty: 'act', i: 'lang', title: L('Interfaz en inglés', 'Interface in Spanish'), act: () => setLang(LANG === 'en' ? 'es' : 'en') }, { ty: 'act', i: 'panel', title: t('sideToggle'), act: toggleSide }, { ty: 'act', i: 'settings', title: t('settings'), act: openSettings }, { ty: 'act', i: 'keyboard', title: t('shortcuts'), act: openKeys }, { ty: 'act', i: 'help', title: t('help'), act: openHelp });
+ ix.forEach(x => { x.k = K[x.ty]; });
ix.forEach(x => { x.nt = norm(x.title); x.nd = norm((x.d || '') + ' ' + (x.body || '')); });
return (SEARCH_INDEX = ix);
}
function openSearch() {
const body = document.createElement('div');
- body.innerHTML = `<div class="sbox"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="s-q">${t('search')}</label><input id="s-q" type="text" role="combobox" aria-expanded="true" aria-controls="s-r" aria-autocomplete="list" autocomplete="off" spellcheck="false" placeholder="${esc(t('searchPh'))}"></div><ul id="s-r" class="sres" role="listbox" aria-label="Resultados"></ul><p class="sm muted s-foot"><kbd>↑</kbd><kbd>↓</kbd> moverte · <kbd>Enter</kbd> abrir · <kbd>Esc</kbd> cerrar</p>`;
+ body.innerHTML = `<div class="sbox"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="s-q">${t('search')}</label><input id="s-q" type="text" role="combobox" aria-expanded="true" aria-controls="s-r" aria-autocomplete="list" autocomplete="off" spellcheck="false" placeholder="${esc(t('searchPh'))}"></div><ul id="s-r" class="sres" role="listbox" aria-label="${L('Resultados', 'Results')}"></ul><p class="sm muted s-foot"><kbd>↑</kbd><kbd>↓</kbd> ${L('moverte', 'move')} · <kbd>Enter</kbd> ${L('abrir', 'open')} · <kbd>Esc</kbd> ${L('cerrar', 'close')}</p>`;
openDialog({ title: `${ic('search')} ${t('search')}`, body, cls: 'search' });
const inp = $('#s-q'), list = $('#s-r');
let res = [], idx = 0;
const draw = () => {
const v = norm(inp.value), ix = searchIndex();
- if (!v) res = ix.filter(x => x.k === 'Módulo' || x.k === 'Página').slice(0, 14);
+ if (!v) res = ix.filter(x => x.ty === 'mod' || x.ty === 'page').slice(0, 14);
else res = ix.map(x => ({ x, s: x.nt.startsWith(v) ? 3 : x.nt.includes(v) ? 2 : x.nd.includes(v) ? 1 : 0 })).filter(r => r.s).sort((a, b) => b.s - a.s || a.x.title.length - b.x.title.length).slice(0, 30).map(r => r.x);
idx = 0;
- list.innerHTML = res.length ? res.map((x, i) => `<li role="option" id="s-o${i}" aria-selected="${i === idx}" data-i="${i}"><span class="s-ic">${ic(x.i, 'sm')}</span><span class="s-t"><span class="${x.mono ? 'mono' : ''}">${esc(x.title.length > 110 ? x.title.slice(0, 108) + '…' : x.title)}</span>${x.d ? `<small>${esc(x.d.length > 100 ? x.d.slice(0, 98) + '…' : x.d)}</small>` : ''}</span><span class="s-k">${x.k}</span></li>`).join('') : `<li class="s-none" role="option" aria-disabled="true">Nada por aquí. Prueba con «syn», «cookie» o «dns».</li>`;
+ list.innerHTML = res.length ? res.map((x, i) => `<li role="option" id="s-o${i}" aria-selected="${i === idx}" data-i="${i}"><span class="s-ic">${ic(x.i, 'sm')}</span><span class="s-t"><span class="${x.mono ? 'mono' : ''}">${esc(x.title.length > 110 ? x.title.slice(0, 108) + '…' : x.title)}</span>${x.d ? `<small>${esc(x.d.length > 100 ? x.d.slice(0, 98) + '…' : x.d)}</small>` : ''}</span><span class="s-k">${x.k}</span></li>`).join('') : `<li class="s-none" role="option" aria-disabled="true">${L('Nada por aquí. Prueba con «syn», «cookie» o «dns».', 'Nothing here. Try “syn”, “cookie” or “dns”.')}</li>`;
inp.setAttribute('aria-activedescendant', res.length ? 's-o0' : '');
};
const go = i => { const x = res[i]; if (!x) return; closeDialog(true); if (x.act) x.act(); else if (location.hash === x.go) route(); else location.hash = x.go; };
@@ -4820,34 +5109,44 @@ function openSettings() {
const solved = Object.keys(S.get().done).length;
const d = openDialog({ title: `${ic('settings')} ${t('settings')}`, body: `
<div class="set-row"><div><p>${t('theme')}</p></div><div data-set="theme">${seg(t('theme'), st.theme, [['light', t('light'), 'sun'], ['dark', t('dark'), 'moon'], ['system', t('system'), null]])}</div></div>
- <div class="set-row"><div><p>${t('language')}</p><p class="sm muted">Interfaz en español o inglés. Las lecciones están en español.</p></div><div data-set="lang">${seg(t('language'), st.lang, [['es', 'Español'], ['en', 'English']])}</div></div>
- ${sw('relative', 'Números de secuencia relativos', 'Como Wireshark por defecto: Seq y Ack empiezan en 0. Desactívalo para ver los valores reales.')}
- ${sw('colorize', 'Colorear paquetes', 'Reglas de color de Wireshark: TCP, HTTP, RST, problemas…')}
- <div class="set-row danger-zone"><div><p>${t('resetProgress')}</p><p class="sm muted">${solved} retos y ${S.xp()} XP guardados en este navegador.</p></div><button type="button" class="btn danger sm" data-reset ${solved || S.xp() ? '' : 'disabled'}>${ic('reset', 'sm')}${t('resetProgress')}</button></div>` });
+ <div class="set-row"><div><p>${t('language')}</p><p class="sm muted">${L('Interfaz en español o inglés. Las lecciones están en español.', 'Interface in Spanish or English. Lessons are in Spanish.')}</p></div><div data-set="lang">${seg(t('language'), st.lang, [['es', 'Español'], ['en', 'English']])}</div></div>
+ ${sw('relative', L('Números de secuencia relativos', 'Relative sequence numbers'), L('Como Wireshark por defecto: Seq y Ack empiezan en 0. Desactívalo para ver los valores reales.', 'Wireshark’s default: Seq and Ack start at 0. Turn it off to see the real values.'))}
+ ${sw('colorize', L('Colorear paquetes', 'Colorize packets'), L('Reglas de color de Wireshark: TCP, HTTP, RST, problemas…', 'Wireshark coloring rules: TCP, HTTP, RST, problems…'))}
+ <div class="set-row danger-zone"><div><p>${t('resetProgress')}</p><p class="sm muted">${L(`${solved} retos y ${S.xp()} XP guardados en este navegador.`, `${solved} challenges and ${S.xp()} XP saved in this browser.`)}</p></div><button type="button" class="btn danger sm" data-reset ${solved || S.xp() ? '' : 'disabled'}>${ic('reset', 'sm')}${t('resetProgress')}</button></div>` });
$$('[data-set]', d).forEach(g => g.addEventListener('click', e => {
const b = e.target.closest('[data-v]'); if (!b) return;
$$('[role=radio]', g).forEach(x => x.setAttribute('aria-checked', String(x === b)));
const k = g.dataset.set; S.set(k, b.dataset.v);
if (k === 'theme') applyTheme(true);
- if (k === 'lang') { applyLang(); SEARCH_INDEX = null; renderTop(); closeDialog(true); route(); openSettings(); }
+ if (k === 'lang') { applyLang(); SEARCH_INDEX = null; renderShell(); closeDialog(true); route(); openSettings(); }
+ if (k === 'theme') renderTop();
}));
$$('[data-sw]', d).forEach(b => b.onclick = () => { const v = b.getAttribute('aria-checked') !== 'true'; b.setAttribute('aria-checked', String(v)); S.set(b.dataset.sw, v); });
$('[data-reset]', d).onclick = async () => {
- const ok = await confirmDialog({ title: '¿Borrar todo tu progreso?', text: `Se borrarán <strong>${Object.keys(S.get().done).length} retos</strong>, <strong>${Object.keys(S.get().badges).length} insignias</strong> y <strong>${S.xp()} XP</strong>. Tus ajustes se mantienen. No se puede deshacer.`, ok: t('resetConfirm') });
- if (ok) { S.reset(); toast('Progreso borrado. A empezar de cero.', 'info', 'reset'); route(); }
+ const nd = Object.keys(S.get().done).length, nb = Object.keys(S.get().badges).length;
+ const ok = await confirmDialog({ title: L('¿Borrar todo tu progreso?', 'Reset all your progress?'), text: L(`Se borrarán <strong>${nd} retos</strong>, <strong>${nb} insignias</strong> y <strong>${S.xp()} XP</strong>. Tus ajustes se mantienen. No se puede deshacer.`, `This deletes <strong>${nd} challenges</strong>, <strong>${nb} badges</strong> and <strong>${S.xp()} XP</strong>. Your settings stay. It cannot be undone.`), ok: t('resetConfirm') });
+ if (ok) { S.reset(); toast(L('Progreso borrado. A empezar de cero.', 'Progress reset. Back to square one.'), 'info', 'reset'); route(); }
};
}
function openHelp() {
- openDialog({ title: `${ic('help')} ${t('help')}`, wide: true, body: `<div class="help">
+ openDialog({ title: `${ic('help')} ${t('help')}`, wide: true, body: LANG === 'en' ? `<div class="help">
+ <section><h3>${ic('rows', 'sm')}The three panes</h3><p>At the top, the <strong>packet list</strong>. In the middle, the layered <strong>detail tree</strong>. At the bottom, the <strong>bytes</strong>. Clicking a field highlights its bytes, and clicking a byte opens its field.</p></section>
+ <section><h3>${ic('filter', 'sm')}The filter bar</h3><p>It turns <span class="okt">green</span> when the filter is valid and <span class="badt">red</span> when it is not, with the reason below. <kbd>Tab</kbd> accepts the suggestion and <kbd>Enter</kbd> applies. In the tree, each field’s ${ic('filter', 'sm')} button turns it into a filter (“Apply as Filter”).</p></section>
+ <section><h3>${ic('target', 'sm')}Challenges</h3><p>Four kinds: write a <strong>filter</strong> (it must show exactly the solution’s packets), pick a <strong>packet</strong>, type an <strong>answer</strong> or choose an option. Each challenge gives 10 XP; each hint takes a little off. Finishing a module gives a badge and 20 extra XP.</p></section>
+ <section><h3>${ic('flask', 'sm')}Analyst tools</h3><p>Expert Information (<kbd>E</kbd>), HTTP objects, cleartext credentials, Statistics (<kbd>S</kbd>) with conversations, endpoints and I/O graph, Follow TCP/UDP stream (<kbd>F</kbd>), Find Packet (<kbd>Ctrl F</kbd>), Go to Packet (<kbd>Ctrl G</kbd>) and the time display format, as in Wireshark.</p></section>
+ <section><h3>${ic('upload', 'sm')}Your captures</h3><p>In the Free lab you can open your own .pcap or .pcapng files (or drag them in). Everything is processed in your browser: nothing leaves your device.</p></section>
+ <section><h3>${ic('book', 'sm')}Sources</h3><p>Field names, coloring rules and the Info column follow Wireshark 4.x; the engine was checked packet by packet against tshark. Official guide: <a href="https://www.wireshark.org/docs/wsug_html_chunked/" target="_blank" rel="noopener noreferrer">Wireshark User's Guide</a> · <a href="https://www.wireshark.org/docs/man-pages/wireshark-filter.html" target="_blank" rel="noopener noreferrer">wireshark-filter(4)</a>.</p></section>
+ </div>` : `<div class="help">
<section><h3>${ic('rows', 'sm')}Las tres zonas</h3><p>Arriba, la <strong>lista de paquetes</strong>. En medio, el <strong>árbol de detalle</strong> por capas. Abajo, los <strong>bytes</strong>. Al pulsar un campo se iluminan sus bytes, y al pulsar un byte se abre su campo.</p></section>
<section><h3>${ic('filter', 'sm')}La barra de filtros</h3><p>Se pone <span class="okt">verde</span> si el filtro es válido y <span class="badt">roja</span> si no, con el motivo debajo. <kbd>Tab</kbd> acepta la sugerencia y <kbd>Enter</kbd> aplica. En el árbol, el botón ${ic('filter', 'sm')} de cada campo lo convierte en filtro («Aplicar como filtro»).</p></section>
<section><h3>${ic('target', 'sm')}Retos</h3><p>Hay cuatro tipos: escribir un <strong>filtro</strong> (debe mostrar exactamente los paquetes de la solución), elegir un <strong>paquete</strong>, escribir una <strong>respuesta</strong> o elegir una opción. Cada reto da 10 XP; cada pista resta un poco. Completar un módulo da una insignia y 20 XP extra.</p></section>
+ <section><h3>${ic('flask', 'sm')}Herramientas de analista</h3><p>Información experta (<kbd>E</kbd>), objetos HTTP, credenciales en claro, Estadísticas (<kbd>S</kbd>) con conversaciones, endpoints y gráfico de E/S, seguir flujo TCP/UDP (<kbd>F</kbd>), Buscar paquete (<kbd>Ctrl F</kbd>), Ir al paquete (<kbd>Ctrl G</kbd>) y formato de tiempo, como en Wireshark.</p></section>
<section><h3>${ic('upload', 'sm')}Tus capturas</h3><p>En el Laboratorio libre puedes abrir tus .pcap o .pcapng (o arrastrarlos). Todo se procesa en tu navegador: nada sale de tu equipo.</p></section>
<section><h3>${ic('book', 'sm')}Fuentes</h3><p>Nombres de campos, reglas de color y formato de la columna Info siguen a Wireshark 4.x; el motor se ha comprobado paquete a paquete contra tshark. Guía oficial: <a href="https://www.wireshark.org/docs/wsug_html_chunked/" target="_blank" rel="noopener noreferrer">Wireshark User's Guide</a> · <a href="https://www.wireshark.org/docs/man-pages/wireshark-filter.html" target="_blank" rel="noopener noreferrer">wireshark-filter(4)</a>.</p></section>
</div>` });
}
function openKeys() {
- openDialog({ title: `${ic('keyboard')} ${t('shortcuts')}`, cls: 'narrow', body: `<table class="tbl keys"><caption class="vh">${t('shortcuts')}</caption><tbody>${SHORTCUTS.map(([k, es, en]) => `<tr><th scope="row">${k.split(' ').map(x => `<kbd>${x}</kbd>`).join(' ')}</th><td>${LANG === 'en' ? en : es}</td></tr>`).join('')}</tbody></table>` });
+ openDialog({ title: `${ic('keyboard')} ${t('shortcuts')}`, cls: 'narrow', body: `<table class="tbl keys"><caption class="vh">${t('shortcuts')}</caption><tbody>${SHORTCUTS.map(([k, es, en]) => `<tr><th scope="row">${k.split(' ').map(x => `<kbd>${LANG === 'en' ? ({ Inicio: 'Home', Fin: 'End', 'Mayús': 'Shift' })[x] || x : x}</kbd>`).join(' ')}</th><td>${LANG === 'en' ? en : es}</td></tr>`).join('')}</tbody></table>` });
}
function onKey(e) {
@@ -4857,6 +5156,7 @@ function onKey(e) {
if (typing || $('#dlg').open || e.ctrlKey || e.metaKey || e.altKey) return;
if (e.key === '/' && CUR_WS) { e.preventDefault(); CUR_WS.focusFilter(); }
else if (e.key === '?') { e.preventDefault(); openKeys(); }
+ else if (e.key === '[' && !MOBILE_MQ.matches) { e.preventDefault(); toggleSide(); }
else if (e.key === 'T' && e.shiftKey) toggleTheme();
else if ((e.key === 'f' || e.key === 'F') && !e.shiftKey && CUR_WS) CUR_WS.follow();
else if ((e.key === 's' || e.key === 'S') && !e.shiftKey && CUR_WS) openStats(CUR_WS);
@@ -4864,11 +5164,17 @@ function onKey(e) {
}
function boot() {
- applyLang(); renderTop(); route();
+ applyLang(); renderShell(); route();
+ setTimeout(() => document.body.classList.add('ready'), 700); // la entrada escalonada solo en la primera carga
addEventListener('hashchange', route);
addEventListener('keydown', onKey);
matchMedia('(prefers-color-scheme: light)').addEventListener('change', () => { if (S.get().settings.theme === 'system') applyTheme(true); });
- S.on(() => { const el = $('[data-xp]'); if (el && +el.textContent !== S.xp()) { el.textContent = S.xp(); const chip = el.closest('.xp-chip'); chip.classList.remove('bump'); void chip.offsetWidth; chip.classList.add('bump'); chip.setAttribute('aria-label', `${S.xp()} XP, ${t('level')} ${S.level().name}`); } });
+ let lastXp = S.xp();
+ S.on(() => { // el lateral refleja al momento retos, insignias y XP
+ updateSide();
+ if (S.xp() > lastXp) { const l = $('.lvl'); if (l) { l.classList.remove('bump'); void l.offsetWidth; l.classList.add('bump'); } }
+ lastXp = S.xp();
+ });
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); else boot();
</script>
diff --git a/package.json b/package.json
index eb72491..92c8309 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "megalodon",
- "version": "1.2.0",
+ "version": "1.3.0",
"description": "Laboratorio de Wireshark sin conexión: capturas sintéticas de un pentest, filtros validados al instante y retos guiados.",
"author": "Yoandy Ramírez Delgado",
"license": "MIT",
@@ -9,7 +9,7 @@
"scripts": {
"build": "node scripts/build.mjs",
"check": "node scripts/build.mjs --check",
- "test:engine": "node --test tests/engine.test.mjs",
+ "test:engine": "node --test tests/engine.test.mjs tests/i18n.test.mjs",
"test:e2e": "node tests/e2e.mjs",
"test": "./run_tests.sh"
},
diff --git a/run_tests.sh b/run_tests.sh
index 006707d..5239ea4 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -3,5 +3,5 @@
set -euo pipefail
cd "$(dirname "$0")"
node scripts/build.mjs --check
-node --test tests/engine.test.mjs
+node --test tests/engine.test.mjs tests/i18n.test.mjs
node tests/e2e.mjs
diff --git a/scripts/capturas.mjs b/scripts/capturas.mjs
index b0a1559..d921917 100644
--- a/scripts/capturas.mjs
+++ b/scripts/capturas.mjs
@@ -17,6 +17,10 @@ const SHOTS = [
{ f: 'experto', w: 1280, h: 800, t: 0, hash: '#/lab?cap=m6', act: async p => { await p.click('[data-expert]'); } },
{ f: 'objetos-http', w: 1280, h: 800, t: 0, hash: '#/lab?cap=m6', act: async p => { await p.click('[data-objects]'); await p.click('.dlg [aria-label="Ver robots.txt"]'); } },
{ f: 'beacon', w: 1280, h: 800, t: 0, hash: '#/lab?cap=m8', act: async p => { await p.locator('.finput').fill('http.request && ip.dst == 203.0.113.66'); await p.locator('.finput').press('Enter'); await p.selectOption('[data-tfmt]', 'dview'); } },
+ { f: 'lateral-plegado', w: 1280, h: 800, t: 0, hash: '#/m/m2', act: async p => { await p.keyboard.press('['); await p.hover('.side-nav [data-mod="m6"]'); } },
+ { f: 'ingles-claro', w: 1280, h: 800, t: 0, theme: 'light', hash: '#/lab?cap=m3', act: async p => { await p.click('[data-lang="en"]'); await p.waitForSelector('.ws'); await p.waitForTimeout(3200); } },
+ { f: 'movil-pestanas', w: 390, h: 844, t: 0, hash: '#/m/m1', dsf: 2 },
+ { f: 'movil-mas', w: 390, h: 844, t: 0, theme: 'light', hash: '#/chuleta', dsf: 2, act: async p => { await p.click('[data-more]'); } },
];
const b = await chromium.launch({ args: ['--use-angle=swiftshader', '--enable-unsafe-swiftshader', '--ignore-gpu-blocklist'] });
for (const s of SHOTS) {
@@ -24,7 +28,7 @@ for (const s of SHOTS) {
const p = await ctx.newPage();
await p.goto(URL0 + (s.hash || '')); await p.waitForSelector('#main h1');
if (!s.hash) { await p.waitForSelector('canvas.shark-cv'); await p.evaluate(([t, m]) => { SHARK.pause(); SHARK.setMode(m || 'real'); SHARK.seek(t); }, [s.t, s.mode]); }
- if (s.act) { await p.waitForSelector('.ws'); await s.act(p); await p.waitForTimeout(450); }
+ if (s.act) { if (/lab/.test(s.hash || '') && !/ingles/.test(s.f)) await p.waitForSelector('.ws'); await s.act(p); await p.waitForTimeout(500); }
await p.waitForTimeout(500);
await p.screenshot({ path: `${OUT}${s.f}.png`, clip: s.clip, fullPage: !!s.full, timeout: 180000 });
console.log(s.f);
diff --git a/src/app/00-iconos.js b/src/app/00-iconos.js
index bf5d842..5668505 100644
--- a/src/app/00-iconos.js
+++ b/src/app/00-iconos.js
@@ -24,6 +24,8 @@ const ICONS={"handshake":"<path d=\"m11 17 2 2a1 1 0 1 0 3-3\" /><path d=\"m14 1
"ok":"<circle cx=\"12\" cy=\"12\" r=\"10\" /><path d=\"m16 9-5.5 5.5L8 12\" />",
"hint":"<path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\" /><path d=\"M9 18h6\" /><path d=\"M10 22h4\" />",
"filter":"<path d=\"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z\" />",
+"panel":"<rect width=\"18\" height=\"18\" x=\"3\" y=\"3\" rx=\"2\" /><path d=\"M9 3v18\" />",
+"more":"<circle cx=\"12\" cy=\"12\" r=\"1\" /><circle cx=\"19\" cy=\"12\" r=\"1\" /><circle cx=\"5\" cy=\"12\" r=\"1\" />",
"pause":"<rect x=\"14\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" /><rect x=\"5\" y=\"3\" width=\"5\" height=\"18\" rx=\"1\" />",
"play":"<path d=\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\" />",
"chevR":"<path d=\"m9 18 6-6-6-6\" />",
diff --git a/src/app/05-i18n.js b/src/app/05-i18n.js
index 55193c0..29aada7 100644
--- a/src/app/05-i18n.js
+++ b/src/app/05-i18n.js
@@ -14,6 +14,7 @@ const STRINGS = {
progress: 'Progreso', resetProgress: 'Borrar mi progreso', resetConfirm: 'Sí, borrar', theme: 'Tema', light: 'Claro', dark: 'Oscuro', system: 'Sistema',
language: 'Idioma', copy: 'Copiar', copied: 'Copiado', lessonsInSpanish: '', importDrop: 'Suelta aquí un .pcap o .pcapng', captures: 'Captura',
expert: 'Información experta', objects: 'Objetos HTTP', creds: 'Credenciales', endpoints: 'Endpoints', gotoPkt: 'Ir al paquete', findPkt: 'Buscar paquete', timeFmt: 'Formato de tiempo', followUdp: 'Seguir flujo UDP',
+ sideToggle: 'Mostrar u ocultar la barra lateral', brandSub: 'Laboratorio de Wireshark', more: 'Más', navMain: 'Secciones', navMobile: 'Secciones (móvil)', themeSwitch: 'Modo oscuro', langSwitch: 'Idioma', allModules: 'Todos los módulos', levelProg: 'Progreso de nivel',
conv: 'Conversaciones', hier: 'Jerarquía de protocolos', io: 'Gráfico de E/S', interval: 'Intervalo', filterThis: 'Filtrar esto', filterStream: 'Filtrar este flujo',
prevStream: 'Flujo anterior', nextStream: 'Flujo siguiente', client: 'Cliente', server: 'Servidor', allPackets: 'Todos los paquetes', matching: 'Cumplen el filtro',
moduleDone: '¡Módulo completado!', badgeEarned: 'Has ganado la insignia', next: 'Siguiente módulo', back: 'Volver', notFound: 'Esta página no existe.',
@@ -32,6 +33,7 @@ const STRINGS = {
progress: 'Progress', resetProgress: 'Reset my progress', resetConfirm: 'Yes, reset', theme: 'Theme', light: 'Light', dark: 'Dark', system: 'System',
language: 'Language', copy: 'Copy', copied: 'Copied', lessonsInSpanish: 'Lessons and challenges are written in Spanish.', importDrop: 'Drop a .pcap or .pcapng here', captures: 'Capture',
expert: 'Expert Information', objects: 'HTTP Objects', creds: 'Credentials', endpoints: 'Endpoints', gotoPkt: 'Go to Packet', findPkt: 'Find Packet', timeFmt: 'Time Display Format', followUdp: 'Follow UDP Stream',
+ sideToggle: 'Show or hide the sidebar', brandSub: 'Wireshark lab', more: 'More', navMain: 'Sections', navMobile: 'Sections (mobile)', themeSwitch: 'Dark mode', langSwitch: 'Language', allModules: 'All modules', levelProg: 'Level progress',
conv: 'Conversations', hier: 'Protocol Hierarchy', io: 'I/O Graph', interval: 'Interval', filterThis: 'Filter this', filterStream: 'Filter this stream',
prevStream: 'Previous stream', nextStream: 'Next stream', client: 'Client', server: 'Server', allPackets: 'All packets', matching: 'Match the filter',
moduleDone: 'Module complete!', badgeEarned: 'You earned the badge', next: 'Next module', back: 'Back', notFound: 'This page does not exist.',
@@ -39,3 +41,7 @@ const STRINGS = {
};
let LANG = 'es';
const t = k => (STRINGS[LANG] && STRINGS[LANG][k]) ?? STRINGS.es[k] ?? k;
+/* Texto en línea para lo que solo aparece una vez: L('español', 'English') */
+const L = (es, en) => LANG === 'en' ? en : es;
+/* Campos de módulo con su versión inglesa (title, sub, badge) */
+const mT = (m, k) => (LANG === 'en' && m[`${k}_en`]) || m[k];
diff --git a/src/app/10-state.js b/src/app/10-state.js
index f46d9f6..0ad4dfb 100644
--- a/src/app/10-state.js
+++ b/src/app/10-state.js
@@ -1,6 +1,8 @@
/* Megalodon · estado y progreso guardados en localStorage («megalodon.v1»). */
const STORE_KEY = 'megalodon.v1';
const LEVELS = [[0, 'Alevín'], [80, 'Tintorera'], [200, 'Tiburón martillo'], [380, 'Gran blanco'], [600, 'Megalodón']];
+const LEVELS_EN = ['Shark pup', 'Blue shark', 'Hammerhead', 'Great white', 'Megalodon'];
+const lvName = lv => (LANG === 'en' ? LEVELS_EN[lv.i] : lv.name);
const XP_BY_HINTS = [10, 8, 6, 5];
const BONUS_MODULE = 20;
const S = (() => {
diff --git a/src/app/20-ui.js b/src/app/20-ui.js
index 60d99a6..7e45c16 100644
--- a/src/app/20-ui.js
+++ b/src/app/20-ui.js
@@ -71,7 +71,7 @@ async function copyText(txt, btn) {
try { ok = document.execCommand('copy'); } catch { ok = false; } ta.remove();
}
if (btn) { btn.classList.add('done'); btn.innerHTML = ic(ok ? 'copied' : 'ko'); btn.setAttribute('aria-label', ok ? t('copied') : 'Error'); setTimeout(() => { btn.classList.remove('done'); btn.innerHTML = ic('copy'); btn.setAttribute('aria-label', t('copy')); }, 1400); }
- toast(ok ? `${t('copied')}: <code>${esc(txt)}</code>` : 'No se pudo copiar', ok ? 'ok' : 'err', ok ? 'copied' : 'ko');
+ toast(ok ? `${t('copied')}: <code>${esc(txt)}</code>` : L('No se pudo copiar', 'Could not copy'), ok ? 'ok' : 'err', ok ? 'copied' : 'ko');
}
function download(bytes, name, type = 'application/octet-stream') {
diff --git a/src/app/30-workspace.js b/src/app/30-workspace.js
index e979a8e..114ba79 100644
--- a/src/app/30-workspace.js
+++ b/src/app/30-workspace.js
@@ -13,6 +13,78 @@ function filterFor(node) {
if (node.field === 'tcp.flags') return `tcp.flags == 0x${Number(v).toString(16).padStart(3, '0')}`;
return `${node.field} == ${v}`;
}
+/* Los mensajes del motor de filtros están en español; en inglés se traducen aquí, sin tocar el motor. */
+const FERR_EN = [
+ [/^Falta cerrar las comillas de la cadena$/, 'Missing closing quote in the string'],
+ [/^Un solo «=» no vale: para comparar usa «==»$/, 'A single “=” is not valid: use “==” to compare'],
+ [/^«(.)» suelto no vale: usa «(..)»$/, '“$1” on its own is not valid: use “$2”'],
+ [/^Carácter inesperado «(.*)»$/, 'Unexpected character “$1”'],
+ [/^Se esperaba una expresión regular entre comillas tras «matches»$/, 'Expected a quoted regular expression after “matches”'],
+ [/^Se esperaba un campo dentro de la función$/, 'Expected a field inside the function'],
+ [/^Se esperaba «\)» para cerrar la función$/, 'Expected “)” to close the function'],
+ [/^Se esperaba «\)» para cerrar el paréntesis$/, 'Expected “)” to close the parenthesis'],
+ [/^Se esperaba «\{» después de «in»$/, 'Expected “{” after “in”'],
+ [/^Se esperaba (.*)$/, 'Expected $1'],
+ [/^El filtro termina antes de tiempo: falta un valor$/, 'The filter ends too early: a value is missing'],
+ [/^El filtro termina antes de tiempo$/, 'The filter ends too early'],
+ [/^No se esperaba «(.*)» aquí$/, '“$1” was not expected here'],
+ [/^«(.*)» no es un campo ni un protocolo conocido\. ¿Querías decir «(.*)»\?$/, '“$1” is not a known field or protocol. Did you mean “$2”?'],
+ [/^«(.*)» no es un campo ni un protocolo conocido$/, '“$1” is not a known field or protocol'],
+ [/^«(.*)» necesita algo a su izquierda$/, '“$1” needs something on its left'],
+ [/^Falta «}» para cerrar el conjunto$/, 'Missing “}” to close the set'],
+ [/^Separa los valores del conjunto con comas: \{80, 443\}$/, 'Separate set values with commas: {80, 443}'],
+ [/^El conjunto de «in» está vacío$/, 'The “in” set is empty'],
+ [/^«(.*)» solo funciona con campos de texto; (.*) es numérico$/, '“$1” only works with text fields; $2 is numeric'],
+ [/^La expresión regular no es válida$/, 'The regular expression is not valid'],
+ [/^Falta el texto a buscar tras «contains»$/, 'Missing the text to search for after “contains”'],
+ [/^Falta el valor con el que comparar ?(.*)$/, 'Missing the value to compare $1 with'],
+ [/^«(.*)» no es un número válido para este campo$/, '“$1” is not a valid number for this field'],
+ [/^«(.*)» no es una dirección IPv4 válida \(p\. ej\. (.*) o (.*)\)$/, '“$1” is not a valid IPv4 address (e.g. $2 or $3)'],
+ [/^«(.*)» no es una MAC válida \(p\. ej\. (.*)\)$/, '“$1” is not a valid MAC (e.g. $2)'],
+ [/^Un protocolo no se compara con un valor: escribe solo su nombre, p\. ej\. «http»$/, 'A protocol is not compared with a value: write just its name, e.g. “http”'],
+ [/^Falta un operador lógico \(«&&» o «\|\|»\) antes de «(.*)»$/, 'Missing a logical operator (“&&” or “||”) before “$1”'],
+];
+const fErr = m => { if (LANG !== 'en' || !m) return m; for (const [re, en] of FERR_EN) if (re.test(m)) return m.replace(re, en); return m; };
+/* Árbol de detalle en inglés con las etiquetas que muestra Wireshark (el disector las genera en español). */
+const TREE_EN = [
+ [/^Frame (\d+): (\d+) bytes en el cable \((\d+) bits\), (\d+) bytes capturados$/, 'Frame $1: $2 bytes on wire ($3 bits), $4 bytes captured'],
+ [/^Hora de llegada \(epoch\): /, 'Epoch Arrival Time: '], [/^Longitud de la trama: (.*) bytes$/, 'Frame Length: $1 bytes'], [/^Número de trama: /, 'Frame Number: '],
+ [/^\[Tiempo desde el paquete anterior: /, '[Time delta from previous captured frame: '], [/^\[Tiempo desde el primer paquete: /, '[Time since reference or first frame: '],
+ [/^\[Protocolos en la trama: /, '[Protocols in frame: '], [/^\[Respuesta en la trama: /, '[Response in frame: '],
+ [/^Tipo de contenido: /, 'Content Type: '], [/^Tipo opaco: (.*) ← en TLS (\S+) el tipo real va cifrado dentro$/, 'Opaque Type: $1 ← in TLS $2 the real type is encrypted inside'],
+ [/^Destino: /, 'Destination: '], [/^Origen: /, 'Source: '], [/^Tipo: (.*)Desconocido/, 'Type: $1Unknown'], [/^Tipo: (.*)\(otro\)$/, 'Type: $1(other)'], [/^Tipo: /, 'Type: '],
+ [/= Versión: /, '= Version: '], [/= Longitud de cabecera: /, '= Header Length: '], [/^Longitud total: /, 'Total Length: '], [/^Identificación: /, 'Identification: '],
+ [/^Tiempo de vida \(TTL\): /, 'Time to Live: '], [/^Protocolo: /, 'Protocol: '], [/^Checksum de cabecera: /, 'Header Checksum: '],
+ [/^Dirección de origen: /, 'Source Address: '], [/^Dirección de destino: /, 'Destination Address: '],
+ [/^Puerto de origen: /, 'Source Port: '], [/^Puerto de destino: /, 'Destination Port: '], [/^\[Índice de flujo: /, '[Stream index: '],
+ [/^\[Longitud del segmento TCP: /, '[TCP Segment Len: '], [/^Número de secuencia \(bruto\): /, 'Sequence Number (raw): '],
+ [/^Número de secuencia: (\d+) {4}\(número relativo\)$/, 'Sequence Number: $1 (relative sequence number)'], [/^Número de secuencia: /, 'Sequence Number: '],
+ [/^\[Siguiente número de secuencia: (\d+) {4}\(relativo\)\]$/, '[Next Sequence Number: $1 (relative sequence number)]'], [/^\[Siguiente número de secuencia: /, '[Next Sequence Number: '],
+ [/^Número de acuse \(bruto\): /, 'Acknowledgment number (raw): '], [/^Número de acuse: (\d+) {4}\(relativo\)$/, 'Acknowledgment Number: $1 (relative ack number)'], [/^Número de acuse: /, 'Acknowledgment Number: '],
+ [/<ninguno>/, '<None>'], [/^Ventana: /, 'Window: '], [/^\[Ventana calculada: /, '[Calculated window size: '], [/^Opciones: \((.*) bytes\)$/, 'Options: ($1 bytes)'],
+ [/^SACK permitido$/, 'SACK permitted'], [/\(multiplicar por (\d+)\)$/, '(multiply by $1)'], [/^\[Análisis SEQ\/ACK\]$/, '[SEQ/ACK analysis]'],
+ [/^\[Este segmento es una retransmisión\]$/, '[This frame is a (suspected) retransmission]'], [/^Datos TCP \((.*) bytes\)$/, 'TCP payload ($1 bytes)'],
+ [/^Longitud: /, 'Length: '], [/^Código: /, 'Code: '],
+ [/^Tipo de hardware: /, 'Hardware type: '], [/^Tipo de protocolo: /, 'Protocol type: '], [/^MAC del emisor: /, 'Sender MAC address: '], [/^IP del emisor: /, 'Sender IP address: '],
+ [/^MAC de destino: /, 'Target MAC address: '], [/^IP de destino: /, 'Target IP address: '],
+ [/^ID de transacción: /, 'Transaction ID: '], [/^Flags: Respuesta$/, 'Flags: Response'], [/^Flags: Petición$/, 'Flags: Request'],
+ [/^Preguntas: /, 'Questions: '], [/^Respuestas: /, 'Answer RRs: '], [/^Nombre: /, 'Name: '], [/^TTL: (\d+) \((\d+) segundos\)$/, 'Time to live: $1 ($2 seconds)'],
+ [/^MAC del cliente: /, 'Client MAC address: '], [/^Tu IP \(yiaddr\): /, 'Your (client) IP address: '],
+ [/^Opción \(53\) Tipo de mensaje DHCP: /, 'Option: (53) DHCP Message Type: '], [/^Opción \(50\) IP solicitada: /, 'Option: (50) Requested IP Address: '],
+ [/^Opción \(54\) Servidor DHCP: /, 'Option: (54) DHCP Server Identifier: '], [/^Opción \(12\) Nombre del equipo: /, 'Option: (12) Host Name: '],
+ [/^Opción \((\d+)\)$/, 'Option: ($1)'], [/^Opción (\d+)$/, 'Option $1'], [/^Fin de la lista de opciones \(EOL\)$/, 'End of Option List (EOL)'],
+ [/^Método: /, 'Request Method: '], [/^URI: /, 'Request URI: '], [/^Versión: /, 'Version: '], [/^Código de estado: /, 'Status Code: '], [/^Frase: /, 'Response Phrase: '],
+ [/^\[URI completa pedida: /, '[Full request URI: '], [/^\[URI completa: /, '[Full request URI: '], [/^\[URI pedida: /, '[Request URI: '],
+ [/^\[Petición en la trama: /, '[Request in frame: '], [/^\[Tiempo desde la petición: /, '[Time since request: '], [/^Credenciales: /, 'Credentials: '],
+ [/^Par de cookie: /, 'Cookie pair: '], [/^Cuerpo \((.*) bytes\)$/, 'File Data: $1 bytes'], [/^Elemento del formulario: /, 'Form item: '], [/^Clave: /, 'Key: '], [/^Valor: /, 'Value: '],
+ [/^Orden: ([A-Z]+)$/, 'Request command: $1'], [/^Orden: /, 'Command: '], [/^Argumento: /, 'Request arg: '], [/^Código de respuesta: /, 'Response code: '],
+ [/^Tipo de handshake: /, 'Handshake Type: '], [/^Longitud del Session ID: /, 'Session ID Length: '], [/\(len=(\d+)\)$/, '(len=$1)'], [/^Extension: tipo /, 'Extension: type '],
+ [/^Mensaje Change Cipher Spec$/, 'Change Cipher Spec Message'], [/^Datos de aplicación cifrados: /, 'Encrypted Application Data: '],
+ [/^NetBIOS Session Service \(longitud (\d+)\)$/, 'NetBIOS Session Service (length $1)'], [/^Cabecera SMB2$/, 'SMB2 Header'], [/^Estado NT: /, 'NT Status: '],
+ [/^Identificador NTLMSSP: /, 'NTLMSSP identifier: '], [/^Tipo de mensaje: /, 'NTLM Message Type: '], [/^Dominio: /, 'Domain name: '], [/^Usuario: /, 'User name: '], [/^Equipo: /, 'Host name: '],
+ [/^ENCTYPE \(que acepta el cliente\): /, 'ENCTYPE: '], [/^etype del ticket: /, 'etype (ticket): '], [/^etype de enc-part: /, 'etype (enc-part): '],
+];
+const treeLabel = l => { if (LANG !== 'en') return l; let out = l; for (const [re, en] of TREE_EN) out = out.replace(re, en); return out; };
const treeKey = (node, depth) => depth + ':' + node.label.split(/[,:(\[]/)[0].trim();
class Workspace {
@@ -31,22 +103,22 @@ class Workspace {
<div class="ws-bar">
<div class="fbar" data-state="empty">
<span class="fbar-ic" aria-hidden="true">${ic('filter')}</span>
- <label class="vh" for="${id}-f">Filtro de visualización</label>
+ <label class="vh" for="${id}-f">${L('Filtro de visualización', 'Display filter')}</label>
<input id="${id}-f" class="finput mono" type="text" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-controls="${id}-ac" aria-describedby="${id}-msg" autocomplete="off" autocapitalize="off" spellcheck="false" placeholder="${esc(t('filterPh'))}">
<button class="ibtn sm" data-clear type="button" aria-label="${t('clear')}">${ic('x')}</button>
<button class="btn sm primary" data-apply type="button" aria-label="${t('apply')}">${ic('enter')}<span>${t('apply')}</span></button>
- <ul class="ac" id="${id}-ac" role="listbox" aria-label="Sugerencias" hidden></ul>
+ <ul class="ac" id="${id}-ac" role="listbox" aria-label="${L('Sugerencias', 'Suggestions')}" hidden></ul>
</div>
- <div class="ws-tools" role="toolbar" aria-label="Herramientas">
+ <div class="ws-tools" role="toolbar" aria-label="${L('Herramientas', 'Tools')}">
<button class="tbtn" data-follow type="button" title="${t('follow')} (F)">${ic('follow')}<span>${t('follow')}</span></button>
<button class="tbtn" data-stats type="button" title="${t('stats')} (S)">${ic('stats')}<span>${t('stats')}</span></button>
- <button class="tbtn" data-expert type="button" title="${t('expert')} (E)">${ic('alert')}<span>Experto</span></button>
- <button class="tbtn" data-objects type="button" title="Archivo › Exportar objetos › HTTP">${ic('file')}<span>${t('objects')}</span></button>
- <button class="tbtn" data-creds type="button" title="Herramientas › Credenciales">${ic('lock')}<span>${t('creds')}</span></button>
- <button class="tbtn" data-find type="button" title="${t('findPkt')} (Ctrl F) · ${t('gotoPkt')} (Ctrl G)">${ic('search')}<span>Buscar</span></button>
+ <button class="tbtn" data-expert type="button" title="${t('expert')} (E)">${ic('alert')}<span>${L('Experto', 'Expert')}</span></button>
+ <button class="tbtn" data-objects type="button" title="${L('Archivo › Exportar objetos › HTTP', 'File › Export Objects › HTTP')}">${ic('file')}<span>${t('objects')}</span></button>
+ <button class="tbtn" data-creds type="button" title="${L('Herramientas › Credenciales', 'Tools › Credentials')}">${ic('lock')}<span>${t('creds')}</span></button>
+ <button class="tbtn" data-find type="button" title="${t('findPkt')} (Ctrl F) · ${t('gotoPkt')} (Ctrl G)">${ic('search')}<span>${t('search')}</span></button>
<button class="tbtn" data-color type="button" aria-pressed="true">${ic('sparkles')}<span>${t('colorize')}</span></button>
${imp ? `<button class="tbtn" data-open type="button">${ic('upload')}<span>${t('open')}</span></button><input type="file" class="vh" data-file accept=".pcap,.pcapng,.cap,application/vnd.tcpdump.pcap" tabindex="-1" aria-hidden="true">` : ''}
- <button class="tbtn" data-export type="button">${ic('download')}<span>Exportar</span></button>
+ <button class="tbtn" data-export type="button">${ic('download')}<span>${L('Exportar', 'Export')}</span></button>
</div>
</div>
<p class="fmsg" id="${id}-msg" aria-live="polite"></p>
@@ -60,7 +132,7 @@ class Workspace {
<div class="pane ptree" aria-label="${t('detail')}" role="region"><ul class="tree" role="tree" aria-label="${t('detail')}" tabindex="0"></ul><p class="pane-empty">${t('noPacket')}</p></div>
<div class="pane phex" role="region" aria-label="${t('hexView')}" tabindex="0"><div class="hex mono"></div></div>
</div>
- <div class="ws-status"><span data-count></span><span class="dot" aria-hidden="true"></span><label class="tfmt"><span>${t('time')}:</span><select data-tfmt aria-label="${t('timeFmt')}"><option value="rel">desde el inicio</option><option value="delta">desde el anterior capturado</option><option value="dview">desde el anterior mostrado</option><option value="abs">hora UTC</option></select></label><span class="dot" aria-hidden="true"></span><span data-name class="mono"></span><span class="grow"></span><span data-legend class="legend"></span></div>
+ <div class="ws-status"><span data-count></span><span class="dot" aria-hidden="true"></span><label class="tfmt"><span>${t('time')}:</span><select data-tfmt aria-label="${t('timeFmt')}"><option value="rel">${L('desde el inicio', 'since beginning of capture')}</option><option value="delta">${L('desde el anterior capturado', 'since previous captured packet')}</option><option value="dview">${L('desde el anterior mostrado', 'since previous displayed packet')}</option><option value="abs">${L('hora UTC', 'UTC time of day')}</option></select></label><span class="dot" aria-hidden="true"></span><span data-name class="mono"></span><span class="grow"></span><span data-legend class="legend"></span></div>
${imp ? `<div class="drop" hidden>${ic('upload')}<span>${t('importDrop')}</span></div>` : ''}
</section>`;
const r = this.host;
@@ -124,27 +196,27 @@ class Workspace {
}
async importFile(f) {
try {
- if (f.size > 64 * 1024 * 1024) throw new Error('El archivo pesa más de 64 MB; este laboratorio está pensado para capturas pequeñas.');
+ if (f.size > 64 * 1024 * 1024) throw new Error(L('El archivo pesa más de 64 MB; este laboratorio está pensado para capturas pequeñas.', 'The file is over 64 MB; this lab is meant for small captures.'));
const raw = readCapture(new Uint8Array(await f.arrayBuffer()));
- if (!raw.length) throw new Error('La captura no tiene paquetes Ethernet que pueda leer.');
+ if (!raw.length) throw new Error(L('La captura no tiene paquetes Ethernet que pueda leer.', 'The capture has no Ethernet packets I can read.'));
this.load(raw, f.name, '');
- toast(`Abierta <strong>${esc(f.name)}</strong>: ${fmtNum(raw.length)} paquetes`, 'ok', 'file');
+ toast(`${L('Abierta', 'Opened')} <strong>${esc(f.name)}</strong>: ${fmtNum(raw.length)} ${L('paquetes', 'packets')}`, 'ok', 'file');
if (this.opts.onImport) this.opts.onImport(f.name);
- } catch (err) { toast(esc(err.message || 'No se pudo leer la captura'), 'err'); }
+ } catch (err) { toast(esc(err.message || L('No se pudo leer la captura', 'Could not read the capture')), 'err'); }
}
exportDialog() {
const base = this.name.replace(/\.(pcapng|pcap|cap)$/i, '');
- const d = openDialog({ title: 'Exportar captura', cls: 'narrow', body: `<p class="muted">Se descarga a tu equipo y la abres tal cual en Wireshark.</p>
+ const d = openDialog({ title: L('Exportar captura', 'Export capture'), cls: 'narrow', body: `<p class="muted">${L('Se descarga a tu equipo y la abres tal cual en Wireshark.', 'It downloads to your device and opens as is in Wireshark.')}</p>
<div class="stack-sm">
- <button class="choice" data-k="all-ng">${ic('download')}<span><strong>Captura completa · .pcapng</strong><small>${fmtNum(this.pkts.length)} paquetes, formato moderno</small></span></button>
- <button class="choice" data-k="all-pcap">${ic('download')}<span><strong>Captura completa · .pcap</strong><small>Formato clásico, lo abre cualquier herramienta</small></span></button>
- <button class="choice" data-k="view-ng" ${this.view.length === this.pkts.length ? 'disabled' : ''}>${ic('filter')}<span><strong>Solo los mostrados · .pcapng</strong><small>${fmtNum(this.view.length)} paquetes con el filtro actual</small></span></button>
+ <button class="choice" data-k="all-ng">${ic('download')}<span><strong>${L('Captura completa', 'Full capture')} · .pcapng</strong><small>${fmtNum(this.pkts.length)} ${L('paquetes, formato moderno', 'packets, modern format')}</small></span></button>
+ <button class="choice" data-k="all-pcap">${ic('download')}<span><strong>${L('Captura completa', 'Full capture')} · .pcap</strong><small>${L('Formato clásico, lo abre cualquier herramienta', 'Classic format, any tool opens it')}</small></span></button>
+ <button class="choice" data-k="view-ng" ${this.view.length === this.pkts.length ? 'disabled' : ''}>${ic('filter')}<span><strong>${L('Solo los mostrados', 'Displayed only')} · .pcapng</strong><small>${fmtNum(this.view.length)} ${L('paquetes con el filtro actual', 'packets with the current filter')}</small></span></button>
</div>` });
$$('[data-k]', d).forEach(b => b.onclick = () => {
const k = b.dataset.k, subset = k.startsWith('view') ? this.view.map(p => this.raw[p.no - 1]) : this.raw;
const ng = k.endsWith('ng');
download(ng ? writePcapng(subset, `Megalodon · ${base}`) : writePcap(subset), `${base}${k.startsWith('view') ? '-filtrado' : ''}.${ng ? 'pcapng' : 'pcap'}`, 'application/vnd.tcpdump.pcap');
- closeDialog(); toast('Captura exportada', 'ok', 'download');
+ closeDialog(); toast(L('Captura exportada', 'Capture exported'), 'ok', 'download');
});
}
@@ -154,7 +226,7 @@ class Workspace {
this.$.fbar.dataset.state = r.empty ? 'empty' : r.ok ? 'ok' : 'bad';
this.$.input.setAttribute('aria-invalid', String(!r.ok));
this.$.msg.className = 'fmsg ' + (r.ok ? '' : 'bad');
- this.$.msg.innerHTML = r.ok ? '' : `${ic('ko', 'sm')}<span>${esc(r.error)}</span>`;
+ this.$.msg.innerHTML = r.ok ? '' : `${ic('ko', 'sm')}<span>${esc(fErr(r.error))}</span>`;
return r;
}
apply(silent) {
@@ -287,7 +359,7 @@ class Workspace {
this.flat.push({ id, node: n, depth, key, parentId, kids, open });
const f = filterFor(n);
return `<li role="treeitem" id="${id}" aria-level="${depth + 1}" aria-selected="false" ${kids ? `aria-expanded="${open}"` : ''}>
- <div class="tn" data-id="${id}">${kids ? `<span class="tw" aria-hidden="true">${ic('chevR', 'sm')}</span>` : '<span class="tw"></span>'}<span class="tl">${esc(n.label)}</span>${f ? `<button class="tf" type="button" tabindex="-1" data-f="${esc(f)}" aria-label="${t('applyAsFilter')}: ${esc(f)}" title="${t('applyAsFilter')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</div>
+ <div class="tn" data-id="${id}">${kids ? `<span class="tw" aria-hidden="true">${ic('chevR', 'sm')}</span>` : '<span class="tw"></span>'}<span class="tl">${esc(treeLabel(n.label))}</span>${f ? `<button class="tf" type="button" tabindex="-1" data-f="${esc(f)}" aria-label="${t('applyAsFilter')}: ${esc(f)}" title="${t('applyAsFilter')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</div>
${kids ? `<ul role="group"${open ? '' : ' hidden'}>${walk(n.kids, depth + 1, id)}</ul>` : ''}</li>`;
}).join('');
this.$.tree.innerHTML = walk(p.tree, 0, null);
@@ -360,7 +432,7 @@ class Workspace {
const p = this.selected();
if (stream === undefined && p && p.tcpStream === undefined && p.f['udp.stream']) return openFollow(this, p.f['udp.stream'][0], 'udp');
const st = stream ?? (p && p.tcpStream);
- if (st === undefined || st === null) { toast('Selecciona un paquete TCP o UDP para seguir su flujo.', 'info', 'follow'); return; }
+ if (st === undefined || st === null) { toast(L('Selecciona un paquete TCP o UDP para seguir su flujo.', 'Select a TCP or UDP packet to follow its stream.'), 'info', 'follow'); return; }
openFollow(this, st);
}
destroy() { this.unsub && this.unsub(); this.host.innerHTML = ''; }
diff --git a/src/app/40-dialogs.js b/src/app/40-dialogs.js
index b7cac24..86c1349 100644
--- a/src/app/40-dialogs.js
+++ b/src/app/40-dialogs.js
@@ -12,8 +12,8 @@ function openFollow(ws, stream, kind = 'tcp') {
<div class="fs-ends"><span class="who cli">${ic('arrowR', 'sm')}${t('client')} <code>${esc(fs.client)}</code></span><span class="who srv">${ic('arrowL', 'sm')}${t('server')} <code>${esc(fs.server)}</code></span></div>
<div class="row"><button class="ibtn" data-prev ${idx <= 0 ? 'disabled' : ''} aria-label="${t('prevStream')}">${ic('chevL')}</button><span class="mono sm">${kind}.stream eq ${cur}</span><button class="ibtn" data-next ${idx >= streams.length - 1 ? 'disabled' : ''} aria-label="${t('nextStream')}">${ic('chevR')}</button></div>
</div>
- <div class="fs-body mono" tabindex="0" aria-label="Contenido del flujo">${fs.chunks.length ? fs.chunks.map(c => `<pre class="${c.client ? 'cli' : 'srv'}"><span class="vh">${c.client ? t('client') : t('server')}: </span>${esc(c.text)}</pre>`).join('') : `<p class="muted">${udp ? 'Este flujo UDP no lleva datos.' : 'Este flujo no lleva datos: solo saludo y cierre (o un RST).'}</p>`}</div>
- <p class="sm muted fs-sum">${t('client')} → ${t('server')}: <strong>${fmtNum(fs.cBytes)}</strong> bytes · ${t('server')} → ${t('client')}: <strong>${fmtNum(fs.sBytes)}</strong> bytes · ${fs.chunks.length} bloques</p>`;
+ <div class="fs-body mono" tabindex="0" aria-label="${L('Contenido del flujo', 'Stream content')}">${fs.chunks.length ? fs.chunks.map(c => `<pre class="${c.client ? 'cli' : 'srv'}"><span class="vh">${c.client ? t('client') : t('server')}: </span>${esc(c.text)}</pre>`).join('') : `<p class="muted">${udp ? L('Este flujo UDP no lleva datos.', 'This UDP stream carries no data.') : L('Este flujo no lleva datos: solo saludo y cierre (o un RST).', 'This stream carries no data: just handshake and teardown (or an RST).')}</p>`}</div>
+ <p class="sm muted fs-sum">${t('client')} → ${t('server')}: <strong>${fmtNum(fs.cBytes)}</strong> bytes · ${t('server')} → ${t('client')}: <strong>${fmtNum(fs.sBytes)}</strong> bytes · ${fs.chunks.length} ${L('bloques', 'chunks')}</p>`;
$('[data-prev]', body).onclick = () => { cur = streams[idx - 1]; render(); };
$('[data-next]', body).onclick = () => { cur = streams[idx + 1]; render(); };
};
@@ -51,10 +51,10 @@ function convPanel(ws, panel) {
const draw = () => {
const rows = c[k], ports = k === 'tcp' || k === 'udp';
const fl = r => k === 'tcp' ? `tcp.stream eq ${r.stream}` : k === 'udp' ? `udp.stream eq ${r.stream}` : k === 'ip' ? `ip.addr == ${r.a} && ip.addr == ${r.b}` : `eth.addr == ${r.a} && eth.addr == ${r.b}`;
- panel.innerHTML = `<div class="chips" role="group" aria-label="Tipo de conversación">${kinds.map(([x, l]) => `<button class="chip ${x === k ? 'on' : ''}" aria-pressed="${x === k}" data-k="${x}">${l} <span class="num">${c[x].length}</span></button>`).join('')}</div>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl"><caption class="vh">Conversaciones ${k}</caption><thead><tr><th scope="col">${k === 'eth' ? 'Dirección A' : 'IP A'}</th>${ports ? '<th scope="col" class="n">Puerto A</th>' : ''}<th scope="col">${k === 'eth' ? 'Dirección B' : 'IP B'}</th>${ports ? '<th scope="col" class="n">Puerto B</th>' : ''}<th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">A → B</th><th scope="col" class="n">B → A</th><th scope="col" class="n">Inicio</th><th scope="col" class="n">Duración</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="chips" role="group" aria-label="${L('Tipo de conversación', 'Conversation type')}">${kinds.map(([x, l]) => `<button class="chip ${x === k ? 'on' : ''}" aria-pressed="${x === k}" data-k="${x}">${l} <span class="num">${c[x].length}</span></button>`).join('')}</div>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl"><caption class="vh">${t('conv')} ${k}</caption><thead><tr><th scope="col">${k === 'eth' ? L('Dirección A', 'Address A') : 'IP A'}</th>${ports ? `<th scope="col" class="n">${L('Puerto A', 'Port A')}</th>` : ''}<th scope="col">${k === 'eth' ? L('Dirección B', 'Address B') : 'IP B'}</th>${ports ? `<th scope="col" class="n">${L('Puerto B', 'Port B')}</th>` : ''}<th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">A → B</th><th scope="col" class="n">B → A</th><th scope="col" class="n">${L('Inicio', 'Start')}</th><th scope="col" class="n">${L('Duración', 'Duration')}</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map((r, i) => `<tr><td class="mono">${esc(r.a)}</td>${ports ? `<td class="n mono">${r.pa}</td>` : ''}<td class="mono">${esc(r.b)}</td>${ports ? `<td class="n mono">${r.pb}</td>` : ''}<td class="n">${r.pkts}</td><td class="n">${fmtNum(r.bytes)}</td><td class="n">${r.ab}</td><td class="n">${r.ba}</td><td class="n mono">${r.start.toFixed(3)}</td><td class="n mono">${r.dur.toFixed(3)}</td><td><button class="ibtn sm" data-f="${esc(fl(r))}" aria-label="${t('filterThis')}: ${esc(fl(r))}" title="${t('filterThis')}">${ic('filter', 'sm')}</button></td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Pista: en un escaneo verás muchas conversaciones TCP de 2 o 3 paquetes desde el mismo origen.</p>`;
+ <p class="sm muted">${L('Pista: en un escaneo verás muchas conversaciones TCP de 2 o 3 paquetes desde el mismo origen.', 'Hint: in a scan you will see many 2- or 3-packet TCP conversations from the same source.')}</p>`;
$$('[data-k]', panel).forEach(b => b.onclick = () => { k = b.dataset.k; draw(); });
$$('[data-f]', panel).forEach(b => b.onclick = () => { ws.setFilter(b.dataset.f); closeDialog(); });
};
@@ -65,7 +65,7 @@ function hierPanel(ws, panel) {
const h = protocolHierarchy(ws.pkts), rows = [];
const walk = n => { rows.push(n); n.kids.forEach(walk); };
walk(h);
- panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl hier"><caption class="vh">${t('hier')}</caption><thead><tr><th scope="col">Protocolo</th><th scope="col" class="n">% paquetes</th><th scope="col" class="bar-col"><span class="vh">Barra</span></th><th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('stats')}"><table class="tbl hier"><caption class="vh">${t('hier')}</caption><thead><tr><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col" class="n">${L('% paquetes', '% packets')}</th><th scope="col" class="bar-col"><span class="vh">${L('Barra', 'Bar')}</span></th><th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map(r => { const name = r.name === 'frame' ? 'Frame' : r.name; const f = r.name === 'frame' ? '' : r.name; return `<tr><td><span class="ind" data-d="${Math.min(r.depth, 8)}">${esc(name)}</span></td><td class="n">${r.pct.toFixed(1)} %</td><td class="bar-col"><span class="bar" data-w="${r.pct}"></span></td><td class="n">${r.pkts}</td><td class="n">${fmtNum(r.bytes)}</td><td>${f && FIELDS[f] ? `<button class="ibtn sm" data-f="${esc(f)}" aria-label="${t('filterThis')}: ${esc(f)}">${ic('filter', 'sm')}</button>` : ''}</td></tr>`; }).join('')}</tbody></table></div>`;
$$('.bar', panel).forEach(b => { b.style.width = `${b.dataset.w}%`; });
$$('.ind', panel).forEach(s => { s.style.paddingInlineStart = `${s.dataset.d * 16}px`; });
@@ -83,13 +83,13 @@ function ioPanel(ws, panel) {
const y = v => H - pb - (v / max) * (H - pb - 10);
const ticks = [0, Math.ceil(max / 2), max];
const xl = Math.max(1, Math.ceil(g.buckets.length / 8));
- panel.innerHTML = `<div class="row between"><div class="row sm"><span class="lgd all"><i></i>${t('allPackets')}</span>${test ? `<span class="lgd hit"><i></i>${t('matching')}: <code>${esc(ws.filterText)}</code></span>` : '<span class="muted">Aplica un filtro para compararlo con el total.</span>'}</div>
+ panel.innerHTML = `<div class="row between"><div class="row sm"><span class="lgd all"><i></i>${t('allPackets')}</span>${test ? `<span class="lgd hit"><i></i>${t('matching')}: <code>${esc(ws.filterText)}</code></span>` : `<span class="muted">${L('Aplica un filtro para compararlo con el total.', 'Apply a filter to compare it with the total.')}</span>`}</div>
<label class="row sm">${t('interval')} <select data-iv>${(opts.length ? opts : [iv]).map(o => `<option value="${o}" ${o === iv ? 'selected' : ''}>${o} s</option>`).join('')}</select></label></div>
- <svg class="io" viewBox="0 0 ${W} ${H}" role="img" aria-label="Paquetes por intervalo de ${iv} segundos: máximo ${max}">
+ <svg class="io" viewBox="0 0 ${W} ${H}" role="img" aria-label="${L(`Paquetes por intervalo de ${iv} segundos: máximo ${max}`, `Packets per ${iv}-second interval: maximum ${max}`)}">
${ticks.map(v => `<line class="gl" x1="${pl}" x2="${W - 4}" y1="${y(v)}" y2="${y(v)}"/><text class="ax" x="${pl - 6}" y="${y(v) + 4}" text-anchor="end">${v}</text>`).join('')}
- ${g.buckets.map((b, i) => `<rect class="b-all" x="${pl + i * bw + bw * 0.12}" y="${y(b.all)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.all)}" rx="${Math.min(3, bw / 4)}"><title>${b.t} s: ${b.all} paquetes${test ? `, ${b.hit} cumplen el filtro` : ''}</title></rect>${test && b.hit ? `<rect class="b-hit" x="${pl + i * bw + bw * 0.12}" y="${y(b.hit)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.hit)}" rx="${Math.min(3, bw / 4)}"/>` : ''}`).join('')}
+ ${g.buckets.map((b, i) => `<rect class="b-all" x="${pl + i * bw + bw * 0.12}" y="${y(b.all)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.all)}" rx="${Math.min(3, bw / 4)}"><title>${b.t} s: ${b.all} ${L('paquetes', 'packets')}${test ? `, ${b.hit} ${L('cumplen el filtro', 'match the filter')}` : ''}</title></rect>${test && b.hit ? `<rect class="b-hit" x="${pl + i * bw + bw * 0.12}" y="${y(b.hit)}" width="${Math.max(1, bw * 0.76)}" height="${H - pb - y(b.hit)}" rx="${Math.min(3, bw / 4)}"/>` : ''}`).join('')}
${g.buckets.map((b, i) => i % xl === 0 ? `<text class="ax" x="${pl + i * bw + bw / 2}" y="${H - 8}" text-anchor="middle">${+b.t.toFixed(2)}</text>` : '').join('')}
- </svg><p class="sm muted">Eje horizontal: segundos desde el primer paquete. Un pico que se repite a intervalos fijos puede ser un beacon.</p>`;
+ </svg><p class="sm muted">${L('Eje horizontal: segundos desde el primer paquete. Un pico que se repite a intervalos fijos puede ser un beacon.', 'Horizontal axis: seconds since the first packet. A spike that repeats at fixed intervals may be a beacon.')}</p>`;
$('[data-iv]', panel).onchange = e => { iv = +e.target.value; draw(); };
};
draw();
@@ -99,22 +99,23 @@ function ioPanel(ws, panel) {
/* ---------- Endpoints (Estadísticas › Endpoints › IPv4) ---------- */
function endsPanel(ws, panel) {
const rows = endpoints(ws.pkts);
- panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('endpoints')}"><table class="tbl"><caption class="vh">${t('endpoints')} IPv4</caption><thead><tr><th scope="col">Dirección</th><th scope="col" class="n">Paquetes</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">Enviados</th><th scope="col" class="n">Recibidos</th><th scope="col"><span class="vh">Acción</span></th></tr></thead>
+ panel.innerHTML = `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('endpoints')}"><table class="tbl"><caption class="vh">${t('endpoints')} IPv4</caption><thead><tr><th scope="col">${L('Dirección', 'Address')}</th><th scope="col" class="n">${L('Paquetes', 'Packets')}</th><th scope="col" class="n">Bytes</th><th scope="col" class="n">${L('Enviados', 'Sent')}</th><th scope="col" class="n">${L('Recibidos', 'Received')}</th><th scope="col"><span class="vh">${L('Acción', 'Action')}</span></th></tr></thead>
<tbody>${rows.map(e => `<tr><td class="mono">${esc(e.addr)}</td><td class="n">${fmtNum(e.pkts)}</td><td class="n">${fmtNum(e.bytes)}</td><td class="n">${fmtNum(e.tx)}</td><td class="n">${fmtNum(e.rx)}</td><td><button class="btn sm ghost" type="button" data-f="ip.addr == ${esc(e.addr)}">${ic('filter', 'sm')}${t('filterThis')}</button></td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Cada IP que aparece en la captura. Un equipo que solo recibe, o uno que habla con muchos, suele ser el primer hilo del que tirar.</p>`;
+ <p class="sm muted">${L('Cada IP que aparece en la captura. Un equipo que solo recibe, o uno que habla con muchos, suele ser el primer hilo del que tirar.', 'Every IP in the capture. A host that only receives, or one that talks to many, is usually the first thread to pull.')}</p>`;
$$('[data-f]', panel).forEach(b => b.onclick = () => { ws.setFilter(b.dataset.f); closeDialog(); });
}
/* ---------- Analizar › Información experta ---------- */
-const SEV_LABEL = { error: 'Error', warn: 'Aviso', note: 'Nota', chat: 'Conversación' };
+const SEV_LABELS = { es: { error: 'Error', warn: 'Aviso', note: 'Nota', chat: 'Conversación' }, en: { error: 'Error', warn: 'Warning', note: 'Note', chat: 'Chat' } };
+const sevLabel = k => SEV_LABELS[LANG === 'en' ? 'en' : 'es'][k];
function openExpert(ws) {
const ex = expertInfo(ws.pkts), body = document.createElement('div');
- body.innerHTML = `<p class="muted sm">Wireshark resume aquí lo que le llama la atención de cada paquete, de más grave a más rutinario. Los mensajes se muestran en inglés, como en Wireshark, para que los reconozcas.</p>
- <div class="ex-sum">${EXPERT_SEV.map(([k, en]) => `<span class="ex-chip sev-${k}"><strong>${fmtNum(ex.count[k])}</strong> ${SEV_LABEL[k]} <small>(${en})</small></span>`).join('')}</div>
- ${ex.items.length ? `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('expert')}"><table class="tbl ex"><caption class="vh">${t('expert')}</caption><thead><tr><th scope="col">Severidad</th><th scope="col">Resumen</th><th scope="col">Protocolo</th><th scope="col" class="n">Cantidad</th><th scope="col">Paquetes</th></tr></thead>
- <tbody>${ex.items.map((it, i) => `<tr><td><span class="ex-chip sev-${it.sev}">${SEV_LABEL[it.sev]}</span></td><td class="mono">${esc(it.summary)}</td><td>${esc(it.proto)}</td><td class="n">${fmtNum(it.nos.length)}</td>
- <td><div class="ex-nos">${it.nos.slice(0, 8).map(n => `<button class="btn sm ghost mono" type="button" data-no="${n}" aria-label="Ir al paquete ${n}">${n}</button>`).join('')}${it.nos.length > 1 ? `<button class="btn sm ghost" type="button" data-show="${i}">${ic('filter', 'sm')}Mostrar</button>` : ''}</div></td></tr>`).join('')}</tbody></table></div>`
- : '<p class="muted">No hay entradas: esta captura no tiene TCP ni HTTP que comentar.</p>'}`;
+ body.innerHTML = `<p class="muted sm">${L('Wireshark resume aquí lo que le llama la atención de cada paquete, de más grave a más rutinario. Los mensajes se muestran en inglés, como en Wireshark, para que los reconozcas.', 'Wireshark sums up here what catches its eye in each packet, from most serious to most routine.')}</p>
+ <div class="ex-sum">${EXPERT_SEV.map(([k, en]) => `<span class="ex-chip sev-${k}"><strong>${fmtNum(ex.count[k])}</strong> ${sevLabel(k)}${LANG === 'en' ? '' : ` <small>(${en})</small>`}</span>`).join('')}</div>
+ ${ex.items.length ? `<div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('expert')}"><table class="tbl ex"><caption class="vh">${t('expert')}</caption><thead><tr><th scope="col">${L('Severidad', 'Severity')}</th><th scope="col">${L('Resumen', 'Summary')}</th><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col" class="n">${L('Cantidad', 'Count')}</th><th scope="col">${L('Paquetes', 'Packets')}</th></tr></thead>
+ <tbody>${ex.items.map((it, i) => `<tr><td><span class="ex-chip sev-${it.sev}">${sevLabel(it.sev)}</span></td><td class="mono">${esc(it.summary)}</td><td>${esc(it.proto)}</td><td class="n">${fmtNum(it.nos.length)}</td>
+ <td><div class="ex-nos">${it.nos.slice(0, 8).map(n => `<button class="btn sm ghost mono" type="button" data-no="${n}" aria-label="${L('Ir al paquete', 'Go to packet')} ${n}">${n}</button>`).join('')}${it.nos.length > 1 ? `<button class="btn sm ghost" type="button" data-show="${i}">${ic('filter', 'sm')}${L('Mostrar', 'Show')}</button>` : ''}</div></td></tr>`).join('')}</tbody></table></div>`
+ : `<p class="muted">${L('No hay entradas: esta captura no tiene TCP ni HTTP que comentar.', 'No entries: this capture has no TCP or HTTP worth commenting on.')}</p>`}`;
openDialog({ title: `${ic('alert')} ${t('expert')}`, body, wide: true });
$$('[data-no]', body).forEach(b => b.onclick = () => { closeDialog(); ws.select(+b.dataset.no, { focusList: true }); });
$$('[data-show]', body).forEach(b => b.onclick = () => { closeDialog(); ws.setFilter(`frame.number in {${ex.items[+b.dataset.show].nos.join(', ')}}`); });
@@ -124,18 +125,18 @@ function openExpert(ws) {
function openObjects(ws) {
const objs = httpObjects(ws.pkts), body = document.createElement('div');
const isText = o => /^(text\/|application\/(json|javascript|xml|x-www-form-urlencoded))/i.test(o.type);
- body.innerHTML = objs.length ? `<p class="muted sm">Los cuerpos HTTP reconstruidos de la captura: páginas, scripts, JSON, formularios y ficheros. Así se recupera lo que se descargó (o se robó) por HTTP sin cifrar.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('objects')}"><table class="tbl"><caption class="vh">${t('objects')}</caption><thead><tr><th scope="col" class="n">Paquete</th><th scope="col">Host</th><th scope="col">Tipo de contenido</th><th scope="col" class="n">Tamaño</th><th scope="col">Nombre</th><th scope="col"><span class="vh">Acciones</span></th></tr></thead>
- <tbody>${objs.map((o, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-no="${o.no}" aria-label="Ir al paquete ${o.no}">${o.no}</button></td><td class="mono">${esc(o.host)}</td><td class="mono sm">${esc(o.type || '—')}</td><td class="n">${fmtNum(o.size)} B</td><td class="mono">${esc(o.name)}</td>
- <td><div class="row">${isText(o) ? `<button class="btn sm ghost" type="button" data-view="${i}" aria-label="Ver ${esc(o.name)}">${ic('eye', 'sm')}Ver</button>` : ''}<button class="btn sm ghost" type="button" data-save="${i}" aria-label="Guardar ${esc(o.name)}">${ic('download', 'sm')}Guardar</button></div></td></tr>`).join('')}</tbody></table></div>
+ body.innerHTML = objs.length ? `<p class="muted sm">${L('Los cuerpos HTTP reconstruidos de la captura: páginas, scripts, JSON, formularios y ficheros. Así se recupera lo que se descargó (o se robó) por HTTP sin cifrar.', 'HTTP bodies rebuilt from the capture: pages, scripts, JSON, forms and files. This is how you recover what was downloaded (or stolen) over plain HTTP.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('objects')}"><table class="tbl"><caption class="vh">${t('objects')}</caption><thead><tr><th scope="col" class="n">${L('Paquete', 'Packet')}</th><th scope="col">Host</th><th scope="col">${L('Tipo de contenido', 'Content type')}</th><th scope="col" class="n">${L('Tamaño', 'Size')}</th><th scope="col">${L('Nombre', 'Filename')}</th><th scope="col"><span class="vh">${L('Acciones', 'Actions')}</span></th></tr></thead>
+ <tbody>${objs.map((o, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-no="${o.no}" aria-label="${L('Ir al paquete', 'Go to packet')} ${o.no}">${o.no}</button></td><td class="mono">${esc(o.host)}</td><td class="mono sm">${esc(o.type || '—')}</td><td class="n">${fmtNum(o.size)} B</td><td class="mono">${esc(o.name)}</td>
+ <td><div class="row">${isText(o) ? `<button class="btn sm ghost" type="button" data-view="${i}" aria-label="${L('Ver', 'View')} ${esc(o.name)}">${ic('eye', 'sm')}${L('Ver', 'View')}</button>` : ''}<button class="btn sm ghost" type="button" data-save="${i}" aria-label="${L('Guardar', 'Save')} ${esc(o.name)}">${ic('download', 'sm')}${L('Guardar', 'Save')}</button></div></td></tr>`).join('')}</tbody></table></div>
<div class="ob-prev" hidden><p class="sm"><strong data-pn></strong></p><pre class="mono" tabindex="0"></pre></div>`
- : '<p class="muted">Esta captura no lleva objetos HTTP. Prueba con los módulos 2, 3 o 6.</p>';
+ : `<p class="muted">${L('Esta captura no lleva objetos HTTP. Prueba con los módulos 2, 3 o 6.', 'This capture carries no HTTP objects. Try modules 2, 3 or 6.')}</p>`;
openDialog({ title: `${ic('file')} ${t('objects')}`, body, wide: true });
$$('[data-no]', body).forEach(b => b.onclick = () => { closeDialog(); ws.select(+b.dataset.no, { focusList: true }); });
- $$('[data-save]', body).forEach(b => b.onclick = () => { const o = objs[+b.dataset.save]; download(o.data, o.name, 'application/octet-stream'); toast(`Guardado: <code>${esc(o.name)}</code>`, 'ok', 'download'); });
+ $$('[data-save]', body).forEach(b => b.onclick = () => { const o = objs[+b.dataset.save]; download(o.data, o.name, 'application/octet-stream'); toast(`${L('Guardado', 'Saved')}: <code>${esc(o.name)}</code>`, 'ok', 'download'); });
$$('[data-view]', body).forEach(b => b.onclick = () => {
const o = objs[+b.dataset.view], pv = $('.ob-prev', body);
- pv.hidden = false; $('[data-pn]', pv).textContent = `${o.name} · paquete ${o.no}`;
+ pv.hidden = false; $('[data-pn]', pv).textContent = `${o.name} · ${L('paquete', 'packet')} ${o.no}`;
$('pre', pv).textContent = new TextDecoder().decode(o.data); // texto, nunca HTML interpretado
$('pre', pv).focus();
});
@@ -144,11 +145,11 @@ function openObjects(ws) {
/* ---------- Herramientas › Credenciales ---------- */
function openCreds(ws) {
const cr = credentials(ws.pkts), body = document.createElement('div');
- body.innerHTML = cr.length ? `<p class="muted sm">Usuarios que viajan por protocolos que Wireshark sabe leer (HTTP Basic, FTP, NTLMSSP). Pulsa el paquete para ir al campo exacto del árbol.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('creds')}"><table class="tbl"><caption class="vh">${t('creds')}</caption><thead><tr><th scope="col" class="n">Paquete</th><th scope="col">Protocolo</th><th scope="col">Usuario</th><th scope="col">Información</th></tr></thead>
- <tbody>${cr.map((c, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-i="${i}" aria-label="Ir al paquete ${c.no}">${c.no}</button></td><td>${esc(c.proto)}</td><td class="mono">${esc(c.user)}</td><td class="sm">${esc(c.info)}</td></tr>`).join('')}</tbody></table></div>
- <p class="sm muted">Wireshark no muestra aquí los formularios POST: esos los buscas tú con <code>http.request.method == "POST"</code>.</p>`
- : '<p class="muted">No hay credenciales en esta captura. Las encontrarás en los módulos 3 (HTTP Basic y FTP) y 7 (NTLMSSP).</p>';
+ body.innerHTML = cr.length ? `<p class="muted sm">${L('Usuarios que viajan por protocolos que Wireshark sabe leer (HTTP Basic, FTP, NTLMSSP). Pulsa el paquete para ir al campo exacto del árbol.', 'Usernames carried by protocols Wireshark can read (HTTP Basic, FTP, NTLMSSP). Click the packet to jump to the exact field in the tree.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${t('creds')}"><table class="tbl"><caption class="vh">${t('creds')}</caption><thead><tr><th scope="col" class="n">${L('Paquete', 'Packet')}</th><th scope="col">${L('Protocolo', 'Protocol')}</th><th scope="col">${L('Usuario', 'Username')}</th><th scope="col">${L('Información', 'Info')}</th></tr></thead>
+ <tbody>${cr.map((c, i) => `<tr><td class="n"><button class="btn sm ghost mono" type="button" data-i="${i}" aria-label="${L('Ir al paquete', 'Go to packet')} ${c.no}">${c.no}</button></td><td>${esc(c.proto)}</td><td class="mono">${esc(c.user)}</td><td class="sm">${esc(c.info)}</td></tr>`).join('')}</tbody></table></div>
+ <p class="sm muted">${L('Wireshark no muestra aquí los formularios POST: esos los buscas tú con', 'Wireshark does not list POST forms here: find those yourself with')} <code>http.request.method == "POST"</code>.</p>`
+ : `<p class="muted">${L('No hay credenciales en esta captura. Las encontrarás en los módulos 3 (HTTP Basic y FTP) y 7 (NTLMSSP).', 'No credentials in this capture. You will find them in modules 3 (HTTP Basic and FTP) and 7 (NTLMSSP).')}</p>`;
openDialog({ title: `${ic('lock')} ${t('creds')}`, body, wide: true });
$$('[data-i]', body).forEach(b => b.onclick = () => { const c = cr[+b.dataset.i]; closeDialog(); ws.revealField(c.no, c.field); });
}
@@ -158,14 +159,14 @@ function openFind(ws, mode = 'find') {
const body = document.createElement('div');
body.innerHTML = `<div class="seg" role="tablist" aria-label="${t('findPkt')}"><button role="tab" id="fd-find" aria-selected="${mode === 'find'}" data-m="find">${ic('search', 'sm')}${t('findPkt')}</button><button role="tab" id="fd-goto" aria-selected="${mode === 'goto'}" data-m="goto">${ic('target', 'sm')}${t('gotoPkt')}</button></div>
<form class="fd" data-p="find" ${mode === 'find' ? '' : 'hidden'} aria-labelledby="fd-find">
- <div class="row wrap"><label class="sm" for="fd-k">Buscar por</label><select id="fd-k" class="sel"><option value="filter">Filtro de visualización</option><option value="str">Cadena en los bytes</option><option value="hex">Valor hexadecimal</option></select>
- <label class="row sm"><input type="checkbox" id="fd-c"> Distinguir mayúsculas</label></div>
- <label class="vh" for="fd-q">Qué buscar</label><input id="fd-q" class="tinput mono" type="text" autocomplete="off" spellcheck="false" placeholder="p. ej. http.cookie, password o 50 4b 03 04">
- <div class="row"><button class="btn primary sm" type="submit">${ic('search', 'sm')}Buscar siguiente</button><span class="sm" data-msg aria-live="polite"></span></div>
+ <div class="row wrap"><label class="sm" for="fd-k">${L('Buscar por', 'Search by')}</label><select id="fd-k" class="sel"><option value="filter">${L('Filtro de visualización', 'Display filter')}</option><option value="str">${L('Cadena en los bytes', 'String in bytes')}</option><option value="hex">${L('Valor hexadecimal', 'Hex value')}</option></select>
+ <label class="row sm"><input type="checkbox" id="fd-c"> ${L('Distinguir mayúsculas', 'Case sensitive')}</label></div>
+ <label class="vh" for="fd-q">${L('Qué buscar', 'What to find')}</label><input id="fd-q" class="tinput mono" type="text" autocomplete="off" spellcheck="false" placeholder="${L('p. ej. http.cookie, password o 50 4b 03 04', 'e.g. http.cookie, password or 50 4b 03 04')}">
+ <div class="row"><button class="btn primary sm" type="submit">${ic('search', 'sm')}${L('Buscar siguiente', 'Find next')}</button><span class="sm" data-msg aria-live="polite"></span></div>
</form>
<form class="fd" data-p="goto" ${mode === 'goto' ? '' : 'hidden'} aria-labelledby="fd-goto">
- <label class="sm" for="fd-n">Número de paquete (1 a ${fmtNum(ws.pkts.length)})</label><input id="fd-n" class="tinput mono" type="number" min="1" max="${ws.pkts.length}" inputmode="numeric">
- <div class="row"><button class="btn primary sm" type="submit">${ic('target', 'sm')}Ir</button><span class="sm" data-msg2 aria-live="polite"></span></div>
+ <label class="sm" for="fd-n">${L('Número de paquete', 'Packet number')} (1 ${L('a', 'to')} ${fmtNum(ws.pkts.length)})</label><input id="fd-n" class="tinput mono" type="number" min="1" max="${ws.pkts.length}" inputmode="numeric">
+ <div class="row"><button class="btn primary sm" type="submit">${ic('target', 'sm')}${L('Ir', 'Go')}</button><span class="sm" data-msg2 aria-live="polite"></span></div>
</form>`;
openDialog({ title: `${ic('search')} ${t('findPkt')}`, body, cls: 'narrow' });
const show = m => { $$('[role=tab]', body).forEach(b => b.setAttribute('aria-selected', String(b.dataset.m === m))); $$('form', body).forEach(f => { f.hidden = f.dataset.p !== m; }); $(m === 'find' ? '#fd-q' : '#fd-n', body).focus(); };
@@ -180,20 +181,20 @@ function openFind(ws, mode = 'find') {
$('[data-p=goto]', body).onsubmit = e => {
e.preventDefault();
const n = +$('#fd-n', body).value, m2 = $('[data-msg2]', body);
- if (!ws.byNo.has(n)) { m2.className = 'sm bad'; m2.textContent = `No existe el paquete ${n}.`; return; }
- if (!ws.view.some(p => p.no === n)) { m2.className = 'sm bad'; m2.textContent = `El paquete ${n} está oculto por el filtro actual. Bórralo para verlo.`; return; }
+ if (!ws.byNo.has(n)) { m2.className = 'sm bad'; m2.textContent = L(`No existe el paquete ${n}.`, `Packet ${n} does not exist.`); return; }
+ if (!ws.view.some(p => p.no === n)) { m2.className = 'sm bad'; m2.textContent = L(`El paquete ${n} está oculto por el filtro actual. Bórralo para verlo.`, `Packet ${n} is hidden by the current filter. Clear it to see it.`); return; }
closeDialog(); ws.select(n, { focusList: true });
};
}
/* Busca el siguiente paquete mostrado, tras el seleccionado y dando la vuelta, como Wireshark. */
function findPacket(ws, kind, q, cs) {
q = String(q || '');
- if (!q.trim()) return { ok: false, msg: 'Escribe qué buscar.' };
+ if (!q.trim()) return { ok: false, msg: L('Escribe qué buscar.', 'Type what to find.') };
let test;
- if (kind === 'filter') { const r = parseFilter(q); if (!r.ok) return { ok: false, msg: r.error || 'El filtro no es válido.' }; test = r.test; }
+ if (kind === 'filter') { const r = parseFilter(q); if (!r.ok) return { ok: false, msg: fErr(r.error) || L('El filtro no es válido.', 'The filter is not valid.') }; test = r.test; }
else if (kind === 'hex') {
const h = q.replace(/0x|[\s:.-]/gi, '');
- if (!/^([0-9a-f]{2})+$/i.test(h)) return { ok: false, msg: 'Escribe bytes en hexadecimal, por pares: 50 4b 03 04' };
+ if (!/^([0-9a-f]{2})+$/i.test(h)) return { ok: false, msg: L('Escribe bytes en hexadecimal, por pares: 50 4b 03 04', 'Type bytes in hex, in pairs: 50 4b 03 04') };
const nd = h.match(/../g).map(x => parseInt(x, 16));
test = p => { const b = p.b; outer: for (let i = 0; i + nd.length <= b.length; i++) { for (let j = 0; j < nd.length; j++) if (b[i + j] !== nd[j]) continue outer; return true; } return false; };
} else {
@@ -203,7 +204,7 @@ function findPacket(ws, kind, q, cs) {
const v = ws.view, start = Math.max(-1, v.findIndex(p => p.no === ws.sel));
for (let k = 1; k <= v.length; k++) {
const p = v[(start + k) % v.length];
- if (test(p)) { ws.select(p.no); return { ok: true, msg: `Encontrado en el paquete ${p.no}${(start + k) >= v.length && start >= 0 ? ' (se ha dado la vuelta)' : ''}.` }; }
+ if (test(p)) { ws.select(p.no); return { ok: true, msg: `${L('Encontrado en el paquete', 'Found in packet')} ${p.no}${(start + k) >= v.length && start >= 0 ? L(' (se ha dado la vuelta)', ' (wrapped around)') : ''}.` }; }
}
- return { ok: false, msg: 'No aparece en ningún paquete mostrado.' };
+ return { ok: false, msg: L('No aparece en ningún paquete mostrado.', 'Not found in any displayed packet.') };
}
diff --git a/src/app/45-ladder.js b/src/app/45-ladder.js
index 5e3af4e..4f23fdd 100644
--- a/src/app/45-ladder.js
+++ b/src/app/45-ladder.js
@@ -1,22 +1,22 @@
/* Megalodon · diagrama de escalera animado de un flujo TCP (módulo 1). Cada flecha es un paquete; al pulsarla se selecciona en Wireshark. */
function ladderSVG(pkts, stream, onPick) {
- const L = flowLadder(pkts, stream); if (!L) return document.createElement('div');
- const W = 560, ax = 150, bx = 470, top = 64, rh = 40, H = top + L.steps.length * rh + 16;
- const phase = s => s.flags.includes('SYN') ? 'hs' : s.flags.includes('FIN') || s.flags.includes('RST') || (s.len === 0 && L.steps.some(x => x.flags.includes('FIN') && x.no < s.no)) ? 'fin' : 'data';
- const names = { hs: 'Saludo', data: 'Datos', fin: 'Cierre' };
+ const LD = flowLadder(pkts, stream); if (!LD) return document.createElement('div');
+ const W = 560, ax = 150, bx = 470, top = 64, rh = 40, H = top + LD.steps.length * rh + 16;
+ const phase = s => s.flags.includes('SYN') ? 'hs' : s.flags.includes('FIN') || s.flags.includes('RST') || (s.len === 0 && LD.steps.some(x => x.flags.includes('FIN') && x.no < s.no)) ? 'fin' : 'data';
+ const names = LANG === 'en' ? { hs: 'Handshake', data: 'Data', fin: 'Teardown' } : { hs: 'Saludo', data: 'Datos', fin: 'Cierre' };
const groups = [];
- L.steps.forEach((s, i) => { const ph = phase(s); if (!groups.length || groups[groups.length - 1].ph !== ph) groups.push({ ph, a: i, b: i }); else groups[groups.length - 1].b = i; });
+ LD.steps.forEach((s, i) => { const ph = phase(s); if (!groups.length || groups[groups.length - 1].ph !== ph) groups.push({ ph, a: i, b: i }); else groups[groups.length - 1].b = i; });
const wrap = document.createElement('figure');
wrap.className = 'ladder';
- wrap.innerHTML = `<svg viewBox="0 0 ${W} ${H}" role="group" aria-label="Diagrama del flujo TCP ${stream}: ${L.steps.length} paquetes entre ${L.a}:${L.pa} y ${L.b}:${L.pb}">
- <text class="lh" x="${ax}" y="20" text-anchor="middle">Kali</text><text class="lh2" x="${ax}" y="38" text-anchor="middle">${L.a}:${L.pa}</text>
- <text class="lh" x="${bx}" y="20" text-anchor="middle">Servidor web</text><text class="lh2" x="${bx}" y="38" text-anchor="middle">${L.b}:${L.pb}</text>
+ wrap.innerHTML = `<svg viewBox="0 0 ${W} ${H}" role="group" aria-label="${L(`Diagrama del flujo TCP ${stream}: ${LD.steps.length} paquetes entre ${LD.a}:${LD.pa} y ${LD.b}:${LD.pb}`, `TCP stream ${stream} diagram: ${LD.steps.length} packets between ${LD.a}:${LD.pa} and ${LD.b}:${LD.pb}`)}">
+ <text class="lh" x="${ax}" y="20" text-anchor="middle">Kali</text><text class="lh2" x="${ax}" y="38" text-anchor="middle">${LD.a}:${LD.pa}</text>
+ <text class="lh" x="${bx}" y="20" text-anchor="middle">${L('Servidor web', 'Web server')}</text><text class="lh2" x="${bx}" y="38" text-anchor="middle">${LD.b}:${LD.pb}</text>
<line class="life" x1="${ax}" x2="${ax}" y1="48" y2="${H - 6}"/><line class="life" x1="${bx}" x2="${bx}" y1="48" y2="${H - 6}"/>
${groups.map(g => `<g class="ph ph-${g.ph}"><rect x="8" y="${top + g.a * rh - 12}" width="74" height="${(g.b - g.a + 1) * rh - 8}" rx="8"/><text x="45" y="${top + ((g.a + g.b) / 2) * rh + 8}" text-anchor="middle">${names[g.ph]}</text></g>`).join('')}
- ${L.steps.map((s, i) => {
+ ${LD.steps.map((s, i) => {
const y = top + i * rh, x1 = s.fromA ? ax : bx, x2 = s.fromA ? bx : ax, dir = s.fromA ? 1 : -1, mid = (ax + bx) / 2;
const lab = s.flags.join(', ') + (s.app ? ` · ${s.app}` : '');
- return `<g class="step ${s.flags.includes('RST') ? 'rst' : ''} ${s.app ? 'app' : ''}" data-no="${s.no}" data-i="${i}" tabindex="0" role="button" aria-label="Paquete ${s.no}: ${esc(lab)}, Seq ${s.seq}, Ack ${s.ack}, Len ${s.len}">
+ return `<g class="step ${s.flags.includes('RST') ? 'rst' : ''} ${s.app ? 'app' : ''}" data-no="${s.no}" data-i="${i}" tabindex="0" role="button" aria-label="${L('Paquete', 'Packet')} ${s.no}: ${esc(lab)}, Seq ${s.seq}, Ack ${s.ack}, Len ${s.len}">
<line class="ar" x1="${x1}" y1="${y}" x2="${x2 - dir * 7}" y2="${y + 12}" pathLength="1"/>
<path class="hd" d="M ${x2} ${y + 12.3} l ${-dir * 10} -7 l 0 9 z"/>
<text class="sl" x="${mid}" y="${y - 3}" text-anchor="middle">${esc(lab)}</text>
@@ -24,7 +24,7 @@ function ladderSVG(pkts, stream, onPick) {
</g>`;
}).join('')}
</svg>
- <figcaption class="row between"><span class="sm muted">Pulsa una flecha para abrir ese paquete en Wireshark.</span><button class="btn sm ghost" type="button" data-replay>${ic('reset', 'sm')}Repetir animación</button></figcaption>`;
+ <figcaption class="row between"><span class="sm muted">${L('Pulsa una flecha para abrir ese paquete en Wireshark.', 'Click an arrow to open that packet in Wireshark.')}</span><button class="btn sm ghost" type="button" data-replay>${ic('reset', 'sm')}${L('Repetir animación', 'Replay animation')}</button></figcaption>`;
const steps = $$('.step', wrap);
steps.forEach((g, i) => { g.style.setProperty('--d', `${i * 110}ms`); });
const play = () => { if (REDUCED.matches) return; wrap.classList.remove('play'); void wrap.offsetWidth; wrap.classList.add('play'); };
diff --git a/src/app/48-shark.js b/src/app/48-shark.js
index 92bbb7e..00792c1 100644
--- a/src/app/48-shark.js
+++ b/src/app/48-shark.js
@@ -309,12 +309,12 @@ const tD0 = u => ZC(u) + HT(u);
const ANCHORS = [
{ id: 'hoc', p: bodyPt(.03, 1.75), w: 0, t: ['Hocico', 'ampollas de Lorenzini'] },
{ id: 'ojo', p: bodyPt(.088, 1.03), w: 0, t: ['Ojo', 'tapetum lucidum'] },
- { id: 'die', p: lerp3(bodyPt(.1, phiM(.1)), center(.1), .1), w: 1, t: ['Dientes aserrados', '2 filas · reemplazo continuo'] },
- { id: 'bra', p: bodyPt(.215, 1.45), w: 0, t: ['Hendiduras branquiales', '5 por lado'] },
- { id: 'dor', p: [X(.445), tD0(.445) + .122, 0], w: 0, t: ['Primera dorsal', 'estabiliza el balanceo'] },
- { id: 'pec', p: add(inward(.258, 2.16, .86), [-.14, -.095, .15]), w: 0, t: ['Aleta pectoral', 'sustentación y giro'] },
- { id: 'qui', p: bodyPt(.875, Math.PI / 2), w: 0, t: ['Quilla del pedúnculo', 'reduce la resistencia'] },
- { id: 'cau', p: [X(1.105), .205, 0], w: 0, t: ['Caudal semilunar', 'nado carangiforme'] },
+ { id: 'die', p: lerp3(bodyPt(.1, phiM(.1)), center(.1), .1), w: 1, t: ['Dientes aserrados', '2 filas · reemplazo continuo'], te: ['Serrated teeth', '2 rows · constant replacement'] },
+ { id: 'bra', p: bodyPt(.215, 1.45), w: 0, t: ['Hendiduras branquiales', '5 por lado'], te: ['Gill slits', '5 per side'] },
+ { id: 'dor', p: [X(.445), tD0(.445) + .122, 0], w: 0, t: ['Primera dorsal', 'estabiliza el balanceo'], te: ['First dorsal', 'steadies the roll'] },
+ { id: 'pec', p: add(inward(.258, 2.16, .86), [-.14, -.095, .15]), w: 0, t: ['Aleta pectoral', 'sustentación y giro'], te: ['Pectoral fin', 'lift and turning'] },
+ { id: 'qui', p: bodyPt(.875, Math.PI / 2), w: 0, t: ['Quilla del pedúnculo', 'reduce la resistencia'], te: ['Caudal keel', 'cuts drag'] },
+ { id: 'cau', p: [X(1.105), .205, 0], w: 0, t: ['Caudal semilunar', 'nado carangiforme'], te: ['Lunate tail', 'carangiform swimming'] },
];
@@ -916,8 +916,8 @@ function callouts(s) {
const pl = document.createElementNS(NS_SVG, 'polyline'); pl.setAttribute('class', 'ld');
const rc = document.createElementNS(NS_SVG, 'rect'); rc.setAttribute('class', 'plate'); rc.setAttribute('rx', 6);
const dt = document.createElementNS(NS_SVG, 'circle'); dt.setAttribute('class', 'dot'); dt.setAttribute('r', 3);
- const t1 = document.createElementNS(NS_SVG, 'text'); t1.setAttribute('class', 'k'); t1.textContent = a.t[0];
- const t2 = document.createElementNS(NS_SVG, 'text'); t2.textContent = a.t[1];
+ const t1 = document.createElementNS(NS_SVG, 'text'); t1.setAttribute('class', 'k'); t1.textContent = (LANG === 'en' ? a.te : a.t)[0];
+ const t2 = document.createElementNS(NS_SVG, 'text'); t2.textContent = (LANG === 'en' ? a.te : a.t)[1];
g.append(pl, rc, dt, t1, t2); svg.append(g);
return { a, g, pl, rc, dt, t1, t2, w: 0 };
});
@@ -983,7 +983,7 @@ function ensureGL() {
cv = document.createElement('canvas');
cv.className = 'shark-cv';
cv.setAttribute('role', 'img');
- cv.setAttribute('aria-label', 'Un megalodón realista nada entre rayos de luz. Cada pocos segundos muerde: eleva el hocico, abre la boca en herradura y adelanta la mandíbula superior enseñando la encía y los dientes aserrados.');
+ cv.setAttribute('aria-label', LANG === 'en' ? 'A realistic megalodon swims through shafts of light. Every few seconds it bites: it lifts its snout, opens its horseshoe mouth and thrusts the upper jaw forward, showing the gum and the serrated teeth.' : 'Un megalodón realista nada entre rayos de luz. Cada pocos segundos muerde: eleva el hocico, abre la boca en herradura y adelanta la mandíbula superior enseñando la encía y los dientes aserrados.');
gl = cv.getContext('webgl2', { antialias: false, alpha: false, depth: false, stencil: false, powerPreference: 'high-performance', preserveDrawingBuffer: false });
if (!gl) return (glOk = false);
try {
@@ -1004,14 +1004,14 @@ function mount(slot) {
const hud = document.createElement('div');
hud.className = 'shark-hud';
hud.setAttribute('role', 'group');
- hud.setAttribute('aria-label', 'Megalodón 3D');
- hud.innerHTML = `<button type="button" class="btn ghost sm" data-shark-mode aria-pressed="false">${ic('layers', 'sm')}Plano técnico</button><button type="button" class="ibtn" data-shark-pause>${ic('pause')}</button>`;
+ hud.setAttribute('aria-label', LANG === 'en' ? '3D megalodon' : 'Megalodón 3D');
+ hud.innerHTML = `<button type="button" class="btn ghost sm" data-shark-mode aria-pressed="false">${ic('layers', 'sm')}${LANG === 'en' ? 'Blueprint' : 'Plano técnico'}</button><button type="button" class="ibtn" data-shark-pause>${ic('pause')}</button>`;
host.append(hud);
const modeBtn = hud.querySelector('[data-shark-mode]'), pauseBtn = hud.querySelector('[data-shark-pause]');
const sync = () => {
const still = isStill();
pauseBtn.innerHTML = ic(still ? 'play' : 'pause');
- pauseBtn.setAttribute('aria-label', still ? 'Reanudar la animación del megalodón' : 'Pausar la animación del megalodón');
+ pauseBtn.setAttribute('aria-label', LANG === 'en' ? (still ? 'Resume the megalodon animation' : 'Pause the megalodon animation') : (still ? 'Reanudar la animación del megalodón' : 'Pausar la animación del megalodón'));
modeBtn.setAttribute('aria-pressed', String(st.blueTo > .5));
};
modeBtn.onclick = () => { st.blueTo = st.blueTo > .5 ? 0 : 1; sync(); if (!running) settle(); };
diff --git a/src/app/50-views.js b/src/app/50-views.js
index b20c500..dd8216e 100644
--- a/src/app/50-views.js
+++ b/src/app/50-views.js
@@ -3,7 +3,7 @@ let CUR_WS = null;
const CAP_CACHE = {};
const capPkts = k => CAP_CACHE[k] || (CAP_CACHE[k] = dissectAll(SCENARIOS[k]()).pkts);
const capName = k => `${SCENARIO_FILES[k] || k}.pcapng`;
-const TASK_TYPES = { filter: ['Filtro', 'filter'], packet: ['Paquete', 'target'], text: ['Respuesta', 'terminal'], choice: ['Test', 'list'] };
+const TASK_TYPES = { filter: [['Filtro', 'Filter'], 'filter'], packet: [['Paquete', 'Packet'], 'target'], text: [['Respuesta', 'Answer'], 'terminal'], choice: [['Test', 'Quiz'], 'list'] };
const norm = s => String(s).normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase().replace(/\s+/g, ' ').trim();
const plain = s => String(s).replace(/[`*]/g, '');
const isNarrow = () => matchMedia('(max-width: 1023px)').matches;
@@ -16,35 +16,35 @@ function viewHome(main) {
main.innerHTML = `
<section class="hero" aria-labelledby="hero-t">
<div class="hero-art" id="hero-slot">
- <picture><source type="image/avif" srcset="${HERO_IMG.avif}"><img class="hero-img" src="${HERO_IMG.webp}" width="${HERO_IMG.w}" height="${HERO_IMG.h}" alt="Megalodón dibujado como un plano técnico azul" decoding="async" fetchpriority="high"></picture>
+ <picture><source type="image/avif" srcset="${HERO_IMG.avif}"><img class="hero-img" src="${HERO_IMG.webp}" width="${HERO_IMG.w}" height="${HERO_IMG.h}" alt="${L('Megalodón dibujado como un plano técnico azul', 'Megalodon drawn as a blue technical blueprint')}" decoding="async" fetchpriority="high"></picture>
</div>
<div class="hero-copy">
- <p class="eyebrow">Laboratorio de Wireshark · eWPT</p>
+ <p class="eyebrow">${L('Laboratorio de Wireshark', 'Wireshark lab')} · eWPT</p>
<h1 id="hero-t">Megalodon</h1>
- <p class="lead">Aprende a leer la red como un pentester: capturas de un ataque real en miniatura, filtros que se validan mientras escribes y retos guiados desde el saludo TCP hasta la inyección SQL.</p>
+ <p class="lead">${L('Aprende a leer la red como un pentester: capturas de un ataque real en miniatura, filtros que se validan mientras escribes y retos guiados desde el saludo TCP hasta la inyección SQL.', 'Learn to read the network like a pentester: miniature captures of a real attack, filters validated as you type and guided challenges from the TCP handshake to SQL injection.')}</p>
<div class="row cta">
- <a class="btn primary lg" href="#/m/${next.id}">${ic('play')}${started ? `${t('continue')}: módulo ${next.n}` : 'Empezar por el módulo 1'}</a>
- <a class="btn ghost lg" href="#/lab">${ic('flask')}Laboratorio libre</a>
+ <a class="btn primary lg" href="#/m/${next.id}">${ic('play')}${started ? `${t('continue')}: ${L('módulo', 'module')} ${next.n}` : L('Empezar por el módulo 1', 'Start with module 1')}</a>
+ <a class="btn ghost lg" href="#/lab">${ic('flask')}${L('Laboratorio libre', 'Free lab')}</a>
</div>
</div>
</section>
<section class="wrap stats3" aria-label="${t('progress')}">
- <div class="stat card"><span class="stat-ic ok">${ic('trophy')}</span><div><p class="stat-v"><span class="num">${xp}</span> XP</p><p class="stat-l">${t('level')}: <strong>${lv.name}</strong>${lv.next ? ` · ${lv.next - xp} XP para el siguiente` : ''}</p>${lv.next ? `<div class="meter" role="progressbar" aria-label="Progreso de nivel" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(100 * (xp - lv.min) / (lv.next - lv.min))}"><i data-w="${100 * (xp - lv.min) / (lv.next - lv.min)}"></i></div>` : ''}</div></div>
- <div class="stat card"><span class="stat-ic">${ic('target')}</span><div><p class="stat-v"><span class="num">${solved}</span> / ${total}</p><p class="stat-l">retos resueltos</p></div></div>
- <div class="stat card"><span class="stat-ic">${ic('award')}</span><div><p class="stat-v"><span class="num">${badges}</span> / ${MODULES.length}</p><p class="stat-l">insignias</p></div></div>
+ <div class="stat card"><span class="stat-ic ok">${ic('trophy')}</span><div><p class="stat-v"><span class="num">${xp}</span> XP</p><p class="stat-l">${t('level')}: <strong>${lvName(lv)}</strong>${lv.next ? ` · ${lv.next - xp} XP ${L('para el siguiente', 'to the next one')}` : ''}</p>${lv.next ? `<div class="meter" role="progressbar" aria-label="${t('levelProg')}" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${Math.round(100 * (xp - lv.min) / (lv.next - lv.min))}"><i data-w="${100 * (xp - lv.min) / (lv.next - lv.min)}"></i></div>` : ''}</div></div>
+ <div class="stat card"><span class="stat-ic">${ic('target')}</span><div><p class="stat-v"><span class="num">${solved}</span> / ${total}</p><p class="stat-l">${L('retos resueltos', 'challenges solved')}</p></div></div>
+ <div class="stat card"><span class="stat-ic">${ic('award')}</span><div><p class="stat-v"><span class="num">${badges}</span> / ${MODULES.length}</p><p class="stat-l">${L('insignias', 'badges')}</p></div></div>
</section>
<section class="wrap" aria-labelledby="mods-t">
- <div class="sec-h"><h2 id="mods-t">Módulos</h2><p class="muted">Del primer SYN a los ataques web. Cada módulo trae su captura, una lección corta y retos con pistas.</p></div>
+ <div class="sec-h"><h2 id="mods-t">${t('modules')}</h2><p class="muted">${L('Del primer SYN a los ataques web. Cada módulo trae su captura, una lección corta y retos con pistas.', 'From the first SYN to web attacks. Every module brings its own capture, a short lesson and challenges with hints.')}</p></div>
<div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
- <div class="sec-h sub"><h3>${t('extra')}: SOC, DFIR y Directorio Activo</h3><p class="muted">Para cuando termines los seis primeros.</p></div>
+ <div class="sec-h sub"><h3>${t('extra')}: ${L('SOC, DFIR y Directorio Activo', 'SOC, DFIR and Active Directory')}</h3><p class="muted">${L('Para cuando termines los seis primeros.', 'For when you finish the first six.')}</p></div>
<div class="mgrid">${MODULES.filter(m => m.extra).map(modCard).join('')}</div>
</section>
<section class="wrap how" aria-labelledby="how-t">
- <h2 id="how-t">Cómo funciona</h2>
+ <h2 id="how-t">${L('Cómo funciona', 'How it works')}</h2>
<ol class="steps3">
- <li class="card"><span class="stepn">1</span><h3>Lee y prueba</h3><p>Cada lección es corta y trae botones «Pruébalo» que aplican el filtro en la captura.</p></li>
- <li class="card"><span class="stepn">2</span><h3>Resuelve</h3><p>Escribe filtros, selecciona paquetes o responde. Se comprueba contra la captura al instante.</p></li>
- <li class="card"><span class="stepn">3</span><h3>Llévatelo</h3><p>Exporta cada captura en .pcapng y repite el reto en tu Wireshark de verdad.</p></li>
+ <li class="card"><span class="stepn">1</span><h3>${L('Lee y prueba', 'Read and try')}</h3><p>${L('Cada lección es corta y trae botones «Pruébalo» que aplican el filtro en la captura.', 'Each lesson is short and has “Try it” buttons that apply the filter to the capture.')}</p></li>
+ <li class="card"><span class="stepn">2</span><h3>${L('Resuelve', 'Solve')}</h3><p>${L('Escribe filtros, selecciona paquetes o responde. Se comprueba contra la captura al instante.', 'Write filters, pick packets or answer. It is checked against the capture instantly.')}</p></li>
+ <li class="card"><span class="stepn">3</span><h3>${L('Llévatelo', 'Take it with you')}</h3><p>${L('Exporta cada captura en .pcapng y repite el reto en tu Wireshark de verdad.', 'Export each capture as .pcapng and repeat the challenge in your real Wireshark.')}</p></li>
</ol>
</section>
${siteFooter()}`;
@@ -55,17 +55,17 @@ function viewHome(main) {
function modCard(m) {
const p = modProgress(m), earned = S.get().badges[m.id];
return `<a class="mcard card" href="#/m/${m.id}">
- <div class="row between"><span class="mic">${ic(m.icon)}</span>${earned ? `<span class="pill ok">${ic('award', 'sm')}${esc(m.badge)}</span>` : `<span class="pill">${m.mins} ${t('minutes')}</span>`}</div>
- <p class="eyebrow">Módulo ${m.n}</p><h3>${esc(m.title)}</h3><p class="muted sm">${esc(m.sub)}</p>
- <div class="mfoot"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="Retos de ${esc(m.title)}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm ${p.done === p.total ? 'okt' : 'muted'}">${p.done}/${p.total}</span></div>
+ <div class="row between"><span class="mic">${ic(m.icon)}</span>${earned ? `<span class="pill ok">${ic('award', 'sm')}${esc(mT(m, 'badge'))}</span>` : `<span class="pill">${m.mins} ${t('minutes')}</span>`}</div>
+ <p class="eyebrow">${L('Módulo', 'Module')} ${m.n}</p><h3>${esc(mT(m, 'title'))}</h3><p class="muted sm">${esc(mT(m, 'sub'))}</p>
+ <div class="mfoot"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="${L('Retos de', 'Challenges in')} ${esc(mT(m, 'title'))}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm ${p.done === p.total ? 'okt' : 'muted'}">${p.done}/${p.total}</span></div>
</a>`;
}
function siteFooter() {
- return `<footer class="foot wrap"><p>Megalodon · laboratorio de Wireshark sin conexión. Contenido basado en la <a href="https://www.wireshark.org/docs/" target="_blank" rel="noopener noreferrer">documentación pública de Wireshark</a>; las capturas son sintéticas y los dominios, de prueba.</p><p>Yoandy Ramírez Delgado · Huelva, España</p></footer>`;
+ return `<footer class="foot wrap"><p>${L('Megalodon · laboratorio de Wireshark sin conexión. Contenido basado en la', 'Megalodon · offline Wireshark lab. Content based on the')} <a href="https://www.wireshark.org/docs/" target="_blank" rel="noopener noreferrer">${L('documentación pública de Wireshark', 'public Wireshark documentation')}</a>${L('; las capturas son sintéticas y los dominios, de prueba.', '; captures are synthetic and domains are test domains.')}</p><p>Yoandy Ramírez Delgado · Huelva, ${L('España', 'Spain')}</p></footer>`;
}
function viewModules(main) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('modules')}</p><h1>Ruta de aprendizaje</h1><p class="muted">Seis módulos principales para el eWPT y dos extra de SOC y Directorio Activo.</p></div>
- <h2 class="vh">Módulos principales</h2><div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('modules')}</p><h1>${L('Ruta de aprendizaje', 'Learning path')}</h1><p class="muted">${L('Seis módulos principales para el eWPT y dos extra de SOC y Directorio Activo.', 'Six core modules for the eWPT and two extra ones on SOC and Active Directory.')}</p></div>
+ <h2 class="vh">${L('Módulos principales', 'Core modules')}</h2><div class="mgrid">${MODULES.filter(m => !m.extra).map(modCard).join('')}</div>
<div class="sec-h sub"><h2>${t('extra')}</h2></div><div class="mgrid">${MODULES.filter(m => m.extra).map(modCard).join('')}</div></div>${siteFooter()}`;
}
@@ -78,12 +78,12 @@ function viewModule(main, { id, q }) {
main.innerHTML = `<div class="mod">
<header class="mod-h wrap-wide">
<a class="back sm" href="#/modulos">${ic('chevL', 'sm')}${t('modules')}</a>
- <div class="mod-title"><span class="mic lg">${ic(m.icon)}</span><div><p class="eyebrow">Módulo ${m.n}${m.extra ? ` · ${t('extra')}` : ''} · ${m.mins} ${t('minutes')}</p><h1>${esc(m.title)}</h1></div></div>
- <div class="mod-prog"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="Retos resueltos" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm" data-prog>${p.done}/${p.total} ${t('tasks').toLowerCase()}</span><span class="pill ${S.get().badges[m.id] ? 'ok' : ''}" data-badge>${ic('award', 'sm')}${esc(m.badge)}</span></div>
+ <div class="mod-title"><span class="mic lg">${ic(m.icon)}</span><div><p class="eyebrow">${L('Módulo', 'Module')} ${m.n}${m.extra ? ` · ${t('extra')}` : ''} · ${m.mins} ${t('minutes')}</p><h1>${esc(mT(m, 'title'))}</h1></div></div>
+ <div class="mod-prog"><div class="meter ${p.done === p.total ? 'full' : ''}" role="progressbar" aria-label="${L('Retos resueltos', 'Challenges solved')}" aria-valuemin="0" aria-valuemax="${p.total}" aria-valuenow="${p.done}"><i></i></div><span class="sm" data-prog>${p.done}/${p.total} ${t('tasks').toLowerCase()}</span><span class="pill ${S.get().badges[m.id] ? 'ok' : ''}" data-badge>${ic('award', 'sm')}${esc(mT(m, 'badge'))}</span></div>
</header>
<div class="mod-grid wrap-wide">
<div class="mod-side">
- <div class="seg" role="tablist" aria-label="Secciones del módulo">
+ <div class="seg" role="tablist" aria-label="${L('Secciones del módulo', 'Module sections')}">
<button role="tab" id="tab-lesson" aria-controls="pan-lesson" data-tab="lesson">${ic('book', 'sm')}${t('lesson')}</button>
<button role="tab" id="tab-tasks" aria-controls="pan-tasks" data-tab="tasks">${ic('target', 'sm')}${t('tasks')} <span class="num" data-tc>${p.done}/${p.total}</span></button>
<button role="tab" id="tab-ws" aria-controls="pan-ws" data-tab="ws" class="only-narrow">${ic('rows', 'sm')}${t('wireshark')}</button>
@@ -92,11 +92,11 @@ function viewModule(main, { id, q }) {
${t('lessonsInSpanish') ? `<p class="note sm">${ic('lang', 'sm')}${t('lessonsInSpanish')}</p>` : ''}
<p class="intro">${md(m.intro)}</p>
${m.lessons.map((l, i) => `<section class="lcard card" id="l-${i}" aria-labelledby="lh-${i}"><h2 id="lh-${i}"><span class="ln">${i + 1}</span>${esc(l.h)}</h2>${l.p.map(x => `<p>${md(x)}</p>`).join('')}${l.ladder !== undefined ? `<div class="ladder-slot" data-stream="${l.ladder}"></div>` : ''}${l.try ? `<div class="tries"><p class="tries-h">${ic('play', 'sm')}${t('tryIt')}</p>${l.try.map(([f, d]) => `<button class="try" type="button" data-f="${esc(f)}"><code>${esc(f)}</code><span>${esc(d)}</span></button>`).join('')}</div>` : ''}</section>`).join('')}
- <button class="btn primary" data-go-tasks type="button">${ic('target')}Ir a los retos</button>
+ <button class="btn primary" data-go-tasks type="button">${ic('target')}${L('Ir a los retos', 'Go to the challenges')}</button>
</div>
<div id="pan-tasks" role="tabpanel" aria-labelledby="tab-tasks" class="pan tasks" tabindex="-1">
${m.tasks.map((x, i) => taskCard(x, i)).join('')}
- <div class="mod-end card ${p.done === p.total ? '' : 'hide'}" data-end>${ic('award')}<div><h2>${t('moduleDone')}</h2><p>${t('badgeEarned')} <strong class="okt">${esc(m.badge)}</strong>.</p></div>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}">${t('next')}${ic('arrowR')}</a>` : ''}</div>
+ <div class="mod-end card ${p.done === p.total ? '' : 'hide'}" data-end>${ic('award')}<div><h2>${t('moduleDone')}</h2><p>${t('badgeEarned')} <strong class="okt">${esc(mT(m, 'badge'))}</strong>.</p></div>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}">${t('next')}${ic('arrowR')}</a>` : ''}</div>
</div>
</div>
<div class="mod-ws" id="pan-ws" role="tabpanel" aria-labelledby="tab-ws"></div>
@@ -132,8 +132,8 @@ function viewModule(main, { id, q }) {
if (q.get('t')) { const el = $(`#task-${q.get('t')}`, main); if (el) setTimeout(() => el.scrollIntoView({ block: 'center' }), 30); }
/* retos */
- refreshFilterPreview = () => $$('[data-curf]', main).forEach(el => { el.innerHTML = ws.filterText ? `<code>${esc(ws.filterText)}</code> · ${ws.view.length} paquetes` : `<span class="muted">${t('none')}</span>`; });
- refreshSelPreview = () => { const p = ws.selected(); $$('[data-cursel]', main).forEach(el => { el.innerHTML = p ? `<strong>n.º ${p.no}</strong> · <span class="mono">${esc(p.info.slice(0, 64))}</span>` : `<span class="muted">${t('none')}</span>`; }); };
+ refreshFilterPreview = () => $$('[data-curf]', main).forEach(el => { el.innerHTML = ws.filterText ? `<code>${esc(ws.filterText)}</code> · ${ws.view.length} ${L('paquetes', 'packets')}` : `<span class="muted">${t('none')}</span>`; });
+ refreshSelPreview = () => { const p = ws.selected(); $$('[data-cursel]', main).forEach(el => { el.innerHTML = p ? `<strong>${L('n.º', 'No.')} ${p.no}</strong> · <span class="mono">${esc(p.info.slice(0, 64))}</span>` : `<span class="muted">${t('none')}</span>`; }); };
refreshFilterPreview(); refreshSelPreview();
const fb = (card, kind, html) => { const el = $('.task-fb', card); el.className = `task-fb ${kind}`; el.innerHTML = html; if (kind === 'bad') { card.classList.remove('nope'); void card.offsetWidth; card.classList.add('nope'); } };
const succeed = (task, card) => {
@@ -162,36 +162,36 @@ function viewModule(main, { id, q }) {
hintBtn.onclick = () => { S.useHint(task.id); renderHints(); const last = $$('.hint', card).pop(); if (last) last.classList.add('new'); };
renderHints();
if (task.type === 'filter') $('[data-check]', card).onclick = () => {
- if (!ws.filterText) return fb(card, 'bad', `${ic('info')}<span>Escribe un filtro en la barra de Wireshark y pulsa ${t('apply')} (o Enter).</span>`);
+ if (!ws.filterText) return fb(card, 'bad', `${ic('info')}<span>${L('Escribe un filtro en la barra de Wireshark y pulsa', 'Type a filter in the Wireshark bar and press')} ${t('apply')} ${L('(o Enter).', '(or Enter).')}</span>`);
const mine = new Set(ws.view.map(p => p.no)), ref = new Set(applyFilter(ws.pkts, task.ref).map(p => p.no));
const allow = task.mode === 'covers' ? new Set(applyFilter(ws.pkts, task.allow).map(p => p.no)) : ref;
const missing = [...ref].filter(n => !mine.has(n)), extra = [...mine].filter(n => !allow.has(n));
if (!missing.length && !extra.length) return succeed(task, card);
- const parts = [`Tu filtro muestra <strong>${mine.size}</strong> paquetes${task.mode === 'covers' ? '' : `; la solución, <strong>${ref.size}</strong>`}.`];
- if (missing.length) parts.push(`Te faltan ${missing.length}.`);
- if (extra.length) parts.push(`Te sobran ${extra.length} (por ejemplo, el n.º ${extra[0]}).`);
+ const parts = [L(`Tu filtro muestra <strong>${mine.size}</strong> paquetes${task.mode === 'covers' ? '' : `; la solución, <strong>${ref.size}</strong>`}.`, `Your filter shows <strong>${mine.size}</strong> packets${task.mode === 'covers' ? '' : `; the solution, <strong>${ref.size}</strong>`}.`)];
+ if (missing.length) parts.push(L(`Te faltan ${missing.length}.`, `${missing.length} missing.`));
+ if (extra.length) parts.push(L(`Te sobran ${extra.length} (por ejemplo, el n.º ${extra[0]}).`, `${extra.length} too many (for example, No. ${extra[0]}).`));
fb(card, 'bad', `${ic('ko')}<span>${parts.join(' ')}</span>`);
};
if (task.type === 'packet') $('[data-check]', card).onclick = () => {
const p = ws.selected();
- if (!p) return fb(card, 'bad', `${ic('info')}<span>Selecciona un paquete en la lista.</span>`);
+ if (!p) return fb(card, 'bad', `${ic('info')}<span>${L('Selecciona un paquete en la lista.', 'Select a packet in the list.')}</span>`);
const r = parseFilter(task.match);
- if (r.test(p)) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>El n.º ${p.no} no es el que buscamos. Fíjate en la columna Info.</span>`);
+ if (r.test(p)) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${L(`El n.º ${p.no} no es el que buscamos. Fíjate en la columna Info.`, `No. ${p.no} is not the one we are after. Look at the Info column.`)}</span>`);
};
if (task.type === 'text') {
const inp = $('input', card);
const check = () => {
const v = inp.value.trim();
- if (!v) return fb(card, 'bad', `${ic('info')}<span>Escribe tu respuesta.</span>`);
+ if (!v) return fb(card, 'bad', `${ic('info')}<span>${L('Escribe tu respuesta.', 'Type your answer.')}</span>`);
const ok = task.ans.some(a => task.list ? v.split(/[\s,;]+/).filter(Boolean).map(Number).sort((x, y) => x - y).join(',') === a : task.exact ? v === a : norm(v) === norm(a));
- if (ok) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${task.exact && task.ans.some(a => norm(a) === norm(v)) ? 'Casi: revisa mayúsculas y símbolos, las contraseñas se copian exactas.' : 'No es eso. Vuelve a mirar la captura o pide una pista.'}</span>`);
+ if (ok) succeed(task, card); else fb(card, 'bad', `${ic('ko')}<span>${task.exact && task.ans.some(a => norm(a) === norm(v)) ? L('Casi: revisa mayúsculas y símbolos, las contraseñas se copian exactas.', 'Almost: check case and symbols, passwords are copied exactly.') : L('No es eso. Vuelve a mirar la captura o pide una pista.', 'Not quite. Look at the capture again or ask for a hint.')}</span>`);
};
$('[data-check]', card).onclick = check;
inp.addEventListener('keydown', e => { if (e.key === 'Enter') { e.preventDefault(); check(); } });
}
if (task.type === 'choice') $$('[data-opt]', card).forEach(b => b.onclick = () => {
if (+b.dataset.opt === task.ans) { b.classList.add('right'); b.setAttribute('aria-checked', 'true'); succeed(task, card); }
- else { b.classList.add('wrong'); b.disabled = true; fb(card, 'bad', `${ic('ko')}<span>No es esa. Descártala y prueba otra.</span>`); }
+ else { b.classList.add('wrong'); b.disabled = true; fb(card, 'bad', `${ic('ko')}<span>${L('No es esa. Descártala y prueba otra.', 'Not that one. Rule it out and try another.')}</span>`); }
});
if (S.isDone(task.id)) { $$('input, .task-act button', card).forEach(el => { el.disabled = true; }); if (task.type === 'choice') { const r = $(`[data-opt="${task.ans}"]`, card); r.classList.add('right'); r.setAttribute('aria-checked', 'true'); } }
});
@@ -207,8 +207,8 @@ function taskCard(x, i) {
: `<div class="opts" role="radiogroup" aria-labelledby="q-${x.id}">${x.opts.map((o, j) => `<button class="opt" type="button" role="radio" aria-checked="false" data-opt="${j}"><span class="ob" aria-hidden="true"></span>${esc(o)}</button>`).join('')}</div>`;
const xp = done ? S.get().done[x.id].xp : XP_BY_HINTS[Math.min(3, S.hintsUsed(x.id))];
return `<article class="task card" id="task-${x.id}" data-id="${x.id}" data-state="${done ? 'done' : 'todo'}" aria-labelledby="q-${x.id}">
- <div class="task-h"><span class="tnum" aria-hidden="true"><span class="tn-n">${i + 1}</span><span class="tn-ok">${ic('check', 'sm')}</span></span><span class="ttype">${ic(ti, 'sm')}${tl}</span><span class="txp">${done ? `${ic('check', 'sm')}+${xp} XP` : `+${xp} XP`}</span></div>
- <p class="tq" id="q-${x.id}"><span class="vh">Reto ${i + 1}${done ? ', resuelto' : ''}: </span>${md(x.q)}</p>
+ <div class="task-h"><span class="tnum" aria-hidden="true"><span class="tn-n">${i + 1}</span><span class="tn-ok">${ic('check', 'sm')}</span></span><span class="ttype">${ic(ti, 'sm')}${L(...tl)}</span><span class="txp">${done ? `${ic('check', 'sm')}+${xp} XP` : `+${xp} XP`}</span></div>
+ <p class="tq" id="q-${x.id}"><span class="vh">${L('Reto', 'Challenge')} ${i + 1}${done ? L(', resuelto', ', solved') : ''}: </span>${md(x.q)}</p>
<div class="task-act">${act}</div>
<div class="task-fb ${done ? 'ok' : ''}" aria-live="polite">${done ? `${ic('ok')}<span>${md(x.ok)}</span>` : ''}</div>
<div class="task-hints"></div>
@@ -216,7 +216,7 @@ function taskCard(x, i) {
</article>`;
}
function celebrate(m, nextM) {
- const d = openDialog({ title: t('moduleDone'), cls: 'narrow celebrate', body: `<div class="badge-big" aria-hidden="true">${ic('award')}</div><p class="center">${t('badgeEarned')}</p><p class="center badge-name">${esc(m.badge)}</p><p class="center muted sm">+${BONUS_MODULE} XP de bonus · ${S.xp()} XP en total · ${t('level')}: ${S.level().name}</p>`,
+ const d = openDialog({ title: t('moduleDone'), cls: 'narrow celebrate', body: `<div class="badge-big" aria-hidden="true">${ic('award')}</div><p class="center">${t('badgeEarned')}</p><p class="center badge-name">${esc(mT(m, 'badge'))}</p><p class="center muted sm">+${BONUS_MODULE} XP ${L('de bonus', 'bonus')} · ${S.xp()} XP ${L('en total', 'in total')} · ${t('level')}: ${lvName(S.level())}</p>`,
footer: `<button class="btn ghost" data-close>${t('close')}</button>${nextM ? `<a class="btn primary" href="#/m/${nextM.id}" data-next>${t('next')}${ic('arrowR')}</a>` : ''}` });
$('[data-close]', d).onclick = () => closeDialog();
const n = $('[data-next]', d); if (n) n.onclick = () => closeDialog(true);
@@ -228,13 +228,13 @@ function viewLab(main, { q }) {
const f = q.get('f') || '';
if (f && !q.get('cap')) { const r = parseFilter(f); if (r.ok) cap = Object.keys(SCENARIOS).find(k => capPkts(k).some(r.test)) || cap; }
main.innerHTML = `<div class="lab">
- <div class="lab-h wrap-wide"><div><p class="eyebrow">${t('lab')}</p><h1>Laboratorio libre</h1></div>
- <div class="row"><label class="sm" for="lab-cap">${t('captures')}</label><select id="lab-cap" class="sel">${MODULES.map(m => `<option value="${m.cap}" ${m.cap === cap ? 'selected' : ''}>${m.n}. ${esc(m.title)} (${capName(m.cap)})</option>`).join('')}<option value="__own" hidden>Tu captura</option></select></div>
+ <div class="lab-h wrap-wide"><div><p class="eyebrow">${t('lab')}</p><h1>${L('Laboratorio libre', 'Free lab')}</h1></div>
+ <div class="row"><label class="sm" for="lab-cap">${t('captures')}</label><select id="lab-cap" class="sel">${MODULES.map(m => `<option value="${m.cap}" ${m.cap === cap ? 'selected' : ''}>${m.n}. ${esc(mT(m, 'title'))} (${capName(m.cap)})</option>`).join('')}<option value="__own" hidden>${L('Tu captura', 'Your capture')}</option></select></div>
</div>
<div class="lab-ws wrap-wide"></div>
</div>`;
const sel = $('#lab-cap', main);
- const ws = new Workspace($('.lab-ws', main), { raw: SCENARIOS[cap](), name: capName(cap), filter: f, allowImport: true, onImport: name => { const o = sel.querySelector('[value=__own]'); o.hidden = false; o.textContent = `Tu captura: ${name}`; sel.value = '__own'; } });
+ const ws = new Workspace($('.lab-ws', main), { raw: SCENARIOS[cap](), name: capName(cap), filter: f, allowImport: true, onImport: name => { const o = sel.querySelector('[value=__own]'); o.hidden = false; o.textContent = `${L('Tu captura', 'Your capture')}: ${name}`; sel.value = '__own'; } });
CUR_WS = ws;
sel.onchange = () => { if (sel.value !== '__own') { ws.load(SCENARIOS[sel.value](), capName(sel.value)); history.replaceState(null, '', `#/lab?cap=${sel.value}`); } };
return () => { ws.destroy(); CUR_WS = null; };
@@ -242,25 +242,25 @@ function viewLab(main, { q }) {
/* ---------- Chuleta ---------- */
function viewCheat(main) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('cheat')}</p><h1>Chuleta de filtros</h1><p class="muted">Los filtros de visualización que más vas a usar. Cópialos o pruébalos directamente en el laboratorio.</p></div>
- <div class="cgrid">${CHEATS.map(g => `<section class="card cs" aria-labelledby="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}"><h2 id="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}">${esc(g.h)}</h2><ul>${g.items.map(([f, d]) => {
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('cheat')}</p><h1>${L('Chuleta de filtros', 'Filter cheat sheet')}</h1><p class="muted">${L('Los filtros de visualización que más vas a usar. Cópialos o pruébalos directamente en el laboratorio.', 'The display filters you will use most. Copy them or try them straight in the lab.')}${LANG === 'en' ? ' Descriptions are in Spanish.' : ''}</p></div>
+ <div class="cgrid">${CHEATS.map(g => `<section class="card cs" aria-labelledby="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}"><h2 id="cs-${esc(norm(g.h).replace(/\W+/g, '-'))}">${esc(mT(g, 'h'))}</h2><ul>${g.items.map(([f, d]) => {
const real = !/\s{3}| vs /.test(f);
- return `<li><div class="cs-f"><code>${esc(f)}</code><p>${esc(d)}</p></div><div class="cs-a">${real ? `<button class="ibtn sm" type="button" data-copy="${esc(f)}" aria-label="${t('copy')}: ${esc(f)}">${ic('copy')}</button><a class="ibtn sm" href="#/lab?f=${encodeURIComponent(f)}" aria-label="Probar en el laboratorio: ${esc(f)}">${ic('play')}</a>` : ''}</div></li>`;
+ return `<li><div class="cs-f"><code>${esc(f)}</code><p>${esc(d)}</p></div><div class="cs-a">${real ? `<button class="ibtn sm" type="button" data-copy="${esc(f)}" aria-label="${t('copy')}: ${esc(f)}">${ic('copy')}</button><a class="ibtn sm" href="#/lab?f=${encodeURIComponent(f)}" aria-label="${L('Probar en el laboratorio', 'Try in the lab')}: ${esc(f)}">${ic('play')}</a>` : ''}</div></li>`;
}).join('')}</ul></section>`).join('')}</div>
- <section class="card cs fields"><h2>Todos los campos del laboratorio</h2><p class="muted sm">Escribe cualquiera en la barra de filtros: el autocompletado los conoce todos.</p>
- <div class="tbl-wrap" tabindex="0" role="region" aria-label="Campos de filtro"><table class="tbl"><caption class="vh">Campos de filtro</caption><thead><tr><th scope="col">Campo</th><th scope="col">Tipo</th><th scope="col">Qué es</th></tr></thead><tbody>${FIELD_DEFS.map(([n, ty, d]) => `<tr><td><code>${n}</code></td><td class="sm muted">${({ p: 'protocolo', u: 'número', b: 'booleano', s: 'texto', ip: 'IPv4', mac: 'MAC', f: 'decimal' })[ty]}</td><td>${esc(d)}</td></tr>`).join('')}</tbody></table></div></section>
+ <section class="card cs fields"><h2>${L('Todos los campos del laboratorio', 'Every field in the lab')}</h2><p class="muted sm">${L('Escribe cualquiera en la barra de filtros: el autocompletado los conoce todos.', 'Type any of them in the filter bar: autocomplete knows them all.')}</p>
+ <div class="tbl-wrap" tabindex="0" role="region" aria-label="${L('Campos de filtro', 'Filter fields')}"><table class="tbl"><caption class="vh">${L('Campos de filtro', 'Filter fields')}</caption><thead><tr><th scope="col">${L('Campo', 'Field')}</th><th scope="col">${L('Tipo', 'Type')}</th><th scope="col">${L('Qué es', 'What it is')}</th></tr></thead><tbody>${FIELD_DEFS.map(([n, ty, d]) => `<tr><td><code>${n}</code></td><td class="sm muted">${(LANG === 'en' ? { p: 'protocol', u: 'number', b: 'boolean', s: 'text', ip: 'IPv4', mac: 'MAC', f: 'decimal' } : { p: 'protocolo', u: 'número', b: 'booleano', s: 'texto', ip: 'IPv4', mac: 'MAC', f: 'decimal' })[ty]}</td><td>${esc(d)}</td></tr>`).join('')}</tbody></table></div></section>
</div>${siteFooter()}`;
$$('[data-copy]', main).forEach(b => b.onclick = () => copyText(b.dataset.copy, b));
}
/* ---------- Glosario ---------- */
function viewGlossary(main, { q }) {
- main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('glossary')}</p><h1>Glosario</h1><p class="muted">${GLOSSARY.length} términos de redes y pentesting explicados sin rodeos.</p></div>
- <div class="gsearch"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="g-q">Buscar en el glosario</label><input id="g-q" type="search" class="tinput" placeholder="Filtra términos…" autocomplete="off"></div>
+ main.innerHTML = `<div class="wrap page"><div class="sec-h"><p class="eyebrow">${t('glossary')}</p><h1>${t('glossary')}</h1><p class="muted">${L(`${GLOSSARY.length} términos de redes y pentesting explicados sin rodeos.`, `${GLOSSARY.length} networking and pentesting terms explained plainly (in Spanish).`)}</p></div>
+ <div class="gsearch"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="g-q">${L('Buscar en el glosario', 'Search the glossary')}</label><input id="g-q" type="search" class="tinput" placeholder="${L('Filtra términos…', 'Filter terms…')}" autocomplete="off"></div>
<p class="sm muted" id="g-n" aria-live="polite"></p>
<dl class="gl">${GLOSSARY.map(([term, d]) => `<div class="card gi" id="g-${esc(norm(term).replace(/\W+/g, '-'))}"><dt>${esc(term)}</dt><dd>${esc(d)}</dd></div>`).join('')}</dl></div>${siteFooter()}`;
const inp = $('#g-q', main), items = $$('.gi', main);
- const run = () => { const v = norm(inp.value); let n = 0; items.forEach((el, i) => { const hit = !v || norm(GLOSSARY[i][0] + ' ' + GLOSSARY[i][1]).includes(v); el.hidden = !hit; n += hit; }); $('#g-n', main).textContent = v ? `${n} de ${GLOSSARY.length} términos` : ''; };
+ const run = () => { const v = norm(inp.value); let n = 0; items.forEach((el, i) => { const hit = !v || norm(GLOSSARY[i][0] + ' ' + GLOSSARY[i][1]).includes(v); el.hidden = !hit; n += hit; }); $('#g-n', main).textContent = v ? L(`${n} de ${GLOSSARY.length} términos`, `${n} of ${GLOSSARY.length} terms`) : ''; };
inp.addEventListener('input', run);
if (q.get('q')) { inp.value = q.get('q'); run(); const first = items.find(x => !x.hidden); if (first) first.classList.add('flash'); }
}
diff --git a/src/app/90-shell.js b/src/app/90-shell.js
index 6bdf590..f158aed 100644
--- a/src/app/90-shell.js
+++ b/src/app/90-shell.js
@@ -11,41 +11,122 @@ function applyTheme(animate) {
const th = resolvedTheme(), root = document.documentElement;
if (animate && !REDUCED.matches) { root.classList.add('theming'); clearTimeout(applyTheme.tm); applyTheme.tm = setTimeout(() => root.classList.remove('theming'), 320); }
root.dataset.theme = th;
- const b = $('[data-theme-btn]'); if (b) b.setAttribute('aria-label', th === 'light' ? t('themeToDark') : t('themeToLight'));
+ const b = $('[data-theme-btn]'); if (b) b.setAttribute('aria-checked', String(th === 'dark'));
}
function applyLang() { LANG = S.get().settings.lang; document.documentElement.lang = LANG; $('#skip').textContent = t('skip'); }
-function renderTop() {
+/* Armazón al estilo de BlueJr y RiskManager-Jr: barra lateral plegable (carril de iconos que se despliega
+ por encima al pasar el ratón o con el teclado), barra superior flotante con buscador, interruptores ES|EN
+ y claro|oscuro, y barra de pestañas abajo en el móvil. */
+const MOBILE_MQ = matchMedia('(max-width: 900px)');
+let CUR_MOD = null, indY = null;
+function sideOpen() { return S.get().settings.side !== false; }
+function renderShell() { renderSide(); renderTop(); renderTabbar(); applyTheme(false); markNav(); }
+function renderSide() {
+ indY = null; // tras repintar, el indicador se coloca sin animar
const xp = S.xp(), lv = S.level();
+ const mods = MODULES.map((m, i) => {
+ const p = modProgress(m), st = p.done === p.total ? 'ok' : p.done ? 'mid' : '';
+ return `<li data-i="${i + 2}"><a href="#/m/${m.id}" class="sub" data-mod="${m.id}" title="${esc(`${m.n}. ${mT(m, 'title')}`)}"><span class="dotn ${st}" aria-hidden="true"><b>${m.n}</b></span><span class="txt">${esc(mT(m, 'title'))}</span><span class="cnt num">${p.done}/${p.total}</span></a></li>`;
+ }).join('');
+ const item = ([k, h, i], n) => `<a href="${h}" data-nav="${k}" data-i="${n}" title="${esc(t(k))}">${ic(i)}<span class="txt">${t(k)}</span></a>`;
+ const pct = lv.next ? Math.round(100 * (xp - lv.min) / (lv.next - lv.min)) : 100;
+ $('#side').setAttribute('aria-label', t('navMain'));
+ $('#side').innerHTML = `
+ <a class="side-brand" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><span class="brand-txt"><b>Megalodon</b><small>${t('brandSub')}</small></span></a>
+ <nav class="side-nav" aria-label="${t('navMain')}">
+ <span class="side-ind" aria-hidden="true"></span>
+ ${item(NAV[0], 0)}${item(NAV[1], 1)}
+ <ul aria-label="${t('modules')}">${mods}</ul>
+ ${NAV.slice(2).map((n, k) => item(n, 10 + k)).join('')}
+ </nav>
+ <div class="side-foot">
+ <a class="lvl" href="#/modulos" title="${t('level')}: ${esc(lvName(lv))}"><span class="lvl-ic" aria-hidden="true">${ic('trophy')}</span><span class="lvl-txt"><b>${esc(lvName(lv))} · <span class="num" data-xp>${xp}</span> XP</b><span class="meter" role="progressbar" aria-label="${t('levelProg')}" aria-valuemin="0" aria-valuemax="100" aria-valuenow="${pct}"><i data-w="${Math.max(3, pct)}"></i></span></span></a>
+ </div>`;
+ $$('[data-i]', $('#side')).forEach(el => el.style.setProperty('--i', el.dataset.i)); // la CSP prohíbe style en línea
+ $$('[data-w]', $('#side')).forEach(el => { el.style.width = `${el.dataset.w}%`; });
+ document.body.classList.toggle('side-mini', !sideOpen());
+}
+/* Progreso en su sitio: no se repinta el lateral, así el indicador y el foco no se mueven */
+function updateSide() {
+ MODULES.forEach(m => {
+ const a = $(`.side-nav [data-mod="${m.id}"]`); if (!a) return;
+ const p = modProgress(m);
+ $('.cnt', a).textContent = `${p.done}/${p.total}`;
+ $('.dotn', a).className = `dotn ${p.done === p.total ? 'ok' : p.done ? 'mid' : ''}`;
+ });
+ const xp = S.xp(), lv = S.level(), pct = lv.next ? Math.round(100 * (xp - lv.min) / (lv.next - lv.min)) : 100;
+ const l = $('.lvl'); if (!l) return;
+ $('.lvl-txt b', l).innerHTML = `${esc(lvName(lv))} · <span class="num" data-xp>${xp}</span> XP`;
+ l.title = `${t('level')}: ${lvName(lv)}`;
+ const m = $('.meter', l); m.setAttribute('aria-valuenow', String(pct)); $('i', m).style.width = `${Math.max(3, pct)}%`;
+}
+function renderTop() {
+ const th = resolvedTheme();
$('#top').innerHTML = `<div class="top-in">
- <a class="brand" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><span class="brand-t">Megalodon</span></a>
- <nav class="nav" aria-label="Principal">${NAV.map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i, 'sm')}<span>${t(k)}</span></a>`).join('')}</nav>
- <div class="top-acts">
+ <button class="ibtn only-desk" type="button" data-side aria-label="${t('sideToggle')}" aria-expanded="${sideOpen()}" title="${t('sideToggle')} ( [ )">${ic('panel')}</button>
+ <a class="brand-m" href="#/" aria-label="Megalodon · ${t('home')}"><span class="logo" aria-hidden="true">${ic('fish')}</span><b>Megalodon</b></a>
+ <span class="grow"></span>
<button class="search-btn" type="button" data-search aria-label="${t('search')} (Ctrl K)">${ic('search')}<span class="sb-t">${t('search')}…</span><kbd>Ctrl K</kbd></button>
- <a class="xp-chip" href="#/modulos" title="${t('level')}: ${lv.name}" aria-label="${xp} XP, ${t('level')} ${lv.name}">${ic('trophy', 'sm')}<span class="num" data-xp>${xp}</span><span class="xp-u">XP</span></a>
- <button class="ibtn hide-narrow" type="button" data-help aria-label="${t('help')}" title="${t('help')}">${ic('help')}</button>
- <button class="ibtn hide-narrow" type="button" data-keys aria-label="${t('shortcuts')}" title="${t('shortcuts')} (?)">${ic('keyboard')}</button>
- <button class="ibtn" type="button" data-settings aria-label="${t('settings')}" title="${t('settings')}">${ic('settings')}</button>
- <button class="ibtn theme-btn" type="button" data-theme-btn aria-label="${t('themeToLight')}"><span class="sun">${ic('sun')}</span><span class="moon">${ic('moon')}</span></button>
- <button class="ibtn" type="button" data-menu aria-label="${t('menu')}" aria-expanded="false" aria-controls="mnav">${ic('menu')}</button>
- </div>
- </div>
- <nav id="mnav" class="mnav" aria-label="Principal (móvil)" hidden>${NAV.map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i)}<span>${t(k)}</span></a>`).join('')}<button type="button" data-help>${ic('help')}<span>${t('help')}</span></button><button type="button" data-keys>${ic('keyboard')}<span>${t('shortcuts')}</span></button></nav>`;
+ <div class="lang-sw" role="group" aria-label="${t('langSwitch')}"><button type="button" data-lang="es" aria-pressed="${LANG === 'es'}" lang="es" aria-label="Español">ES</button><button type="button" data-lang="en" aria-pressed="${LANG === 'en'}" lang="en" aria-label="English">EN</button></div>
+ <button class="theme-sw" type="button" role="switch" data-theme-btn aria-checked="${th === 'dark'}" aria-label="${t('themeSwitch')}"><span class="track" aria-hidden="true">${ic('sun')}${ic('moon')}</span><span class="knob" aria-hidden="true"></span></button>
+ <button class="ibtn only-desk" type="button" data-help aria-label="${t('help')}" title="${t('help')}">${ic('help')}</button>
+ <button class="ibtn only-desk" type="button" data-keys aria-label="${t('shortcuts')}" title="${t('shortcuts')} (?)">${ic('keyboard')}</button>
+ <button class="ibtn only-desk" type="button" data-settings aria-label="${t('settings')}" title="${t('settings')}">${ic('settings')}</button>
+ </div>`;
const top = $('#top');
- $$('[data-search]', top).forEach(b => b.onclick = openSearch);
- $$('[data-help]', top).forEach(b => b.onclick = () => { closeMenu(); openHelp(); });
- $$('[data-keys]', top).forEach(b => b.onclick = () => { closeMenu(); openKeys(); });
+ $('[data-search]', top).onclick = openSearch;
+ $('[data-help]', top).onclick = openHelp;
+ $('[data-keys]', top).onclick = openKeys;
$('[data-settings]', top).onclick = openSettings;
$('[data-theme-btn]', top).onclick = toggleTheme;
- const mb = $('[data-menu]', top), mn = $('#mnav');
- mb.onclick = () => { const open = mn.hidden; mn.hidden = !open; mb.setAttribute('aria-expanded', String(open)); if (open) $('a', mn).focus(); };
- $$('a', mn).forEach(a => a.addEventListener('click', closeMenu));
- applyTheme(false); markNav();
+ $('[data-side]', top).onclick = toggleSide;
+ $$('[data-lang]', top).forEach(b => b.onclick = () => setLang(b.dataset.lang));
+}
+function renderTabbar() {
+ const tb = $('#tabbar');
+ tb.setAttribute('aria-label', t('navMobile'));
+ tb.innerHTML = NAV.slice(0, 4).map(([k, h, i]) => `<a href="${h}" data-nav="${k}">${ic(i)}<span>${t(k)}</span></a>`).join('') + `<button type="button" data-more aria-haspopup="dialog">${ic('more')}<span>${t('more')}</span></button>`;
+ $('[data-more]', tb).onclick = openMore;
}
-function closeMenu() { const mn = $('#mnav'); if (mn && !mn.hidden) { mn.hidden = true; $('[data-menu]').setAttribute('aria-expanded', 'false'); } }
+function openMore() {
+ const d = openDialog({ title: `${ic('more')} ${t('more')}`, cls: 'narrow sheet', body: `<div class="more-list">
+ <a href="#/glosario" data-go>${ic('glossary')}<span>${t('glossary')}</span>${ic('chevR', 'sm')}</a>
+ <button type="button" data-a="settings">${ic('settings')}<span>${t('settings')}</span>${ic('chevR', 'sm')}</button>
+ <button type="button" data-a="help">${ic('help')}<span>${t('help')}</span>${ic('chevR', 'sm')}</button>
+ <button type="button" data-a="keys">${ic('keyboard')}<span>${t('shortcuts')}</span>${ic('chevR', 'sm')}</button>
+ </div>` });
+ $('[data-go]', d).onclick = () => closeDialog(true);
+ $$('[data-a]', d).forEach(b => b.onclick = () => { closeDialog(true); ({ settings: openSettings, help: openHelp, keys: openKeys })[b.dataset.a](); });
+}
+function toggleSide() {
+ S.set('side', !sideOpen());
+ document.body.classList.toggle('side-mini', !sideOpen());
+ const b = $('[data-side]'); if (b) b.setAttribute('aria-expanded', String(sideOpen()));
+ setTimeout(moveIndicator, 340);
+}
+function setLang(l) {
+ if (l === LANG) return;
+ S.set('lang', l); applyLang(); SEARCH_INDEX = null; renderShell(); route();
+ toast(l === 'en' ? 'Interface in English. Lessons stay in Spanish.' : 'Interfaz en español.', 'info', 'lang');
+}
+/* Indicador del lateral: se desliza hasta el elemento activo (solo transform, sin mover la página) */
+function moveIndicator() {
+ const nav = $('.side-nav'), ind = $('.side-ind'), act = nav && $('a[aria-current="page"]', nav);
+ if (!ind) return;
+ if (!act) { ind.style.opacity = '0'; return; }
+ const y = act.getBoundingClientRect().top - nav.getBoundingClientRect().top + nav.scrollTop, h = act.offsetHeight; // no offsetTop: los <li> no son el padre de referencia
+ if (indY === null || REDUCED.matches) { ind.style.transition = 'none'; ind.style.transform = `translateY(${y}px)`; ind.style.height = `${h}px`; ind.style.opacity = '1'; indY = y; requestAnimationFrame(() => { ind.style.transition = ''; }); return; }
+ ind.style.height = `${h}px`; ind.style.opacity = '1'; ind.style.transform = `translateY(${y}px)`; indY = y;
+}
+function closeMenu() {}
function toggleTheme() { S.set('theme', resolvedTheme() === 'light' ? 'dark' : 'light'); applyTheme(true); }
let CUR_NAV = 'home';
-function markNav() { $$('[data-nav]').forEach(a => { if (a.dataset.nav === CUR_NAV) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); }); }
+function markNav() {
+ $$('[data-nav]').forEach(a => { const on = a.dataset.nav === CUR_NAV && !(CUR_MOD && a.closest('.side-nav')); if (on) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); });
+ $$('[data-mod]').forEach(a => { if (a.dataset.mod === CUR_MOD) a.setAttribute('aria-current', 'page'); else a.removeAttribute('aria-current'); });
+ requestAnimationFrame(moveIndicator);
+}
function route() {
const raw = location.hash.replace(/^#/, '') || '/';
@@ -56,13 +137,13 @@ function route() {
const main = $('#main');
let hit = null;
for (const [re, fn, nav] of ROUTES) { const m = path.match(re); if (m) { hit = { fn, nav, id: m[1] }; break; } }
- CUR_NAV = hit ? hit.nav : '';
+ CUR_NAV = hit ? hit.nav : ''; CUR_MOD = hit && hit.fn === viewModule ? hit.id : null;
main.classList.remove('enter'); void main.offsetWidth; main.classList.add('enter');
cleanup = hit ? hit.fn(main, { id: hit.id, q }) || null : (viewNotFound(main), null);
$$('.meter[aria-valuemax]', main).forEach(mt => { const i = mt.firstElementChild; if (i && !i.style.width) i.style.width = `${Math.max(2, 100 * (+mt.getAttribute('aria-valuenow')) / (+mt.getAttribute('aria-valuemax')))}%`; });
markNav();
const h1 = $('h1', main);
- document.title = `${h1 && hit && hit.nav !== 'home' ? h1.textContent + ' · ' : ''}Megalodon · Laboratorio de Wireshark`;
+ document.title = `${h1 && hit && hit.nav !== 'home' ? h1.textContent + ' · ' : ''}Megalodon · ${L('Laboratorio de Wireshark', 'Wireshark lab')}`;
if (!firstRoute) { window.scrollTo(0, 0); main.focus({ preventScroll: true }); }
firstRoute = false;
}
@@ -72,31 +153,33 @@ let SEARCH_INDEX = null;
function searchIndex() {
if (SEARCH_INDEX) return SEARCH_INDEX;
const ix = [];
- NAV.forEach(([k, h, i]) => ix.push({ k: 'Página', i, title: t(k), go: h }));
+ const K = { page: L('Página', 'Page'), mod: L('Módulo', 'Module'), les: L('Lección', 'Lesson'), task: L('Reto', 'Challenge'), glo: t('glossary'), flt: L('Filtro', 'Filter'), fld: L('Campo', 'Field'), act: L('Acción', 'Action') };
+ NAV.forEach(([k, h, i]) => ix.push({ ty: 'page', i, title: t(k), go: h }));
MODULES.forEach(m => {
- ix.push({ k: 'Módulo', i: m.icon, title: `${m.n}. ${m.title}`, d: m.sub, go: `#/m/${m.id}` });
- m.lessons.forEach((l, j) => ix.push({ k: 'Lección', i: 'book', title: l.h, d: `Módulo ${m.n} · ${plain(l.p[0]).slice(0, 90)}`, go: `#/m/${m.id}?l=${j}`, body: plain(l.p.join(' ')) }));
- m.tasks.forEach(x => ix.push({ k: 'Reto', i: 'target', title: plain(x.q), d: `Módulo ${m.n} · ${m.title}`, go: `#/m/${m.id}?t=${x.id}` }));
+ ix.push({ ty: 'mod', i: m.icon, title: `${m.n}. ${mT(m, 'title')}`, d: mT(m, 'sub'), go: `#/m/${m.id}`, body: LANG === 'en' ? `${m.title} ${m.sub}` : '' });
+ m.lessons.forEach((l, j) => ix.push({ ty: 'les', i: 'book', title: l.h, d: `${K.mod} ${m.n} · ${plain(l.p[0]).slice(0, 90)}`, go: `#/m/${m.id}?l=${j}`, body: plain(l.p.join(' ')) }));
+ m.tasks.forEach(x => ix.push({ ty: 'task', i: 'target', title: plain(x.q), d: `${K.mod} ${m.n} · ${mT(m, 'title')}`, go: `#/m/${m.id}?t=${x.id}` }));
});
- GLOSSARY.forEach(([term, d]) => ix.push({ k: 'Glosario', i: 'glossary', title: term, d, go: `#/glosario?q=${encodeURIComponent(term)}` }));
- CHEATS.forEach(g => g.items.forEach(([f, d]) => { if (!/\s{3}| vs /.test(f)) ix.push({ k: 'Filtro', i: 'filter', title: f, d, go: `#/lab?f=${encodeURIComponent(f)}`, mono: true }); }));
- FIELD_DEFS.forEach(([n, , d]) => ix.push({ k: 'Campo', i: 'tree', title: n, d, go: `#/lab?f=${encodeURIComponent(n)}`, mono: true }));
- ix.push({ k: 'Acción', i: 'sun', title: 'Cambiar tema claro u oscuro', act: toggleTheme }, { k: 'Acción', i: 'settings', title: t('settings'), act: openSettings }, { k: 'Acción', i: 'keyboard', title: t('shortcuts'), act: openKeys }, { k: 'Acción', i: 'help', title: t('help'), act: openHelp });
+ GLOSSARY.forEach(([term, d]) => ix.push({ ty: 'glo', i: 'glossary', title: term, d, go: `#/glosario?q=${encodeURIComponent(term)}` }));
+ CHEATS.forEach(g => g.items.forEach(([f, d]) => { if (!/\s{3}| vs /.test(f)) ix.push({ ty: 'flt', i: 'filter', title: f, d, go: `#/lab?f=${encodeURIComponent(f)}`, mono: true }); }));
+ FIELD_DEFS.forEach(([n, , d]) => ix.push({ ty: 'fld', i: 'tree', title: n, d, go: `#/lab?f=${encodeURIComponent(n)}`, mono: true }));
+ ix.push({ ty: 'act', i: 'sun', title: L('Cambiar tema claro u oscuro', 'Toggle light or dark theme'), act: toggleTheme }, { ty: 'act', i: 'lang', title: L('Interfaz en inglés', 'Interface in Spanish'), act: () => setLang(LANG === 'en' ? 'es' : 'en') }, { ty: 'act', i: 'panel', title: t('sideToggle'), act: toggleSide }, { ty: 'act', i: 'settings', title: t('settings'), act: openSettings }, { ty: 'act', i: 'keyboard', title: t('shortcuts'), act: openKeys }, { ty: 'act', i: 'help', title: t('help'), act: openHelp });
+ ix.forEach(x => { x.k = K[x.ty]; });
ix.forEach(x => { x.nt = norm(x.title); x.nd = norm((x.d || '') + ' ' + (x.body || '')); });
return (SEARCH_INDEX = ix);
}
function openSearch() {
const body = document.createElement('div');
- body.innerHTML = `<div class="sbox"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="s-q">${t('search')}</label><input id="s-q" type="text" role="combobox" aria-expanded="true" aria-controls="s-r" aria-autocomplete="list" autocomplete="off" spellcheck="false" placeholder="${esc(t('searchPh'))}"></div><ul id="s-r" class="sres" role="listbox" aria-label="Resultados"></ul><p class="sm muted s-foot"><kbd>↑</kbd><kbd>↓</kbd> moverte · <kbd>Enter</kbd> abrir · <kbd>Esc</kbd> cerrar</p>`;
+ body.innerHTML = `<div class="sbox"><span aria-hidden="true">${ic('search')}</span><label class="vh" for="s-q">${t('search')}</label><input id="s-q" type="text" role="combobox" aria-expanded="true" aria-controls="s-r" aria-autocomplete="list" autocomplete="off" spellcheck="false" placeholder="${esc(t('searchPh'))}"></div><ul id="s-r" class="sres" role="listbox" aria-label="${L('Resultados', 'Results')}"></ul><p class="sm muted s-foot"><kbd>↑</kbd><kbd>↓</kbd> ${L('moverte', 'move')} · <kbd>Enter</kbd> ${L('abrir', 'open')} · <kbd>Esc</kbd> ${L('cerrar', 'close')}</p>`;
openDialog({ title: `${ic('search')} ${t('search')}`, body, cls: 'search' });
const inp = $('#s-q'), list = $('#s-r');
let res = [], idx = 0;
const draw = () => {
const v = norm(inp.value), ix = searchIndex();
- if (!v) res = ix.filter(x => x.k === 'Módulo' || x.k === 'Página').slice(0, 14);
+ if (!v) res = ix.filter(x => x.ty === 'mod' || x.ty === 'page').slice(0, 14);
else res = ix.map(x => ({ x, s: x.nt.startsWith(v) ? 3 : x.nt.includes(v) ? 2 : x.nd.includes(v) ? 1 : 0 })).filter(r => r.s).sort((a, b) => b.s - a.s || a.x.title.length - b.x.title.length).slice(0, 30).map(r => r.x);
idx = 0;
- list.innerHTML = res.length ? res.map((x, i) => `<li role="option" id="s-o${i}" aria-selected="${i === idx}" data-i="${i}"><span class="s-ic">${ic(x.i, 'sm')}</span><span class="s-t"><span class="${x.mono ? 'mono' : ''}">${esc(x.title.length > 110 ? x.title.slice(0, 108) + '…' : x.title)}</span>${x.d ? `<small>${esc(x.d.length > 100 ? x.d.slice(0, 98) + '…' : x.d)}</small>` : ''}</span><span class="s-k">${x.k}</span></li>`).join('') : `<li class="s-none" role="option" aria-disabled="true">Nada por aquí. Prueba con «syn», «cookie» o «dns».</li>`;
+ list.innerHTML = res.length ? res.map((x, i) => `<li role="option" id="s-o${i}" aria-selected="${i === idx}" data-i="${i}"><span class="s-ic">${ic(x.i, 'sm')}</span><span class="s-t"><span class="${x.mono ? 'mono' : ''}">${esc(x.title.length > 110 ? x.title.slice(0, 108) + '…' : x.title)}</span>${x.d ? `<small>${esc(x.d.length > 100 ? x.d.slice(0, 98) + '…' : x.d)}</small>` : ''}</span><span class="s-k">${x.k}</span></li>`).join('') : `<li class="s-none" role="option" aria-disabled="true">${L('Nada por aquí. Prueba con «syn», «cookie» o «dns».', 'Nothing here. Try “syn”, “cookie” or “dns”.')}</li>`;
inp.setAttribute('aria-activedescendant', res.length ? 's-o0' : '');
};
const go = i => { const x = res[i]; if (!x) return; closeDialog(true); if (x.act) x.act(); else if (location.hash === x.go) route(); else location.hash = x.go; };
@@ -119,34 +202,44 @@ function openSettings() {
const solved = Object.keys(S.get().done).length;
const d = openDialog({ title: `${ic('settings')} ${t('settings')}`, body: `
<div class="set-row"><div><p>${t('theme')}</p></div><div data-set="theme">${seg(t('theme'), st.theme, [['light', t('light'), 'sun'], ['dark', t('dark'), 'moon'], ['system', t('system'), null]])}</div></div>
- <div class="set-row"><div><p>${t('language')}</p><p class="sm muted">Interfaz en español o inglés. Las lecciones están en español.</p></div><div data-set="lang">${seg(t('language'), st.lang, [['es', 'Español'], ['en', 'English']])}</div></div>
- ${sw('relative', 'Números de secuencia relativos', 'Como Wireshark por defecto: Seq y Ack empiezan en 0. Desactívalo para ver los valores reales.')}
- ${sw('colorize', 'Colorear paquetes', 'Reglas de color de Wireshark: TCP, HTTP, RST, problemas…')}
- <div class="set-row danger-zone"><div><p>${t('resetProgress')}</p><p class="sm muted">${solved} retos y ${S.xp()} XP guardados en este navegador.</p></div><button type="button" class="btn danger sm" data-reset ${solved || S.xp() ? '' : 'disabled'}>${ic('reset', 'sm')}${t('resetProgress')}</button></div>` });
+ <div class="set-row"><div><p>${t('language')}</p><p class="sm muted">${L('Interfaz en español o inglés. Las lecciones están en español.', 'Interface in Spanish or English. Lessons are in Spanish.')}</p></div><div data-set="lang">${seg(t('language'), st.lang, [['es', 'Español'], ['en', 'English']])}</div></div>
+ ${sw('relative', L('Números de secuencia relativos', 'Relative sequence numbers'), L('Como Wireshark por defecto: Seq y Ack empiezan en 0. Desactívalo para ver los valores reales.', 'Wireshark’s default: Seq and Ack start at 0. Turn it off to see the real values.'))}
+ ${sw('colorize', L('Colorear paquetes', 'Colorize packets'), L('Reglas de color de Wireshark: TCP, HTTP, RST, problemas…', 'Wireshark coloring rules: TCP, HTTP, RST, problems…'))}
+ <div class="set-row danger-zone"><div><p>${t('resetProgress')}</p><p class="sm muted">${L(`${solved} retos y ${S.xp()} XP guardados en este navegador.`, `${solved} challenges and ${S.xp()} XP saved in this browser.`)}</p></div><button type="button" class="btn danger sm" data-reset ${solved || S.xp() ? '' : 'disabled'}>${ic('reset', 'sm')}${t('resetProgress')}</button></div>` });
$$('[data-set]', d).forEach(g => g.addEventListener('click', e => {
const b = e.target.closest('[data-v]'); if (!b) return;
$$('[role=radio]', g).forEach(x => x.setAttribute('aria-checked', String(x === b)));
const k = g.dataset.set; S.set(k, b.dataset.v);
if (k === 'theme') applyTheme(true);
- if (k === 'lang') { applyLang(); SEARCH_INDEX = null; renderTop(); closeDialog(true); route(); openSettings(); }
+ if (k === 'lang') { applyLang(); SEARCH_INDEX = null; renderShell(); closeDialog(true); route(); openSettings(); }
+ if (k === 'theme') renderTop();
}));
$$('[data-sw]', d).forEach(b => b.onclick = () => { const v = b.getAttribute('aria-checked') !== 'true'; b.setAttribute('aria-checked', String(v)); S.set(b.dataset.sw, v); });
$('[data-reset]', d).onclick = async () => {
- const ok = await confirmDialog({ title: '¿Borrar todo tu progreso?', text: `Se borrarán <strong>${Object.keys(S.get().done).length} retos</strong>, <strong>${Object.keys(S.get().badges).length} insignias</strong> y <strong>${S.xp()} XP</strong>. Tus ajustes se mantienen. No se puede deshacer.`, ok: t('resetConfirm') });
- if (ok) { S.reset(); toast('Progreso borrado. A empezar de cero.', 'info', 'reset'); route(); }
+ const nd = Object.keys(S.get().done).length, nb = Object.keys(S.get().badges).length;
+ const ok = await confirmDialog({ title: L('¿Borrar todo tu progreso?', 'Reset all your progress?'), text: L(`Se borrarán <strong>${nd} retos</strong>, <strong>${nb} insignias</strong> y <strong>${S.xp()} XP</strong>. Tus ajustes se mantienen. No se puede deshacer.`, `This deletes <strong>${nd} challenges</strong>, <strong>${nb} badges</strong> and <strong>${S.xp()} XP</strong>. Your settings stay. It cannot be undone.`), ok: t('resetConfirm') });
+ if (ok) { S.reset(); toast(L('Progreso borrado. A empezar de cero.', 'Progress reset. Back to square one.'), 'info', 'reset'); route(); }
};
}
function openHelp() {
- openDialog({ title: `${ic('help')} ${t('help')}`, wide: true, body: `<div class="help">
+ openDialog({ title: `${ic('help')} ${t('help')}`, wide: true, body: LANG === 'en' ? `<div class="help">
+ <section><h3>${ic('rows', 'sm')}The three panes</h3><p>At the top, the <strong>packet list</strong>. In the middle, the layered <strong>detail tree</strong>. At the bottom, the <strong>bytes</strong>. Clicking a field highlights its bytes, and clicking a byte opens its field.</p></section>
+ <section><h3>${ic('filter', 'sm')}The filter bar</h3><p>It turns <span class="okt">green</span> when the filter is valid and <span class="badt">red</span> when it is not, with the reason below. <kbd>Tab</kbd> accepts the suggestion and <kbd>Enter</kbd> applies. In the tree, each field’s ${ic('filter', 'sm')} button turns it into a filter (“Apply as Filter”).</p></section>
+ <section><h3>${ic('target', 'sm')}Challenges</h3><p>Four kinds: write a <strong>filter</strong> (it must show exactly the solution’s packets), pick a <strong>packet</strong>, type an <strong>answer</strong> or choose an option. Each challenge gives 10 XP; each hint takes a little off. Finishing a module gives a badge and 20 extra XP.</p></section>
+ <section><h3>${ic('flask', 'sm')}Analyst tools</h3><p>Expert Information (<kbd>E</kbd>), HTTP objects, cleartext credentials, Statistics (<kbd>S</kbd>) with conversations, endpoints and I/O graph, Follow TCP/UDP stream (<kbd>F</kbd>), Find Packet (<kbd>Ctrl F</kbd>), Go to Packet (<kbd>Ctrl G</kbd>) and the time display format, as in Wireshark.</p></section>
+ <section><h3>${ic('upload', 'sm')}Your captures</h3><p>In the Free lab you can open your own .pcap or .pcapng files (or drag them in). Everything is processed in your browser: nothing leaves your device.</p></section>
+ <section><h3>${ic('book', 'sm')}Sources</h3><p>Field names, coloring rules and the Info column follow Wireshark 4.x; the engine was checked packet by packet against tshark. Official guide: <a href="https://www.wireshark.org/docs/wsug_html_chunked/" target="_blank" rel="noopener noreferrer">Wireshark User's Guide</a> · <a href="https://www.wireshark.org/docs/man-pages/wireshark-filter.html" target="_blank" rel="noopener noreferrer">wireshark-filter(4)</a>.</p></section>
+ </div>` : `<div class="help">
<section><h3>${ic('rows', 'sm')}Las tres zonas</h3><p>Arriba, la <strong>lista de paquetes</strong>. En medio, el <strong>árbol de detalle</strong> por capas. Abajo, los <strong>bytes</strong>. Al pulsar un campo se iluminan sus bytes, y al pulsar un byte se abre su campo.</p></section>
<section><h3>${ic('filter', 'sm')}La barra de filtros</h3><p>Se pone <span class="okt">verde</span> si el filtro es válido y <span class="badt">roja</span> si no, con el motivo debajo. <kbd>Tab</kbd> acepta la sugerencia y <kbd>Enter</kbd> aplica. En el árbol, el botón ${ic('filter', 'sm')} de cada campo lo convierte en filtro («Aplicar como filtro»).</p></section>
<section><h3>${ic('target', 'sm')}Retos</h3><p>Hay cuatro tipos: escribir un <strong>filtro</strong> (debe mostrar exactamente los paquetes de la solución), elegir un <strong>paquete</strong>, escribir una <strong>respuesta</strong> o elegir una opción. Cada reto da 10 XP; cada pista resta un poco. Completar un módulo da una insignia y 20 XP extra.</p></section>
+ <section><h3>${ic('flask', 'sm')}Herramientas de analista</h3><p>Información experta (<kbd>E</kbd>), objetos HTTP, credenciales en claro, Estadísticas (<kbd>S</kbd>) con conversaciones, endpoints y gráfico de E/S, seguir flujo TCP/UDP (<kbd>F</kbd>), Buscar paquete (<kbd>Ctrl F</kbd>), Ir al paquete (<kbd>Ctrl G</kbd>) y formato de tiempo, como en Wireshark.</p></section>
<section><h3>${ic('upload', 'sm')}Tus capturas</h3><p>En el Laboratorio libre puedes abrir tus .pcap o .pcapng (o arrastrarlos). Todo se procesa en tu navegador: nada sale de tu equipo.</p></section>
<section><h3>${ic('book', 'sm')}Fuentes</h3><p>Nombres de campos, reglas de color y formato de la columna Info siguen a Wireshark 4.x; el motor se ha comprobado paquete a paquete contra tshark. Guía oficial: <a href="https://www.wireshark.org/docs/wsug_html_chunked/" target="_blank" rel="noopener noreferrer">Wireshark User's Guide</a> · <a href="https://www.wireshark.org/docs/man-pages/wireshark-filter.html" target="_blank" rel="noopener noreferrer">wireshark-filter(4)</a>.</p></section>
</div>` });
}
function openKeys() {
- openDialog({ title: `${ic('keyboard')} ${t('shortcuts')}`, cls: 'narrow', body: `<table class="tbl keys"><caption class="vh">${t('shortcuts')}</caption><tbody>${SHORTCUTS.map(([k, es, en]) => `<tr><th scope="row">${k.split(' ').map(x => `<kbd>${x}</kbd>`).join(' ')}</th><td>${LANG === 'en' ? en : es}</td></tr>`).join('')}</tbody></table>` });
+ openDialog({ title: `${ic('keyboard')} ${t('shortcuts')}`, cls: 'narrow', body: `<table class="tbl keys"><caption class="vh">${t('shortcuts')}</caption><tbody>${SHORTCUTS.map(([k, es, en]) => `<tr><th scope="row">${k.split(' ').map(x => `<kbd>${LANG === 'en' ? ({ Inicio: 'Home', Fin: 'End', 'Mayús': 'Shift' })[x] || x : x}</kbd>`).join(' ')}</th><td>${LANG === 'en' ? en : es}</td></tr>`).join('')}</tbody></table>` });
}
function onKey(e) {
@@ -156,6 +249,7 @@ function onKey(e) {
if (typing || $('#dlg').open || e.ctrlKey || e.metaKey || e.altKey) return;
if (e.key === '/' && CUR_WS) { e.preventDefault(); CUR_WS.focusFilter(); }
else if (e.key === '?') { e.preventDefault(); openKeys(); }
+ else if (e.key === '[' && !MOBILE_MQ.matches) { e.preventDefault(); toggleSide(); }
else if (e.key === 'T' && e.shiftKey) toggleTheme();
else if ((e.key === 'f' || e.key === 'F') && !e.shiftKey && CUR_WS) CUR_WS.follow();
else if ((e.key === 's' || e.key === 'S') && !e.shiftKey && CUR_WS) openStats(CUR_WS);
@@ -163,10 +257,16 @@ function onKey(e) {
}
function boot() {
- applyLang(); renderTop(); route();
+ applyLang(); renderShell(); route();
+ setTimeout(() => document.body.classList.add('ready'), 700); // la entrada escalonada solo en la primera carga
addEventListener('hashchange', route);
addEventListener('keydown', onKey);
matchMedia('(prefers-color-scheme: light)').addEventListener('change', () => { if (S.get().settings.theme === 'system') applyTheme(true); });
- S.on(() => { const el = $('[data-xp]'); if (el && +el.textContent !== S.xp()) { el.textContent = S.xp(); const chip = el.closest('.xp-chip'); chip.classList.remove('bump'); void chip.offsetWidth; chip.classList.add('bump'); chip.setAttribute('aria-label', `${S.xp()} XP, ${t('level')} ${S.level().name}`); } });
+ let lastXp = S.xp();
+ S.on(() => { // el lateral refleja al momento retos, insignias y XP
+ updateSide();
+ if (S.xp() > lastXp) { const l = $('.lvl'); if (l) { l.classList.remove('bump'); void l.offsetWidth; l.classList.add('bump'); } }
+ lastXp = S.xp();
+ });
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot); else boot();
diff --git a/src/content/modules.js b/src/content/modules.js
index 31fa96a..6641429 100644
--- a/src/content/modules.js
+++ b/src/content/modules.js
@@ -9,6 +9,7 @@ const MODULES = [
id: 'm1', n: 1, cap: 'm1', icon: 'handshake', mins: 25,
title: 'El saludo TCP', sub: 'Handshake de tres pasos, puertos, flags, Seq/Ack y cierre',
badge: 'Domador del handshake',
+ title_en: 'The TCP handshake', sub_en: 'Three-way handshake, ports, flags, Seq/Ack and teardown', badge_en: 'Handshake tamer',
intro: 'Kali (192.168.56.10) visita la web del laboratorio (192.168.56.20). Antes de que viaje un solo byte de HTTP, las dos máquinas se saludan. Aquí aprendes a leer ese saludo como lo hace un pentester.',
lessons: [
{ h: 'Las tres zonas de Wireshark', p: ['Arriba está la **lista de paquetes**: una fila por paquete, con número, tiempo, origen, destino, protocolo, longitud e información resumida.', 'En medio, el **árbol de detalle**: el mismo paquete abierto por capas (Ethernet → IP → TCP → HTTP). Abajo, los **bytes** en hexadecimal. Si pulsas un campo del árbol, sus bytes se iluminan; si pulsas un byte, se abre su campo.', 'Los colores no son decoración: violeta claro es TCP, verde es HTTP, gris oscuro con letras rojas es un problema TCP y rojo es un RST.'], try: [['tcp', 'Solo TCP'], ['arp', 'Solo ARP: quién tiene esta IP']] },
@@ -32,6 +33,7 @@ const MODULES = [
id: 'm2', n: 2, cap: 'm2', icon: 'globe', mins: 30,
title: 'HTTP al desnudo', sub: 'Peticiones, cabeceras, métodos, códigos de estado y Follow Stream',
badge: 'Lector de HTTP',
+ title_en: 'HTTP laid bare', sub_en: 'Requests, headers, methods, status codes and Follow Stream', badge_en: 'HTTP reader',
intro: 'Marta entra en la tienda tienda.ewpt.local, inicia sesión y navega por su panel. Todo va por HTTP sin cifrar, así que lo puedes leer entero.',
lessons: [
{ h: 'Petición y respuesta', p: ['Una petición HTTP empieza con la **línea de petición**: método, ruta y versión, por ejemplo `GET /login HTTP/1.1`. Debajo van las cabeceras y, tras una línea vacía, el cuerpo (si lo hay).', 'La respuesta empieza con la **línea de estado**: `HTTP/1.1 200 OK`. Wireshark enlaza cada respuesta con su petición: en el árbol verás «Petición en la trama» y la URI pedida.'], try: [['http.request', 'Solo peticiones'], ['http.response', 'Solo respuestas']] },
@@ -55,6 +57,7 @@ const MODULES = [
id: 'm3', n: 3, cap: 'm3', icon: 'cookie', mins: 30,
title: 'Cookies y credenciales en claro', sub: 'Sesiones, Basic Auth, formularios y FTP',
badge: 'Cazador de credenciales',
+ title_en: 'Cookies and cleartext credentials', sub_en: 'Sessions, Basic Auth, forms and FTP', badge_en: 'Credential hunter',
intro: 'En la intranet de una empresa, un equipo Windows (192.168.56.40) entra en un panel con Basic Auth, inicia sesión en un formulario y se conecta por FTP. Ninguno de los tres protocolos cifra nada.',
lessons: [
{ h: 'Cookies: la memoria de la web', p: ['HTTP no recuerda quién eres entre peticiones. Tras el login, el servidor te da una **cookie de sesión** con `Set-Cookie` y tu navegador la devuelve en cada petición con `Cookie`. Quien tenga esa cookie **es** tú para el servidor.', 'Los atributos de la cookie importan: **HttpOnly** impide que JavaScript la lea (frena el robo por XSS), **Secure** obliga a enviarla solo por HTTPS y **SameSite** limita los envíos desde otras webs.'], try: [['http.set_cookie', 'El servidor reparte cookies'], ['http.cookie contains "PHPSESSID"', 'El cliente las devuelve']] },
@@ -77,6 +80,7 @@ const MODULES = [
id: 'm4', n: 4, cap: 'm4', icon: 'signpost', mins: 20,
title: 'DNS: la guía de teléfonos', sub: 'Consultas, respuestas, tipos de registro y NXDOMAIN',
badge: 'Rastreador de nombres',
+ title_en: 'DNS: the phone book', sub_en: 'Queries, answers, record types and NXDOMAIN', badge_en: 'Name tracker',
intro: 'Antes de visitar una web, el equipo pregunta su IP al DNS. Esa conversación cuenta mucho: qué servicios existen, dónde están alojados y qué nombres no existen.',
lessons: [
{ h: 'Pregunta y respuesta', p: ['DNS suele ir por **UDP al puerto 53**. El cliente pregunta («¿qué IP tiene www.ewpt.local?») y el servidor responde con el mismo **ID de transacción**, así se emparejan.', '`dns.flags.response == 0` son preguntas y `== 1` respuestas. El nombre preguntado está en `dns.qry.name`.'], try: [['dns.flags.response == 0', 'Solo preguntas'], ['dns.qry.name contains "ewpt"', 'Nombres del laboratorio']] },
@@ -96,6 +100,7 @@ const MODULES = [
id: 'm5', n: 5, cap: 'm5', icon: 'lock', mins: 25,
title: 'TLS: lo que el cifrado deja ver', sub: 'Client Hello, SNI, ALPN, TLS 1.3 y HTTP sin cifrar',
badge: 'Ojo de cerradura',
+ title_en: 'TLS: what encryption still shows', sub_en: 'Client Hello, SNI, ALPN, TLS 1.3 and unencrypted HTTP', badge_en: 'Keyhole eye',
intro: 'Kali abre dos webs por HTTPS y, por despiste, envía un login por HTTP normal. Vas a comprobar qué esconde TLS y qué no.',
lessons: [
{ h: 'El saludo TLS', p: ['Tras el saludo TCP llega el saludo TLS. El cliente envía **Client Hello** (versiones y cifrados que acepta, y el nombre del sitio) y el servidor responde **Server Hello** con lo elegido. En TLS 1.3, casi todo lo que viene después ya va cifrado.', 'El tipo de mensaje está en `tls.handshake.type`: 1 es Client Hello y 2 Server Hello.'], try: [['tls.handshake.type == 1', 'Client Hello'], ['tls.handshake.type == 2', 'Server Hello']] },
@@ -116,6 +121,7 @@ const MODULES = [
id: 'm6', n: 6, cap: 'm6', icon: 'swords', mins: 40,
title: 'Ataques web en el tráfico', sub: 'Escaneo SYN, fuerza bruta de directorios y de login, SQLi y XSS',
badge: 'Ojo de halcón',
+ title_en: 'Web attacks on the wire', sub_en: 'SYN scan, directory and login brute force, SQLi and XSS', badge_en: 'Hawk eye',
intro: 'Desde Kali alguien escanea el servidor, busca directorios ocultos, prueba contraseñas en bucle e inyecta SQL y JavaScript. Todo queda en la captura; aprende a reconocer cada firma.',
lessons: [
{ h: 'Escaneo SYN (nmap -sS)', p: ['El atacante envía un **SYN** a muchos puertos desde el **mismo puerto de origen** y con ventana pequeña (1024). Si responde **SYN, ACK**, el puerto está abierto y el atacante corta enseguida con **RST** (por eso se llama «medio abierto»). Si responde **RST, ACK**, está cerrado.', 'Para ver los puertos abiertos: `tcp.flags.syn==1 && tcp.flags.ack==1 && tcp.srcport < 1024`. Y en Estadísticas → Conversaciones verás decenas de conversaciones de 2 paquetes.'], try: [['tcp.flags.syn==1 && tcp.flags.ack==0 && tcp.window_size_value == 1024', 'Los SYN del escaneo'], ['tcp.flags.syn==1 && tcp.flags.ack==1 && tcp.srcport < 1024', 'Puertos que dicen «abierto»']] },
@@ -142,6 +148,7 @@ const MODULES = [
id: 'm7', n: 7, cap: 'm7', icon: 'network', mins: 25, extra: true,
title: 'Directorio Activo: Kerberos, SMB y NTLM', sub: 'Tickets, SPN, RC4 y autenticación NTLM sobre SMB',
badge: 'Guardián del dominio',
+ title_en: 'Active Directory: Kerberos, SMB and NTLM', sub_en: 'Tickets, SPNs, RC4 and NTLM authentication over SMB', badge_en: 'Domain guardian',
intro: 'En el dominio MEGACORP.LOCAL, un usuario pide tickets Kerberos y un equipo intruso se autentica por SMB con NTLM contra el controlador de dominio.',
lessons: [
{ h: 'Kerberos en cuatro mensajes', p: ['**AS-REQ / AS-REP**: el usuario pide al controlador de dominio su TGT (el «pase general»). **TGS-REQ / TGS-REP**: con el TGT pide tickets para servicios concretos, identificados por su **SPN** (por ejemplo `cifs/DC01.megacorp.local`).', 'Campos útiles: `kerberos.CNameString` (usuario), `kerberos.SNameString` (servicio), `kerberos.realm` (dominio) y `kerberos.etype` (cifrado).'], try: [['kerberos', 'Todo Kerberos'], ['kerberos.msg_type == 13', 'Tickets de servicio (TGS-REP)']] },
@@ -160,6 +167,7 @@ const MODULES = [
id: 'm8', n: 8, cap: 'm8', icon: 'radar', mins: 25, extra: true,
title: 'Caza en el SOC', sub: 'ARP spoofing, beacons de C2 y exfiltración por DNS',
badge: 'Cazador del SOC',
+ title_en: 'SOC hunting', sub_en: 'ARP spoofing, C2 beacons and DNS exfiltration', badge_en: 'SOC hunter',
intro: 'Un analista del SOC recibe esta captura de la estación WS-0412 (192.168.56.40). Hay tres cosas raras. Encuéntralas.',
lessons: [
{ h: 'ARP spoofing', p: ['ARP traduce IP a MAC y no tiene autenticación. Un atacante puede gritar «la puerta de enlace soy yo» con respuestas ARP no pedidas y ponerse en medio (MITM).', 'Señal: varias respuestas ARP para la **misma IP con otra MAC**. Wireshark lo marca como «duplicate IP address».'], try: [['arp.opcode == 2', 'Respuestas ARP'], ['arp.src.proto_ipv4 == 192.168.56.1', 'Quién dice ser la puerta de enlace']] },
diff --git a/src/content/reference.js b/src/content/reference.js
index 8d63223..eebeb93 100644
--- a/src/content/reference.js
+++ b/src/content/reference.js
@@ -1,6 +1,6 @@
/* Megalodon · chuleta de filtros y glosario. */
const CHEATS = [
- { h: 'Lo básico', items: [
+ { h: 'Lo básico', h_en: 'The basics', items: [
['tcp', 'Solo TCP (escribe el nombre de cualquier protocolo: udp, dns, http, tls, arp…)'],
['!arp', 'Todo menos ARP (también vale «not arp»)'],
['ip.addr == 192.168.56.20', 'Paquetes donde esa IP es origen o destino'],
@@ -31,7 +31,7 @@ const CHEATS = [
['http.authbasic', 'Credenciales Basic decodificadas'],
['urlencoded-form', 'Formularios enviados por POST'],
] },
- { h: 'DNS, TLS y más', items: [
+ { h: 'DNS, TLS y más', h_en: 'DNS, TLS and more', items: [
['dns.qry.name contains "ewpt"', 'Consultas a un dominio'],
['dns.flags.rcode == 3', 'Nombres que no existen (NXDOMAIN)'],
['len(dns.qry.name) > 30', 'Nombres larguísimos (posible exfiltración)'],
@@ -41,7 +41,7 @@ const CHEATS = [
['kerberos.etype == 23', 'Tickets Kerberos con RC4'],
['ntlmssp.auth.username', 'Usuarios que se autentican por NTLM'],
] },
- { h: 'Operadores', items: [
+ { h: 'Operadores', h_en: 'Operators', items: [
['== != > < >= <=', 'Comparar (también eq, ne, gt, lt, ge, le)'],
['&& || !', 'Y, o, no (también and, or, not)'],
['http.host contains "admin"', 'contains: contiene ese texto (distingue mayúsculas)'],
diff --git a/src/index.html b/src/index.html
index a161445..6383efe 100644
--- a/src/index.html
+++ b/src/index.html
@@ -14,8 +14,14 @@
</head>
<body>
<a class="skip" href="#main" id="skip">Saltar al contenido</a>
-<header id="top" class="top"></header>
-<main id="main" tabindex="-1"></main>
+<div class="app">
+ <aside id="side" class="side"></aside>
+ <div class="col">
+ <header id="top" class="top"></header>
+ <main id="main" tabindex="-1"></main>
+ </div>
+</div>
+<nav id="tabbar" class="tabbar"></nav>
<dialog id="dlg" class="dlg"></dialog>
<div id="toasts" class="toasts" role="status" aria-live="polite"></div>
<noscript><p class="noscript">Megalodon necesita JavaScript. Todo funciona en tu navegador, sin conexión.</p></noscript>
diff --git a/src/styles.css b/src/styles.css
index 593bc3c..c17783c 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -642,3 +642,112 @@ li[aria-level='1'] > .tn .tl { font-weight: 650; font-family: var(--font-sans);
.tbl.ex td.mono { word-break: normal; overflow-wrap: anywhere; min-width: 14ch; }
.tbl.ex th:nth-child(3), .tbl.ex td:nth-child(3) { display: none; } /* el protocolo ya va en el mensaje */
}
+
+/* ========== Armazón 1.3: barra lateral plegable, barra superior flotante y pestañas en el móvil ==========
+ Mismo lenguaje que BlueJr y RiskManager-Jr. Movimiento: muelle sin rebote al plegar, indicador que se desliza,
+ :active a 0,97 y entrada escalonada solo en la primera carga. Con movimiento reducido, sin desplazamientos. */
+:root { --top-h: 80px; --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); --hair: rgb(255 255 255 / 0.07); --hair-2: rgb(255 255 255 / 0.12); --sidebar: rgb(18 21 27 / 0.92); --tint: rgb(108 178 255 / 0.12); }
+[data-theme='light'] { --hair: rgb(15 23 42 / 0.08); --hair-2: rgb(15 23 42 / 0.13); --sidebar: rgb(255 255 255 / 0.94); --tint: rgb(20 63 148 / 0.08); }
+.app { --sw: 264px; display: grid; grid-template-columns: calc(var(--sw) + 12px) minmax(0, 1fr); min-height: 100dvh; transition: grid-template-columns 320ms var(--ease-drawer); }
+body.side-mini .app { --sw: 68px; }
+.col { min-width: 0; padding: 0 16px 40px; }
+
+/* Lateral */
+.side { --w: var(--sw); position: sticky; top: 0; z-index: 35; height: 100dvh; width: calc(var(--w) + 12px); padding: 12px 0 12px 12px; display: flex; flex-direction: column; overflow: hidden; transition: width 320ms var(--ease-drawer); }
+.side::before { content: ''; position: absolute; inset: 12px 0 12px 12px; z-index: -1; border-radius: 24px; background: var(--sidebar); box-shadow: 0 0 0 1px var(--hair), var(--sh-panel); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); transition: box-shadow 320ms var(--ease-out); }
+.side > * { width: var(--w); transition: width 320ms var(--ease-drawer); }
+body.side-mini .side:is(:hover, :focus-within) { --w: 264px; }
+body.side-mini .side:is(:hover, :focus-within)::before { box-shadow: 0 0 0 1px var(--hair), var(--sh-overlay); }
+body.side-mini .side :is(.txt, .cnt, .brand-txt, .lvl-txt) { opacity: 0; transition: opacity 140ms var(--ease-out); }
+body.side-mini .side:is(:hover, :focus-within) :is(.txt, .cnt, .brand-txt, .lvl-txt) { opacity: 1; transition-delay: 90ms; }
+.side-brand { display: flex; align-items: center; gap: 12px; padding: 18px 15px 12px; color: var(--ink); text-decoration: none; white-space: nowrap; }
+.side-brand .logo, .brand-m .logo { width: 38px; height: 38px; border-radius: 12px; flex: none; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #1fd38a)); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
+.brand-txt { display: grid; min-width: 0; }
+.brand-txt b { font-size: 17px; font-weight: 720; letter-spacing: -0.02em; }
+.brand-txt small { font: 500 11px/1.3 var(--font-mono); letter-spacing: 0.06em; color: var(--ink-3); text-transform: uppercase; }
+.side-nav { position: relative; flex: 1; padding: 6px 10px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
+.side-nav ul { list-style: none; margin: 2px 0 6px; padding: 0; }
+.side-ind { position: absolute; left: 10px; right: 10px; top: 0; height: 40px; border-radius: 12px; background: var(--tint); opacity: 0; pointer-events: none; transition: transform 340ms var(--ease-out), height 340ms var(--ease-out), opacity 200ms; }
+.side-ind::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
+.side-nav a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 8px 12px; border-radius: 12px; color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: 14.5px; white-space: nowrap; transition: background-color 180ms var(--ease-out), color 180ms var(--ease-out), transform 140ms var(--ease-out); }
+.side-nav a:active { transform: scale(0.97); }
+.side-nav a[aria-current='page'] { color: var(--ink); }
+.side-nav a[aria-current='page'] > .i { color: var(--accent); }
+.side-nav a.sub { min-height: 36px; padding-left: 13px; font-size: 13.5px; font-weight: 500; }
+.side-nav .txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
+.side-nav .cnt { font: 500 12px var(--font-mono); color: var(--ink-3); }
+.dotn { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 7px; border: 1.5px solid var(--ink-4); transition: transform 220ms var(--ease-out); }
+.dotn b { font: 600 11px var(--font-mono); color: var(--ink-2); }
+.dotn.mid { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
+.dotn.ok { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, transparent); }
+@media (hover: hover) and (pointer: fine) {
+ .side-nav a:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); color: var(--ink); }
+ .side-nav a:hover .dotn { transform: scale(1.12); }
+}
+body.ready .side-nav > a, body.ready .side-nav li { animation: none; }
+.side-nav > a, .side-nav li { animation: side-in 300ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 25ms + 40ms); }
+@keyframes side-in { from { opacity: 0; transform: translateX(-8px); } }
+.side-foot { padding: 12px 10px 14px; border-top: 1px solid var(--hair); }
+.lvl { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 12px; color: var(--ink); text-decoration: none; white-space: nowrap; transition: background-color 160ms var(--ease-out); }
+.lvl:active { transform: scale(0.98); }
+.lvl-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 11px; background: var(--ok-soft); color: var(--ok); }
+.lvl-txt { display: grid; gap: 6px; min-width: 0; flex: 1; font-size: 13px; }
+.lvl-txt b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
+.lvl.bump .lvl-ic { animation: bump 0.45s var(--spring); }
+@media (hover: hover) and (pointer: fine) { .lvl:hover { background: var(--surface-2); } }
+
+/* Barra superior flotante */
+.top { position: sticky; top: 0; z-index: 30; padding-top: 12px; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
+.top-in { display: flex; align-items: center; gap: 8px; height: auto; min-height: 56px; width: 100%; padding: 8px 10px; border-radius: 999px; background: var(--glass); box-shadow: 0 0 0 1px var(--hair), var(--sh-panel); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
+.top-in > :not(.grow) { flex-shrink: 0; }
+.top .ibtn { border-radius: 50%; width: 40px; height: 40px; }
+.brand-m { display: none; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 720; letter-spacing: -0.02em; }
+.brand-m .logo { width: 32px; height: 32px; border-radius: 10px; }
+.top .search-btn { min-width: 230px; width: auto; height: 40px; padding: 0 8px 0 14px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair-2); justify-content: flex-start; color: var(--ink-3); }
+.top .search-btn .sb-t { flex: 1; text-align: left; display: inline; }
+.top .search-btn kbd { display: inline-block; }
+@media (hover: hover) and (pointer: fine) { .top .search-btn:hover { box-shadow: inset 0 0 0 1px var(--accent); } }
+/* Interruptores del mismo tamaño: 80 × 40, relleno 3 y dos huecos de 36 × 32 */
+.lang-sw { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); }
+.lang-sw button { min-width: 36px; height: 32px; border: 0; border-radius: 999px; background: none; color: var(--ink-3); font: 650 12px var(--font-mono); transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), box-shadow 200ms var(--ease-out); }
+.lang-sw button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--hair-2), var(--sh-raise); }
+.lang-sw button:active { transform: scale(0.94); }
+.theme-sw { position: relative; display: inline-flex; width: 80px; height: 40px; padding: 3px; border: 0; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--hair); cursor: pointer; }
+.theme-sw .track { position: relative; z-index: 1; display: grid; grid-template-columns: 36px 36px; width: 100%; height: 100%; place-items: center; color: var(--ink-3); pointer-events: none; }
+.theme-sw .track .i { width: 15px; height: 15px; transition: color 200ms var(--ease-out); }
+.theme-sw[aria-checked='false'] .track .i:first-child, .theme-sw[aria-checked='true'] .track .i:last-child { color: var(--ink); }
+.theme-sw .knob { position: absolute; top: 3px; left: 3px; width: 36px; height: 34px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--hair-2), var(--sh-raise); transition: transform 280ms var(--ease-out); }
+.theme-sw[aria-checked='true'] .knob { transform: translateX(38px); }
+.theme-sw:active .knob { width: 40px; }
+.theme-sw[aria-checked='true']:active .knob { transform: translateX(34px); }
+
+/* Pestañas del móvil */
+.tabbar { display: none; }
+.more-list { display: grid; gap: 4px; }
+.more-list a, .more-list button { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border: 0; border-radius: 14px; background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 550; text-decoration: none; text-align: left; }
+.more-list span { flex: 1; }
+.more-list a:active, .more-list button:active { transform: scale(0.98); }
+
+.hero { border-radius: 24px; margin-top: 14px; }
+html { scroll-padding-top: calc(var(--top-h) + 16px); }
+
+@media (max-width: 1100px) { .top .search-btn { min-width: 0; width: 40px; padding: 0; justify-content: center; } .top .search-btn .sb-t, .top .search-btn kbd { display: none; } }
+@media (max-width: 900px) {
+ .app, body.side-mini .app { grid-template-columns: minmax(0, 1fr); }
+ .side, .only-desk { display: none !important; }
+ .brand-m { display: inline-flex; }
+ .col { padding: 0 max(12px, env(safe-area-inset-left)) calc(96px + env(safe-area-inset-bottom)); }
+ .top .search-btn { background: none; box-shadow: none; color: var(--ink-2); }
+ .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40; padding: 6px; border-radius: 24px; background: var(--glass-thick); box-shadow: 0 0 0 1px var(--hair), var(--sh-overlay); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); }
+ .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 2px; min-height: 48px; padding: 7px 2px 5px; border: 0; border-radius: 18px; background: none; color: var(--ink-2); text-decoration: none; font: inherit; font-size: 11px; font-weight: 550; transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out), transform 140ms var(--ease-out); }
+ .tabbar a:active, .tabbar button:active { transform: scale(0.94); }
+ .tabbar [aria-current='page'] { background: var(--tint); color: var(--ink); }
+ .tabbar [aria-current='page'] .i { color: var(--accent); }
+ .toasts { bottom: calc(96px + env(safe-area-inset-bottom)); }
+ .hero { margin-inline: -12px; border-radius: 0 0 24px 24px; margin-top: 10px; }
+}
+@media (max-width: 420px) { .brand-m b { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } .top-in { gap: 4px; padding: 6px 8px; } }
+@media (prefers-reduced-motion: reduce) {
+ .app, .side, .side > *, .side-ind, .theme-sw .knob { transition: none !important; }
+ .side-nav > a, .side-nav li { animation: none; }
+}
diff --git a/tests/e2e.mjs b/tests/e2e.mjs
index 06dcbcc..9d75012 100644
--- a/tests/e2e.mjs
+++ b/tests/e2e.mjs
@@ -186,6 +186,93 @@ await t('buscar (Ctrl F) por hex, ir al paquete (Ctrl G), formato de tiempo y fl
await p.close2();
});
+await t('armazón: lateral plegable con [, carril que se despliega al pasar el ratón y estado guardado', async () => {
+ const p = await page(browser, { hash: '#/m/m2' });
+ const w = () => p.$eval('#side', el => Math.round(el.getBoundingClientRect().width));
+ const open = await w();
+ assert(open > 200, `abierto ${open}`);
+ assert(await p.getAttribute('.side-nav [data-mod="m2"]', 'aria-current') === 'page', 'm2 activo en el lateral');
+ assert(await p.$eval('.side-ind', el => getComputedStyle(el).opacity) === '1', 'indicador visible');
+ await p.keyboard.press('[');
+ await p.waitForTimeout(450);
+ assert(await p.evaluate(() => document.body.classList.contains('side-mini')), 'clase side-mini');
+ assert(await p.getAttribute('[data-side]', 'aria-expanded') === 'false', 'aria-expanded false');
+ const rail = await p.$eval('.app', el => parseFloat(getComputedStyle(el).gridTemplateColumns));
+ assert(rail < 100, `carril ${rail}`);
+ await p.hover('.side-nav [data-nav="lab"]');
+ await p.waitForTimeout(450);
+ assert(await p.$eval('.side-nav [data-nav="lab"] .txt', el => +getComputedStyle(el).opacity) > 0.9, 'etiquetas visibles al pasar el ratón');
+ await p.mouse.move(900, 400);
+ await p.reload(); await p.waitForSelector('#main h1');
+ assert(await p.evaluate(() => document.body.classList.contains('side-mini')), 'plegado se recuerda');
+ await p.click('[data-side]'); await p.waitForTimeout(400);
+ assert(!(await p.evaluate(() => document.body.classList.contains('side-mini'))), 'se vuelve a abrir con el botón');
+ await p.click('.side-nav [data-nav="lab"]'); await p.waitForSelector('.lab');
+ assert(await p.getAttribute('.side-nav [data-nav="lab"]', 'aria-current') === 'page', 'lab activo');
+ assert(!p.errors.length, p.errors.join(' | '));
+ await p.close2();
+});
+
+await t('idioma: el interruptor ES|EN cambia toda la interfaz y se recuerda', async () => {
+ const p = await page(browser, { hash: '#/m/m3' });
+ await p.click('[data-lang="en"]');
+ await p.waitForFunction(() => document.documentElement.lang === 'en');
+ assert(await p.getAttribute('[data-lang="en"]', 'aria-pressed') === 'true', 'EN pulsado');
+ assert(/Cookies and cleartext credentials/.test(await p.textContent('#main h1')), 'título del módulo en inglés');
+ assert(/Challenges/.test(await p.textContent('#tab-tasks')), 'pestaña Retos → Challenges');
+ assert(/Modules/.test(await p.textContent('.side-nav [data-nav="modules"]')), 'lateral en inglés');
+ assert(/Lessons and challenges are written in Spanish/.test(await p.textContent('#pan-lesson')), 'aviso honesto de lecciones en español');
+ assert(/Wireshark lab/.test(await p.title()), 'título del documento');
+ await p.fill('.finput', 'ip.src = 1');
+ await p.waitForFunction(() => /A single “=” is not valid/.test(document.querySelector('.fmsg').textContent));
+ await p.click('[data-stats]'); await p.waitForTimeout(250);
+ assert(/Packets/.test(await p.textContent('.dlg thead')), 'cabeceras de estadísticas');
+ await p.keyboard.press('Escape'); await p.waitForTimeout(250);
+ await p.goto(URL0 + '#/'); await p.reload(); await p.waitForSelector('#main h1');
+ assert(/Start with module 1|Continue/.test(await p.textContent('.hero .cta')), 'inicio en inglés tras recargar');
+ assert(/Shark pup/.test(await p.textContent('.lvl')), 'nivel en inglés');
+ await p.click('[data-lang="es"]');
+ await p.waitForFunction(() => document.documentElement.lang === 'es');
+ assert(/Empezar por el módulo 1|Continuar/.test(await p.textContent('.hero .cta')), 'vuelta al español');
+ assert(!p.errors.length, p.errors.join(' | '));
+ await p.close2();
+});
+
+await t('tema: el interruptor claro|oscuro es un role=switch y cambia data-theme', async () => {
+ const p = await page(browser, { theme: 'dark', hash: '#/chuleta' });
+ const sw = '[data-theme-btn]';
+ assert(await p.getAttribute(sw, 'role') === 'switch', 'role switch');
+ assert(await p.getAttribute(sw, 'aria-checked') === 'true', 'oscuro marcado');
+ await p.click(sw);
+ await p.waitForFunction(() => document.documentElement.dataset.theme === 'light');
+ assert(await p.getAttribute(sw, 'aria-checked') === 'false', 'claro desmarcado');
+ await p.keyboard.press('Shift+T');
+ await p.waitForFunction(() => document.documentElement.dataset.theme === 'dark');
+ assert(!p.errors.length, p.errors.join(' | '));
+ await p.close2();
+});
+
+await t('móvil: sin lateral, barra de pestañas abajo y hoja «Más» con glosario, ajustes, ayuda y atajos', async () => {
+ const p = await page(browser, { viewport: { width: 390, height: 844 }, hash: '#/m/m1' });
+ assert(await p.$eval('#side', el => getComputedStyle(el).display) === 'none', 'lateral oculto');
+ const tb = await p.$eval('#tabbar', el => { const r = el.getBoundingClientRect(); return { d: getComputedStyle(el).display, b: Math.round(r.bottom), n: el.children.length }; });
+ assert(tb.d !== 'none' && tb.b >= 820 && tb.b <= 844 && tb.n === 5, `tab bar ${JSON.stringify(tb)}`);
+ assert(await p.getAttribute('#tabbar [data-nav="modules"]', 'aria-current') === 'page', 'Módulos activo en el módulo');
+ assert(await p.evaluate(() => document.documentElement.scrollWidth) <= 390, 'sin scroll horizontal');
+ await p.click('#tabbar [data-nav="lab"]'); await p.waitForSelector('.lab');
+ assert(await p.getAttribute('#tabbar [data-nav="lab"]', 'aria-current') === 'page', 'Lab activo');
+ await p.click('[data-more]'); await p.waitForSelector('.more-list');
+ assert((await p.$$('.more-list > *')).length === 4, 'cuatro entradas');
+ await p.click('.more-list [data-a="settings"]');
+ await p.waitForFunction(() => /Ajustes/.test(document.querySelector('#dlg h2')?.textContent || ''));
+ await p.keyboard.press('Escape'); await p.waitForTimeout(300);
+ await p.click('[data-more]'); await p.waitForSelector('.more-list');
+ await p.click('.more-list [data-go]'); await p.waitForSelector('.gl');
+ assert(!(await p.evaluate(() => document.querySelector('#dlg').open)), 'la hoja se cierra al navegar');
+ assert(!p.errors.length, p.errors.join(' | '));
+ await p.close2();
+});
+
await t('curso completo: los 58 retos se resuelven desde la interfaz y se ganan las 8 insignias', async () => {
const p = await page(browser, { hash: '#/modulos' });
const mods = await p.evaluate(() => MODULES.map(m => ({ id: m.id, tasks: m.tasks.map(x => ({ id: x.id, type: x.type, ref: x.ref, match: x.match, ans: x.ans })) })));
@@ -228,6 +315,17 @@ for (const theme of ['dark', 'light']) await t(`axe 0 infracciones en los diálo
} finally { await p.close2(); }
});
+await t('axe 0 infracciones · lateral plegado, inglés y hoja «Más»', async () => {
+ const p = await page(browser, { hash: '#/m/m1', axe: true });
+ try {
+ await p.keyboard.press('['); await p.waitForTimeout(450); await axe(p, 'lateral plegado');
+ await p.click('[data-lang="en"]'); await p.waitForTimeout(300); await axe(p, 'inglés');
+ await p.click('[data-theme-btn]'); await p.waitForTimeout(400); await axe(p, 'inglés claro');
+ } finally { await p.close2(); }
+ const m = await page(browser, { viewport: { width: 390, height: 844 }, theme: 'light', hash: '#/lab', axe: true });
+ try { await m.click('[data-more]'); await m.waitForSelector('.more-list'); await m.waitForTimeout(350); await axe(m, 'hoja Más'); } finally { await m.close2(); }
+});
+
for (const [w, h] of [[1280, 800], [390, 844]]) for (const theme of ['dark', 'light']) {
await t(`axe 0 infracciones · ${w} px · ${theme === 'dark' ? 'oscuro' : 'claro'}`, async () => {
for (const hash of ['', '#/modulos', '#/m/m1', '#/lab', '#/chuleta', '#/glosario']) {
diff --git a/tests/i18n.test.mjs b/tests/i18n.test.mjs
new file mode 100644
index 0000000..305bd6a
--- /dev/null
+++ b/tests/i18n.test.mjs
@@ -0,0 +1,53 @@
+// Interfaz en inglés: los mensajes de error del motor de filtros (en español) se traducen todos,
+// y las claves de STRINGS existen en los dos idiomas.
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { readFileSync } from 'node:fs';
+import { loadEngine } from './load.mjs';
+
+const E = loadEngine();
+const ws = readFileSync(new URL('../src/app/30-workspace.js', import.meta.url), 'utf8');
+const fErr = new Function('LANG', ws.slice(ws.indexOf('const FERR_EN'), ws.indexOf('const treeKey')) + '; return fErr;')('en');
+const SPANISH = /[áéíóúñ¿«»]|\b(falta|el|la|del|para|campo|valor|se esperaba|no es|termina|conjunto|vale)\b/i;
+
+const BAD = ['ip.src = 1', 'tcp.port | 80', 'ip.addr == 999.1.1.1', 'tcp.port == abc', 'htp', 'tcp.flg == 2', 'tcp.port in {80 443}', 'tcp.port in {}',
+ 'http == 1', 'tcp.port == 80 http', 'tcp.port contains "a"', '(tcp', 'ip.src ==', 'eth.addr == zz', 'http.host matches "("', 'http.host == "abc',
+ '&& tcp', 'len(tcp', 'len(tcp.len', 'tcp.port in 80', 'tcp.port #', 'http contains', 'http.host matches 1'];
+
+test('cada error del filtro tiene traducción inglesa', () => {
+ const seen = new Set();
+ for (const f of BAD) {
+ const r = E.parseFilter(f);
+ assert.equal(r.ok, false, `«${f}» debería ser inválido`);
+ const en = fErr(r.error);
+ assert.ok(!SPANISH.test(en), `sin traducir: «${f}» → ${r.error} → ${en}`);
+ seen.add(r.error.replace(/«[^»]*»/g, '«»'));
+ }
+ assert.ok(seen.size >= 15, `solo ${seen.size} mensajes distintos cubiertos`);
+});
+
+test('en español los mensajes no cambian', () => {
+ const fEs = new Function('LANG', ws.slice(ws.indexOf('const FERR_EN'), ws.indexOf('const treeKey')) + '; return fErr;')('es');
+ const r = E.parseFilter('ip.src = 1');
+ assert.equal(fEs(r.error), r.error);
+});
+
+test('STRINGS tiene las mismas claves en es y en', () => {
+ const src = readFileSync(new URL('../src/app/05-i18n.js', import.meta.url), 'utf8');
+ const STRINGS = new Function(src.slice(0, src.indexOf('let LANG')) + '; return STRINGS;')();
+ assert.deepEqual(Object.keys(STRINGS.en).sort(), Object.keys(STRINGS.es).sort());
+});
+
+test('cada módulo tiene título, subtítulo e insignia en inglés', () => {
+ for (const m of E.MODULES) for (const k of ['title_en', 'sub_en', 'badge_en']) assert.ok(m[k] && !/[áéíóúñ]/.test(m[k]), `${m.id}.${k}`);
+});
+
+test('el árbol de detalle en inglés no deja etiquetas en español en ningún paquete', () => {
+ const treeLabel = new Function('LANG', ws.slice(ws.indexOf('const TREE_EN'), ws.indexOf('const treeKey')) + '; return treeLabel;')('en');
+ const ES_TREE = /[áéíóúñ]|\b(de|del|la|el|los|bytes en|capturados|longitud|puerto|número|ventana|tipo|origen|destino|orden|petición|respuesta|cuerpo|usuario|equipo|dominio|opción|cabecera|relativo|bruto|segundos|multiplicar|ninguno|otro|desconocido)\b/i;
+ const bad = new Set(); let n = 0;
+ const walk = nodes => nodes.forEach(x => { n++; const en = treeLabel(x.label); if (!/\\r\\n$/.test(x.label) && ES_TREE.test(en.replace(/"[^"]*"|: .*$/, ''))) bad.add(en.replace(/\d+/g, 'N')); walk(x.kids); });
+ for (const k of Object.keys(E.SCENARIOS)) E.dissectAll(E.SCENARIOS[k]()).pkts.forEach(p => walk(p.tree));
+ assert.ok(n > 5000, `solo ${n} nodos`);
+ assert.deepEqual([...bad].slice(0, 40), []);
+});