Plataforma empresarial de Inteligencia Geoespacial y Ciberseguridad para Infraestructuras Críticas.
Enterprise-grade Geo-Risk & Cyber-Intelligence System for Critical Infrastructures.
https://github.com/Niltra/EnergySec/raw/main/demostracion_final.mp4
En la era de la ciberseguridad industrial y la transición energética, gestionar datos masivos en tiempo real es vital. EnergySec ingesta miles de métricas energéticas, las procesa mediante un motor de Inteligencia Artificial para detectar anomalías de consumo o voltaje, y cruza las coordenadas exactas de las infraestructuras con alertas públicas (ej. Accidentes de Tráfico de la DGT) mediante su Motor Geo-Riesgo.
¿El verdadero valor comercial y de seguridad? Un sistema de Ciberseguridad en Tiempo Real basado en Aspectos (AOP) que ofusca y censura automáticamente los datos financieros y catastrales confidenciales dependiendo del nivel de autorización del empleado, previniendo fugas de información interna (Data Leaks) sin penalizar el rendimiento del código.
Hemos protegido la lógica de negocio a toda costa. El núcleo (Core Domain) de Java es completamente agnóstico al framework. Interactúa con el mundo exterior (Bases de Datos PostgreSQL, Microservicio Python ML, y APIs REST) de forma exclusiva a través de Puertos (Interfaces) y Adaptadores estrictamente definidos.
El sistema está diseñado para escalar de forma masiva. Al utilizar Virtual Threads de Java 21, el backend Spring Boot puede levantar decenas de miles de hilos asíncronos concurrentes con un impacto en memoria insignificante. Combinado con la agrupación masiva de persistencia (Hibernate Batching optimizado en bloques de 100) y un filtro defensivo de peticiones (Bucket4j Rate Limiting por Tokens), la API está completamente blindada contra cuellos de botella y ataques de Denegación de Servicio (DDoS).
Nuestra joya de la corona. En lugar de dispersar sentencias condicionales if (user.isAdmin()) por todo el código, desarrollamos un Security Aspect (AOP) dinámico. Este aspecto intercepta los objetos JSON de respuesta justo antes de que abandonen el servidor backend. Si el hilo virtual determina que el JWT del usuario carece de los privilegios adecuados, los datos críticos (CIF/NIF de empresas, valores monetarios en euros, y coordenadas geográficas exactas) son ofuscados instantáneamente (ej. 1.250.000 € se transforma en [CONFIDENCIAL]).
Un microservicio aislado escrito en Python 3.11 (FastAPI) que consume las lecturas de la red eléctrica y aplica el algoritmo de Machine Learning Isolation Forest (Scikit-Learn). Identifica picos de tensión antinaturales o caídas de demanda en microsegundos, y se comunica con el ecosistema Java de vuelta mediante un cortacircuitos resiliente (Resilience4j Circuit Breaker), lo que previene que la caída de la IA afecte a la infraestructura global (prevención de Alert Fatigue).
Monitorizamos el corazón del sistema en vivo usando Spring Boot Actuator en conjunto con un recolector de métricas que alimenta un contenedor Prometheus. Estos datos (uso de hilos, pools de conexiones HikariCP, latencias HTTP) se visualizan en un dashboard empresarial mediante Grafana.
Para que cualquier persona pueda clonar y arrancar el ecosistema en 1 minuto sin configurar variables de entorno, hemos preparado unos scripts de auto-arranque que generan secretos locales de un solo uso y levantan los contenedores automáticamente.
- Tener instalado Git.
- Tener instalado y en ejecución Docker Desktop.
Abre tu terminal y ejecuta:
git clone https://github.com/Niltra/EnergySec.git
cd EnergySecEn Windows 🪟:
Simplemente haz doble clic en el archivo start.bat que está dentro de la carpeta clonada, o ejecútalo en tu terminal:
start.batEn Linux / Mac 🍎🐧: Ejecuta el script de bash desde la terminal:
chmod +x start.sh
./start.shEl script se encargará de crear la carpeta secrets/ localmente, rellenarla con credenciales seguras de un solo uso, y levantar la base de datos PostgreSQL, el backend Java, el motor Python y el panel Grafana.
- 💻 Frontend Interactivo (Mapa UI): Abre el archivo
frontend/index.htmlen tu navegador con doble clic para probar el AOP de enmascaramiento de datos en tiempo real sobre el mapa de España. - 📖 Swagger UI (Documentación de API): http://localhost:8080/swagger-ui.html
- 📊 Grafana Dashboards: http://localhost:3000 (Usuario:
admin/ Contraseña:admin) - 🔎 Métricas Prometheus: http://localhost:9090
In an era where energy infrastructure and cyber warfare are critical, managing massive real-time data while ensuring national security is paramount. EnergySec ingests thousands of metrics per minute from public grids, processes them through an AI Engine to detect voltage/consumption anomalies, and uses a mathematical Geo-Risk Engine to cross-reference precise infrastructural coordinates with external public alerts (e.g. Traffic Accidents).
But most importantly, its true business value lies in a real-time Aspect-Oriented Programming (AOP) Cybersecurity System that dynamically obfuscates confidential financial and cadastre data based on the employee's authorization level, preventing internal data leaks without any performance penalties.
We protect the domain logic at all costs. The Java Core Domain is completely framework-agnostic, interacting with the outside world (PostgreSQL Databases, Python ML Microservices, REST APIs) exclusively through strictly defined Ports and Adapters.
Designed for massive scale. By leveraging Java 21 Virtual Threads, the Spring Boot backend can spawn tens of thousands of concurrent non-blocking threads with a negligible memory footprint. Combined with bulk persistence optimization (Hibernate Batching) and a defensive IP request filter (Bucket4j Token-based Rate Limiting), the API is fully shielded against DDoS attacks and database bottlenecks.
Our crown jewel. Instead of scattering if(user.isAdmin()) checks throughout the codebase, we developed a dynamic Security Aspect (AOP). It intercepts JSON responses right before they leave the backend server. If the virtual thread determines the user's JWT lacks sufficient clearance, critical data (Company CIFs, monetary values, exact GPS coordinates) is instantly obfuscated (e.g. 1.2M € becomes [CONFIDENTIAL]).
An isolated Python 3.11 microservice that consumes the electrical grid readings and applies Scikit-Learn's Isolation Forest algorithm to flag sudden drops or unnatural peaks in energy consumption in microseconds. It communicates back to the Java ecosystem via a resilient Resilience4j Circuit Breaker, preventing an AI outage from cascading into a global infrastructure failure (preventing Alert Fatigue).
We monitor the system's heartbeat live using Spring Boot Actuator combined with a metrics scraper that feeds a Prometheus container. This data (thread usage, HikariCP connection pools, HTTP latencies) is visualized on an enterprise dashboard via Grafana.
To make it incredibly easy for anyone to clone and spin up the ecosystem in 1 minute without setting up complex environment variables, we've provided auto-start scripts that generate local dummy secrets and orchestrate all containers.
- Git installed.
- Docker Desktop installed and running.
Open your terminal and run:
git clone https://github.com/Niltra/EnergySec.git
cd EnergySecOn Windows 🪟:
Simply double-click the start.bat file located inside the folder, or run it in your terminal:
start.batOn Linux / Mac 🍎🐧: Run the bash script from your terminal:
chmod +x start.sh
./start.shThe script will automatically handle the local secrets/ folder creation, fill it with secure dummy credentials, and spin up the PostgreSQL Database, Java Backend, Python Engine, and Grafana dashboard.
- 💻 Interactive Frontend (Map UI): Open the
frontend/index.htmlfile in your browser to test the Data Masking AOP in real-time over the map of Spain. - 📖 Swagger UI (API Docs): http://localhost:8080/swagger-ui.html
- 📊 Grafana Dashboards: http://localhost:3000 (User:
admin/ Password:admin) - 🔎 Prometheus Metrics: http://localhost:9090