Add Android forensics, IOC threat-intel DB, Compose companion; scrub secrets from configs

This commit is contained in:
SsSnake
2026-07-13 15:45:47 -07:00
parent 925216290f
commit e48d577bd5
387 changed files with 211976 additions and 921 deletions

View File

@@ -6,56 +6,29 @@ from web.auth import check_password, hash_password, load_credentials, save_crede
auth_bp = Blueprint('auth', __name__)
# Login is disabled — AutarchOS is a single-user appliance. The endpoints
# below are kept so existing url_for('auth.*') calls and the companion app
# API still resolve; they auto-grant a session.
@auth_bp.route('/login', methods=['GET', 'POST'])
def login():
if 'user' in session:
return redirect(url_for('dashboard.index'))
if request.method == 'POST':
username = request.form.get('username', '')
password = request.form.get('password', '')
creds = load_credentials()
if username == creds['username'] and check_password(password, creds['password']):
session['user'] = username
if creds.get('force_change'):
flash('Please change the default password.', 'warning')
return redirect(url_for('settings.index'))
next_url = request.args.get('next', url_for('dashboard.index'))
return redirect(next_url)
else:
flash('Invalid credentials.', 'error')
return render_template('login.html')
session['user'] = 'admin'
next_url = request.args.get('next') or url_for('dashboard.index')
return redirect(next_url)
@auth_bp.route('/api/login', methods=['POST'])
def api_login():
"""JSON login endpoint for the companion app."""
data = request.get_json(silent=True) or {}
username = data.get('username', '')
password = data.get('password', '')
if not username or not password:
return jsonify({'ok': False, 'error': 'Missing username or password'}), 400
creds = load_credentials()
if username == creds['username'] and check_password(password, creds['password']):
session['user'] = username
return jsonify({'ok': True, 'user': username})
else:
return jsonify({'ok': False, 'error': 'Invalid credentials'}), 401
session['user'] = 'admin'
return jsonify({'ok': True, 'user': 'admin'})
@auth_bp.route('/api/check', methods=['GET'])
def api_check():
"""Check if the current session is authenticated."""
if 'user' in session:
return jsonify({'ok': True, 'user': session['user']})
return jsonify({'ok': False}), 401
return jsonify({'ok': True, 'user': session.get('user', 'admin')})
@auth_bp.route('/logout')
def logout():
session.clear()
return redirect(url_for('auth.login'))
# No-op: logout makes no sense without a login wall. Bounce home.
return redirect(url_for('dashboard.index'))