From 6da8b11301b8cc6cba017163174baf8a6f948eb6 Mon Sep 17 00:00:00 2001 From: Jon Ander Oribe Date: Sun, 11 Jan 2026 14:06:55 +0100 Subject: [PATCH 01/10] Add login system with authentication and login page Introduced a login system to restrict access to the application. Added session-based authentication in app.py, including login and logout routes, and a new login.html template for the login form. Updated .dockerignore to exclude .uv directory. --- .dockerignore | 1 + app.py | 31 ++++++++++++++++- templates/login.html | 82 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 templates/login.html diff --git a/.dockerignore b/.dockerignore index ec27b35..6b0c09f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -15,6 +15,7 @@ venv/ .eggs/ *.egg-info/ *.egg +.uv # IDE .idea/ diff --git a/app.py b/app.py index 4a79270..1c487f7 100644 --- a/app.py +++ b/app.py @@ -23,7 +23,7 @@ import subprocess from typing import Any -from flask import Flask, render_template, jsonify, send_file, Response, request +from flask import Flask, render_template, jsonify, send_file, Response, request,redirect, url_for, flash, session from config import VERSION from utils.dependencies import check_tool, check_all_dependencies, TOOL_DEPENDENCIES @@ -44,6 +44,7 @@ _app_start_time = _time.time() # Create Flask app app = Flask(__name__) +app.secret_key = "signals_intelligence_secret" # Required for flash messages # Disable Werkzeug debugger PIN (not needed for local development tool) os.environ['WERKZEUG_DEBUG_PIN'] = 'off' @@ -141,6 +142,34 @@ cleanup_manager.register(adsb_aircraft) # MAIN ROUTES # ============================================ +@app.before_request +def require_login(): + # Lista de rutas que NO requieren login (para evitar un bucle infinito) + allowed_routes = ['login', 'static', 'favicon'] + + # Si el usuario no estΓ‘ logueado y la ruta actual no estΓ‘ permitida... + if 'logged_in' not in session and request.endpoint not in allowed_routes: + return redirect(url_for('login')) + +@app.route('/logout') +def logout(): + session.pop('logged_in', None) + return redirect(url_for('login')) + +@app.route('/login', methods=['GET', 'POST']) +def login(): + if request.method == 'POST': + username = request.form.get('username') + password = request.form.get('password') + + if username == "admin" and password == "intercept2026": + session['logged_in'] = True + return redirect(url_for('index')) + else: + flash("ACCESS DENIED: INVALID CREDENTIALS", "error") + + return render_template('login.html', version=VERSION) + @app.route('/') def index() -> str: tools = { diff --git a/templates/login.html b/templates/login.html new file mode 100644 index 0000000..282e3d1 --- /dev/null +++ b/templates/login.html @@ -0,0 +1,82 @@ + + + + + + iNTERCEPT // Restricted Access + + + + +
+
+ + +

SECURE LOGIN

+

// Restricted Terminal Access

+ + + +

SYSTEM AUTH v{{ version }}

+
+
+
+ + \ No newline at end of file From 1a7a33041c193f8d16cec538ca2cad8ad64196c5 Mon Sep 17 00:00:00 2001 From: Jon Ander Oribe Date: Sun, 11 Jan 2026 14:17:13 +0100 Subject: [PATCH 02/10] Styles improvement --- static/css/login.css | 36 ++++++++++++++++++++++++++++++++++++ templates/login.html | 37 +------------------------------------ 2 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 static/css/login.css diff --git a/static/css/login.css b/static/css/login.css new file mode 100644 index 0000000..437e803 --- /dev/null +++ b/static/css/login.css @@ -0,0 +1,36 @@ +.login-box { + background: rgba(10, 10, 26, 0.9); + border: 1px solid var(--accent-cyan); + padding: 30px; + border-radius: 4px; + box-shadow: 0 0 20px rgba(0, 212, 255, 0.2); + width: 100%; + max-width: 400px; + margin-top: 20px; +} + +.form-input { + width: 100%; + background: #050510; + border: 1px solid #1a1a40; + color: var(--accent-cyan); + padding: 12px; + margin: 10px 0; + font-family: 'JetBrains Mono', monospace; + outline: none; +} + +.form-input:focus { + border-color: var(--accent-green); + box-shadow: 0 0 10px rgba(0, 255, 136, 0.2); +} + +.flash-error { + color: var(--accent-red); + font-size: 11px; + margin-bottom: 15px; + text-transform: uppercase; + border: 1px solid var(--accent-red); + padding: 8px; + background: rgba(255, 0, 0, 0.1); +} \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index 282e3d1..e351300 100644 --- a/templates/login.html +++ b/templates/login.html @@ -5,42 +5,7 @@ iNTERCEPT // Restricted Access - +
From 03ce8471963fc1c2ab80ad696b44ec760933fc0f Mon Sep 17 00:00:00 2001 From: Jon Ander Oribe Date: Sun, 11 Jan 2026 14:56:25 +0100 Subject: [PATCH 03/10] Logout button added --- static/css/index.css | 10 +++++++--- templates/index.html | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/static/css/index.css b/static/css/index.css index 48f20c3..26af980 100644 --- a/static/css/index.css +++ b/static/css/index.css @@ -658,14 +658,18 @@ header h1 .tagline { } #depsBtn { - right: 60px; + right: 5.5em; +} + +#helpBtn { + right: 3.5em; } .theme-toggle { position: absolute; top: 50%; transform: translateY(-50%); - right: 100px; + right: 8em; width: 32px; height: 32px; border-radius: 50%; @@ -4717,4 +4721,4 @@ body::before { .preset-freq-btn:active { transform: scale(0.98); -} +} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 9ba594c..1c9b865 100644 --- a/templates/index.html +++ b/templates/index.html @@ -118,8 +118,11 @@ πŸŒ™ β˜€οΈ +
- + + +